Information Technology Reference
In-Depth Information
Figure 2.4.
A trace of a complex query
Establish the query george is a grandfather of john .
1.
Look for george is a grandfather of john in the KB.
Nothing found.
2.
Look for If . . . then george is a grandfather of john in the KB.
Found: If X is a father of Y and Y is a parent of Z then X is a grandfather of Z.
This matches for X=george and Z=john .
3.
Work on the two if-parts of the matching conditional:
Establish the query george is a father of Y .
See the detailed trace in figure 2.3.
Return success for george is a father of Y with Y=sue .
Establish the query sue is a parent of john .
1.
Look for sue is a parent of john in the KB.
Nothing found.
2.
Look for If . . . then sue is a parent of john in the KB.
Found: If X is a child of Y then Y is a parent of X.
This matches for Y=sue and X=john .
3.
Work on the single if-part of the matching conditional:
Establish the query john is a child of sue .
1.
Look for john is a child of sue in the KB.
Found.
Return success for john is a child of sue .
Since this one part was successful, return success for the query
sue is a parent of john .
Since both parts were successful, return success for the top-level query
george is a grandfather of john .
So for the second subquery in figure 2.4, Y is a parent of john , the Y already has a
value, sue . That is why the second subquery to establish is sue is a parent of john , with
no variables remaining. The rest of the trace is similar to previous ones.
This was a complex enough query that it is worth reviewing the thinking that went
into it in a less formal way:
For George to be a grandfather of John, George needs to be a father of somebody
who is a parent of John.
 
Search WWH ::




Custom Search