This preview shows pages 1–8. 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 CQ’s ◆ Theorem: P 1 ∪ … ∪ P k ⊆ Q 1 ∪ … ∪ Q n if and only if for each P i there is some Q j such that P i ⊆ Q j . ◆ Proof (if): Obvious. 3 Proof of “OnlyIf” ◆ Assume P 1 ∪ … ∪ P k ⊆ Q 1 ∪ … ∪ Q n . ◆ Let D be the canonical (frozen) DB for P i . ◆ Since the containment holds, and P i ( D ) includes the frozen head of P i , there must be some Q j such that Q j ( D ) also includes the frozen head of P i . ◆ Thus, P i ⊆ Q j . 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)....
View
Full
Document
This document was uploaded on 01/06/2012.
 Spring '09

Click to edit the document details