I can't think of any general solution to the problem you pose. There's no central list of facts that are stored in a Rete memory somewhere (which I would presume is the definition of "relevant" here.) If you've got a source license, I can think of an implementation that wouldn't have too much overhead: put a boolean flag into the Fact class which defaults to "false", and then simply set it to "true" for each Fact in a Token when a Token is stored in any Rete memory. Facts won't be removed from a Rete memory unless they are removed from working memory altogether (which happens during modify, too), so you only would need to set the flag back to false when a fact is retracted. Then you could retract an irrelevant fact immediately after asserting it just by checking that flag.
Of course, domain-specific solutions are simple enough; you can write specific rules that specifically match facts which you consider irrelevant (if you can't simply avoid asserting them in the first place.) On Wednesday 16 May 2007 2:59:27 am Shyamal Pandya1 wrote: > Hi, > > > > If there is a very large number of facts pumped into the rule engine, > out of which a small number is relevant to the existing rules, then I > would like to retract the irrelevant facts to conserve memory. My > question is, is there a way to know if a fact is a (possibly partial) > match for any rule in the working memory? > > I was thinking of writing a rule to match facts that are irrelevant to > all other rules, and as the action to retracting matching facts, but I > am not sure how I would write such a rule. How would I write this rule, > or is there any alternative way to achieve this in Jess? > > > > Thanks, > > Shyamal -- --------------------------------------------------------- Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://www.jessrules.com -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------
