<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. 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; "> 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 <wolfgang.laun@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Rules Users List <rules-users@lists.jboss.org> <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 <<a ymailto="mailto:mehtad@hotmail.com" href="mailto:mehtad@hotmail.com">mehtad@hotmail.com</a>> wrote:<br>> Hi,<br>><br>> How can I ensure that a rule is executed only when a fact is retracted. If<br>> I<br>> implement the rule using a "not" condition it will execute even when the<br>> object was never inserted into the working memory. Is there a way to<br>> implement the rule such that it will not execute when a fact is never<br>> inserted into the working memory, but executes only when the fact is<br>> retracted from the working memory.<br>><br>> Thanks,<br>> dme<br>><br>><br>><br>> --<br>> View this message in context:<br>>
http://drools.46999.n3.nabble.com/How-to-execute-a-rule-only-when-a-fact-is-retracted-tp4020338.html<br>> Sent from the Drools: User forum mailing list archive at <a target="_blank" href="http://nabble.com/">Nabble.com</a>.<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>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>