I am building a Java GUI on top of a Jess application.
Because I am new in this I started using the eval function of the rete object 
to communicate with Jess.

I use Jesswin as a backup to test the jess code.
Now I have a problem with a rule, this rule modifies a multivalue slot with 
string values.
This rule functions fine in Jesswin but gives an error when run from Java.

Look at the multivalue slot 'DifferentiaalDiagnostiek', after the rule has 
fired, it should have the values:
"Rheuma" "Brucellosis", when run from Jesswin this is the case, when run from 
Java it gives the error 'fact not in working memory'. The slot value has 
changed but without the string quotes.

What does the errormessage mean: 'Fact object not in working memory'?
Because it is in working memory!

Why doesn't it work in Java with the Jess eval function?

How can I put string values in a multivalue slot in a java application?

PS. I need to put the names of illnesses in strings because they can exist of 
multiple words.



The Error :

(defrule modfact ?f <- (Ziekte ( Naam ?t&:( eq ?t "ZiekteA" ) ))
=>
(modify ?f (Ernst nil) (Behandeling nil) (Ziekteverwekker nil) 
(DifferentiaalDiagnostiek (create$ "Rheuma" "Brucellosis" )) ))

(run 1)(undefrule modfact)

An error occurred at line: 1
which look like: ( run 1 )

Errormessage: Fact object not in working memory (MAIN::Ziekte (Naam "ZiekteA") 
(Ernst nil) (Behandeling nil) (Ziekteverwekker nil) (DifferentiaalDiagnostiek 
Rheuma Brucellosis) (EndemischContinent ) (EndemischRegio ) (EndemischLand ) 
(EndemischProvincie ) (EndemischDistrict ) (EndemischPlaats ))

Errorcode: 1


The code :

try{
  Value v = m_rete.eval(jesscmd1);
  v = m_rete.eval(jesscmd2);
} catch (JessException je)
{System.out.println("An error occurred at line: " + je.getLineNumber());
System.out.println("which look like: " + je.getProgramText());
System.out.println("Errormessage: " + je.getMessage());
System.out.println("Errorcode: " + je.getErrorCode());}



Kind regards,

Teun Theunissen

Reply via email to