next up previous index
Next: Syntax errors Up: Interaction with the Previous: Entering Programs from

Querying Programs

Once a set of clauses has been compiled into the database,   it may be queried in the usual Prolog manner.   If there are no uninstantiated variables in the query, the system replies 'yes' or 'no' and prompts for another query, for example:

[eclipse 1]: father(jacob, joseph).
yes.
[eclipse 2]:
If there are uninstantiated variables in the query, the system will attempt to find an instantiation of them which will satisfy the query, and if successful it will display one such instantiation.   It will then wait for a further instruction: either a <CR> (``newline'' or ``return'') or a semi-colon ' ;'. A return will end the query successfully. A semi-colon will initiate backtracking   in an attempt to find another solution to the query. Note that it is not necessary to type a new line after the semicolon --- one keystroke is enough. When the top level loop can detect that there are no further solutions, it does not wait for the semicolon or newline, but it displays directly the next prompt. For example in a query on a family database:
[eclipse 2]: father(X, Y).
X = abraham
Y = isaac   More? (;)   (';' typed)

X = isaac
Y = jacob

yes.
[eclipse 3]:

Queries may be extended over more than one line. When this is done the prompt changes to a tabulation character, ie. the input is indented to indicate that the query is not yet completed. The fullstop marks the end of the input.



next up previous index
Next: Syntax errors Up: Interaction with the Previous: Entering Programs from



Micha Meier
Mon Mar 4 12:11:45 MET 1996