Hi,

I am trying to implement a Event-Condition-Action Agent using
Jess. Basically, events are mapped into facts that are inserted into a
Jess engine. Several Jess rules correlate the events received and as a
consequence generate another higher level event. This event is
communicated to the Java program embedding the RETE engine through a
UserFunction, namely notifyEvent.

I have managed to get callbacks from Jess, but the problem is that it does
not return me the values of the Jess variables I pass as arguments. For
example, given the following rule in Jess:

(defrule play-classical-music "Rule determining when user wants to listen 
classical music"
   (presence-event (personID ?userID))
   (not (presence-event (personID ~?userID)))
   =>
   (notifyEvent (play-music-event (user ?userID) (type-music
"classical")))
   (printout t "play-music event asserted" crlf))

The Java code receiving the function call is:

public Value call(ValueVector vv, Context context) throws JessException {
            // We are expecting parameters on the following form 
            // (event-name (attribute-name attribute-value)+)
            // Print out the contents of the event generated
            System.out.println("AGGREGATION EVENT RECEIVED: " +
vv.get(0));
            System.out.println("CONTENTS: "+ vv.toString());
} 


The results printed out are:

AGGREGATION EVENT RECEIVED: notifyEvent
CONTENTS: (notifyEvent (play-music-event (user ?userID) (type-music 
"classical")))

How can I make to receive the value of the variable '?userID' ?

My apologies if the question is too basic. I have been searching in the
mailing list and I haven't managed to find a similar problem.

Regards,

-----
Diego Lopez de Ipina
http://www-lce.eng.cam.ac.uk/~dl231



---------------------------------------------------------------------
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