Hi all,

I told about my problem with retracting. (see section below). I think i`ve
found the problem

In my program i first delete all facts in the rete engine and set them
again. The setting function uses an Iterator from Rete.listFacts( ).

Then i definstance the fact (walk-to (agens ?t) (destination ?l) (OBJECT
?o))

Now i run the machine. The fact ?oldloc isn`t retracted, but if i don`t
delete and reset all facts the rule works fine.

The problem is I think, that when i delete all facts a automatically
undefinstance of  (located (thing ?m) (location ?l2) (OBJECT ?o2))
takes place. This is a shadowfact. When the fact is asserted again, the fact
is there, but the match with the deffinstance object is gone.
So the (located (thing ?m) (location ?l2) (OBJECT ?o2)) appears in the
factlist, but it is a shadowfact and there is no deffinstance object???

My question is: Could this be the problem and how can i solve this ??
I need to reset all facts !! (i think of using rete.listDeffinstances(), but
how ??)

Thanks in advance..


---------------------previous mail -------------------------------
Hi all,

I have a problem with retracting. I`ve the following rule:

(defrule rule-walk-to
     ?w <- (walk-to (agens ?t) (destination ?l) (OBJECT ?o))
     ?oldloc <- (located (thing ?m) (location ?l2) (OBJECT ?o2))
      =>
     (printout t "*** retracting ******* " crlf)
     (retract ?oldloc)
     (retract ?w)
     (printout t "*** retracting ******* " crlf)
)


When i run the jess machine, i`ve the following facts:

Fact : 0  (MAIN::initial-fact)
Fact : 5  (MAIN::adjacent (class <External-Address:java.lang.Class>)
(locale1 <External-Address:vs.storyworldontology.Forest>) (locale1_type
<External-Address:java.lang.Class>) (locale2
<External-Address:vs.storyworldontology.Mountains>) (locale2_type
<External-Address:java.lang.Class>) (OBJECT
<External-Address:vs.storyworldontology.Adjacent>))
Fact : 6  (MAIN::adjacent (class <External-Address:java.lang.Class>)
(locale1 <External Address:vs.storyworldontology.Mountains>) (locale1_type
<External-Address:java.lang.Class>) (locale2
<External-Address:vs.storyworldontology.Desert>) (locale2_type
<External-Address:java.lang.Class>) (OBJECT
<External-Address:vs.storyworldontology.Adjacent>))
Fact : 7  (MAIN::located (class <External-Address:java.lang.Class>)
(location <External-Address:vs.storyworldontology.Mountains>) (location_type
<External-Address:java.lang.Class>) (thing
<External-Address:vs.storyworldontology.Princess>) (thing_type
<External-Address:java.lang.Class>) (OBJECT <External-Address:vs.stor
yworldontology.Located>))
Fact : 10  (MAIN::walk-to (agens
<External-Address:vs.storyworldontology.Princess>) (agens_type
<External-Address:java.lang.Class>) (class
<External-Address:java.lang.Class>) (patiens
<External-Address:vs.storyworldontology.Mountains>) (patiens_type
<External-Address:java.lang.Class>) (OBJECT
<External-Address:vs.storyworldontology.WalkTo>) (destination
<External-Address:vs.storyworldontology.Desert>) (destination_type
<External-Address:java.lang.Class>))

As shown by (watch all), the rule fires using fact 10 and fact 7

FIRE 1 MAIN::rule-walk-to f-10, f-7

So far so good.

But then the retracting doesn`t work; The output is:

*** retracting *******
<== f-10 (MAIN::walk-to (agens
<External-Address:vs.storyworldontology.Princess>) (agens_type
<External-Address:java.lang.Class>) (class
<External-Address:java.lang.Class>) (patiens
<External-Address:vs.storyworldontology.Mountains>) (patiens_type
<External-Address:java.lang.Class>) (OBJECT
<External-Address:vs.storyworldontology.WalkTo>) (destination
<External-Address:vs.storyworldontology.Desert>) (destination_type
<External-Address:java.lang.Class>))
*** retracting *******

Not only fact 10 should be retracted. Fact 7 should also been retracted.
I`ve no idea why this doesn`t
work. When I print ?oldloc, it gives the good fact (fact 7), so ?oldloc
should contain the fact...but it isn`t retracted.

Anybody an idea...???

Thanks in advance,

Sander

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