Hello ernest Ok, sorry for the mistake... It works now. Thanks a lot philippe -----Message d'origine----- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Ernest Friedman-Hill Envoyé : samedi 29 novembre 2008 01:29 À : jess-users Objet : Re: JESS: Accumulate CE problem
Note that in the book example, the variable ?name is bound to a slot in the CE, but in your example, you don't do that with your variable ? domain. You can just add it to the pattern: (TicketQV (duration ?s&:(< ?s 3)) (domain ?domain)) On Nov 28, 2008, at 12:10 PM, [EMAIL PROTECTED] wrote: > 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 > > > --------------------------------------------------------- Ernest Friedman-Hill Informatics & Decision Sciences 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] -------------------------------------------------------------------- -------------------------------------------------------------------- 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] --------------------------------------------------------------------
