Next: , Previous: , Up: mpg-bpr   [Contents][Index]


11.3.174 query_abbreviation/3   hook

Synopsis

:- multifile 'SU_messages':query_abbreviation/3.

'SU_messages':query_abbreviation(+QueryClass, -Prompt, -Pairs)

A way to specify one letter abbreviations for responses to queries from the Prolog System.

Arguments

QueryClass

atom

The query class being defined.

Prompt

atom

The prompt to be used, typically indicating appropriate abbreviations.

Pairs

list of pair

A list of word-abbreviation pairs, defining the characters accepted and the corresponding abstract answers.

Description

This predicate 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), !.

Prolog only asks for keyboard input in a few different ways. These are enumerated in the clauses for 'SU_messages':query_abbreviation/3. These clauses specify valid abbreviations for a given key word. For example,

query_abbreviation(yes_or_no, ' (y or n) ', [yes-[-1,0'y], no-"n"]) :- !.

a French translator might decide that the letters ‘O’ and ‘o’ are reasonable abbreviations for ‘oui’ (yes), and therefore write

query_abbreviation(yes_or_no, ' (y or n) ', [yes-[-1,0'o,0'O], no-"n"]) :- !.

Exceptions

ask_query/4 checks the output arguments.

See Also

Query Processing.


Send feedback on this subject.