Node:Query Handling Predicates, Previous:Query Processing, Up:Messages and Queries



Query Handling Predicates

ask_query(+QueryClass, +Query, +Help, -Answer) [Hookable]

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.

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:


query_hook(+QueryClass, +Query, +QueryLines, +Help, +HelpLines, -Answer) [Hook]
user:query_hook(+QueryClass, +Query, +QueryLines, +Help, +HelpLines, -Answer)

Called by ask_query/4 before processing the query. If this predicate succeeds, it is assumed that the query has been processed and nothing further is done.

query_class_hook(+QueryClass, -Prompt, -InputMethod, -MapMethod, -FailureMode) [Hook]
user:query_class_hook(+QueryClass, -Prompt, -InputMethod, -MapMethod, -FailureMode)

Provides the user with a method of overriding the call to 'SU_messages':query_class/5 in the preparation phase of query processing. This way the default query class characteristics can be changed.

'SU_messages':query_class(+QueryClass, -Prompt, -InputMethod, -MapMethod, -FailureMode) [multifile,extendible]

Returns the parameters of the given QueryClass:

For the list of default input- and map methods, see the "Default Input Methods" and "Default Map Methods" subsections in Query Processing.

'SU_messages':query_abbreviation(+QueryClass, -Prompt, -Pairs) [multifile,extendible]

This extendible predicate provides a shortcut for defining query classes with some fixed characteristics, where

This defines a query class with the given prompt, the line input method, the char(Pairs) map method and help_query failure mode. The predicate is actually implemented by the first clause of 'SU_messages':query_class/5:

query_class(QueryClass, Prompt, line,
            char(Pairs), help_query) :-
        query_abbreviation(QueryClass, Prompt, Pairs), !.

query_input_hook(+InputMethod, +Prompt, -RawInput) [Hook]
user:query_input_hook(+InputMethod, +Prompt, -RawInput)

Provides the user with a method of overriding the call to 'SU_messages':query_input/3 in the input phase of query processing. This way the implementation of the default input methods can be changed.

'SU_messages':query_input(+InputMethod, +Prompt, -RawInput) [multifile,extendible]

Implements the input phase of query processing. The user is prompted with Prompt, input is read according to InputMethod, and the result is returned in RawInput.

See Query Processing, for details.

query_map_hook(+MapMethod, +RawInput, -Result, -Answer) [Hook]
user:query_map_hook(+MapMethod, +RawInput, -Result, -Answer)

Provides the user with a method of overriding the call to 'SU_messages':query_map/4 in the mapping phase of query processing. This way the implementation of the default map methods can be changed.

'SU_messages':query_map(+MapMethod, +RawInput, -Result, -Answer) [multifile,extendible]

Implements the mapping phase of query processing. The RawInput, received from query_input/3, is mapped to the abstract answer term Answer. The mapping is defined by the MapMethod parameter, and one of the terms success, failure and failure(Warning), describing the result of the conversion is returned in Result.

See Query Processing, for details.