Next: Searching (I)
Up: Syntax and Semantics of
Previous: Programs
- We interact with a logic program by making queries
- A query is a conjunction of atoms
(which we want to be prove)
- An answer will consist of bindings for the variables in the
query which make it true w.r.t. the program
- Several (different) answers are possible
- We will mark a query starting with ?-
- Example:
-
- ?- sound(spot, X).
X = bark
-
- ?- sound(A, roar).
A = hobbes
-
- ?- animal(barry).
yes
-
- ?- animal(X).
X = spot ;
X = barry ;
X = hobbes
-
- ?- sound(A, S).
Last modification: Thu Oct 7 12:04:03 MEST 1999 <webmaster@clip.dia.fi.upm.es>