Starting from:

$35

Homework 2 - Family Tree queries using Prolog

CSCI630 – Homework 2 Prolog-P Author: Archit SaƟsh Joshi (aj6082@rit.edu) Queries and outputs – 1. Who are Elizabeth's grandchildren?  Query: setof(X, grandchildOf(X, elizabeth), Grandchildren). Output: Grandchildren = [beatrice,eugenie,harry,james,louise,peter,william,zara] 2. Who are Diana's brothers-in-law? Query: setof(X, brotherInLawOf(X, diana), BrotherInLaw). Output: BrotherInLaw = [andrew,edward] 3. Who are Zara's cousins?  Query: setof(X, firstCousinOf(X, zara), CousinsOf). Output: CousinsOf = [beatrice,eugenie,harry,james,louise,william] 4. Who are Eugenie's ancestors?  Query: setof(X, ancestorOf(X, eugenie), Ancestors). Output: Ancestors = [andrew,elizabeth,george,mum,philip,sarah]