Thanks Wolfgang, Your snippet of code showed that the templates where defined, but in the wrong module. a '(set-current-module MAIN)' did the trick.
Thanks again. ________________________________ Van: [email protected] [mailto:[email protected]] Namens Wolfgang Laun Verzonden: dinsdag 30 december 2008 16:02 Aan: [email protected] Onderwerp: Re: JESS: Deftemplate On Mon, Dec 29, 2008 at 5:02 PM, Theunissen, Teun <[email protected]<mailto:[email protected]>> wrote: Dear All, I'm trying to embedd Jess in a Java Gui. Two comments: if I try to run a batch file by the rete engine with the following java statement: m_rete.batch(jessfile); (1) Are there any other method calls to m_rete between the constructor call and this one? assume that jessfile = "./jess/goB.clp" I get the following error message: An error occurred at line: 25 which look like: ( load-facts ./jess/facts_behandeling.clp ) Errormessage: Undefined function Groep This is a familair error message if a deftemplate is not executed before the load-facts command is executed. But in the goB.clp file the deftemplate.clp file is executed before the load-facts command. (batch ./jess/deftemplate.clp) (load-facts ./jess/facts_behandeling.clp) (2) Try the following, to narrow it down: Comment out the (load-facts ...) on goB.clp Insert this after the call m_rete.batch(jessfile); Iterator<?> it = rete.listDeftemplates(); while( it.hasNext() ){ Deftemplate dt = (Deftemplate)it.next(); System.out.println(new PrettyPrinter(dt)); } What do you get on standard output? All of your code - as far as you've posted it - looks good to me. -W
