CS345 PROBLEM SET #5
Due in class, Wednesday, November 18, 1996.
3 Questions, 100 pts.

Problem 1 (40 pts.)

Consider the global predicates in an integrated information system about the Stanford students.
student(S)
S is a student at Stanford.
office(S,O)
O is the office of S.
phone(S,P)
P is the phone of S.
major(S,M)
S is majoring in M.
advisor(S,A)
A is the advisor of S.
machine(S,M)
M is the machine of S.
group(S,G)
G is the group of S.
Suppose there are five source, each providing one view:
phone-dir(S,O,P) :- student(S) & office(S,O) & phone(S,P)

su-info(S,A,M) :- student(S) & advisor(S,A) & major(S,M)

acad-info(S,M,G) :- student(S) & major(S,M) & group(S,G)

cs-info(S,O,M) :- student(S) & major(S,cs) & office(S,O) & machine(S,M)

db-info(S,A,M,P) :- student(S) & major(S,cs) & group(S,db) & advisor(S,A) & machine(S,M) & phone(S,P).

Note that cd and db are constants.
a)
Express each of the following queries in terms of the global predicates.
b)
Find all minimal solutions (in terms of the available views) to each of the queries from a).

Problem 2 (30 pts.)

For this problem, suppose that the views from Problem 1 have the following binding patterns:
phone-dir(S,O,P) - fff.
su-info(S,A,M) - bff.
acad-info(S,M,G) - bbf.
cs-info(S,O,M) - ffb or fbf.
db-info(S,A,M,P) - bfbf or bffb.
Find all minimal solutions (in terms of the adorned views) to each of the following queries:

Problem 3 (30 pts.)

Consider the following conjunctive queries:
Q1:
p(X) :- arc(X,Y) & arc(Y,Z) & arc(Z,X)
Q2:
p(X) :- arc(X,W) & arc(Y,W) & arc(W,Z) & arc(Z,Y) & arc(Z,X)
Q3:
p(X) :- arc(X,X1) & arc(X1,X2) & arc(X2,X3) & arc(X3,X4) & arc(X4,X5) & arc(X5,X)
Q4:
p(X) :- arc(X,Y) & arc(Y,X) & arc(X,Z).
a)
Minimize each query.
b)
Minimize their union.