[rules-users] Accessing collections in conditional statements (inside/outside working memory)
Evert Penninckx
evert.penninckx at gmail.com
Mon Jun 21 07:42:48 EDT 2010
Thanks for the info, Thomas.
Currently, I'm not modifying the children. Yet :) For now my rules are only
deriving, I hope I can keep it this way, but we'll see.
Good point about the exists. Many of my rules have indeed as condition the
existence of "a" child. But, in many cases I use some bindings which are
referred to in another condition or consequence, like
rule "01"
when
$child : Child($attribute : attribute)
$parent : Parent(children contains $child)
then
// do stuff
end
To use the exists clause I rewrote them to
rule "02"
when
$parent : Parent()
exists( Child() from $parent.children )
then
// do stuff
end
However, in rule 02 I loose the binding for $attribute. I'll have to get it
from another, probably more adequate, fact.
Greetz
Evert
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Accessing-collections-in-conditional-statements-inside-outside-working-memory-tp905005p911205.html
Sent from the Drools - User mailing list archive at Nabble.com.
More information about the rules-users
mailing list