This should really be a FAQ entry. You just have to modify your
matching pattern so it excludes whatever you'll be modifying the facts
to look like. You examples aren't quite concrete enough for me to use
them, so I'll make up my own here. For instance:

(deftemplate sum (slot op1) (slot op2) (slot sum (default nil)))

(defrule compute-sum
  ?s <- (sum (op1 ?n1) (op2 ?n2) (sum nil))
  =>
  (modify ?s (sum (+ ?n1 ?n2))))

If we didn't match on (sum nil), there would be an infinite loop. But
the dum slot is never nil after the modify, so the loop is
broken. Sometimes, instead of changing the match criteria, you instead
can retract one or more of the matched facts that will no longer be
needed.


I think Maren Zubizarreta wrote:
> Hi again after a short while:
> The answer I got from this list about how to change a fact, was to use the
> "modify" function.
> I applied this to my example:
>      (assert (Shop (a somethg)(b somethgelse)))
>      (defrule change-the-fact
>           ?fact <-(Shop(a something))
>      =>
>      modify ?fact (b change))
> Or to this one:
>      (assert (Shop (a somethg)(b somethgelse)))
>      (assert (House (c somethg))
>      (defrule change-the-fact
>           (House ?some)
>           ?fact <-(Shop(a ?some))
>      =>
>      modify ?fact ((a ?some)(b change))
> 
> In both cases Jess enters an infinite loop
> 
> So the question would be:How can I modify a fact's slot that isn't the one
> used
> to do the matching?
> thanx
> 
> 
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
> 



---------------------------------------------------------
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