[rules-users] OR operator

Jaikiran Pai jai_forums2005 at yahoo.co.in
Mon Aug 13 04:21:33 EDT 2007


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070813/41ce1c27/attachment.html 


More information about the rules-users mailing list