[rules-users] Is "emptieness" supported in Drools 5 (LHS)

Pegram, Macon zmpegram at choosehmc.com
Tue Aug 18 17:20:13 EDT 2009


According to MVEL they've added a convenience for checking the
"emptiness" of a value (see: http://mvel.codehaus.org/Value+Tests )

 

In MVEL you'd simply write:  myMap == empty

 

This seemed like a MUCH cleaner way to write some of the LHS of the
rules, so I thought I'd try it out.  

 

Given the following rule:

rule "Check Empties - Original"

    when         

        $grabBag : MyGrabBag(someMap != null)

        eval ($grabBag.getSomeMap().size() == 0)

    then

end

 

This could be rewritten:

 

rule "Check Empties - Simple"

    when         

        MyGrabBag(someMap == empty)

    then

end

 

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:
BuildError: Unable to create restriction '[VariableRestriction: == empty
]' for field 'someMap' in the rule 'Check Empties - Simple'

BuildError: Unable to return Declaration for identifier 'empty'

 

Am I assuming incorrectly that the LHS is fully MVEL compliant?

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090818/4fd23dd5/attachment.html 


More information about the rules-users mailing list