Docsity

Rule Goal Graphs-Distributed Queries-Assignment, Exercises of Distributed Database Management Systems

Toggle sidebar
bg1
CS345A PROBLEM SET #3
Due in class, Wednesday, April 27, 1994
1) (15 points) Find the modularly strati๎˜‹ed mo del for the following program and EDB:
p(X) :- a(X,Y) & q(X) & not p(Y)
q(X) :- b(X,Y) & not q(Y)
q(X) :- c(X)
with EDB facts
a
(1
๎˜‚
2),
a
(2
๎˜‚
3),
a
(3
๎˜‚
1),
b
(2
๎˜‚
1),
b
(3
๎˜‚
2),
c
(1). Indicate the locally strat-
i๎˜‹ed model for each module.
2) (20 points) Here are some recursive datalog rules.
p(X,Y) :- a(X,Z) & q(Z,Y)
q(X,Y) :- b(X,Z) & p(Z,W) & p(W,Y)
q(X,Y) :- c(X,Y)
Write in pseudo-Pascal and relational algebra a program that performs seminaive
evaluation of these rules.
3) (20 points) For the rules of Problem 2 and the EDB
a
(1
๎˜‚
2),
a
(3
๎˜‚
4),
a
(5
๎˜‚
6),
b
(2
๎˜‚
3),
c
(4
๎˜‚
5), and
c
(6
๎˜‚
7), show what new facts are added to ๎˜’
p
and ๎˜’
q
at each round of
seminaiveevaluation.
4) (15 points) Construct the rule/goal graph for the rules of Problem 2 and the initial
goal
p
bf
.
5) (20 points) Construct the rule/goal graph for the following rules:
p(X,Y) :- q(X,Y)
p(X,Y) :- p(X,Z) & p(Z,W) & p(Y,W)
with the initial goal
p
bf
. In this example, to avoid having to deal with a goal
p
ff
we
must consider the order of subgoals for the second rule. The matter is discussed in
general in Section 12.10, although in this case, common sense tells us the proper order
to use. Note that di๎˜”erent uses of the same rule can expand goals in di๎˜”erent orders.
6) (15 points) Rectify the following rules.
p(X,Y) :- q(X,X,Z,Y) & q(X,Z,W,a)
q(A,B,C,D) :- p(A,B) & p(C,D)
q(A,B,C,D) :- b(A,B,C,D)
1
docsity.com

Partial preview of the text

Download Rule Goal Graphs-Distributed Queries-Assignment and more Exercises Distributed Database Management Systems in PDF only on Docsity!

CSA PROBLEM SET  Due in class Wednesday April  

  p oints Find the mo dularly strati ed mo del for the following program and EDB

pX  aXY  qX  not pY qX  bXY  not qY qX  cX

with EDB facts a   a   a   b   b   c  Indicate the lo cally strat i ed mo del for each mo dule

  p oints Here are some recursive datalog rules

pXY  aXZ  qZY qXY  bXZ  pZW  pWY qXY  cXY

Write in pseudoPascal and relational algebra a program that p erforms seminaive evaluation of these rules   p oints For the rules of Problem  and the EDB a   a   a   b   c   and c   show what new facts are added to p and q at each round of seminaive evaluation

  p oints Construct the rulegoal graph for the rules of Problem  and the initial goal pbf^ 

  p oints Construct the rulegoal graph for the following rules pXY  qXY pXY  pXZ  pZW  pYW with the initial goal pbf^  In this example to avoid having to deal with a goal pf^ f^ we must consider the order of subgoals for the second rule The matter is discussed in general in Section  although in this case common sense tells us the prop er order to use Note that dierent uses of the same rule can expand goals in dierent orders

  p oints Rectify the following rules

pXY  qXXZY  qXZWa qABCD  pAB  pCD qABCD  bABCD

docsity.com