Title: Rules firing in an endless loop...
Although I only have 5 rules, I get into a strange loop.

Here is the rule that fires continuously:

(defrule ASP1
    (OrmedContext
        (readyToRun TRUE)
        (task "script")
        (OBJECT ?c)
    )
    (CompleterResponseElement
        (ormedContext ?c)
        (key "ASP")
    )
    =>
    (bind ?s (new OrmedScript "ASP"))
    (call ?c setSelectedScript ?s)
    (call ?s addInstruction (new OrmedScriptInstruction "Aspirine Cardio (100mg)" FALSE TRUE TRUE TRUE))
    (call ?s addInstruction (new OrmedScriptInstruction "Aspirine 500mg" FALSE TRUE TRUE TRUE))
    (call ?s addInstruction (new OrmedScriptInstruction "Aspirine 1000mg" FALSE TRUE TRUE TRUE))
)

My understanding is that ?c is the same. It is the way I found to avoid the problem of bean properties which can’t be null.
Here OrmedContext has a completerResponseElement, but it can be null. Therefore, I do things the other way round:
When I set a completerResponseElement to my OrmedContext, I set the ormedContext in CompleterResponseElement and
The latter is definstanced.

My rule means:

When a OrmedContext is readyToRun and task is “script” and has a CompleterResponseElement with key is “ASP”
Then create a new OrmedScript, set it to OrmedContext then add three instructions.

OrmedContext, CompleterResponseElement, OrmedScript are definstanced (in the Java code). Only OrmedContext is dynamic.
When I add the new OrmedScript to OrmedContext I do:

  • undefinstance the previous one if it is not null
  • assign the ormedContext property to it
  • definstance the new selectedScript
  • fire property change for the selectedScript in OrmedContext

I am really puzzled because it seems so simple!

Thanks,

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