[rules-users] Possible to enforce a unique salience?

Tihomir Surdilovic tsurdilo at redhat.com
Mon Dec 27 13:52:14 EST 2010


Nothing out-of-the-box afaik.

Take a look at dynamic salience expressions - 
http://blog.athico.com/2007/05/dynamic-salience-expressions.html
Also note that dynamic salience can also be determined with a function 
call, for example:

package com.sample
public class MyClass {
...
    public static int uniqueSalience(String ruleflowGroup) {
         // return and maintain unique salience contract ..implement 
yourself
     }
...
}

and in your drl for example:

package com.sample
import function com.sample.MyClass.uniqueSalience;

rule "testrule"
     ruleflow-group "abc"
     salience (uniqueSalience("abc"))
when
    ...
then
    ...
end

Hope this helps some.

Thanks.
Tihomir

> Is it possible in Drools to enforce a unique salience?
>
> Ideally this would be done at the point of entering a new rule.
>
> For example, if a rule existed with salience of 17 and a user tried to 
> add a
> new rule of salience 17, an error message would be generated saying
> 'salience level already in use'.
>
> Even better would be the ability to enforce a unique salience for rules
> belonging to a particular ruleflow-group.
>
> The reason for wanting to achieve this is to prevent indeterminate 
> behaviour
> when two or more rules exist with the same salience level.
>
> Any help would be much appreciated.
>
> Regards,
>
> Barnaby
> -- 
> View this message in context: 
> http://drools-java-rules-engine.46999.n3.nabble.com/Possible-to-enforce-a-unique-salience-tp2120470p2120470.html
> Sent from the Drools - User mailing list archive at Nabble.com 
> <http://Nabble.com>.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org <mailto: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/20101227/7f685d7d/attachment.html 


More information about the rules-users mailing list