{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs345-4

cs345-4 - 1 Extended Conjunctive Queries Unions Arithmetic...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Extended Conjunctive Queries Unions Arithmetic Negation 2 Containment of Unions of CQ’s ¡ Theorem: P 1 ∪ … ∪ P k ⊆ Q 1 ∪ … ∪ n if and only if for each P i there is some j such that P ⊆ . ¡ Proof (if): Obvious. 3 Proof of “Only-If” ¡ Assume P 1 ∪ … ∪ P k ⊆ Q 1 ∪ … ∪ n . ¡ Let D be the canonical (frozen) DB for i . ¡ Since the containment holds, and P (D) includes the frozen head of P , there must be some Q j such that Q (D) also includes the frozen head of P . ¡ Thus, P ⊆ . 4 CQ Contained in Datalog Program ¡ Let Q be a CQ and P a Datalog program. ¡ Each returns a relation for each EDB database D, so it makes sense to ask if Q ⊆ P. ¢ That is, Q(D) ⊆ P(D) for all D. 5 The Containment Test ¡ Let D be the canonical DB for Q. ¡ Compute P(D), and test if it contains the frozen head of Q. ¡ If so, Q ⊆ P ; if not, D is a counterexample. 6 Example Q : p(X,Y) :- a(X,Z) & a(Z,W) & a(W,Y) P : p(X,Y) :- a(X,Y) p(X,Y) :- p(X,Z) & p(Z,Y) ¡ Intuitively: Q = paths of length 3; P = all paths. ¡ Frozen Q : D = {a(x,z), a(z,w), a(w,y)}. 7 Example --- Continued D = {a(x,z), a(z,w), a(w,y)} P : p(X,Y) :- a(X,Y) p(X,Y) :- p(X,Z) & p(Z,Y) ¡ Infer by first rule: p(x,z), p(z,w), p(w,y). ¡ Infer by second rule: p(x,w), p(z,y), p(x,y). Frozen head of Q, so Q ⊆ P. 8 Other Containments ¡ It is doubly exponential to tell if a Datalog program is contained in a CQ....
View Full Document

{[ snackBarMessage ]}

Page1 / 31

cs345-4 - 1 Extended Conjunctive Queries Unions Arithmetic...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online