using 'or' like that results in subrule generation, i.e. rules will fire
for all matching combinatinos - this is not what people normally want.
you can also do it using field constraints
person : (Person (interests contains "Golf" || contains "Soccer")
Jaikiran Pai wrote:
Hi,
This is a very newbie question. I have a Person object which contains
a collection named "interests". This collection will contain the
activities that the Person is interested in. If the person is
interested in Golf, Soccer and Baseball, then this collection will
contain these 3 strings. I am trying to write a rule which checks
whether a person is interested in Soccer OR Golf and if he's
interested then do further logic. I looked at the documentation for
Drools syntax, and looks like this is how i have to write the rule:
rule Testing
when
person : (Person (interests contains "Golf") or Person (interests
contains "Soccer") )
then
System.out.println("I am interested");
end
Is this the correct way to do this? Is there a simpler construct like:
person : Person (interests contains "Golf" or interests contains
"Soccer" )
I was thinking on the lines of the "," (and) operator :
person : Person (interests contains "Golf", interests contains
"Soccer" )
Thank you.
------------------------------------------------------------------------
Why delete messages? Unlimited storage is just a click away.
<
http://in.rd.yahoo.com/tagline_mail_1/*http://help.yahoo.com/l/in/yahoo/m...
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users