





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






CS Final Examination Friday Decemb er pm
Directions
The exam is open book any written materials may b e used Answer all questions on the exam pap er itself The total numb er of p oints is You may make additional comments at the b ottoms of pages or at the end if you feel the need to clarify or justify your answers Do not forget to sign the pledge b elow
I acknowledge and accept the honor co de
Print your name here
Problem p oints Here are two conjunctive queries with negation
Q qX nX nY aXY NOT aYX Q qX nX nY aXX NOT aYY
a Is Q Q Verify or give a counterexample
b Is Q Q Verify or give a counterexample
Problem p oints Supp ose we have global concepts
l ik esD W drinker D likes wine variety W f r eq D B drinker D frequents bar B ser v esB W bar B serves wine W
Let there also b e the following view denitions
v DB freqDB v DB likesDW servesBW v BW servesBW likesDW freqDB
a Supp ose we are given the query
Q qDW freqDB servesBW Find all the minimal solutions that can b e built from the three views ab ove and are contained in the query Q
b Show that each of your solutions in a is contained in Q by expanding them and then describing containment mappings You may abbreviate f r eq l ik es and ser v es by f l and s resp ectively
c Are any of your solutions equivalent to Q Justify your answer
Problem p oints Supp ose we have a source s that has information ab out drinkers the bars they frequent and the wines they like This source may b e thought of as structured as an OEM ob ject consisting of a ro ot ob ject some numb er of sub ob jects lab eled dr ink er and for each of the latter ob jects a sub ob ject lab eled name some numb er of sub ob jects lab eled bar whose value is the name of a bar and some numb er of sub ob jects lab eled w ine whose value is the name of a wine You may assume name is a key for drinkers for bars and for wines This structure is suggested b elow
drinker
name bar wine
a We wish to create a mediator m that will exp ort an OEM ob ject lo oking like that of s and pictured ab ove More precisely we wish m to exp ort those parts of the ob ject at s that match the description and picture ab ove since we can never know what other sub ob jects might b e present at s Write an MSL program that denes m
b We wish to create another mediator m that exp orts a representation of the information of s in a dierent form suggested by
bars wines
bar
name drinker
wine
name drinker
That is the ro ot of m has two sub ob jects lab eled bar s and w ines A bar ob ject has a
sub ob ject lab eled name the name of the bar and some numb er of sub ob jects lab eled dr ink er the names of the drinkers who frequent that bar Similarly a w ine ob ject has a sub ob ject lab eled name of the wine and some numb er of sub ob jects lab eled dr ink er the names of the drinkers who like that wine Write an MSL program to dene m
Problem p oints We dened the weakinstance window function as a series of op erations on particular instances of the relations involved i e particular databases However in simple cases we can gure out in advance the result of these op erations Supp ose that the relations are AB and B C For each of the following dep endencies give an expression of relational algebra to compute AC according to the weakinstance denition
a The only dep endency is B A j C
b The only dep endency is B C
Problem p oints Find all the minimal stable mo dels for the following rules
p NOT q q NOT p r p NOT s s p NOT r
Problem p oints For the rules
r pXYZ aXY aYZ r pXYZ pXWY pWYZ
Draw the rulegoal graph if the initial goal no de query is pbf^ f
Problem p oints Apply the simplied magicsets transformation no th supple mentary predicates and no supplementary predicates b efore EDB subgoals to the Datalog program
pXY aXY pXY pXW bWZ pZY
if the query is p A i e pbf^ Note that in this case bf is the only binding pattern for p so the rules do not need to b e split or rectied