Information Technology Reference
In-Depth Information
indentation was used to show how
deep
you were in the procedure. When one of the
subqueries returns
success
or
failure
, you must be able to decide what to do at one
level higher.
This is illustrated in example 3 with the subquery
sue is a child of george
. This
subquery returned
success
. But the work was not finished, since at a higher level, it
was still necessary to work on the second subquery
george is male
.
In example 4, the first conditional sentence found did not work: the subquery
jane
is male
returned
failure
. But again the work was not finished: the procedure was at
step 3, and it required going to step 4, which required returning to step 2 to look for
another conditional. The second conditional did work, and the entire query returned
success
.
2.4 Variables in queries
In the four examples just considered, the query
Q
only contained constants. The
back-chaining procedure must be generalized so that it also works when
Q
contains
variables. In this case, the interest lies not in whether
Q
is logically entailed, but
for
what values of the variables
the query
Q
is logically entailed. Note the following:
If the query is
sue is a child of gina
, it asks if the sentence is logically entailed
by the KB. It is a yes/no question, and the
success
or
failure
returned by back-
chaining gives the answer.
If the query is
X is a child of gina
, it asks for what value of
X
is the sentence
logically entailed by the KB. It is a
wh
question (who? what? when? where?
why? how?). The expected answer is something like
X=sue
(since the sentence
sue is a child of gina
is entailed).
When a query contains a variable, a unique answer is not necessarily expected. If the
query is
john is a child of Z
, either of the following answers would work:
Z=sue
or
Z=sam
; each corresponding sentence is logically entailed.
2.4.1 One complication: Renaming variables
One complication raised by the issue of variables within queries is the following: what
should be done if a variable in a query has the same name as one in the knowledge
base? How can one keep straight which is which?
The answer is simple: