<div> </div><div> If you have only one or two rules using "from $collection", you are probably ok. If you have more, the "from" will probably be much heavier than inserting facts into the working memory (assuming not all of your "from" conditions will be shared among rules) by the reasons stated by Thomas, even if you are not modifying facts.</div>
<div><br></div><div> Also, remember you can negate operators:</div><div><br></div><div>Parent( collection contains $child )</div><div><br></div><div>Parent( collection not contains $child )</div><div><br></div><div> That is more efficient than composing "exists"/"not" and "from".</div>
<div><br></div><div> Edson</div><br><br><div class="gmail_quote">2010/6/21 Evert Penninckx <span dir="ltr"><<a href="mailto:evert.penninckx@gmail.com">evert.penninckx@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Thanks for the info, Thomas.<br>
<br>
Currently, I'm not modifying the children. Yet :) For now my rules are only<br>
deriving, I hope I can keep it this way, but we'll see.<br>
<br>
Good point about the exists. Many of my rules have indeed as condition the<br>
existence of "a" child. But, in many cases I use some bindings which are<br>
referred to in another condition or consequence, like<br>
rule "01"<br>
when<br>
$child : Child($attribute : attribute)<br>
$parent : Parent(children contains $child)<br>
then<br>
// do stuff<br>
end<br>
To use the exists clause I rewrote them to<br>
rule "02"<br>
when<br>
$parent : Parent()<br>
exists( Child() from $parent.children )<br>
then<br>
// do stuff<br>
end<br>
However, in rule 02 I loose the binding for $attribute. I'll have to get it<br>
from another, probably more adequate, fact.<br>
<br>
<br>
<br>
Greetz<br>
<br>
Evert<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Accessing-collections-in-conditional-statements-inside-outside-working-memory-tp905005p911205.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Accessing-collections-in-conditional-statements-inside-outside-working-memory-tp905005p911205.html</a><br>
</font><div><div></div><div class="h5">Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>