<br> Yuri,<br><br> We support -> for backward compatibility and I confess I haven't seen this error before. I guess it may be complaining about the variable binding:<br><br> $age : age -> (Math.abs($age -
c1.age) < 10),<br><br> Anyway, if you can please open a JIRA for that. <br> An yes, we prefer to not use -> anymore, so if you are able to change this during your upgrade, then it is better to simply use the "eval" keyword instead of the ->. Example:
<br><br> c2:Child( eval(Math.abs(age - c1.age) < 10), ...)<br><br> Note that if that is the only place where you use the "age" field, the binding is automatically created for you. You don't need to do it explicitly anymore. If you need the binding for other purposes, you can do a regular binding:
<br><br> c2:Child( $age : age, eval(Math.abs($age - c1.age) < 10), ...)<br>
<br> Regarding your second questions, the answer is yes. We now support totally nestable && and || as constraints and restriction connectors. So:<br><br> p2: Person(<br> (sex == "M" &&
p1.sex == "F") || (sex == "F" && p1.sex == "M")<br> )<br><br> () are optional and && has higher priority than ||. <br> We already updated docs for such things in the manual. I would like to ask you to read and please provide feedback and even patches for parts of the text that eventually are not clear:
<br><br><a href="http://labs.jboss.com/file-access/default/members/drools/freezone/docs/4.0.0.13773GA/html/index.html">http://labs.jboss.com/file-access/default/members/drools/freezone/docs/4.0.0.13773GA/html/index.html</a>
<br><br> Section 6.5.2.<br><br> []s<br> Edson<br><br><br><div><span class="gmail_quote">2007/7/25, Yuri <<a href="mailto:ydewit@gmail.com">ydewit@gmail.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 migrating my 3.0.6 rules into 4.0 but I am getting the following error in<br>Drools IDE:<br><br>"Trying to create a restriction for an empty restriction"<br><br>I am basically using an inline-eval (I believe this is the new terminology for
<br>the ->() construct):<br><br>Rule<br>when<br> c1:Child()<br> c2:Child(<br> age -> (Math.abs(age - c1.age) < 10),<br> ...)<br>then<br> ...<br>end<br><br>If I remove the "age -> ..." line the error goes away.
<br><br>Along the same lines I am also wondering if there is a better way (aside from<br>using "->()", which has a lower perf as I understand it) of doing the following:<br><br>Rule<br>when<br> p1: Person()
<br> p2: Person(<br> ...,<br> sex -> (<br> (sex == "M" && p1.sex == "F")<br> || (sex == "F" && p1.sex == "M")<br> )
<br> )<br>then<br> insert(new Couple(p1, p2));<br>end<br><br>thanks,<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>