<br> A DRL constraint is always:<br><br><fieldName> <operator> <restriction_list><br><br> So the correct is even when dealing with booleans to explicitly state your intent:<br><br>myClass : MyClass( myBoolean == true )<br>
<br> An eval is any valid java/mvel expression that returns a boolean, and that is why it works without the explicit comparison to null.<br><br> []s<br> Edson<br> <br><div class="gmail_quote">2009/5/3 lightbulb432 <span dir="ltr"><<a href="mailto:veerukrishnan@hotmail.com">veerukrishnan@hotmail.com</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
The simplified syntax you describe doesn't seem to work in Drools 4<br>
(drools-core.jar and drools-compiler.jar, both version 4.0.4):<br>
<br>
package MyClassRules;<br>
dialect "mvel"<br>
<br>
import com.myclass.MyClass;<br>
<br>
rule Works<br>
when<br>
myClass : MyClass()<br>
eval(myClass.myBoolean)<br>
then<br>
System.out.println("This means myBoolean is true");<br>
end;<br>
<br>
rule DoesntWork<br>
when<br>
myClass : MyClass(myBoolean)<br>
then<br>
System.out.println("This means myBoolean is true");<br>
end;<br>
<br>
The first rule above is fired and the message is printed to the console, as<br>
expected, but not the second rule. The above is my rule file in its<br>
entirety. What's going wrong here - the file compiles fine, so I'm guessing<br>
there's no problem with the syntax?<br>
<div><div></div><div class="h5"><br>
<br>
<br>
Edson Tirelli-3 wrote:<br>
><br>
> The "arrow" is an old syntax from the Drools 3.0 times that is no<br>
> longer<br>
> necessary and was deprecated in 4. It is the exact same thing as a<br>
> bind+eval:<br>
><br>
> MemberBlog(member : member -> (member.getUsername().equals(<br>
> principal.getName())))<br>
><br>
> Above is exact same thing as:<br>
><br>
> MemberBlog(member : member, eval(member.getUsername().equals(<br>
> principal.getName())))<br>
><br>
> But in Drools 4 and 5, that can be simplified to:<br>
><br>
> MemberBlog( member.username == <a href="http://principal.name" target="_blank">principal.name</a> )<br>
><br>
> Much cleaner as you can see.<br>
><br>
> []s<br>
> Edson<br>
><br>
><br>
><br>
> 2009/5/1 lightbulb432 <<a href="mailto:veerukrishnan@hotmail.com">veerukrishnan@hotmail.com</a>><br>
><br>
>><br>
>> What does the arrow ("->") mean in a rule file? I've searched on Google,<br>
>> looked through the Drools documentation, and haven't been able to find<br>
>> out<br>
>> what it does.<br>
>><br>
>> It appears in the autocomplete of my IDE for Drools, and I've seen it in<br>
>> an<br>
>> example in the JBoss Seam documentation, but am unable to tell what it<br>
>> does:<br>
>><br>
>> rule InsertMemberBlog<br>
>> no-loop<br>
>> activation-group "permissions"<br>
>> when<br>
>> principal: Principal()<br>
>> memberBlog: MemberBlog(member : member -><br>
>> (member.getUsername().equals(principal.getName())))<br>
>> check: PermissionCheck(target == memberBlog, action == "insert", granted<br>
>> == false)<br>
>> then<br>
>> check.grant();<br>
>> end;<br>
>><br>
>><br>
>> --<br>
>> View this message in context:<br>
>> <a href="http://www.nabble.com/What-does-the-arrow-%28%22-%3E%22%29-mean-in-a-rule-file--tp23341009p23341009.html" target="_blank">http://www.nabble.com/What-does-the-arrow-%28%22-%3E%22%29-mean-in-a-rule-file--tp23341009p23341009.html</a><br>
>> Sent from the drools - user mailing list archive at Nabble.com.<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
>><br>
><br>
><br>
><br>
> --<br>
> Edson Tirelli<br>
> JBoss Drools Core Development<br>
> JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
><br>
><br>
<br>
--<br>
</div></div>View this message in context: <a href="http://www.nabble.com/What-does-the-arrow-%28%22-%3E%22%29-mean-in-a-rule-file--tp23341009p23354001.html" target="_blank">http://www.nabble.com/What-does-the-arrow-%28%22-%3E%22%29-mean-in-a-rule-file--tp23341009p23354001.html</a><br>
<div><div></div><div class="h5">Sent from the drools - user mailing list archive at Nabble.com.<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>