Hello , i am trying to use accumulate CE element
My jess version Jess71p2
The example ( accumulate from  pdf   6.15) works nicely  ...
------------------------------------------------------------------------
-----
(deftemplate employee (slot salary) (slot name))
(defrule count-highly-paid-employees2
?c <- (accumulate (bind ?list (new java.util.ArrayList)) ;; initializer
        (?list add ?name) ;; action
         ?list ;; result
        (employee (name ?name) (salary ?s&:(< ?s 100000)))) ;; CE
=>
(printout t (?c toString) crlf)
------------------------------------------------------------------------
----
But trying to adapt to my own  use  case ( with java classes)  , i have
problem 
------------------------------------------------------------------------
----
(import emb.myown.model.*)
(deftemplate TicketQV       (declare (from-class TicketQV)))
;; TicketQV has  domain and duration slots from java code

(defrule Accumulate-tickets
    "XXX"
?infos <-  (accumulate (bind ?list (new java.util.ArrayList)) ;;
initializer
                 (?list add ?domain) ;; action
                  ?list                          ;; result      
                (TicketQV (duration ?s&:(< ?s 3)))) ;; CE
=>
(printout t (?infos toString) " Accumulated  tickets." crlf))

------------------------------------------
test:
     [java] Demo
     [java] Jess reported an error in routine Context.getVariable
     [java]     while executing (call ?list add ?domain)
     [java]     while executing rule LHS (Node2)
     [java]     while executing rule LHS (TEQ)
     [java]     while executing rule LHS (TECT).
     [java]   Message: No such variable domain.
.................................................
..............................................
Any clue ?
Thanks 
Philippe



Reply via email to