Other's have answered most your Qs, so I'll just answer one part inline.
On 14/02/2012 06:08, Greg Barton wrote:
> I think it would be a great idea as long as it's not just generating the 
> salience code below under the covers. (Taking your example literally.)  But I 
> assume you're just creating a conflict resolution relation based on the 
> annotations.  This solves the main problem with salience which is it's global 
> reach. (i.e. all rules marked with salience are related whether you want them 
> to be or not.)
>
> Maybe more specifically worded annotations would be good: @firesBefore() and 
> @firesAfter()
>
> And you don't have it in the examples below, but I'm assuming you could have 
> multiple before and after annotations per rule.
>
> Also, you mentioned agenda-groups: could this be extended to those as well?  
> i.e. instead of groups activating in LIFO order, be explicitly ordered by 
> annotation?
Yes I think annotations make the keyword's ruleflow-group and 
agenda-group redundant. The labels automatically place rules into 
groups, so we can add method calls that dictate how to execute that 
group, i.e. linearly (ruleflow-group) or stack (agenda-groups). The idea 
needs some more thought and fleshing out, but I'll update my 
DroolsModules page to mention "before"/"after" as well as using labels 
as alternative grouping mechanisms to agenda-group and ruleflow-group:
http://community.jboss.org/wiki/DroolsModule

Mark

>
> --- On Mon, 2/13/12, Mark Proctor<[email protected]>  wrote:
>
>> From: Mark Proctor<[email protected]>
>> Subject: [rules-dev] salience alternative with before/after
>> To: [email protected]
>> Date: Monday, February 13, 2012, 6:25 PM
>> Davide has suggested a good idea.
>>
>> Now that rules support annotations, and annotations with
>> values. We
>> should add a before/after keyword to each rule.
>> before/after would then
>> take a list of annotations. The idea is to use this to
>> generate salience
>> under the covers.
>>
>> rule resetBalance before( @cashflow ) when then end
>>
>> rule debit @cashflow when then end
>>
>> rule credit @cashflow when  then end
>>
>> rule printBalance after(@cashflow ) when then end.
>>
>> Salience gives one rule priority over another, thus it's
>> declaring an
>> implicit relationship between rules. Yet it's a magic
>> number that
>> doesn't easily show this relation, and as the rulebase
>> grows it can be
>> very hard to determine those relationships as specified by
>> salience from
>> reading the rules. before/after allows you to specify
>> declarative the
>> relationships betwen rules in a more maintainable and
>> readable way, even
>> if under the covers it's just generating:
>>
>> rule resetBalance salience 100 when then end
>>
>> rule debit salience 0  when then end
>>
>> rule credit salience 0 when  then end
>>
>> rule printBalance saliance -100 when then end.
>>
>> Yes there are agenda-groups and ruleflow-groups, but they
>> can be a bit
>> cumbersome compared to the simplicity of using salience.
>> This way we get
>> the simplicity of using salience, without the downfalls of
>> it being a
>> magic number.
>>
>> What do people think? Any ideas on how we can improve this?
>> At build
>> time it would have to report impossible to resolve
>> relationships and barf.
>>
>> Mark
>> _______________________________________________
>> rules-dev mailing list
>> [email protected]
>> https://lists.jboss.org/mailman/listinfo/rules-dev
>>
> _______________________________________________
> rules-dev mailing list
> [email protected]
> https://lists.jboss.org/mailman/listinfo/rules-dev

_______________________________________________
rules-dev mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-dev

Reply via email to