If answer
is a deftemplate with slots ident
and text
, the following snippet looks like the construction of a fact:
(answer(ident headers.get(i)(text patientData.get(j).get(i))
- A bare fact does not represent a Jess command that can be executed via
Rete.executeCommand
.
- You shouldn't use the deprecated method
executeCommand
; use eval
.
- Your parentheses aren't balanced properly, 6 opening parentheses against 4 closing ones.
- Assuming that headers is a
List<String>
in your Java application, you cannot simply throw a Java method call at Jess, which doesn't understand Java syntax in the first place and (presumably) doesn't know about the pojo header
at all.
- The same is true for the pojo
patientData
.
- While you might pass objects from your Java program to the Jess engine, this is absolutely impossible for simple variables like
i
and j
.
Considering all of this (most of which is easy to learn from the excellent Jess manual), using
r.eval( "(assert (answer (ident \"" +
headers.get(i) +
"\")(text \"" +
patientData.get(j).get(i) +
"\")))" );
might have a chance of succeeding and indeed insert a new fact into working memory.