UMBC              Fall 2005
CMSC661        Principles of Database Systems
 

Homework3 -- Due November 28th  beginning of class. No late homework accepted.

Datalog
Note: least fixed point is also called the perfect fixed point.

1. Consider the rules: (15 points)
        p(X,Y) <- q(X,Y) & Not r(X).
        r(X) <- s(X,Y) & Not t(Y).
        r(X) <- s(X,Y) & r(Y).
a) Determine the stratum of each prediacte. Is the program stratified?
b) Suppose the relations for the EDB predicates s, t,  and q are, respectively, S ={ab, bc, ca}, T = {a, b, c} and Q = {ab, bc, cd, de}. Find the least
fixed point for the IDB predicates p and r, give this EDB.

2. Consider the rules:  (15 points)
    p(X) <- q(X) & Not r(X).
    s(X) <- q(X) & Not p(X).
    t(X) <- q(X) & Not s(X).

Assume q and r are EDB predicates with unary relations {1, 2, 3} and {1}, respectively; other predicates are IDB.
a) Draw the stratum graph and indicate the stratum of each predicate.
b) Find the least fixed point for these rules and the given EDB relations.

3. Consider the rules: (15 points)
    p(X) <- r(X) & Not s(X).
    p(X) <- t(X,Y) & p(Y).
    q(X) <- r(X) & Not p(X).
    q(X) <- t(X,Y) & q(Y).

Suppose the EDB predicates r, s, and t have, respectively, the relations
    R = {2,3},
    S = {2},
    T ={(1,1), (2,2), (3,3), (4,4), (2,1), (3,2), (4,3)}
a) Find the stratum of each predicate.
b) Find the least fixed point for the IDB predicates p and q.

4. Any two from Exercise 10.2.1 (H. G-M) (10 points)

5. Any two from Exercise 10.2.2 (H. G-M) (10 points)

6. Redo Exercise 13.1.4 with the following modifications: (10 points)
    1/2 of all search keys appear in exactly 2 records,
    1/4 appear in exactly 3 records,
    1/4 appear in exactly 4 records.

7. Exercise 13.3.1 d. (10 points)  (not 13.3.8 d as indicated before)

8. Exercise 13.4.4 (b and c) (15 points)