[rules-dev] salience alternative with before/after

Davide Sottara dsotty at gmail.com
Tue Feb 14 01:28:40 EST 2012


First of all, let me share the "responsibility" (credit or blame, up to you
:)) with my colleague and friend Stefano Bragaglia. 

This said, the idea is indeed to generate salience statically at compile
time, for a few reasons:
- conflict resolution by priority is a basic and familiar strategy
- comparison of numbers is easy 
- it will not add overhead, nor alter the current engine structure.
- it would be compatible with "legacy" rules tagged with salience (PROVIDED
we move from integers to floating point values)

However:
- we will adapt the salience as needed, e.g. when a new package is added.
Salience indeed determines a global, absolute total ordering within all the
rules. The proposed annotations just define a relative, partial ordering. We
would eventually generate one of the possible total orderings compatible
with the more relaxed constraints.
Notice that sometimes it won't be possible to create the ordering due to
loops - but I guess that it would be yet another bug-detecting enhancement

As for grups, we are considering to deprecate them in favor of a more
general concept (Mark will tell you more). Initially I guess that this new
feature will be local to an agenda group, agenda groups having higher
priority in determining what can fire and what can't. 

However, the before/after attributes should already be flexible enough to
mimic some group-like behaviour. Mark's example is limited: an attribute, in
fact, can have nested "fields", such as:
@cashflow( color=red )
so now we can write specific precedences: before( @cashflow( red ; ) ) 
or more group-like precedences : before( @cashflow() ) 
exploiting an unification-like mechanism to decide which rule is actually
comparable to which. 
In this case, you could tag all the rules in your group with @cashflow and
just one of them with the additional attribute...

Best
Davide

ps. As for the attribute names, the poll is open :)


--
View this message in context: http://drools.46999.n3.nabble.com/salience-alternative-with-before-after-tp3742094p3742863.html
Sent from the Drools: Developer (committer) mailing list mailing list archive at Nabble.com.


More information about the rules-dev mailing list