Salience in drools?

The short answer is that you shouldn't rely on the order of rules firing of the same salience - if they are "in conflict" (ie both are eligible to fire). Rules with no salience are just salience of zero, BTW.

The short answer is that you shouldn't rely on the order of rules firing of the same salience - if they are "in conflict" (ie both are eligible to fire). Rules with no salience are just salience of zero, BTW. Of course it is deterministic - its just that the algorithm is subject to change between versions (not very likely though).

This is under the general area of "conflict resolution" and much has been written about it. I can't find a current article on Drools strategy - but I believe most of it is "recency" - ie the most recently modified/inserted fact "wins" - or rather the rules that refer to the most recent fact will win. If after all that it can't decide - it is usually the order in which they rules are loaded (which usually co-incides with how they are written in the file).

If you have to have an order - use salience, or use rule-flow or similar, best not to second guess how it will work.

I'm not really interested in it from a production standpoint - I understand the purposes of salience and I'd never be relying on a certain implementation firing them in a certain order. It's simply a point of interest for me to know if the behaviour is defined at all. Cheers for your answer!

– JBirch Sep 9 '10 at 7:32 According to official JBOSS documentation , rules with default salience (or equal but not default) will be executed in arbitrary order. One should never rely on it if order of actions is important. (docs.redhat.com/docs/en-US/JBoss_Enterprise_BRMS_Platform/5/…) – ZeC Oct 12 '11 at 12:46 The execution order did change at some point during the Drools 5.

X releases. My rules only worked if the execution happened in a certain order, shame on me. Luckily I was smart enough to write unit tests that picked it up.

– Toni Rikkola Nov 30 '11 at 15:09.

My experience with Drools 5.1 is that it's last in, first out. That is, the rule defined last in your drl will be executed first. But yes, relying on such behavior wouldn't be the best idea :).

The Rete algorithm used recency and specificity of conditions.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions