If a fact is to be matched right after insertion the solution is simple: add a rule with low salience matching and retracting the fact.
If you expect/hope that it matches later and you have a time limit, @expires is the answer. The interesting case is when you don't have the time limit and still hope for a match. If you have a convincing use case for that, I might be enticed to develop a solution for that ;-) -W On 18/07/2012, Ladd <l...@codemettle.com> 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@lists.jboss.org > https://lists.jboss.org/mailman/listinfo/rules-users > _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users