If I understand your problem correctly, you can, may be, flag your MyObj ( add an attribute called flag and set it to some value ) indicating that it has passed “morespecific” rule and add constraint in the “general” rule to ignore such facts ?

 

-abhay


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of Martin, Matthias
Sent: Thursday, May 19, 2011 12:20 PM
To: rules-users@lists.jboss.org
Subject: [rules-users] Is it possible to affect load order of rules?

 

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


This message contains information that may be privileged or confidential and is the property of the KPIT Cummins Infosystems Ltd. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. KPIT Cummins Infosystems Ltd. does not accept any liability for virus infected mails.