I suspect the key phrase here is "doing something similar." If you're
actually modifying a jess.Fact object from Java code, remember that
the (modify) command is really a (retract) followed by modification of
the fact followed by an (assert). If you modify any of the slots of a
Fact object while it is actually in the Rete network, Jess's behaviour
is undefined. The simplest way to modify a fact in a Java application
might be to use a Funcall object to run the (modify) command, which
does the right thing for you, automatically.
I think Lakshmi Vempati wrote:
> I am working on a project that does not use Java Bean design pattern for
> the Ontology representation.
> The mapping of classes and instances is handled separately by java code.
> Likewise any changes
> to attribute values on the server are mapped to jess and jess generated
> events are mapped back to the
> server. When I try to do something like this:
>
> (deftemplate A (slot name) (slot y))
> (deftemplate B (slot name) (slot x))
>
> (defrule create-fact-rule
> ?a <- (A (name "a") (y 4))
>
> (not (B (name "b") (x 6)))
> =>
> (assert (B (name "b") (x 6)))
> )
>
> (defrule modify-fact-rule
> ?a <- (A (name "a") (y 5))
>
> ?b <- (B (name "b") (x 6))
>
> =>
> (modify ?b (x 4))
> )
>
> (defrule delete-fact-rule
> ?a <- (A (name "a") (y 3))
> ?b <- (B (name "b"))
> =>
> (retract ?b)
> )
>
> works fine in jess stand-alone mode. But doing something similar in
> an integrated mode is resulting in two facts for b with same fact-id's.
> The problem arising from this is when delete-fact-rule is fired, only
> one of the facts for b is retracted leaving one behind.
> This prevent's create-fact-rule from firing again. This seems to happen
> only the first time
> the fact b is modified.
> Each further modification does not create extra facts with same fact-id.
>
> Any insight as to what may be causing this greatly appreciated.
>
> Thanks,
>
> Lakshmi Vempati
Content-Description: Card for Lakshmi Vempati
[Attachment, skipping...]
---------------------------------------------------------
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]
---------------------------------------------------------------------