Oh... I misread the pseudo code. I missed that the if (age>60) is inside the
if(location=="A") rule. This is easy enough to fix. It's would essentially
be the same thing as the otherwise, but in DRL:
rule 'Rule One'
activation-group 'age-test'
salience 300
when
Person (location == 'A', age > 60 )
Then
do_something();
end
rule 'Rule Two'
activation-group 'age-test'
salience 200
when
Person (location == 'B', age > 70 )
Then
do_something();
end
rule 'Rule Three'
activation-group 'age-test'
salience 100
when
Person (location == 'C', age > 80 )
Then
do_something();
end
rule 'Rule Else'
activation-group 'age-test'
when
Person (location not in ('A','B','C'), age > 65
)
Then
do_something();
end
This is a good example why it can be difficult to model rules from procedural language.
With a rule, you are reacting to a given condition, but with procedural language waterfall
logic, you automatically exclude conditions as you fall through the logic. With rules,
there is not waterfall effect. You have to simulate the waterfall logic with explicit
exclusions.
This is best represented with a lot of if() but no else clauses in procedural language
logic.
Not the only rule I modified to make this work was my else rule.
Regards,
Armand
From: rules-users-bounces(a)lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On
Behalf Of Ronald Albury
Sent: Wednesday, November 23, 2011 11:22 AM
To: rules-users(a)lists.jboss.org
Subject: Re: [rules-users] multi-factor rule
Armand
I don't think that works if location=='B' and age=68