<div dir="ltr"><br>&nbsp;&nbsp;&nbsp; I believe there is an open ticket for a bug when using &quot;not(exists())&quot; in 5.0. I did not investigated yet, but I believe this is a regression in the new asymmetric matching algorithm in 5.0. Anyway, we will fix it before releasing the final version. <br>
<br>&nbsp;&nbsp;&nbsp; Meantime, just use:<br><br>not( Tail(dog == $dog) )<br><br>&nbsp;&nbsp;&nbsp; Since the &quot;exists&quot; is redundant there because &quot;not&quot; is the existential operator, not the &quot;boolean&quot; operator.<br><br>&nbsp;&nbsp;&nbsp; []s<br>
&nbsp;&nbsp;&nbsp; Edson<br><br><div class="gmail_quote">2008/10/6 tim tim <span dir="ltr">&lt;<a href="mailto:timbaermannextra@googlemail.com">timbaermannextra@googlemail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div dir="ltr">hello there,<br><br>i have a rule, that should fire, when a required part of a whole is missing.<br>lets say the whole is a dog, and the required part the tail.<br>then the rule should fire, when there is a dog without a tail.<br>

<br>i stated the rule in two logically equivalent ways.<br><br>1) when we have a dog, and all existing tails belong to other peoples dogs, the rule should fire:<br><br>rule &quot;no dog without a tail; forall&quot; <br>&nbsp;&nbsp;&nbsp; when<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $dog :Dog()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; forall($t : Tail()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Tail(dog != $dog))<br>&nbsp;&nbsp;&nbsp; then<br>&nbsp;&nbsp; // fire rule<br>end<br><br><br>2) when we have a dog and no tail exists that belongs to this dog the rule should fire:<br>

<br>rule &quot;no dog without a tail; not exists&quot; <br>
&nbsp;&nbsp;&nbsp; when<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; $dog :Dog()<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; not( exists( Tail(dog == $dog)))<br>
&nbsp;&nbsp;&nbsp; then<br>
&nbsp;&nbsp; // fire rule<br>
end<br>
<br><br>and they really do behave similar, but not the same..<br>workingMemory.insert(dog);<br>
workingMemory.insert(dog.getTail());<br>
workingMemory.fireAllRules();<br><br>
// here both did not fire, but when i go on:<br><br>workingMemory.modifyRetract(dogHandle)<br>workingMemory.modifyInsert(dogHandle, dog)<br>workingMemory.fireAllRules();<br>// now the not(exists(..)) version did fire, whereas the forall(..) version did not.<br>

<br><br>of course both rules should not have fired, nothing changed for the dogs relationship<br>with its tail.<br><br>i am using the 5.0.0.snapshot version of drools but i can not imagine that this is an <br>unknown bug, as this is rather basic predicate logic.<br>

what am i missing?<br><br>best, tim<br><br></div>
<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>
<br></blockquote></div><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>