[rules-users] Error in OR rule

Piotr Jedrychowski pjedrychowski at proximetry.pl
Tue May 25 02:37:25 EDT 2010


Thank you for help!

Regards,
Piotr





On 2010-05-24 17:43, Wolfgang Laun wrote:
> This is due to a designed or accidental glitch in the LHS syntax.
>
> An "and" CE may not contain an "or" CE as one of its operands; it
> may only contain a /parenthesized /"or" (but all other CEs without
> the additional decoration). This means that you must write
>
>   (or (and MyFact(id==1)
>                 MyFact(id==2))
>         (    # !
>            (or MyFact(id==3) MyFact(id==4))
>         )    # !
>   )
>
> The simplified version from Piotr's post is, of course, preferred.
>
> Sadly, there is more than one discrepancy between the DRL syntax as 
> presented in
> the non-normative syntax diagrams shown in the Drools Expert manual 
> and the
> actual syntax as implemented in the DRL.g file.
>
> -W
>
>
> 2010/5/24 Giovanni Motta <mottagio at gmail.com <mailto:mottagio at gmail.com>>
>
>     Hello, i had similar problems with or constructs, and decided to
>     avoid them.
>     Drools expert manual says that or constructs are internally
>     rewritten, i suppose this mechanism is not fine-tuned.
>     My 2 cents...
>
>     2010/5/24 Piotr Jedrychowski <pjedrychowski at proximetry.pl
>     <mailto:pjedrychowski at proximetry.pl>>
>
>         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 <http://4.2.3.GA>
>         * Drools 5.0
>
>         Regards,
>         Piotr
>         _______________________________________________
>         rules-users mailing list
>         rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>         https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>     _______________________________________________
>     rules-users mailing list
>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>    

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100525/3fef3f82/attachment.html 


More information about the rules-users mailing list