Look at the syntax diagram for ConditionalElement in http://members.inode.at/w.laun/drools/DroolsSyntax.pdf, p.7, to get an idea of the overall complexity. (Attention: this document incorporates some changes that will happen only with version 5.2., it's still work in progress) The omission of 'and' in the WhenPArt (p.5)  is traditional syntactic sugar. Not permitting the same in subexpressions is much easier to handle the parser.

So, the answer is: easier parsing and, hopefully, better error recovery.

-W



2010/11/23 Nathan Bell <Nathan.Bell@pharmacyonesource.com>

This rule:

 

rule "Not"

when

      not(

          RuleTime()

          Patient()

          )

then

      System.out.println("not");

end

 

produces the following errors when compiled:

 

[ERR 102] Line 43:5 mismatched input 'Patient' expecting ')' in rule "Not"

[ERR 102] Line 44:5 mismatched input ')' expecting 'then' in rule "Not"

 

 

But if I change it to use explicit ANDs instead of implicit ANDs it compiles and runs.

 

rule "NotBlock"

when

      not(

          RuleTime()

          and

          Patient()

          )

then

      System.out.println("notBlock");

end

 

 

Is it invalid syntax to use implicit ANDs in a not block? If so, why?

 

 

Thank You,

 

Nathan Bell


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users