[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
Thu Oct 28 18:31:28 EDT 2010


You're talking about the follwing errata, aren't you?

     rule noCustomerWithLowAccountBalance
     when
       $address : Address( addressLine1 == "Rossa Avenue" )
       not ( $account : Account( balance < 100 )
             and Customer( accounts contains $account ) )
     then
       System.out.println("No customers with low balance in "+ "their 
accounts live at Rossa Avenue");
     end

     Should be changed to:

     rule noCustomerWithLowAccountBalance
     when
       $address : Address( addressLine1 == "Rossa Avenue" )
       not ( $account : Account( balance < 100 )
              and Customer( accounts contains $account, address == 
$address ) )
     then
       System.out.println("No customers with low balance in "+ "their 
accounts live in Rossa Avenue");
     end



If the new version is correct, why is the condition  "address == 
$address" still missing in the related figure? Or do I not see something?



> see book errata at
> https://www.packtpub.com/support?nid=4009
>
> ________________________________________
> From: rules-users-bounces at lists.jboss.org [rules-users-bounces at lists.jboss.org] On Behalf Of Tina Vießmann [tviessmann at stud.hs-bremen.de]
> Sent: Wednesday, 27 October 2010 1:24 p.m.
> To: Rules Users List
> Subject: [rules-users] Question about Rete Tree example with NotNode in "Drools JBoss Rules 5.0 Developers Guide"
>
> 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
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>




More information about the rules-users mailing list