I totally agree with Wolfgang here.
I am surprised, all the more so because (cf. Expert):
"Each rule has a salience attribute that can be assigned an integer number,"
This does not event remotely indicate that you can use an expression involving bound variables.
If it isn't documented, nobody will use it. Being in front of the when part where the bindings occur, it is counter-intuitive to other bound variable references, and so I didn't even try.
However: good to know, and thanks!
-W
On 26 August 2010 15:21, Edson Tirelli <tirelli@post.com> wrote:
> Wolfgang,
> Not sure I understand what you mean, but Drools supports dynamic
> salience:
> rule "fire in rank order 1,2,..."
> salience( -$rank )
> when
> Element( $rank : rank,... )
> ...
> then
> ...
> end
> Edson
>
> 2010/8/26 Wolfgang Laun <wolfgang.laun@gmail.com>
>>
>> Just FYI, but who knows ;-)
>>
>> Our proprietary vintage RBS has a feature is (admittedly) rarely used
>> but could come in handy, every now and then.
>>
>> Given this class
>>
>> class Element {
>> int rank; // rank > 0
>> }
>>
>> and to fire a rule in ascending rank order, you can write (using
>> modified Drools syntax)
>>
>> rule "fire in rank order 1,2,..."
>> when
>> Element( $rank : rank,... )
>> // ...
>> salience -$rank ### <=
>> then
>> // ...
>> end
>>
>> The dynamically set salience does all the work. (Of course, you can
>> achieve the same order
>> in Drools easily enough.)
>>
>> This is possible since salience is a value that must be carried over
>> into the activation.
>> There is at least one other rule attribute that shares this property,
>> but I'm not sure
>> whether anything useful can be done with dynamic agenda groups.
>>
>> Cheers
>> -W
>> _______________________________________________
>> rules-dev mailing list
>> rules-dev@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
>
> --
> Edson Tirelli
> JBoss Drools Core Development
> JBoss by Red Hat @ www.jboss.com
>
> _______________________________________________
> rules-dev mailing list
> rules-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-dev
>
>
_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev