Deductive Databases

Exercise - Kinship

Write rules defining the grandparent relation, the ancestor relation, and the sibling relation in terms of the parent relation. (Hint: you will also need the built-in relation distinct to get the definition of sibling correct.) Sample parent data is given in the top box below. Enter your rules in the middle box, then click outside the box. Whenever you click outside the data box or rule box, the editors at the bottom of the page are updated to reflect the values for the three defined relations in accordance with your rules. Once your rules are working correctly, try changing the parent data. For example, give daniel some children or remove some parent facts. Check that the grandparent, ancestor, and sibling data are still correct.