[rules-users] Error in OR rule

Piotr Jedrychowski pjedrychowski at proximetry.pl
Mon May 24 09:20:10 EDT 2010


Hello.

I have a problem with such a condition after 'when':
(or (and MyFact(id==1) MyFact(id==2)) (or MyFact(id==3) MyFact(id==4)))

For this condition I got this error:
errors; [7,41]: [ERR 101] Line 7:41 no viable alternative at input 'or' 
in rule "Sensor-1-ON"[7,64]: [ERR 102] Line 7:64 mismatched input 
'MyFact' expecting ')' in rule "Sensor-1-ON"[7,84]: [ERR 102] Line 7:84 
mismatched input ')' expecting 'then' in rule "Sensor-1-ON"

When I changed my condition to this:
(or (and MyFact(id==1) MyFact(id==2)) MyFact(id==3) MyFact(id==4))
everything is correct. Both conditions from logic point of view, are the 
same, but the first one can't be compiled. Why?

Maybe someone had similar problem and could help me?

I'm using:
* JBoss 4.2.3.GA
* Drools 5.0

Regards,
Piotr



More information about the rules-users mailing list