1 Answering Queries Using Views Alon Y. Halevy Based on Levy et al. PODS ‘95.

Slides:



Advertisements
Similar presentations
Manipulation of Query Expressions. Outline Query unfolding Query containment and equivalence Answering queries using views.
Advertisements

CSE 636 Data Integration Answering Queries Using Views Bucket Algorithm.
ICDT'2001, London, UK1 Minimizing View Sets without Losing Query-Answering Power Chen Li Stanford University joint work with Mayank Bawa and Jeff Ullman.
CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman.
2005conjunctive-ii1 Query languages II: equivalence & containment (Motivation: rewriting queries using views)  conjunctive queries – CQ’s  Extensions.
Information Integration Using Logical Views Jeffrey D. Ullman.
Lecture 11: Datalog Tuesday, February 6, Outline Datalog syntax Examples Semantics: –Minimal model –Least fixpoint –They are equivalent Naive evaluation.
Query Folding Xiaolei Qian Presented by Ram Kumar Vangala.
CPSC 504: Data Management Discussion on Chandra&Merlin 1977 Laks V.S. Lakshmanan Dept. of CS UBC.
1 Conjunctions of Queries. 2 Conjunctive Queries A conjunctive query is a single Datalog rule with only non-negated atoms in the body. (Note: No negated.
On the logic of merging Sebasien Konieczy and et el Muhammed Al-Muhammed.
Containment of Nested XML Queries Xin (Luna) Dong, Alon Halevy, Igor Tatarinov University of Washington.
SECTION 21.5 Eilbroun Benjamin CS 257 – Dr. TY Lin INFORMATION INTEGRATION.
1 NP-Complete Problems. 2 We discuss some hard problems:  how hard? (computational complexity)  what makes them hard?  any solutions? Definitions 
Properties of SLUR Formulae Ondřej Čepek, Petr Kučera, Václav Vlček Charles University in Prague SOFSEM 2012 January 23, 2012.
5.3 Linear Independence.
Efficient Query Evaluation on Probabilistic Databases
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Generating Efficient Plans for Queries Using Views Chen Li Stanford University with Foto Afrati (National Technical University of Athens) and Jeff Ullman.
Containment of Nested XML Queries Presented by: Orly Goren Xin Dong, Igor TatarinovAlon Halevy,
CPSC 322 Introduction to Artificial Intelligence September 20, 2004.
SECTIONS 21.4 – 21.5 Sanuja Dabade & Eilbroun Benjamin CS 257 – Dr. TY Lin INFORMATION INTEGRATION.
1 Polynomial Church-Turing thesis A decision problem can be solved in polynomial time by using a reasonable sequential model of computation if and only.
A scalable algorithm for answering queries using views Rachel Pottinger, Alon Levy [2000] Rachel Pottinger and Alon Y. Levy A Scalable Algorithm for Answering.
2005certain1 Views as Incomplete Databases – Certain & Possible Answers  Views – an incomplete representation  Certain and possible answers  Complexity.
Local-as-View Mediators Priya Gangaraju(Class Id:203)
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 23 Instructor: Paul Beame.
CSE 636 Data Integration Answering Queries Using Views Overview.
Information Integration Using Logical Views Jeffrey D. Ullman.
2005lav-iii1 The Infomaster system & the inverse rules algorithm  The InfoMaster system  The inverse rules algorithm  A side trip – equivalence & containment.
III. Reduced Echelon Form
1 Query Planning with Limited Source Capabilities Chen Li Stanford University Edward Y. Chang University of California, Santa Barbara.
Rada Chirkova (North Carolina State University) and Chen Li (University of California, Irvine) Materializing Views With Minimal Size To Answer Queries.
Containment CSE 590 DB Rachel Pottinger. Outline zIntroduction zMotivation zFormal definition zAlgorithms for different complexities zAn application:
Logical Database Design Nazife Dimililer. II - Logical Database Design Two stages –Building and validating local logical model –Building and validating.
Do Now Pass out calculators. Solve the following system by graphing: Graph paper is in the back. 5x + 2y = 9 x + y = -3 Solve the following system by using.
Computational Optimization
Presenter: Dongning Luo Sept. 29 th 2008 This presentation based on The following paper: Alon Halevy, “Answering queries using views: A Survey”, VLDB J.
Propositional Resolution Computational LogicLecture 4 Michael Genesereth Spring 2005.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
Implicit Differentiation
Lecture 22 More NPC problems
Mediators, Wrappers, etc. Based on TSIMMIS project at Stanford. Concepts used in several other related projects. Goal: integrate info. in heterogeneous.
Lparse Programs Revisited: Semantics and Representation of Aggregates Guohua Liu and Jia-Huai You University of Alberta Canada.
Approximate schemas Michel de Rougemont, LRI, University Paris II.
1 Bisimulations as a Technique for State Space Reductions.
Datalog Inspired by the impedance mismatch in relational databases. Main expressive advantage: recursive queries. More convenient for analysis: papers.
Answering Queries Using Views LMSS’95 Laks V.S. Lakshmanan Dept. of Comp. Science UBC.
CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman Fall 2006.
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
Implicit Differentiation Objective: To find derivatives of functions that we cannot solve for y.
CPSC 536N Sparse Approximations Winter 2013 Lecture 1 N. Harvey TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAA.
A Dichotomy in the Complexity of Deletion Propagation with Functional Dependencies 2012 ACM SIGMOD/PODS Conference Scottsdale, Arizona, USA PODS 2012 Benny.
1 Reasoning with Infinite stable models Piero A. Bonatti presented by Axel Polleres (IJCAI 2001,
Vasilis Syrgkanis Cornell University
Containment of Relational Queries with Annotation Propagation Wang-Chiew Tan University of California, Santa Cruz.
Solve Linear Systems by Elimination February 3, 2014 Pages
Answering Queries Using Views Presented by: Mahmoud ELIAS.
Solving separable differential equations HW: Practice WS (last two pages of slide show)
Extensions of Datalog Wednesday, February 13, 2001.
COMPLEXITY THEORY IN PRACTICE
Answering Queries using Templates with Binding Patterns
Ch. 6 – The Definite Integral
Containment Mappings Canonical Databases Sariaya’s Algorithm
Introduction to Automata Theory
Local-as-View Mediators
Logic Based Query Languages
Materializing Views With Minimal Size To Answer Queries
Rewriting Equations Equivalent Equations.
Presentation transcript:

1 Answering Queries Using Views Alon Y. Halevy Based on Levy et al. PODS ‘95

2 Conjunctive queries zSafe - each variable in the head appears in the body. headbody subgoal

3 Views zA view is a derived relation defined in terms of stored base relations. zA materialized view is a view stored in the DB (like a cache).

4 Query Containment  iff for any DB, any answer to Q 2 is an answer to Q 1. zContainment is NP-complete. zEquivalence is defined as two-way containment.

5 The problem Definition: Given a query Q and views V 1,V 2,…,V m, find an equivalent query Q’ (a rewriting) that uses one or more of the views.

6 Variants of the problem  Q’ is a complete rewriting of Q if it uses just the views (and built-in predicates).  Q’ is a locally minimal rewriting if we cannot remove a subgoal from Q’ and retain equivalence.  Q’ is a globally minimal rewriting if there is no other rewriting with less subgoals.

7 Containment mapping Definition: A containment mapping (CM) from Q 1 to Q 2 is a mapping from the variables of Q 1 to those of Q 2 such that every subgoal in Q 1 is mapped to a subgoal in Q 2. Example: Q 1 : q(X):-p(X,Y),p(Y,Z),p(Z,W). Q 2 : q(X):-p(X,Y),p(Y,X). CM: X/X, Y/Y, Z/X, W/Y

8 Rewriting vs. containment Proposition 1: Let Q and V be conjunctive queries. There is a rewriting of Q using V iff i.e. if V is empty for a DB then so is Q.

9 Corollaries zProposition 1 provides a complete characterization of the rewriting problem. zWe can use known results from containment to the rewriting problem: yComplexity results yPractical techniques for finding rewritings

10 Results z Complexity: Proposition 2: If Q but not V may contain built-in predicates, then finding a rewriting of Q using V is NP-complete. z Practical solution using Containment Mappings (Chandra & Merlin 1977)

11 Using containment mappings Theorem: For conjunctive queries (without built-in predicates), there is a containment mapping between Q 1 and Q 2 iff z Finding a CM is NP-complete.  We can find a rewriting by finding a CM from V to Q that only maps the bodies.  Then, just add V’ s head to Q ’s body.

12 Minimal rewriting Lemma 3 (technical):  If Q’ is a locally minimal rewriting of Q using V, then Q’ contains no new relation subgoals.  If Q has a rewriting then it has a rewriting with no new variables. Lemma 4: A locally minimal rewriting Q’ of Q has no more subgoals than Q.

13 Complexity of complete rewriting Proposition 5: Finding a complete rewriting is NP-complete. the problem of exact-cover by 3-sets

14 The picture so far zTo find a rewriting: 1. Seek a CM from the views to the query. Add these view heads to the query. 2. Minimize by removing redundant subgoals. zBoth problems are independently NP- complete.

15 Conclusions zUsing views to answer queries is an important problem. Especially for information integration on the web. zQuery containment and containment mappings provide the key for solving the problem. zThe variants of the problem are NP-complete. This is not too bad, since queries are usually short.