<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Along the same lines, have a boolean attribute called "markedForDeletion" on the fact. &nbsp;Set it to true and match rules off of that, with a low priority rule that retracts it when all others are done.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span>And if you can't modify the original fact class, like Wolfie says below, insert a control fact that points back to the original, and have rules match off of that:</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new
 york', times, serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span>class RetractionHandler {</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">&nbsp; public OriginalFactClass theDoomedFact;</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; ">}</div><div><br></div>  <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div dir="ltr"> <font size="2" face="Arial"> <hr size="1">  <b><span
 style="font-weight:bold;">From:</span></b> Wolfgang Laun &lt;wolfgang.laun@gmail.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Rules Users List &lt;rules-users@lists.jboss.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, October 17, 2012 12:09 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] How to execute a rule only when a fact is retracted<br> </font> </div> <br>
Insert a fact that says "retracted" and write a rule matching that.<br><br>Or, even simpler, execute whatever is required together with the retraction<br>of that fact.<br><br>-W<br><br>On 17/10/2012, dme1 &lt;<a ymailto="mailto:mehtad@hotmail.com" href="mailto:mehtad@hotmail.com">mehtad@hotmail.com</a>&gt; wrote:<br>&gt; Hi,<br>&gt;<br>&gt; How can I ensure that a rule is executed only when a fact is retracted. If<br>&gt; I<br>&gt; implement the rule using a "not" condition it will execute even when the<br>&gt; object was never inserted into the working memory. Is there a way to<br>&gt; implement the rule such that it will not execute when a fact is never<br>&gt; inserted into the working memory, but executes only when the fact is<br>&gt; retracted from the working memory.<br>&gt;<br>&gt; Thanks,<br>&gt; dme<br>&gt;<br>&gt;<br>&gt;<br>&gt; --<br>&gt; View this message in context:<br>&gt;
 http://drools.46999.n3.nabble.com/How-to-execute-a-rule-only-when-a-fact-is-retracted-tp4020338.html<br>&gt; Sent from the Drools: User forum mailing list archive at <a target="_blank" href="http://nabble.com/">Nabble.com</a>.<br>&gt; _______________________________________________<br>&gt; rules-users mailing list<br>&gt; <a ymailto="mailto:rules-users@lists.jboss.org" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>&gt;<br>_______________________________________________<br>rules-users mailing list<br><a ymailto="mailto:rules-users@lists.jboss.org" 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><br> </div> </div> 
 </div></body></html>