Here is code to query the user with several questions and put the result into a dict, keyed with a "slot name".
The above collects patient data for an expert system and so a run looks like this:
?-
questions(Dict),prettyprint_dict(Dict).
what is subject name?
|: J.F. Sebastian
what is patient risk? (one of: [high,medium,low]) (default: medium)
|: don't know
Expecting one of: [high,medium,low], but got: don't know
what is patient risk? (one of: [high,medium,low]) (default: medium)
|: LOW
how long have they had the condition for? (one of: [months,weeks,days]) (default: weeks)
|: months
is the trial justifiable? (one of: [yes,no]) (default: yes)
|:
what is their antibody count? (one of: [high,medium,low]) (default: medium)
|: low
how do they live? (one of: [sedentary,active]) (default: sedentary)
|: sedentary
do they have anaemia? (one of: [yes,no]) (default: no)
|:
is their blood pressure raised? (one of: [yes,no]) (default: no)
|:
anaemia_state no
antibody_count low
blood_pressure no
clinical_trial yes
condition_time months
life_style sedentary
name J.F. Sebastian
patient_risk low
Dict = patient{anaemia_state:no,antibody_count:low,blood_pressure:no,
clinical_trial:yes,condition_time:months,
life_style:sedentary,name:"J.F. Sebastian",patient_risk:low}.