<div>   </div><div>    If you have only one or two rules using &quot;from $collection&quot;, you are probably ok. If you have more, the &quot;from&quot; will probably be much heavier than inserting facts into the working memory (assuming not all of your &quot;from&quot; 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 &quot;exists&quot;/&quot;not&quot; and &quot;from&quot;.</div>
<div><br></div><div>    Edson</div><br><br><div class="gmail_quote">2010/6/21 Evert Penninckx <span dir="ltr">&lt;<a href="mailto:evert.penninckx@gmail.com">evert.penninckx@gmail.com</a>&gt;</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&#39;m not modifying the children. Yet :) For now my rules are only<br>
deriving, I hope I can keep it this way, but we&#39;ll see.<br>
<br>
Good point about the exists. Many of my rules have indeed as condition the<br>
existence of &quot;a&quot; child. But, in many cases I use some bindings which are<br>
referred to in another condition or consequence, like<br>
rule &quot;01&quot;<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 &quot;02&quot;<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&#39;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>