The "head" of a pattern can't be a variable, but presumably since you
know ?x has a slot currentTaskName and a method setLeftComponentName
you know the name of its defclass ("Session"?) and can use that
instead. If you've got multiple similar defclasses, you can make them
extend a common base (i.e., use that third parameter to defclass) and
use that base name instead of ?x.Anyway, every definstance fact has a slot OBJECT which holds the object represented by the fact; so (Session (OBJECT ?x)) means "the Session fact representing the object ?x" -- which is all I think you're trying to achieve here, right? I think Alexander Lamb wrote: [Charset iso-8859-1 unsupported, filtering to ASCII...] > Hello, > > Here is a rule (which obviously does not work) which represents the general > idea of what I am trying to do: > > (defrule component1Rule > (userSession ?x) > (?x (currentTaskName "COMPLETER")) > => > (call ?x setLeftComponentName "CompleterComponent") > ) > > (defrule component2Rule > (userSession ?x) > (?x (currentTaskName "SCRIPT")) > => > (call ?x setLeftComponentName "TasksComponent") > ) > > Here userSession is an instance (definstance) of a Session class which is > dynamic (e.g. Modifying currentTaskName is notified). > > Since I am running an application server, a single Rete engine is shared by > many users (one user = one userSession). > > The rule is "match a userSession whose currentTaskName = "COMPLETER" and if > found, call this userSession to set an attribute to a given value (here > leftComponentName). > > Not quite sure how to achieve this? Didn't find anything in the > documentation and in the pumps example (which is the closest) there is a > match on (OBJECT ?x) but it is a match on an attribute of the object and not > the object itself which is stored in the ?x. > --------------------------------------------------------- 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] --------------------------------------------------------------------
