<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>