Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Exercise 4 (Datalog, 2 pts) Consider the following relations: Parent(X,Y): X is

ID: 3721258 • Letter: E

Question

Exercise 4 (Datalog, 2 pts) Consider the following relations: Parent(X,Y): X is a parent of Y; Male(X): X is a male Here is a Datalog query that uses these relations: X) and Parent(z,Y); R1(X,Y) ? Parent(Z R2(X,Y) ? R1(Y,Z) and Parent(ZX) and Male(X); ?- R2 For each of the following statements indicate whether it is true or false (1 pt for each correct answer). 1. The intermediate relation R10X,Y) includes all pairs (X,Y) such that X is a grandparent of Y. 2. The intermediate relation R1(X,Y) includes all pairs (X,Y) such that X and Y are siblings. 3. The output relation R2(X,Y) includes all pairs (X,Y) such that X is a nephew of Y 4. The output relation R2(X,Y) includes all pairs (X,Y) such that X is an uncle of Y

Explanation / Answer

From the given data, R1(X,Y) indicates that X and Y are siblings because they have the common parent Z.

And R2(X,Y) indicates that Y and Z are siblings and Z is parent of X. Therefore X is a nephew of Y.

From the above data, below are the results of the statements

1 is False

2 is True

3. is True

4 is False