This preview shows pages 1–9. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 1 Extended Conjunctive Queries Unions Arithmetic Negation 2 Containment of Unions of CQs 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 OnlyIf 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
This document was uploaded on 01/06/2012.
 Spring '09

Click to edit the document details