<br> Rahul,<br><br> Sorry, seems there is an error in the docs. You can only use the up-front binding notation when you use infix OR, not the prefixed OR:<br><br>$binding : ( A(...) or A(...) ) // this is valid<br>$binding : (or A(...) A(...) ) // this is not
<br><br> Maybe we need to start supporting prefix notation for this too, but I really don't like this up-front binding notation. This is handled as a special case in the grammar, where you can't nest other CEs, etc... in other words, it is not orthogonal. It was good when we didn't supported nesting, but now that we do support, it makes things dangerous. Example: this is not valid:
<br><br>$x : ( X(...) or ( X(...) and Y(...) ) ) // obviously, not valid<br><br> But if you remove the binding or move the binding inside, it is valid:<br><br>( X(...) or ( X(...) and Y(...) ) ) // valid<br>(
$x : X(...) or (
$x : X(...) and Y(...) ) ) // valid<br>
<br> Problem is that Mark does like that up-front notation, and he is the boss... ;)<br> Anyway, I would like to hear your opinion about it (and possibly other users too), if you prefer this up-front notation even being handled as a special case, or the multi-binding is ok for you.
<br><br> Meanwhile, the workaround is either use the multi-bind as you are using or the infix OR as I showed above.<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/10/23, Rahul Phadnis <<a href="mailto:rahul.phadnis@yahoo.com">
rahul.phadnis@yahoo.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I am using Jboss Rules 4.0.2 version.<br><br>I am trying to using or with binding. However the
<br>following doesn't work<br>rule "RulesTest"<br> # the if part<br> activation-group "ActivationGroup1"<br> salience 50<br> when<br> $eventType: EventType(id ==<br>Constants.EVENT_DEVCOM_ID
)<br> $result : Result()<br> $param : Parameter($thresh:threshold)<br> # difference exceeds threshold value and<br>it is still day time<br> context: (or DevContext(difference > $thresh,
<br>dayTime == true)<br> DevContext(difference > $thresh, sleepy<br>== false, dayTime == false) )<br><br> then<br> # do something here<br><br>end<br><br>I get rule compilation errors:
<br>SEVERE: CheckedDroolsException<br>org.drools.CheckedDroolsException: There were errors<br>in the rule source: [320,18]: unknown:320:18<br>mismatched token:<br>[@1949,12142:12143='or',<34>,320:18]; expecting type
<br>ID[321,15]: unknown:321:15 mismatched token:<br>[@1967,12215:12227='DevContext',<7>,321:15]; expecting<br>type RIGHT_PAREN[321,86]: unknown:321:86 mismatched<br>token: [@1990,12286:12286=')',<12>,321:86]; expecting
<br>type THEN<br> at<br>org.drools.compiler.RuleBaseLoader.makeRuleBase(RuleBaseLoader.java:6<br><br>Is this a known bug ?<br><br>I can work around by using the alternate syntax<br>suggested in the documentation which is:
<br><br>or $context : DevContext(difference > $thresh, dayTime<br>== true)<br> $context : DevComContext(difference > $thresh,<br>sleepy == false, dayTime == false) )<br><br>Rahul.<br><br><br>_______________________________________________
<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users
</a><br></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @
<a href="http://www.jboss.com">www.jboss.com</a>