Yes, looks like this will help.
Define the expression "check for". :)
When working with Rete rules engines, all rules conditions are *evaluated* at fact insertion time. But the consequences are executed at rule fire time. So, does not matter if you use activation groups or not, all your 10 rule conditions will be evaluated the moment your facts are inserted into the working memory.
Now, if you use the same activation group for all 10 rules and rule 3 fires, it immediately cancels any other possible activations of rules 4 to 10 and they obviously will not fire. So, the end result is that only rule 3 was executed, that I thought was your goal.
There is no "flag", as you mentioned, that can prevent the rule's LHS evaluation, although a control fact can be used to prevent beta matchings.
[]s
Edson
2009/4/21 Lindy hagan <lindyhagan@gmail.com>nope, I am not looking for that.
This is my requirement: If I have 10 rules say from rule 1 to rule 10. If rule 3 is satisfied, should not check for rule 4 to rule 10.
We cannot achieve the above scenario using "activation-groups".
2009/4/21 Edson Tirelli <tirelli@post.com>
Lindy,The rule with the highest salience ***that matches (i.e., in your words: is satisfied)*** will be fired and the others will be canceled, so I guess that is exactly what you are looking for.
"my understanding is that if you have 10 rules under same activation group always the one with high salience will fire ignoring other rules. (correct me if i am wrong.)"
If I misunderstood your case, please explain it further.
[]s
Edson2009/4/21 Lindy hagan <lindyhagan@gmail.com>
I don't know much about drools, am still evaluating drools, we have a similar scenario that as soon as a rule is satisfied, should not check for other rules.
looking at the manual for activation-group , my understanding is that if you have 10 rules under same activation group always the one with high salience will fire ignoring other rules. (correct me if i am wrong.)
Probably we need to set some flag to check whether the previous rule is processed or not.2009/4/20 Edson Tirelli <tirelli@post.com>
Take a look at the manual on "activation-group"s. They allow you to do that.
Also, you can call fireAllRules(1) to fire only one rule, in case your whole rulebase is like that.
[]s
Edson
2009/4/19 Manish1985 <pramanish@gmail.com>
Hi All,
Assume that following is the case,
rule "Rule1"
when
t:Test(status==10)
Test(testValue > 90)
then
t.percent=5;
modify(t);
end
rule "Rule2"
when
t:Test(status==10)
Test(testValue> 80)
then
t.percent=10;
modify(t);
end
rule "Rule3"
when
t:Test(status==10)
Test(testValue > 50)
then
t.percent=15;
modify(t);
end
Here, based on each condition i will assign percentage value.
Assume that testValue is 100 and status is 10 so it will be evaluated true
for each rule
but i dont want that. i want Rule1 to be evaluated and then it should stop
executing other rules other wise percetage value will be different from what
i want.
(15 instead of 5).
I can do this by adding one more condition in every rule like
Test(percent==0)
and initially i will intialize Test.percent by zero so only first Rule will
be evaluated/executed.
But is there any other way apart from these?
One more thing is that in decision table i want to add OR between two
conditions.
How can i do that? please give me example for doing that.
Thanks a lot in advance.
Regards,
Manish
--
View this message in context: http://www.nabble.com/I-want-only-first-rule-to-be-executed-even-more-than-one-rule-are-fulfilling-the-LHS-tp23080560p23080560.html
Sent from the drools - user mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.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
_______________________________________________
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
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users