<div><br></div>   This is an ambiguity inherent to the DRL language. This happens because the parser has no way of knowing if the (...) following the expression belong to the expression (i.e., is a method call, where you forgot the &quot;,&quot; between parameters) or if it is not part of the expression. So, we arbitrarily decided that the parser will always consider the () in this case as part of the expression, and if it is not a valid syntax, it will raise an error. You found one way of breaking the ambiguity by adding () on getAddresses, but you could also do:<div>
<br></div><div><meta http-equiv="content-type" content="text/html; charset=utf-8">       ( Address( ) from $person.addresses )</div><div><br></div><div>   or add a ; at the end of the expression:</div><div><br></div><div>
<meta http-equiv="content-type" content="text/html; charset=utf-8">       Address( ) from $person.addresses;</div><div><br></div><div>   It is not a bug, as it is an ambiguity inherent to the language, not the implementation, but I guess we could have better documentation on that. Just for the curious, it is the same kind of ambiguity present on java/c++ parsers when you have nested &quot;if/else&quot; without blocks {}. Ex:</div>
<div><br></div><div>if (...) </div><div>   if( ... )</div><div>      ...;</div><div>else</div><div>   ...;</div><div><br></div><div>    Does the else above belong to the first or second &quot;if&quot;? The parser has no way to know that, so they arbitrarily decided that in java/c++ that says the else belongs to the closest &quot;if&quot; and my identation above is misleading...</div>
<div><br></div><div>   Edson</div><div><br><div class="gmail_quote">2011/1/26 Evert Penninckx <span dir="ltr">&lt;<a href="mailto:evert.penninckx@gmail.com">evert.penninckx@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Hi<br>
<br>
This little rule won&#39;t compile:<br>
<br>
rule &quot;Test from and or&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $person : Person()<br>
        Address( ) from $person.addresses<br>
        (Address() or Address())<br>
then<br>
# do stuff<br>
end<br>
<br>
BuildError: Unable to build expression for &#39;from&#39; : [Error: Failed to<br>
compile: 1 compilation error(s):<br>
 - (1,7) unqualified type in strict mode for: $person]<br>
[Near : {... Unknown ....}]<br>
             ^<br>
[Line: 1, Column: 0] &#39;$person.addresses(Address() or Address())&#39;<br>
<br>
BuildError: Unable to determine the used declarations.<br>
java.lang.Class cannot be cast to org.mvel2.util.MethodStub<br>
<br>
<br>
This does work<br>
<br>
rule &quot;Test from and or&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $person : Person()<br>
        Address( ) from $person.addresses<br>
        Address() or Address()<br>
then<br>
# do stuff<br>
end<br>
<br>
And this also:<br>
<br>
rule &quot;Test from and or&quot;<br>
dialect &quot;mvel&quot;<br>
when<br>
        $person : Person()<br>
        Address( ) from $person.getAddresses()<br>
        (Address() or Address())<br>
then<br>
# do stuff<br>
end<br>
<br>
<br>
<br>
Can anybody confirm this as a bug?<br>
<br>
<br>
<br>
Tnx<br>
<br>
<br>
Evert<br>
<font color="#888888">--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Possible-bug-using-from-and-or-tp2354444p2354444.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Possible-bug-using-from-and-or-tp2354444p2354444.html</a><br>

Sent from the Drools - User mailing list archive at Nabble.com.<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>
</font></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>