Conjunctive Queries Complexity & Decomposition Techniques

Conjunctive Queries Complexity & Decomposition Techniques

Conjunctive Queries Complexity & Decomposition Techniques G. Gottlob Technical University of Vienna, Austria This talk reports about joint work with I. Adler, M. Grohe, N. Leone and F. Scarcello For papers and further material see: http://ulisse.deis.unical.it/~frank/Hypertrees/ Three Problems: CSP: Constraint satisfaction problem BCQ: Boolean conjunctive query evaluation HOM: The homomorphism problem Important problems in different areas. All these problems are hypergraph based. But actually: CSP = BCQ = HOM CSP Set of variables V={X1,...,Xn}, domain D, Set of constraints {C1,...,Cm} where: Ci= <Si, Ri> scope relation (Xj1,...,Xjr) 1 6 7 3 1 5 3 9 2 4 7 6 3 5 4 7 Solution to this CSP: A substitution h: VÆD such that ∀i: h(Si ∈ Ri) Associated hypergraph: {var(Si) | 1 ≤ i ≤ m } Example of CSP: Crossword Puzzle 1h: P A R I S 1v: L I M B O P A N D A L I N G O and so on L A U R A P E T R A A N I T A P A M P A P E T E R Conjunctive Database Queries are CSPs ! DATABASE: Enrolled Teaches Parent John Algebra 2003 McLane Algebra March McLane Lisa Robert Logic 2003 Kolaitis Logic May Kolaitis Robert Mary DB 2002 Lausen DB June Rahm Mary Lisa DB 2003 Rahm DB May ……… ….. ……. ……… ….. ……. ……… ….. QUERY: Is there any teacher having a child enrolled in her course? ans Å Enrolled(S,C,R) ∧ Teaches(P,C,A) ∧ Parent(P,S) Queries and Hypergraphs ans Å Enrolled(S,C’,R) ∧ Teaches(P,C,A) ∧ Parent(P,S) C’ C R A S P Queries, CSPs, and Hypergraphs Is there a teacher whose child attends some course? Enrolled(S,C,R) ∧ Teaches(P,C,A) ∧ Parent(P,S) C R A S P The Homomorphism Problem Given two relational structures A = (U , R1, R2,..., Rk ) B = (V , S1, S 2 ,..., Sk ) Decide whether there exists a homomorphism h from A to B h : U ⎯⎯→ V such that ∀x, ∀i x ∈ Ri ⇒ h(x) ∈ Si HOM is NP-complete (well-known) Membership: Obvious, guess h. Hardness: Transformation from 3COL. 1 2 5 A B 3 4 12 1 3 red green 6 2 3 red blue 34 green red 25 green blue 45 blue red 36 blue green Graph 3-colourable iff HOM(A,B ) yes-instance. HOM is NP-complete (well-known, independently proved in various contexts) Membership: Obvious, guess h. Hardness: Transformation from 3COL. 1 2 5 A B 3 4 12 h h 1 3 red green 6 2 3 red blue 34 green red 25 green blue 45 blue red 36 blue green Graph 3-colourable iff HOM(A,B ) yes-instance. CSP= BCQ = HOM Complexity of CSPs NP-complete in the general case (Bibel, Chandra and Merlin ’77, etc.) NP-hard even for fixed constraint relations Polynomial in case of acyclic hypergraphs (Yannakakis ’81) LOGCFL-complete (in NC2) (G.L.S. ’98) Interest in larger tractable classes of CQ/CSP Acyclic Hypergraphs ans Å Enrolled(S,C’,R) ∧ Teaches(P,C,A) ∧ Parent(P,S) C’ C Parent(P,S) R A Teaches(P,C,A) Enrolled(S,C’,R) S P Join Tree n2 log n 3 8 d: 3 7 d(Y,P) 5 7 6 7 3 8 9 r: 9 3 8 8 3 8 r(Y,Z,U) 3 8 4 3 8 3 8 9 4 9 4 7 3 8 9 s: 9 8 9 3 8 t: 8 3 8 s(Z,U,W) t(V,Z) 9 3 3 8 4 9 5 3 8 3 8 9 4 9 4 7 3 8 d: 3 7 d(Y,P) 5 7 6 7 3 8 9 r: 9 3 8 8 3 8 r(Y,Z,U) 3 8 4 3 8 3 8 9 4 9 4 7 3 8 9 s: 9 8 9 3 8 t: 8 3 8 s(Z,U,W) t(V,Z) 9 3 3 8 4 9 5 3 8 3 8 9 4 9 4 7 3 8 d: 3 7 d(Y,P) 5 7 6 7 3 8 9 r: 9 3 8 8 3 8 r(Y,Z,U) 3 8 4 3 8 3 8 9 4 9 4 7 3 8 9 s: 9 8 9 3 8 t: 8 3 8 s(Z,U,W) t(V,Z) 9 3 3 8 4 9 5 3 8 3 8 9 4 9 4 7 3 8 d: 3 7 d(Y,P) 5 7 6 7 3 8 9 r: 9 3 8 8 3 8 r(Y,Z,U) 3 8 4 3 8 3 8 9 4 9 4 7 3 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8 8 3 8 r(Y,Z,U) 3 8 4 3 8 3 8 9 4 9 4 7 3 8 9 s: 9 8 9 3 8 t: 8 3 8 s(Z,U,W) t(V,Z) 9 3 3 8 4 9 5 3 8 3 8 9 4 9 4 7 3 8 d: 3 7 d(Y,P) 5 7 6 7 3 8 9 r: 9 3 8 8 3 8 r(Y,Z,U) 3 8 4 3 8 3 8 9 4 9 4 7 3 8 9 s: 9 8 9 3 8 t: 8 3 8 s(Z,U,W) t(V,Z) 9 3 3 8 4 9 5 3 8 3 8 9 4 9 4 7 3 8 d: 3 7 d(Y,P) 5 7 6 7 3 8 9 r: 9 3 8 8 3 8 r(Y,Z,U) 3 8 4 3 8 3 8 9 4 9 4 7 3 8 9 s: 9 8 9 3 8 t: 8 3 8 s(Z,U,W) t(V,Z) 9 3 3 8 4 9 5 3 8 3 8 9 4 9 4 7 A solution: Y=3, P=7, Z=8, U=9, W=4, V=9 Computing the result • The result size can be exponential (even in case of ACQs).

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    124 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us