[rules-users] How to execute a rule only when a fact is retracted

Greg Barton greg_barton at yahoo.com
Wed Oct 17 13:45:25 EDT 2012


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.

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:

class RetractionHandler {
  public OriginalFactClass theDoomedFact;
}


________________________________
 From: Wolfgang Laun <wolfgang.laun at gmail.com>
To: Rules Users List <rules-users at lists.jboss.org> 
Sent: Wednesday, October 17, 2012 12:09 PM
Subject: Re: [rules-users] How to execute a rule only when a fact is retracted
 
Insert a fact that says "retracted" and write a rule matching that.

Or, even simpler, execute whatever is required together with the retraction
of that fact.

-W

On 17/10/2012, dme1 <mehtad at hotmail.com> wrote:
> Hi,
>
> How can I ensure that a rule is executed only when a fact is retracted. If
> I
> implement the rule using a "not" condition it will execute even when the
> object was never inserted into the working memory. Is there a way to
> implement the rule such that it will not execute when a fact is never
> inserted into the working memory, but executes only when the fact is
> retracted from the working memory.
>
> Thanks,
> dme
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/How-to-execute-a-rule-only-when-a-fact-is-retracted-tp4020338.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20121017/061e55df/attachment.html 


More information about the rules-users mailing list