OK. It took me a few laps with the debugger to understand what is happening with the following:
<pre>
rule
when
$assignment: Assignment($resource: resource)
not Booking(resource == $resource)
then
insertLogical(new Booking($resource));
end
</pre>
<p>
Basically, in the rhs the insertion of the new Booking causes the lhs to be reevaluated, and since in the reevaluation, there IS a Booking, it is retracted. Then the lhs is reevaluated to see that there is NOT a Booking, and so the rhs is run again, and loop and loop and loop.
</p>
<p>
But what I don't understand, is if I add an update in the rhs like this:
</p>
<pre>
rule
when
$assignment: Assignment($resource: resource)
not Booking(resource == $resource)
then
update($assignment);
insertLogical(new Booking($resource));
end
</pre>
<p>
there isn't a loop. I didn't take the journey with the debugger to answer this question, but am still wondering: why does the update break the infinite loop?
</p>
Thanks,
John
<br><hr align="left" width="300">
View this message in context: <a href="http://www.nabble.com/looping-due-to-immediate-retraction-tf4847517.html#a13869521">looping due to immediate retraction</a><br>
Sent from the <a href="http://www.nabble.com/drools---user-f11823.html">drools - user mailing list archive</a> at Nabble.com.<br>