[rules-users] Loop Drools on Multi Element

laune wolfgang.laun at gmail.com
Wed Feb 22 03:35:47 EST 2012


Using forall isn't so complicated. You can use the simplified form, where
the
condition to be satisfied is written in the pattern selecting the domain.

rule setPriority
when
    $order: OrderType( priority != "high" )
    forall ( OrderLineType( quantity > 2 ) from $order.lineItem )
then
    modify( $order ){ setPriority( "high" ) }
    System.out.println( "set to high" );
end



This illustrates very nicely the duality (by de Morgan's laws) between
forall and negated existence.


As for efficiency: repeated evaluation of large lists where the elements
aren't facts /may/
slow you down - whether this is a problem depends on other factors.
 

--
View this message in context: http://drools.46999.n3.nabble.com/Loop-Drools-on-Multi-Element-tp3761638p3765879.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20120222/28c9e42c/attachment.html 


More information about the rules-users mailing list