Dear all,

thank you for the replies and very creative suggestions how
such a behavior could be implemented. I just wanted to add that I also thought about a simple
implementation based on  rule-base events (as Wolfgang
also suggested) but was unsure if this is good design
because that this scatters behavior between rules and
event stuff and makes parts of the system non-declarative.
@Wolfgang, sorry for being imprecise in my first post. Of
course I meant a pattern with multivariables as first and last
part for the add rule ($? ?x $?) in order to let x bind to each
element of the multislot.

Kind regards,
Lars

Wolfgang Laun schrieb:
Martijn Tromm wrote:

Wolfgang wrote:
"It seems that the object facts are retracted all right if some slot c.m is reduced, but this does not trigger the second rule."


****

Why not?

Because

  ?os <- (object-status (obj ?x) (status p))

contains a typo. Omit (status p) and it works fine. (Sorry, I am not trying to be witty. I attributed the non-firing to something else while running these examples. logical *can* be tricky.)

Wolfgang

This certainly is the case in Haley's eclipse-rule engine (Eclipse is a derivative of Nasa Clips), which may be different on some points but not on this one I believe. Any change in the conflict-set will create new activations, whether they are positive or negative. At least that's what I believe will happen and what I know will happen in Haley's rule engine. Correct me if I'm wrong.

Martijn




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Wolfgang Laun
Sent: woensdag 20 februari 2008 15:41
To: [email protected]
Subject: Re: JESS: Rules for detecting changes of a multislot

Martijn Tromm wrote:

Lars,

With activations and retractions I was thinking about something like
this:
For every object in (c (m a b c)) assert a separate relation-fact
(object ?x) and keep a object-status template-fact for reference. Once
an object gets asserted it will be remembered by a object-status fact
with a status present/not-present.
(defrule infer-object)
(logical (c (m ? ?x ?)))
=>
(assert (object ?x))
)

You'll have to use (logical (c (m ?$ ?x ?$))) or else it'll match only
lists with a length of three.

If an object gets removed from the list, the object-fact will
automatically be retracted. I'm not quite sure of the syntax though (it
has been a while). And I hope it works for templates with multi-slots
--------------------------------------------------------------------
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