Title: Re: JESS: Still a problem when trying to match an object in an object... More info

Is the rule defined in the engine BEFORE the defclass?

 

 

Richard Long         "Imagination is more important than knowledge."

Senior Developer

Gestalt LLC

12605 Challenger, Suite 160, Orlando, FL 32826

321.235.8254 - Office

407.491.8628 - Cell
407.380.2456 - Fax

 

http://www.gestalt-llc.com

Value beyond the sum of the parts!

-----Original Message-----
From: Alexander Lamb [mailto:[EMAIL PROTECTED]]
Sent
: Thursday, October 03, 2002 11:30 AM
To: [EMAIL PROTECTED]
Subject: Re: JESS: Still a problem when trying to match an object in anobject... 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