The error you're seeing doesn't happen when the rule is fired, but
rather while it's being compiled. There is no need to "valorize"
anything -- the variable "?pars" can simply be used directly on the
right hand side of the rule. Your "bind" calls -- indeed, all
function calls -- are illegal on the left hand side of a rule.
On Jun 14, 2007, at 8:25 AM, Francesco Lelli wrote:
Hi all,
Inside jess working memory I place a shadow fact based on a
bean (called IMInformation) that contains a vector of different
beans (called InstrumentManagerParameter). If few words I would
like to access to a filed contained into an entry of the vector of
beans.
The java object is the following:
UML: http://gladgw.lnl.infn.it:2002/ProblemSolver/doc/UML/PSEngine/
IMInformation.png
JAVADOC: http://gladgw.lnl.infn.it:2002/ProblemSolver/doc/org/
gridcc/ie/impl/listener/IMInformation.html
SRC:
http://ulisse.elettra.trieste.it/cgi-bin/viewcvs.cgi/gridcc/wp3/
ProblemSolver/ProblemSolver/src/org/gridcc/ie/impl/listener/
IMInformation.java?rev=1.1&content-type=text/vnd.viewcvs-markup
in order to present the object format to JESS I used the following
defclasses:
(defclass event org.gridcc.ie.impl.listener.IMInformation)
(defclass imParameter org.gridcc.ie.im.InstrumentManagerParameter)
I also define the following rule:
(defrule receivedEvent
(event (timestamp ?r&:(> ?r 1)) (imPar ?pars )
(instrumentManagerID ?id))
(bind ?p0 ?pars)
;; (bind ?v0 (call ?pars getValue ))
;;(bind ?p1 (nth$ 2 $?pars))
;;(bind ?v1 (call ?p1 getValue ))
=>
(printout t "NEW EVENT received at time " ?r " from " ?id " p0 " ?
v0 crlf)
Unfortunately once triggered I obtain the following bad slot value:
Message: Bad slot value . Program text: ( defrule receivedEvent
( event ( timestamp ?r & : ( > ?r 1 ) ) ( imPar ?pars )
( instrumentManagerID ?id ) ) ( bind ?v0 ( at line 10.
at jess.Jesp.parseError(Jesp.java:162
at jess.Jesp.parsePattern(Jesp.java:1363)
at jess.Jesp.parseLHS(Jesp.java:1111)
at jess.Jesp.doParseDefrule(Jesp.java:933)
at jess.Jesp.parseDefrule(Jesp.java:893)
at jess.Jesp.parseSexp(Jesp.java:149)
at jess.Jesp.parse(Jesp.java:69)
at jess.Jesp.parse(Jesp.java:54)
at jess.Batch.batch(Batch.java:43)
at jess.Batch.call(Batch.java:57)
at jess.FunctionHolder.call(FunctionHolder.java:30)
at jess.Funcall.execute(Funcall.java:266)
at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1596)
at jess.Jesp.parseSexp(Jesp.java:173)
at jess.Jesp.parse(Jesp.java:69)
at jess.Rete.executeCommand(Rete.java:145
at jess.Rete.executeCommand(Rete.java:1441)
I’m sure that the fields of the java object are valorized and not
null. I didn’t find the way to valorize p0 into the jess engine.
Thx in advance for the helping
Francesco
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://www.jessrules.com
--------------------------------------------------------------------
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]
--------------------------------------------------------------------