[rules-dev] Nesting of Conditional Elements and Conjunctive Negations

Edson Tirelli tirelli at post.com
Fri Jan 12 17:13:16 EST 2007


 
    All,

   As you may be aware, JBoss Rules 3.0.x does not support nesting of 
elements inside a NOT (Conjunctive Negations) or EXISTS node. Also, the 
nesting of ANDs and ORs is not totally consistent for all cases.
   We spent the last few weeks working on the full support to arbitrary 
conditional element nesting. It means now you will be able to nest 
whatever CE you want inside any other CE. This is an important step in 
supporting "forall" and improving "accumulate" for Event Stream Processing.

   For those of you curious to try it, code is commited. Just checkout 
from trunk, build and try it. As the change to support this feature was 
a big one, there may eventually be issues to fix, so if you find one, 
please report in order to help us have it ready for release.

   For one example of things you can do, pretend there is a business 
rule that says:

"All VIP guests must have Caviar, Cheese and his prefered champagne 
served in his table".

   The above rule can be easily implemented now in the following way:

rule "Guest's dinner"   
    when
        $gc : GuestCategory( type == "VIP" )
        not ( Guest( category = $gc, $table : table, $champ : 
preferedChampagne )
              not( Caviar( table == $table ) and
                   Cheese( table == $table ) and
                   Champagne( type == $champ, table == $table ) ) )
    then
        results.add("All VIP guests are served");       
end

   I will add "forall" now, that is just syntax sugar for the above 
structure.

   []s
   Edson

-- 
 Edson Tirelli
 Software Engineer - JBoss Rules Core Developer
 Office: +55 11 3124-6000
 Mobile: +55 11 9218-4151
 JBoss, a division of Red Hat @ www.jboss.com





More information about the rules-dev mailing list