|Representing Anthropological Knowledge: Calculating Kinship|
|Michael D. Fischer||
Analyzing and Understanding Cultural Codes
|Trying things out
If you click on the 'Do Query' button on the Prolog interpreter below, the query, parent(X,Y), to the left of this button is evaluated against a prolog database (the lower window). We are adding a new rule that derives parent from child, which is in the top window.
Try changing the query from parent(X,Y) to child(X,Y), press the 'Do Query' button, and verify that the same pairs, in reverse order, are identified. For this particular group of people there are 30 parent relationships, and correspondingly there must be 30 child relationships. There are more children than parents, but we are identifying the relationship child and the relationship parent, not the specific number of parents.
If you scroll through the program in the lower window, you will see the data representing each person, and the three additional rules for child, sibling and spouse. From these we will build a set of rules, like parent, that can describe the usual range of genealogical relationships.
You can get different kinds of information depending on how you enter the query (or goal):
child(mike, george). /is mike the child of
The first query simply evaluates to true, because this is an instance previously supplied to Prolog. The second query evaluates to false. There is no instance which matches 'child(mike,mary)'.
The terms F, K, V and L in the latter three examples are
variables. Any term which begins with an uppercase letter (A-Z) is treated
as a variable by Prolog. When variables are present, information from each
matching instance of the predicate is assigned to the variable from the
corresponding position. The latter three will evaluate to true, but the presence
of variables in the query will give more information. The third query supplies
the additional information that the value of the variable F is 'mike'. The fourth
that K is 'george'. The fifth evaluates to true 30 times with the present data,
the first time with 'V=george' and 'L=earl', and the second time to 'V=mike' and
'L=george', and so on.
Next section: Basic kin types