Hi, I've experienced problems with retracting facts under the following circumstances: a) when it contained a reference to a java object and b) when I accessed the member methods of that object. It can't be retracted but it can be modified: that produces two modified copies (!). The same problem appears to exist with definstanced facts.
See the sample code and output below: (clear) (reset) (defclass map java.util.HashMap) (watch all) (definstance map (new java.util.HashMap) static) (retract 1) (facts) (definstance map (new java.util.HashMap) static) (call (fact-slot-value (fact-id 2) OBJECT) put "key1" "val1") (call (fact-slot-value (fact-id 2) OBJECT) get "key1") (retract 2) (facts) (clear) (reset) (deftemplate map (slot object)) (watch all) (assert (map (object (new java.util.HashMap)))) (retract 1) (facts) (assert (map (object (new java.util.HashMap)))) (call (fact-slot-value (fact-id 2) object) put "key1" "val1") (call (fact-slot-value (fact-id 2) object) get "key1") (retract 2) (facts) (modify 2 (object nil)) (facts) ;******** OUTPUT ************ Jess> TRUE Jess> java.util.HashMap Jess> TRUE Jess> ==> f-1 (MAIN::map (class <External-Address:java.lang.Class>) (empty TRUE) (OBJECT <External-Address:java.util.HashMap>)) <Fact-1> Jess> <== f-1 (MAIN::map (class <External-Address:java.lang.Class>) (empty TRUE) (OBJECT <External-Address:java.util.HashMap>)) TRUE Jess> f-0 (MAIN::initial-fact) For a total of 1 facts. Jess> ==> f-2 (MAIN::map (class <External-Address:java.lang.Class>) (empty TRUE) (OBJECT <External-Address:java.util.HashMap>)) <Fact-2> Jess> Jess> "val1" Jess> TRUE Jess> f-0 (MAIN::initial-fact) f-2 (MAIN::map (class <External-Address:java.lang.Class>) (empty TRUE) (OBJECT <External-Address:java.util.HashMap>)) For a total of 2 facts. Jess> TRUE Jess> TRUE Jess> TRUE Jess> TRUE Jess> ==> f-1 (MAIN::map (object <External-Address:java.util.HashMap>)) <Fact-1> Jess> <== f-1 (MAIN::map (object <External-Address:java.util.HashMap>)) TRUE Jess> f-0 (MAIN::initial-fact) For a total of 1 facts. Jess> ==> f-2 (MAIN::map (object <External-Address:java.util.HashMap>)) <Fact-2> Jess> Jess> "val1" Jess> TRUE Jess> f-0 (MAIN::initial-fact) f-2 (MAIN::map (object <External-Address:java.util.HashMap>)) For a total of 2 facts. Jess> <Fact-2> Jess> f-0 (MAIN::initial-fact) f-2 (MAIN::map (object nil)) f-2 (MAIN::map (object nil)) For a total of 3 facts. Jess> -------------------------------------------------------------------- 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] --------------------------------------------------------------------
