My 2 cents worth ...
First the 'single' slot activation is a bit mis-leading to me. I would
prefer to see it labelled 'any' slot activation since any slot that
is modifed can cause an activation (actually a 'match' of the pattern and
not necessarily an activation -- rules are activated). Following along
with Alan's suggestions then instead of
(declare (activate PER-SLOT|PER-TEMPLATE))
I'd prefer to see
(declare (activate ANY-SLOT-IN-TEMPLATE |ANY-SLOT-IN-PATTERN))
or
(declare (activate SLOT-IN-TEMPLATE |SLOT-IN-PATTERN))
or
(declare (activate TEMPLATE-SLOT |PATTERN-SLOT))
or
(declare (activate ANY-SLOT |PATTERN-SLOT))
To me this means that the current default behaviour is to (try to)
match the pattern when any slot in the template is changed. The
other option is to match the pattern when any slot mentioned in
the pattern changes (the so-called single-slot activation).
To go a bit further, I wonder if designating this in the deftemplate or
defclass
is the right palce to do it. If it is in the deftemplate/defclass then to
change
the behaviour of all templates/classes one has to add the declare in all
deftemplates.
Also it then becomes impossible to have different behaviours in different
rules for a given template. Could one consider:
a) a global designation that changes the default behaviour:
(set-default-pattern-activation ANY-SLOT | PATTERN-SLOT)
or more accurately
(set-default-pattern-match-attempt ANY-SLOT-CHANGES |
PATTERN-SLOT-CHANGES)
b) designate any non-default behaviour on a per rule or per-pattern basis.
For a rule use (declare (pattern-activation ANY-SLOT | PATTERN-SLOT))
or (declare (pattern-match-attempt ANY-SLOT-CHANGES |
PATTERN-SLOT-CHANGES))
For a single pattern use
(defrule some-rule
(declare (pattern-activation ANY-SLOT))
(factA (slotA1 45) (slotA2 apples)) ;; matched when any
slot changes
(PATTERN-SLOT-CHANGES
(factB (slotB1 ?x) (slotB3 22)) ;; matched ONLY when
slotB1 or slotB3 change
(factC (slotC5)) ;; matched ONLY when
slotC5 changes
)
=>
...
)
Again the syntax needs a lot of work ... just a thought.
Bob.
Bob Orchard
National Research Council of Canada Conseil national de recherches
Canada
Institute for Information Technology Institut de technologie de
l'information
1200 Montreal Road, Building M-50 M50, 1200 chemin Montrial
Ottawa, ON, Canada K1A 0R6 Ottawa (Ontario) Canada K1A 0R6
(613) 993-8557
(613) 952-0215 Fax / tilicopieur
[EMAIL PROTECTED]
Government of Canada | Gouvernement du Canada
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 28, 2003 7:35 AM
To: [EMAIL PROTECTED]
Subject: Re: JESS: "Single-slot activations"
I think Alan Moore wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> How about:
>
> (declare (activation SLOT|TEMPLATE))
>
> or
>
> (declare (activate PER-SLOT|PER-TEMPLATE))
>
> or something similar.
>
> I suggest that you don't use the boolean form because, in the future, you
> might decide to add another activation strategy:
>
> (declare (activation SLOT|TEMPLATE|KARMA))
good point
>
> Also, how will this work with the automatically generated deftemplates for
> java classes? Can we specify this somehow when using (defclass)?
Don't know what the syntax is yet, but yes.
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
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]
--------------------------------------------------------------------