[rules-users] Alternate approaches of using OR operator (to avoid sub-rule generation)
Jaikiran Pai
jai_forums2005 at yahoo.co.in
Fri Jul 18 03:54:48 EDT 2008
We are using Drools-3.0.6. In one of our scenarios, we are trying to use the OR operator as follows:
rule Testing
when
person : (Person (interests contains "Golf") or Person (interests contains "Soccer") )
then
System.out.println("I am interested");
end
Based on one of my earlier posts in this forum (long time back), this rule will result in
"The OR CE will cause subrule generation, meaning the rule will fire twice if both conditions are true".
One of the ways, i was planning to change this is as follows:
rule Testing
when
person : Person()
then
if (person.getInterests().contains("Golf") || person.getInterests().contains("Soccer")) {
System.out.println("I am interested");
}
end
I don't think this is the best solution, though. Anyone has any better ways of implementing this? I know that Drools - 4 has a better support for this, but right now we don't have plans of migrating.
Thank you.
regards,
-Jaikiran
---------------------------------
Did you know? You can CHAT without downloading messenger. Click here
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080718/2de955c4/attachment.html
More information about the rules-users
mailing list