Hello again!

In order to avoid having more than one rule for a given question that fires,
my idea is to add to the LHS something like:

(defrule test
    (MyObject
        (needsXYZ TRUE)
        ...
    )
    =>
    (call ... The answer to XYZ is...)
)

Well, this works fine (e.g. Using salience correctly, even if more than one
rule might have given an answer for some question, I can stop it once the
first one is found).
However, I will now start using this to handle the choice of widgets (UI
elements) used in the application (indeed, you can't have more than one
possible UI element for a given property for example).
Since the number of questions (lets call them "keys") is rather high, I
would like to avoid implementing one get function for each possible key and
instead implement a function like:

Public boolean needsKey(String key)

And on the LHS something like:

(defrule test
    (MyObject
        (needsKey("XYZ") TRUE)
        ...
    )
    =>
    (call ... The answer to XYZ is...)
    (call ... SetNeedsKey "XYZ" false)
)

Obviously, this won't work.

What is the recommended way to handled this? It is a little bit like the
"cut" operator: once you find the first answer to a given question, stop
looking.

Thanks,

Alex

-- 
Alexander Lamb 
Groupe Serveurs Applicatifs
Division d'Informatique Midicale
Htpitaux Universitaires de Genhve
21 rue Micheli-du-Crest
CH-1211 Genhve 4 / Switzerland
Tel: +41-22 372.48.46 Fax: +41-22 382.86.80
[EMAIL PROTECTED] / http://www.hcuge.ch

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to