jess-users  

Re: JESS: Problem with getslotvalue

Ernest Friedman-Hill
Mon, 05 Oct 2009 08:04:46 -0700


On Oct 5, 2009, at 10:42 AM, Steffen Niermann wrote:

Has anybody an idea, why the changes in the facts, which will be printed in the console, will not take effect on the getSlotValue fuction?
 ....

I'm not quite sure why you think the changes *would* be visible through the variable "v" in your Java code. Your rules *don't* modify the Verzug fact -- they retract it (i.e., delete it) after asserting a completely separate one. The changes aren't reflected in the fact pointed to by "v" because that fact isn't even in working memory.

(defrule einspannen
    ;(declare (no-loop TRUE))
    (Werkstueck (Einspannungsart "Segmentbackenabdruck"))
    ?r1 <- (noloops (einspannennl 0))
    ?r2 <- (Verzug (v1 ?v1) (v2 ?v2))
    =>
    (retract ?r1)
    (assert (noloops (einspannennl 2)))
    (assert (Verzug (v1 (+ ?v1 2)) (v2 ?v2)))
    (retract ?r2)
    )


If you were to actually modify the existing fact, e.g.,

=>
    (assert (noloops (einspannennl 2)))
    (modify ?r1 (v1 (+ ?v1 2)) (v2 ?v2))

then of course you'd see the changes in that variable.




---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs
PO Box 969, MS 9012                            ejfr...@sandia.gov
Livermore, CA 94550                             http://www.jessrules.com





--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.
--------------------------------------------------------------------