[rules-users] rules priority

Nadav Hashimshony nadavh at gmail.com
Sun Sep 26 03:09:16 EDT 2010


Thanks for the responses.
what i did was:

rule "Rule-01"
salience 100
activation-group "defender"
no-loop true
.....

rule "Rule-02"
activation-group "defender"
no-loop true
.....

this way i assured the higher priorities rules run first (salience 100) and
that only one rule overall will be used.

thanks.
Nadav.



2010/9/22 Leonardo Gomes <leonardo.f.gomes at gmail.com>

> I think that you can explore the options already suggested:
>
> - guard condition
> - agenda group
>
> and also:
>
> - no-loop, if you happen to have any rule looping around itself
> - drools.halt( ) in the consequence, if you want to completely halt the
> execution when a given rule matches.
>
> Cheers,
> Leo.
>
>
>
> 2010/9/21 Esteban Aliverti <esteban.aliverti at gmail.com>
>
> If what you need is to fire just a subset of all the activated rules, you
>> could use agenda-group attribute instead of activation-group.
>>
>> Best,
>>
>> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>>
>> Esteban Aliverti
>> - Developer @ http://www.plugtree.com
>> - Blog @ http://ilesteban.wordpress.com
>>
>>
>> 2010/9/20 Michael Anstis <michael.anstis at gmail.com>
>>
>> You could consider using a "guard condition" e.g.
>>>
>>> rule 1
>>>     when
>>>         not Solved()
>>>         <Your rule 1>
>>>     then
>>>         insert new Solved();
>>>         ....
>>>     end
>>>
>>> rule 2
>>>     when
>>>         not Solved()
>>>         <Your rule 2>
>>>     then
>>>         insert new Solved();
>>>         ....
>>>     end
>>>
>>>
>>> If you only want one rule per "group" then have the grouping as a member
>>> of the guard condition.
>>>
>>> I'm not sure if you can cause the processing of activations to abort.
>>>
>>> 2010/9/20 Nadav Hashimshony <nadavh at gmail.com>
>>>
>>>>  Hi
>>>>
>>>> Im using drools 5 with Guvnor 5
>>>> i set up 30 Technical rules and build a package to be used by my
>>>> drools-sample application.
>>>>
>>>> my probelm is as followed, some rule may conflict, i want to set up a
>>>> rule order and if one rule is caught then i want the drools to stop and not
>>>> continue to try other rules.
>>>>
>>>> ive use salience but it hasnt really done the trick.
>>>>
>>>> example:
>>>> my rules:
>>>>
>>>> rule "Rule-01"
>>>> salience 100
>>>> activation-group "group1"
>>>> ...
>>>> System.Out.Println("caught rule 1")
>>>> ....
>>>>
>>>> rule "Rule-02"
>>>> salience 100
>>>> activation-group "group1"
>>>> ...
>>>> System.Out.Println("caught rule 2")
>>>> ....
>>>>
>>>> rule "Rule-03"
>>>> activation-group "group2"
>>>> ...
>>>> System.Out.Println("caught rule 3")
>>>> ....
>>>>
>>>>
>>>> rule "Rule-04"
>>>> activation-group "group2"
>>>> ...
>>>> System.Out.Println("caught rule 4")
>>>> ....
>>>>
>>>>
>>>> actual result: lets say all 4 rules are cuaght, what i will see is as
>>>> followed
>>>>
>>>> ACTIVATION CREATED rule:Rule-01 activationId:Rule-01 [1] declarations:
>>>> BEFORE ACTIVATION FIRED
>>>> caught rule 1
>>>> ACTIVATION CANCELLED rule:Rule-2
>>>>
>>>> ACTIVATION CREATED rule:Rule-03 activationId:Rule-01 [1] declarations:
>>>> BEFORE ACTIVATION FIRED
>>>> caught rule 3
>>>> ACTIVATION CANCELLED rule:Rule-3
>>>>
>>>>
>>>> only one rule from each activation-group will be fired, and the first
>>>> group with the higher salience will fire first.
>>>>
>>>> what i would like is it one rule was caught to stop trying? is it
>>>> possible?
>>>>
>>>> Thanks, Nadav.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100926/a03f8a9d/attachment.html 


More information about the rules-users mailing list