<div dir="ltr"><br> 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:<br>
<br>rule fallback<br>when<br> Article( processed == false )<br> ...<br>end<br><br> The flag must be set on the consequence of the other rules though, what may not be ideal. <br><br> []s<br> Edson<br><br><div class="gmail_quote">
2008/9/17 Marcus Ilgner <span dir="ltr"><<a href="mailto:marcus.ilgner@gmail.com">marcus.ilgner@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all,<br>
<br>
I'm currently puzzled on how to implement a sort of fallback rule. In<br>
my scenario I have a couple of articles and payments related to those<br>
articles. Now I need to distribute royalties to the authors of these<br>
articles. There's a common business logic which says "distribute X<br>
percent for articles of type T, Y percent for articles of type S and Z<br>
percent for all other articles".<br>
At first, my approach was to write the rules like this (omitting a<br>
rule for type 'S' for the sake of brevity):<br>
<br>
rule1<br>
activation-group "article1"<br>
salience 100<br>
when<br>
$article : Article(type == 'T')<br>
$payment : Payment( article==$article )<br>
then<br>
account(x%)<br>
end<br>
<br>
rule3<br>
activation-group "article1"<br>
salience 0<br>
when<br>
$article : Article()<br>
$payment : Payment( article==$article )<br>
then<br>
account(z%)<br>
end<br>
<br>
However, I quickly found out that the use of activation-group will<br>
then only consider all articles of type T and ignore all other<br>
fact-combinations. Retracting payments from the WM is also not<br>
feasible since there may be other rules that should work on them.<br>
I also cannot write the last rule as Article( type != 'T', type != 'S'<br>
etc) since new article types may be added later on and it would not be<br>
manageable to update all previously written rules (which may very well<br>
number in thousands in the future).<br>
Now I'm a bit stuck on this issue and would welcome any hints.<br>
<br>
Best regards<br>
Marcus<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br> Edson Tirelli<br> JBoss Drools Core Development<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>