If you have two rules

(defrule rule1
  (A)
  (B)
  =>
  (C)
  )


(defrule rule2
  (A)
  (B)
  =>
  (D)
  )

and both A and B are true, then

1) Both C and D will be executed, and
2) A and B will each be evaluated only once, as if you had written

(defrule rule3
  (A)
  (B)
  =>
  (do-C-and-D-in-some-random-order))


I think Adarsh Jain wrote:
> Does this mean I can use the same for both rules.
> Now if you look at my query, "Using multiple objects in LHS",  I have given an
> example.
> So, how do I use the country object with attr name = "USA" in the second rule.
> do i have to
> do the filtering again.
> I will attach the example here again.
> 
> ;;If the name attr in Country instance is "USA", then call a method on Country
> object
> ;;that would return an array of State objects. Change the name attribute of the
> State object
> ;;to "Northern Virginia" if the name attr is "Virginia".
> (Defclass country Country)
> 
> (defrule search-country
>         (country (name ?name) (Object ?country))
>         (test (eq "USA" ?name)
> =>
>         (call ?country getStates)
> 
> I am not sure how to proceed further.
> 
> Thanks,
> Adarsh
> 
> friedman_hill ernest j wrote:
> 
> > No; just write both rules and they will both fire. Jess will combine
> > their left-hand-sides automatically.
> >
> > I think Adarsh Jain wrote:
> > > Hi,
> > > Can you invoke another rule from the RHS that works on the same facts.
> > >
> > > Thanks,
> > > Adarsh
> >
> > ---------------------------------------------------------
> > Ernest Friedman-Hill
> > Distributed Systems Research        Phone: (925) 294-2154
> > Sandia National Labs                FAX:   (925) 294-2234
> > Org. 8920, MS 9012                  [EMAIL PROTECTED]
> > PO Box 969                 http://herzberg.ca.sandia.gov
> > Livermore, CA 94550
> 
> --
> Adarsh Jain
> Longitude Systems, Inc
> Ph: 703-818-5436
> 
> 



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550
---------------------------------------------------------------------
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