I have an application using Jade and Jess together to monitor data from hardware. The data is encapsulated in a class Data which has the correct form to allow me to create use dynamic with definstance...
jess.defclass("dataobject", "org.jlab.coda.agents.ontologies.subscriber.Data", null);

then later...

jess.definstance("dataobject", data, true, jess.getGlobalContext());

... everything behaves as expected and after running for a while (facts) produces a list of facts of the form...

f-7 (MAIN::dataobject (_0 "current_units") (_1 "DC3") (_2 "mV") (_3 "java.lang.String") (class <External-Address:java.lang.Class>) (device "DC3") (driverClass "java.lang.String") (name "current_units") (value "mV") (valueClass "java.lang.String") (OBJECT <External-Address:org.jlab.coda.agents.ontologies.subscriber.Data>))

... the problem begins if I try to apply a rule to the dataobjects.

Jess> (defrule test (dataobject $?data)=>(printout t "Jess triggered " $?data crlf))
Jess reported an error in routine Jesp.parseDefrule.
Message: Expected '=>' .
Program text: ( defrule test ( dataobject $?data ) at line 20.
at jess.Jesp.parseError(Jesp.java:1583)
at jess.Jesp.doParseDefrule(Jesp.java:907)
at jess.Jesp.parseDefrule(Jesp.java:859)
at jess.Jesp.parseSexp(Jesp.java:153)
at jess.Jesp.parse(Jesp.java:61)
at org.jlab.coda.agents.behaviours.BasicJess$1.run(BasicJess.java:254)

... this appears to be due to the fact that the rule is being applied to dataobject since the following, slightly modified rule is parsed correctly but (of course) is useless since there are no facts with the root dataobj.

Jess> (defrule test (dataobj $?data)=>(printout t "Jess triggered " $?data crlf))
TRUE

...this is all with Jess6.0 and jdk1.3.1

Any ideas anyone?
Graham
-------------------------------------------------------------------------------
Beware of Geeks bearing GIFS. http://www.jlab.org/coda Jefferson lab DAQ group

Reply via email to