<div dir="ltr"><br> I believe there is an open ticket for a bug when using "not(exists())" 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> Meantime, just use:<br><br>not( Tail(dog == $dog) )<br><br> Since the "exists" is redundant there because "not" is the existential operator, not the "boolean" operator.<br><br> []s<br>
Edson<br><br><div class="gmail_quote">2008/10/6 tim tim <span dir="ltr"><<a href="mailto:timbaermannextra@googlemail.com">timbaermannextra@googlemail.com</a>></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 "no dog without a tail; forall" <br> when<br>
$dog :Dog()<br> forall($t : Tail()<br> Tail(dog != $dog))<br> then<br> // 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 "no dog without a tail; not exists" <br>
when<br>
$dog :Dog()<br> not( exists( Tail(dog == $dog)))<br>
then<br>
// 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> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>