[rules-users] rules priority

Michael Anstis michael.anstis at gmail.com
Mon Sep 20 05:21:06 EDT 2010


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100920/ac6c8bb5/attachment.html 


More information about the rules-users mailing list