Hello
I'm a newcomer to this list and Jess so I apologize in advance if this
question is too much of a newbie. If there's a better forum for this kind
of question, please let me know. I have gone through the doc but couldn't
find the answer.
I am building a system where I don't know in advance which facts are known.
So I have to query the user for these facts that are unknown and only these
facts. I have a solution but it is fragile and basically don't like it very
much. I'm hoping somebody can help me improve. I am currently running under
Jess 4.3.
Currently, I assert a fact with a list of all possible questions. I have a
number of rules that "cancel" some of these questions based on the known
facts and, finally, I have rules that query the user for those questions
that have not been cancelled. See the code below.
The main problem with this approach is that I have to assert one fact with
the list of all possible questions, it's manageable as long as that list is
small but it's unmanageable (I think) if the list grow.
I would appreciate any help on how to improve this solution.
Here's my code, for simplicity, I have included the rules that relates to
the country:
(defrule ask-user-country
(ask $head country $?tail)
=>
(printout t "Enter country: ")
(assert (country (read t))))
(defrule build-ask-country
?old-list <- (ask $?head country $?tail)
(country ?x)
=>
(retract ?old-list)
(assert (ask ?head ?tail)))
; here is the very weak point IMHO:
; this fact must countain all the possible questions
(assert (ask country nationality salary preferences))
Depending on whether or not I have asserted (country country-name), it will
prompt the user.
Thanks for any help
--ben
Beno�t Marchal
Need a reliable web host? Need great tech support?
Want answers to your questions in minutes?
Check out Virtualis Systems for this and more!
http://www.virtualisys.com/vr/bmarchal
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------