The easiest solution, given your description of the problem, I think is to add a "processed" flag to Article if possible. So your fallback rule, besides having a lower salience as you already have, would just check for articles that were not processed yet:

rule fallback
when
     Article( processed == false )
     ...
end

   The flag must be set on the consequence of the other rules though, what may not be ideal.

   []s
   Edson

2008/9/17 Marcus Ilgner <marcus.ilgner@gmail.com>
Hi all,

I'm currently puzzled on how to implement a sort of fallback rule. In
my scenario I have a couple of articles and payments related to those
articles. Now I need to distribute royalties to the authors of these
articles. There's a common business logic which says "distribute X
percent for articles of type T, Y percent for articles of type S and Z
percent for all other articles".
At first, my approach was to write the rules like this (omitting a
rule for type 'S' for the sake of brevity):

rule1
activation-group "article1"
salience 100
when
 $article : Article(type == 'T')
 $payment : Payment( article==$article )
then
 account(x%)
end

rule3
activation-group "article1"
salience 0
when
 $article : Article()
 $payment : Payment( article==$article )
then
 account(z%)
end

However, I quickly found out that the use of activation-group will
then only consider all articles of type T and ignore all other
fact-combinations. Retracting payments from the WM is also not
feasible since there may be other rules that should work on them.
I also cannot write the last rule as Article( type != 'T', type != 'S'
etc) since new article types may be added later on and it would not be
manageable to update all previously written rules (which may very well
number in thousands in the future).
Now I'm a bit stuck on this issue and would welcome any hints.

Best regards
Marcus
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @ www.jboss.com