You are correct, the patterns in the LHS of a rule are treated as being
ANDed together. To create an OR condition, you could use two or more
separate rules. Instead of:

Jess> (defrule cantDoThis (test (or (this ?) (that ?))) => (assert
(thisandThat)))
Rete Exception in routine ReteCompiler::eval.
  Message: Unbound variable found in funcall: _blank_2  at line 1:  (
defrule cnatDoThis ( test ( or ( this ?_blank_2 ) ( that ?_blank_3 ) ) ) = >
( assert ( tat ) ) ) .
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(Compiled Code)
        at java.lang.Throwable.<init>(Compiled Code)
        ....
Jess> (assert (this Z))
<Fact-0>
Jess> (assert (that V))
<Fact-1>
Jess> (facts)
f-0   (this Z)
f-1   (that V)
For a total of 2 facts.
TRUE
Jess> (defrule thisRule (this ?) => (assert (thisandThat)))
TRUE
Jess> (defrule thatRule (that ?) => (assert (thisandThat)))
TRUE
Jess> (run)
TRUE
Jess> (facts)
f-0   (this Z)
f-1   (that V)
f-2   (thisandThat)
For a total of 3 facts.
TRUE
Jess> 
Opinions are strictly those of the author and 
do not necessarily reflect those of GRCI.
____________________________________________
Lewis Hart                   GRC International
703-506-5938              1900 Gallows Rd
[EMAIL PROTECTED]            Vienna, VA 22182


-----Original Message-----
From: Message UK [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 18, 1999 4:32 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: JESS: OR and AND in rules


Hi all. I would like to be able to use an OR in a rule, like "if this is the

case" OR "this is the case" then fire rule X.

In some rules I have listed several conditions, which I have assumed works 
as an AND:

(defrule worried_AIDS
 >>  ?u <- (user(hiv_status "pos"))
 >>  ?e <- (enquiry (type G3)(value "done"))
        =>

        ...etc...

is that right? is it ANDed? How do I do an OR? (if it's possible)? And if 
the above is in fact an OR, how do I do an AND??!!

Tres thanks. Debbie Lampon


______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
---------------------------------------------------------------------
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]
---------------------------------------------------------------------

Reply via email to