I just tried to set this up in a prototype, and I must be
misunderstanding something about xor-group, because it didn't work the
way I expected.

I defined two rules, both of which would match the input based on their
parameters and conditions.  I set the first one to salience "1" and the
second to "2".  I set them both to have the same xor-group value.  In my
consequence, I just added a print statement, so I would know which one
it matched.

What I saw is that it matched both rules, and it matched the one with
salience "2" first.

What do I have to do to have it match only a single rule (or none) in an
xor-group?

> -----Original Message-----
> From: Michael Neale [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, November 19, 2005 5:59 PM
> To: [email protected]
> Subject: [spam]::RE: [drools-user] RE: [spam]::RE: 
> [drools-user] RE: [spam]::Re: [drools-user] Is order of 
> "rule" elements in "rule-set" the load-order?
> 
> 
> No if salience (priority) is not set, then it is not 
> necessarily as simple as top to bottom in the XML (as I am 
> sure you read in the doco on it). 
> 
> If you care about the order in the xor group, you need to set 
> salience accordingly. 
> 
> If you have very special needs for ordering, you can write 
> and plug in your own conflict resolver of course.
> 
> -----Original Message-----
> From: Karr, David [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, 20 November 2005 11:53 AM
> To: [email protected]
> Subject: [drools-user] RE: [spam]::RE: [drools-user] RE: 
> [spam]::Re: [drools-user] Is order of "rule" elements in 
> "rule-set" the load-order?
> 
> So are you saying that rules definitely fire (checking 
> conditions) in the order they are in in the XML, ignoring for 
> the moment any conflict resolution settings (like salience)?  
> If that's the case, then that might give me what I need, if I 
> order the rules in order of priority in each xor-group.
> 
> > -----Original Message-----
> > From: Michael Neale [mailto:[EMAIL PROTECTED]
> > 
> > No the ordering works over the whole ruleset with nothing to do with
> > xor grouping.
> > 
> > The rules inside an xor group would follow the ordering of 
> rule firing
> > of the whole rule set, the xor group having no effect on 
> this (the xor 
> > group simply only allows one of the rules to fire).
> > 
> > -----Original Message-----
> > From: Karr, David [mailto:[EMAIL PROTECTED]
> > 
> > > -----Original Message-----
> > > From: Geoffrey Wiseman [mailto:[EMAIL PROTECTED]
> > > 
> > > On 11/19/05, Karr, David <[EMAIL PROTECTED]> wrote:
> > > > I'm trying to figure out how I can make only one rule 
> in a set of
> > > > rules fire, and have it check the rules in a certain order.
> > > >
> > > > I see that using the "xor-group" attribute deals with the
> > > "only one"
> > > > part, but I'm not sure how to specify the order it checks
> > > the rules in
> > > > an xor-group. Is that what "salience" is for? In a particular
> > > > xor-group, will the rule with the highest salience be
> > checked first?
> > > 
> > > Salience is a factor, yes; that's the easiest way to control the
> > > firing of rules. There's a page on the Drools site about Conflict 
> > > Resolution that should help clarify somewhat.
> > 
> > Yes, I saw that section.  I wasn't certain from that 
> exactly what the
> > semantics would be in the context of xor-groups.
> > Would the saliency ordering in a particular xor-group be completely 
> > independent of the saliency ordering in a different xor-group, even 
> > for identical saliency values across xor-groups?
> > 
> > I want to use salience within xor-groups because I want each rule in
> > an xor-group to have a condition which checks to see whether a 
> > particular code value "isPresent()" in a list, but each particular 
> > code value has a "priority", so I'll set the salience for 
> that rule to 
> > the priority for the code value.
> 
> 

Reply via email to