Edson,<br><br>Thanks for clarifying this.  I appreciate it. <br><br>Macon<br><br><div class="gmail_quote">2009/8/19 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com">tirelli@post.com</a>&gt;</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>   Sometimes this is indeed not clear, so I will try to explain here. Drools uses MVEL to resolve some expressions and semantic code. Although we would like to make it 100% compatible and enable it to use mvel everywhere, that is easier said than done (but we do have someone working on that).<br>

<br>   Anytime you want to force Drools to fallback into MVEL (or java, as the other supported dialect) you need to place your code inside an eval(). For some well known situations, Drools does this automatically, but that is not the case with empty.<br>

 <br>   For now, in your case, you could either do:<br><br><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">MyGrabBag( someMap != null, someMap.empty == true )</span></font><br>

<br>   Or if you are using mvel as your rule dialect:<br><br><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">MyGrabBag( eval( someMap == empty ) )</span></font><br>

<br>   []s<br>   Edson<br><br><br><div class="gmail_quote">2009/8/18 Pegram, Macon <span dir="ltr">&lt;<a href="mailto:zmpegram@choosehmc.com" target="_blank">zmpegram@choosehmc.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">









<div link="blue" vlink="purple" lang="EN-US">

<div>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">According to MVEL they’ve added a convenience for
checking the “emptiness” of a value (see: <a href="http://mvel.codehaus.org/Value+Tests" title="http://mvel.codehaus.org/Value+Tests" target="_blank">http://mvel.codehaus.org/Value+Tests</a>
)</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">In MVEL you’d simply write:  myMap == empty</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">This seemed like a MUCH cleaner way to write some of the LHS
of the rules, so I thought I’d try it out.  </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Given the following rule:</span></font></p>

<p><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">rule</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&quot;Check Empties - Original&quot;</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>



<p><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">   
</span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">when         </span></font></b></p>

<p><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">       
$grabBag : MyGrabBag(someMap != null)</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>

<p><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">       
</span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">eval</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">
($grabBag.getSomeMap().size() == 0)</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>

<p><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">   
</span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">then</span></font></b></p>

<p><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">end</span></font></b></p>

<p><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;"> </span></font></b></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">This could be rewritten:</span></font></p>

<p><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;"> </span></font></b></p>

<p><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">rule</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> </span></font><font color="green" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: green;">&quot;Check Empties - Simple&quot;</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>



<p><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">   
</span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">when         </span></font></b></p>

<p><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">       
MyGrabBag(someMap == </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">empty</span></font></b><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">)</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>



<p><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">    </span></font><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">then</span></font></b></p>



<p><b><font color="#960000" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(150, 0, 0); font-weight: bold;">end</span></font></b></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">The IDE (Eclipse 3.4.2 w/ Drools plugin) seems to recognize
“empty”  is a keyword (it makes it bold), but the drools
compiler in the IDE  reports:<br>
BuildError: Unable to create restriction &#39;[VariableRestriction: == empty ]&#39; for
field &#39;someMap&#39; in the rule &#39;Check Empties - Simple&#39;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">BuildError: Unable to return Declaration for identifier
&#39;empty&#39;</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Am I assuming incorrectly that the LHS is fully MVEL
compliant?</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

</div>

</div>


<br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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></blockquote></div><font color="#888888"><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
</font><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></blockquote></div><br>