11.3.165 query_abbreviation/3 [extendible]


:- 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.



The query class being defined.


The prompt to be used, typically indicating appropriate abbreviations.

list of pair

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


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,0'Y], no-"nN"]) :- !.

a French translator might decide that the letters `O' and `o' are reasonable abreviations for `oui' (yes), and therefore write

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

See Also

Query Processing.

Send feedback on this subject.