I think mauricio rincon wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Hi... > I have a problem with OR (v) operator. I_m using this operator in a rule, > that should be fired only once when both of the conditions happened . The > problem is that if both events are happening, the rule fires twice. example; > > (defrule names (or (name mao) (name july)) => (printout "hello world")) > > I_m getting: hello world > hello world >
In this particular case the solution is simple: use the 'or' connective constraint, not the 'or' conditional element: (defrule names (name mao|july) => (printout "hello world")) In the general case, when the 'or' conditional element is really needed, the solution is to make sure that when the rule fires, it has some detectable effect, and then match the negation of that effect on the left-hand-side of the rule; trivially (defrule names (or (name mao) (name july)) (not (names fired)) => (assert (names fired)) (printout "hello world")) --------------------------------------------------------- Ernest Friedman-Hill Advanced Software Research Phone: (925) 294-2154 Sandia National Labs FAX: (925) 294-2234 PO Box 969, MS 9012 [EMAIL PROTECTED] Livermore, CA 94550 http://herzberg.ca.sandia.gov -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------