Next: mpg-ref-assert, Previous: mpg-ref-arg, Up: mpg-bpr [Contents][Index]
ask_query/4
hookableask_query(+QueryClass, +Query, +Help, -Answer)
Prints the question Query, then reads and processes user input according to QueryClass, and returns the result of the processing, the abstract answer term Answer. The Help message may be printed in case of invalid input.
term, must be nonvar
Determines the allowed values for the atom Answer.
term
A message term.
term
A message term.
term
See QueryClass
All queries made by the system are handled by calling this predicate.
First ask_query/4
calls query_hook/6
with the same
arguments plus the Query and Help arguments
converted to format-command lines. If this call succeeds, then it
overrides all further processing done by ask_query/4
. Otherwise,
the query is processed in the following way:
user:query_class_hook/5
;
'SU_messages':query_class/5
;
query_class/5
.
The four step procedure is used for performing this phase, the predicates tried are the following:
user:query_input_hook/3
;
'SU_messages':query_input/3
;
query_input/3
.
success
—the mapping was successful, Answer is valid;
failure
—the mapping was unsuccessful, the query has to be
repeated;
failure(Warning)
—same as failure
, but first
the given warning message has to be printed.
The four step procedure is used for performing this phase, the predicates tried are the following:
user:query_map_hook/4
;
'SU_messages':query_map/4
;
query_map/4
.
If the mapping phase succeeds, then ask_query/4
returns with the
Answer delivered by this phase.
print_message/2
.
FailureMode specifies whether to print the help message and
whether to re-print the query text. Subsequently, the input and mapping
phases are called again, and this is repeated until the mapping is
successful.
instantiation_error
QueryClass, Query, or Help uninstantiated.
type_error
QueryClass not an atom.
domain_error
QueryClass not a valid query class.