Well, it seems to me that basically two rules would keep the set of
EntityAt facts up to date.
(defrule create-entity-at
(entity ?id ?x ?y)
(position ?pid ?x ?y)
(not (EntityAt ?id ?pid))
=>
(assert (EntityAt ?id ?pid)))
(defrule delete-entity-at
?e <- (EntityAt ?id ?pid)
(entity ?id ?x ?y)
(not (position ?pid ?x ?y))
=>
(retract ?e))
Whenever an (entity) changes, both rules will probably fire (given
that the necessary position and/or EntityAt facts exist.)
Does this do it?
I think Neeraj - Khandelwal wrote:
>
> Hi all,
> I have the followong problem:
>
> I have the facts:
>
> (entity id x y)
> (position pid x y )
>
> Now theres a rule which asserts new facts based on the current values of
> the above facts.
>
> the new fact is of the type:
>
> (EntityAt id pid)
>
> Now at some point in the future the fact for entity modifies its x and y
> values. I would like this to delete the old EntityAt fact and assert a new
> fact based on the new value of entity fact. Basicly I want Jess to clean
> up after itself. Is there an easy and straight forward way of doing this?
> I am currently using the fact number to see if a fact is newer than
> another to see if it is still valid.
>
> the problem is complicated by the fact that I already have a big facts and
> rule base and I want to achieve this by making the minimal changes.
>
> thanx ,
> Neeraj.
>
>
>
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
>
---------------------------------------------------------
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]
---------------------------------------------------------------------