[rules-users] Question about Rete Tree example with NotNode in "Drools JBoss Rules 5.0 Developers Guide"

Tina Vießmann tviessmann at stud.hs-bremen.de
Tue Oct 26 20:24:08 EDT 2010


Hi,

I'm working through the explanations about Rete Trees in chapter 12 of 
"Drools JBoss Rules 5.0 Developers Guide" on page 264-265. I have a 
problem in understanding the input of the NotNode.

The rule says:
     when
       $address : Address ( addressLine == "Rossa Avenue" )
       not (
         $account : Account ( balance < 100 ) and
         Customer ( accounts contains $account )
       )
     then
        ...

The related figure shows:
1. The Address object being processed and a tuple will be created by a 
LeftInputAdapterNode.
2. The tuple of 1. will be joined with the Account fact with no 
constraints (so that there's a tuple of size two?).
3. The tuple of 2. will be joined with the Customer fact with the 
restriction 'accounts contains $account'. (That results in a tuple with 
size 3!?)
4. The tuple of 3. will then be processed by a RightInputAdapterNode.
5. The tuple/fact from 3. will be processed using a NotNode together 
with the Address-tuple from 1.

I don't understand while the tuple from 1. will in step 2 be joined with 
the Account fact. I would have expected something like:
1. // same
2. The Account fact will be processed and a tuple will be created by a 
LeftInputAdapterNode.
3. The Customer fact will be joined with the Account tuple with the 
constraint 'accounts contains $address'. Resulting in a tuple.
4. // somehow the tuple from step 3 will be negated and joined with the 
tuple from step 1.

Could anybody explain to me why it's done the way its drawn in the book?

Thank you! :)
Tina



More information about the rules-users mailing list