While reading the original posting I didn't (and I still don't) see the
reason for the rules you're looking for. Somewhere in the system, there
must be some action that adds or removes an element from the multislot
list (perhaps using (modify)). There you know what is going on, and the
old value ist still available. (Perhaps (defadvice) could be used.)
Another approach would be to use shadow facts, and to react to the calls
being made to the setter for the multislot.
A pattern (? ?fact ?) will just match any multislot with exactly three
elements, binding ?fact to the middle one.
Why do you say that "all the facts have to be stored twice"? Actually,
just the slot m (of your facts of template C) has to be duplicated.
Martin's proposal would work fine.
Kind regards
Wolfgang
Lars Braubach wrote:
Hi,
thanks for your reply Martijn. The solution should work
but is also rather inefficient because all facts would have
be stored twice. Maybe some Rete expert could argue, if such
a rule could be expressed direcly in a rete network (not considering
the specification language). If this is possible it might indicate
that just the CLIPS/JESS language is insufficient for expressing such
kind of behavior.
Kind regards,
Lars
Martijn Tromm schrieb:
Hi,
You must either keep the same data in another slot for reference like:
(C (m a b c) (m-old a b c d)) Now you can compare old and new and
detect changes between. (actually you store the mutation this way)
Or I think you have to store each object in a separate fact and keep
track of changes through activations (addition) or retractions and
logical dependencies (removal).
Regards,
Martijn
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Lars Braubach
Sent: dinsdag 19 februari 2008 10:34
To: [email protected]
Subject: JESS: Rules for detecting changes of a multislot
Hi,
I am trying to design a rule that is able to detect
when a single fact of a multislot is added/removed.
Given that the contained multislot values are
backed with Java objects I would also like to
know which fact has been added/removed.
(deftemplate C (multislot m))
(deffacts facts
(C (m a b c))
)
For the addition of values I could figure out
a rule that does what I want, but its unclear
to me how this could be achieved for the removal
of values. (The addition rule simply uses a pattern
(? ?fact ?) in order to generate bindings for
each element of the multislot.)
Any ideas how this could be achieved?
Kind regards,
Lars
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
--------------------------------------------------------------------
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 owner-jess-
[EMAIL PROTECTED]
--------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.516 / Virus Database: 269.20.7/1286 - Release Date: 18-2-
2008 18:49
No virus found in this outgoing message.
Checked by AVG Free Edition. Version: 7.5.516 / Virus Database:
269.20.7/1286 - Release Date: 18-2-2008 18:49
--------------------------------------------------------------------
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]
--------------------------------------------------------------------
--------------------------------------------------------------------
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]
--------------------------------------------------------------------
--------------------------------------------------------------------
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]
--------------------------------------------------------------------