[rules-users] I want only first rule to be executed even more than one rule are fulfilling the LHS
Edson Tirelli
tirelli at post.com
Tue Apr 21 12:35:42 EDT 2009
Lindy,
"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.)"
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.
If I misunderstood your case, please explain it further.
[]s
Edson
2009/4/21 Lindy hagan <lindyhagan at 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 at 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 at 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 at 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 at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090421/285a3bf2/attachment.html
More information about the rules-users
mailing list