The easiest way to do this is to use a custom helper object eg RuleLatch(fact, “name”).
You would write your rules so that for each group of mutually exclusive rules then for the fact they match against they check the absence of an appropriate
RuleLatch, as part of their result part they then insert the appropriate rule latch – thereby preventing any other rule from running.
The easiest way to stop processing a particular fact is to retract it. If you do need to keep it in your working memory then use the RuleLatch concept as
above – each rule may check for two latches, one latch for a particular group of rules as described above, the other latch is a more global control which only a couple of rules insert.
Hope that makes sense,
Thomas
From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org]
On Behalf Of tom ska
Sent: 22 July 2010 14:27
To: rules-users@lists.jboss.org
Subject: [rules-users] Problem with DRL language/ XLS decision tables.
Hello,
I have a problem with defining rules. I insert many, many objects (facts) to ksession object (StatefulKnowledgeSession). I want to fire rules for
all of them(facts), but I want to fire only one rule from all rules for each one fact(not always this same rule is fired, because I use salience). activation-group is not appropriate, because it works only with one object (fact) - rest is not processed
by engine.
Second question is: how can I stop processing rules, bot only for one fact, not for all of them.
Thanks,
tom.
P.S. forgive me my English... :)
P.S.2 Firstly I want to do this in DRL, then, I'll try with XLS, and write post if I would find problems...