Title: Re: JESS: Still a problem when trying to match an object in an object... More info
Some more info on my previous question:

The crash happens exactly here:

    defaultOrmedContext = new OrmedContext();
    defaultOrmedContext.setTask("completer");
    rete = ((Application)WOApplication.application()).reteEngine();
    try
      {
      rete.definstance("OrmedContext",defaultOrmedContext,true);
      NSLog.out.appendln("++++ New defaultOrmedContext instance defined: " + this);
      }
    catch(Exception e)
      {
      NSLog.out.appendln("**** ERROR IN DEFINSTANCE: " + e.toString());
      }

And here is the result:

**** ERROR IN DEFINSTANCE: Jess reported an error in routine DefinstanceList.createFact.
  Message: Called method threw an exception.
Async Error: Jess reported an error in routine get
    while executing (get ?r keyCode)
    while executing (eq "ASP" (get ?r keyCode))
    while executing rule LHS (TEQ)
    while executing rule LHS (TEQ)
    while executing rule LHS (TECT).
  Message: No such property: keyCode.

In my code, you can see that the OrmedContext task is "completer" and moreover the readyToRun value is false therefore the rule:

(defrule ASP1
    (OrmedContext
        (readyToRun TRUE)
        (task "script")
        (selectedCompleterResponse ?r & :(eq "ASP" (get ?r keyCode)))
        (OBJECT ?x)
    )
    =>
    (bind ?s (new OrmedScript "Aspirine"))
    (call ?s addInstruction (new OrmedScriptInstruction "Aspirine Cardio (100mg)" TRUE TRUE TRUE))
    (call ?s addInstruction (new OrmedScriptInstruction "Aspirine 500mg" TRUE TRUE TRUE))
    (call ?s addInstruction (new OrmedScriptInstruction "Aspirine 1000mg" TRUE TRUE TRUE))
    (call ?x setCurrentScript ?s)
)

Should not even get to the selectedCompleterResponse (which is null at that point).
I tried to create a selectedCompleterResponse so that the value would never be null, but the get method is never
Called. It is as if the engine “assumed” ?r didn’t have keyCode as an attribute.

Alex
--
Alexander Lamb
Groupe Serveurs Applicatifs
Division d'Informatique Médicale
Hôpitaux Universitaires de Genève
21 rue Micheli-du-Crest
CH-1211 Genève 4 / Switzerland
Tel: +41-22 372.48.46 Fax: +41-22 382.86.80
[EMAIL PROTECTED] / http://www.hcuge.ch

Reply via email to