Please find an example in attachement
-- christophe

[EMAIL PROTECTED] wrote:

>Please provide an example of the problem.  Thanks
>
>>
>> I am experiencing retraction of logically derived facts after the
>> addition of a new rule
>>
>> in the Rete engine (I know this is not the canonical use of an expert
>> system but...)
>>
>> Could someone give me more insight on why Jess is behaving so ?
>
>

// test for retraction behavior on logically asserted facts
// [EMAIL PROTECTED] - March 2002

; uncomment following to see retraction
;(watch all)

(deftemplate inc (slot cpt)  (slot in))
(deftemplate in  extends inc)
(deftemplate top (slot cpt))

(deffacts f1
  (in (cpt chp)    (in Staff))
  (in (cpt Staff)  (in Person))
  (in (cpt Person) (in Thing))
)

;(deffacts f1
;  (in (cpt lw)     (in Staff))
;  (in (cpt Staff)  (in Person))
;  (in (cpt Person) (in Thing))
;)

(defrule inc-closure
  (logical (inc (cpt ?cpt) (in ?in1))
           (in  (cpt ?in1) (in ?in2&~?in1)))
  =>
  (assert (inc (cpt ?cpt) (in ?in2)))
)

(printout t "**** INITIAL FACTS ****" crlf)
(facts)

(reset)
(run)
(printout t "**** AFTER RUN ****" crlf)
(facts)

(defrule test
  (logical (inc (in ?cpt))
           (not (inc (cpt ?cpt))))
  =>
  (assert (top (cpt ?cpt)))
)

(printout t "**** AFTER DEFRULE ****" crlf)
(facts)

(reset)
(run)
(printout t "**** AFTER NEW RUN ****" crlf)
(facts)









Reply via email to