[rules-users] How to retract events that don't match any rules (without @expires())

Mark Proctor mproctor at codehaus.org
Fri Jul 20 01:22:52 EDT 2012


You could also look at the declarative agenda stuff, which is 
experimental at the moment. With this you can track if there are any 
activations that need to fire for a rule. When there are no activations 
still to fire, you can iterate and retract facts.

You could probably even correlate specific objects with activation 
bindings, using 'not', to determine if it can be retracted.

Mark
On 18/07/2012 20:01, Ladd wrote:
> Is there a recommended way to remove events from working memory that don't
> match and can't activate any rules?
>
> For example, let's say I have two rules which should both fire when a person
> with name "Bob" is encountered.  If a person with name "Jim" comes in he
> stays in working memory forever even though he doesn't match any current
> rules.
>
> I know @expires() for Person events would work.  But I don't know what a
> "safe" time would be since I don't know ahead of time what temporal rules
> might be written for them.
>
> >From the 5.4.0 Drools Fusion docs (Chapter 2) I found these statements:
>
> /"In other words, one an event is inserted into the working memory, it is
> possible for the engine to find out when an event can no longer match other
> facts and automatically retract it, releasing its associated resources."/
>
> /"Events may be automatically expired after some time in the working memory.
> Typically this happens when, based on the existing rules in the knowledge
> base, the event can no longer match and activate any rules. Although, it is
> possible to explicitly define when an event should expire."/
>
> Based on this statement I would expect my "Jim" to be automatically expired
> after "some time".  Maybe it will be and I'm just not waiting long enough.
>
> But then I found this quote from Edson:
>
> /"Any object type for which there are no explicit
> expiration policy, nor temporal constraints from which to derive the
> expiration offset will have an infinite expiration offset, i.e., will never
> be automatically retracted."/
>
> So my question is, how can I retract events which don't match any rules?
>
> Thanks in advance for any tips or suggestsions!!
>
> - Ladd
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/How-to-retract-events-that-don-t-match-any-rules-without-expires-tp4018760.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



More information about the rules-users mailing list