[rules-users] Is it possible to affect load order of rules?

Martin, Matthias martin at adesso.de
Thu May 19 02:50:09 EDT 2011


Hello,

in our project we've to know, which rules have already been checked, regardless whether or not the rule gets activated and hence put on the agenda. Is there any possibility to affect the order, in which the drools engine reads and checks the LHS of rules? I suppose the assignment of a salience value has no effect on the load order and is rather a mechanism for conflict resolving, when a rule is about to be fired.
Background for this demand explained in an nutshell:
We use salience for conflict resolving. The conflicting rule with the highest salience value should be fired, but the others with minor salience values mustn't! In our scenario it can occur, that two (or more) rules might conflict at runtime. Therefore we want to perceive, which rule for which fact has already been checked, actually if it gets never activated on the agenda.

Example:
rule "morespecific"
salience 100
when myObj(variant = Variants.SPECIFIC_1 && fee < 10)
then....
end

rule "general"
salience 30
when myObj(fee < 100)
then....
end

If I set the value for variant to Variants.SPECIFIC_1 and the fee value to 30, for example, the first rule will never make it to the agenda but the second one does and is actually getting fired because it doesn't care about the variants value and 30 is less 100.
We want to perceive the already performed check for "morespecific" for a specific object und halt the execution of "general".

Any suggestions are welcome!

Regards,

Matthias Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110519/f326fcc2/attachment.html 


More information about the rules-users mailing list