Containment of Nested XML Queries Xin (Luna) Dong, Alon Halevy, Igor Tatarinov University of Washington.

Slides:



Advertisements
Similar presentations
Containment of Conjunctive Queries on Annotated Relations TJ Green University of Pennsylvania Symposium on Database Provenance University of Edinburgh.
Advertisements

Chapter 11 Limitations of Algorithm Power Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
2005conjunctive-ii1 Query languages II: equivalence & containment (Motivation: rewriting queries using views)  conjunctive queries – CQ’s  Extensions.
CPSC 504: Data Management Discussion on Chandra&Merlin 1977 Laks V.S. Lakshmanan Dept. of CS UBC.
Efficient Keyword Search for Smallest LCAs in XML Database Yu Xu Department of Computer Science & Engineering University of California, San Diego Yannis.
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.
DIMACS Streaming Data Working Group II On the Optimality of the Holistic Twig Join Algorithm Speaker: Byron Choi (Upenn) Joint Work with Susan Davidson.
Structural Joins: A Primitive for Efficient XML Query Pattern Matching Al Khalifa et al., ICDE 2002.
On the Memory Requirements of XPath Evaluation over XML Streams Ziv Bar-Yossef Marcus Fontoura Vanja Josifovski IBM Almaden Research Center.
TIMBER A Native XML Database Xiali He The Overview of the TIMBER System in University of Michigan.
Efficient Query Evaluation on Probabilistic Databases
20081COMMA08 – Toulouse, May 2008 The Computational Complexity of Ideal Semantics I Abstract Argumentation Frameworks Paul E. Dunne Dept. Of Computer Science.
1 Answering Queries Using Views Alon Y. Halevy Based on Levy et al. PODS ‘95.
1 Rewriting Nested XML Queries Using Nested Views Nicola Onose joint work with Alin Deutsch, Yannis Papakonstantinou, Emiran Curtmola University of California,
Containment of Nested XML Queries Presented by: Orly Goren Xin Dong, Igor TatarinovAlon Halevy,
Aki Hecht Seminar in Databases (236826) January 2009
Branch and Bound Similar to backtracking in generating a search tree and looking for one or more solutions Different in that the “objective” is constrained.
NP-Complete Problems Reading Material: Chapter 10 Sections 1, 2, 3, and 4 only.
Query Languages Aswin Yedlapalli. XML Query data model Document is viewed as a labeled tree with nodes Successors of node may be : - an ordered sequence.
The Theory of NP-Completeness
A Framework for Using Materialized XPath Views in XML Query Processing Dapeng He Wei Jin.
Validating Streaming XML Documents Luc Segoufin & Victor Vianu Presented by Harel Paz.
Containment and Equivalence for an XPath Fragment By Gerom e Mikla Dan Suciu Presented By Roy Ionas.
TOSS: An Extension of TAX with Ontologies and Similarity Queries Edward Hung, Yu Deng, V.S. Subrahmanian Department of Computer Science University of Maryland,
Chapter 11: Limitations of Algorithmic Power
Managing XML and Semistructured Data Lecture 16: Indexes Prof. Dan Suciu Spring 2001.
Inbal Yahav A Framework for Using Materialized XPath Views in XML Query Processing VLDB ‘04 DB Seminar, Spring 2005 By: Andrey Balmin Fatma Ozcan Kevin.
XML –Query Languages, Extracting from Relational Databases ADVANCED DATABASES Khawaja Mohiuddin Assistant Professor Department of Computer Sciences Bahria.
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.
CIS607, Fall 2005 Semantic Information Integration Article Name: Clio Grows Up: From Research Prototype to Industrial Tool Name: DH(Dong Hwi) kwak Date:
Abstract State Machines and Computationally Complete Query Languages Andreas Blass,U Michigan Yuri Gurevich,Microsoft Research & U Michigan Jan Van den.
XML-to-Relational Schema Mapping Algorithm ODTDMap Speaker: Artem Chebotko* Wayne State University Joint work with Mustafa Atay,
Selective and Authentic Third-Party distribution of XML Documents - Yashaswini Harsha Kumar - Netaji Mandava (Oct 16 th 2006)
1 Propagating Functional Dependencies with Conditions Wenfei Fan University of Edinburgh & Bell Laboratories Shuai Ma University of Edinburgh Yanli HuNational.
Chapter 11 Limitations of Algorithm Power. Lower Bounds Lower bound: an estimate on a minimum amount of work needed to solve a given problem Examples:
Computational Complexity Polynomial time O(n k ) input size n, k constant Tractable problems solvable in polynomial time(Opposite Intractable) Ex: sorting,
A D ICHOTOMY ON T HE C OMPLEXITY OF C ONSISTENT Q UERY A NSWERING FOR A TOMS W ITH S IMPLE K EYS Paris Koutris Dan Suciu University of Washington.
XML as a Boxwood Data Structure Feng Zhou, John MacCormick, Lidong Zhou, Nick Murphy, Chandu Thekkath 8/20/04.
General Database Statistics Using Maximum Entropy Raghav Kaushik 1, Christopher Ré 2, and Dan Suciu 3 1 Microsoft Research 2 University of Wisconsin--Madison.
A Summary of XISS and Index Fabric Ho Wai Shing. Contents Definition of Terms XISS (Li and Moon, VLDB2001) Numbering Scheme Indices Stored Join Algorithms.
Querying Structured Text in an XML Database By Xuemei Luo.
Diversified Top-k Graph Pattern Matching 1 Yinghui Wu UC Santa Barbara Wenfei Fan University of Edinburgh Southwest Jiaotong University Xin Wang.
A Survey Based Seminar: Data Cleaning & Uncertain Data Management Speaker: Shawn Yang Supervisor: Dr. Reynold Cheng Prof. David Cheung
2-Level Minimization Classic Problem in Switching Theory Tabulation Method Transformed to “Set Covering Problem” “Set Covering Problem” is Intractable.
© ETH Zürich Eric Lo ETH Zurich a joint work with Carsten Binnig (U of Heidelberg), Donald Kossmann (ETH Zurich), Tamer Ozsu (U of Waterloo) and Peter.
RRXS Redundancy reducing XML storage in relations O. MERT ERKUŞ A. ONUR DOĞUÇ
Presented by Jiwen Sun, Lihui Zhao 24/3/2004
Answering Queries Using Views: The Last Frontier.
Answering Tree Pattern Queries Using Views Laks V.S. Lakshmanan, Hui (Wendy) Wang, and Zheng (Jessica) Zhao University of British Columbia Vancouver, BC.
Lecture 7: Foundations of Query Languages Tuesday, January 23, 2001.
A Dichotomy in the Complexity of Deletion Propagation with Functional Dependencies 2012 ACM SIGMOD/PODS Conference Scottsdale, Arizona, USA PODS 2012 Benny.
Strings Basic data type in computational biology A string is an ordered succession of characters or symbols from a finite set called an alphabet Sequence.
LIMITATIONS OF ALGORITHM POWER
Query Caching and View Selection for XML Databases Bhushan Mandhani Dan Suciu University of Washington Seattle, USA.
Holistic Twig Joins Optimal XML Pattern Matching Nicolas Bruno Columbia University Nick Koudas Divesh Srivastava AT&T Labs-Research SIGMOD 2002.
1 Holistic Twig Joins: Optimal XML Pattern Matching Nicolas Bruno, Nick Koudas, Divesh Srivastava ACM SIGMOD 2002 Presented by Jun-Ki Min.
Efficient Discovery of XML Data Redundancies Cong Yu and H. V. Jagadish University of Michigan, Ann Arbor - VLDB 2006, Seoul, Korea September 12 th, 2006.
Introduction to NP Instructor: Neelima Gupta 1.
1 Efficient Processing of XML Twig Patterns with Parent Child Edges: A Look-ahead Approach Presenter: Qi He.
Answering Queries Using Views Presented by: Mahmoud ELIAS.
1 Efficient Processing of Partially Specified Twig Queries Junfeng Zhou Renmin University of China.
XML Query languages--XPath. Objectives Understand XPath, and be able to use XPath expressions to find fragments of an XML document Understand tree patterns,
1 Representing and Reasoning on XML Documents: A Description Logic Approach D. Calvanese, G. D. Giacomo, M. Lenzerini Presented by Daisy Yutao Guo University.
Computing Full Disjunctions
Queries with Difference on Probabilistic Databases
Chapter 11 Limitations of Algorithm Power
Early Profile Pruning on XML-aware Publish-Subscribe Systems
A Framework for Testing Query Transformation Rules
Materializing Views With Minimal Size To Answer Queries
Presentation transcript:

Containment of Nested XML Queries Xin (Luna) Dong, Alon Halevy, Igor Tatarinov University of Washington

Query Containment The most fundamental relationship between a pair of queries Query Q is contained in Q’ if:  For any database D,  Q(D) is a subset of Q’(D)

Applications of Query Containment Semantic caching Reasoning about contents of data sources in data integration Verification of integrity constraints Verification of knowledge bases Determining queries independent of updates Query answering using views

Query Processing in PDMS XML Query Containment in Peer Data Management System (PDMS)  Answering queries using views to extract remote data  Removing redundant queries to enhance performance [Tatarinov and Halevy, SIGMOD 2004] M WS M PW M SB M BW QWQW Q W UW Stanford Berkeley UPenn QWQW QPQP Q B1 Q B2 QSQS Q B1 QSQS Q B2 Q B1

Query Containment: Relational v.s. XML Relational Input DSets of tuples Output Q(D)A set of tuples Instance containment Q(D)  Q’(D) – Subset Query containment Q  Q’ – for every input D, Q(D)  Q’(D)

Query Containment: Relational v.s. XML RelationalXML Input DSets of tuplesAn XML instance tree Output Q(D)A set of tuplesAn XML instance tree Instance containment Q(D)  Q’(D) – Subset Q(D) Q’(D) – Tree homomorphism Query containment Q  Q’ – for every input D, Q(D)  Q’(D) Q Q’ – for every input D, Q(D) Q’(D)

Example – An XML Instance D: Alice Bob project member AliceBob

Example – An XML Query Q: for $x in /project return { for $y in $x/member return { where $y=“Alice” return where $y=“Bob” return } D: Q(D): group name group name AliceBob project member AliceBob

Example – Another XML Query Q’: for $x in /project return { for $y in /project/member return { where $y=“Alice” return where $y=“Bob” return } D: Q’(D): name group name AliceBob project member AliceBob

Q’(D): Q(D): X Example – Tree Homomorphism and Query Containment Q (D) Q’(D) Q’(D) Q (D) name group name AliceBob group name group name AliceBob Q’(D): Q(D): name group name AliceBob group name group name AliceBob

Query Containment Problem From answer containment to query containment Our problems  Given queries Q and Q’, decide whether Q Q’  The complexity of query containment Q’(D) Q (D)  Q’ Q Q (D) Q’(D)  Q Q’

Previous Work (I) Relational query containment  Conjunctive queries [Chandra and Merlin, STOC 1977]  Acyclic queries [Yannakakis, VLDB 1981]  Queries with union [Sagiv and Yannakakis, JACM 1980]  Queries with negation [Levy and Sagiv, VLDB 1993]  Queries with arithmetic comparisons [Klug, JACM 1988]  Recursive queries [Shmueli, 1993], [Chaudhuri and Vardi, 1992]  Queries over bags [Ioannidis and Ramakrishnan, 1995]

Previous Work (II) XML query containment – two new challenges  XPath containment With *, // and […] [Miklau and Suciu, PODS 2002] With equality testing on tag variables [Deutsch and Tannen, KRDB 2001] Conjunctive queries over path expressions [Florescu, Levy and Suciu, PODS 1998]  Nested query containment

Containment Cannot be Determined Solely by Comparing XPath Components Q: for $g in /group where $g/gname/text() = “database” return { for $p in $g/person return {$p/text()} {for $q in $g/paper where $q/author/text() = $p/text() return {$q/title/text()} } } Q’: for $g in /group return { for $p in $g/person return {$p/text()} {$g/gname/text()} {for $q in $g/paper where $q/author/text() = $p/text() return {$q/title/text()} } }

Previous Work (II) XML query containment – two new challenges  XPath containment With *, // and […] [Miklau and Suciu, PODS 2002] With equality testing on tag variables [Deutsch and Tannen, KRDB 2001] Conjunctive queries over path expressions [Florescu, Levy and Suciu, PODS 1998]  Nested query containment Complex object query containment [Levy and Suciu, PODS 1997] Containment of nested XML queries has not been fully studied

Our Focus: Nested XML Queries Returned tag constants Conjunctive – no two sibling query blocks return the same tag XPath:  HAVE Child axis (/) Wildcards (*) Branches ([…])  NOT HAVE descendant // Arithmetic comparison Union Here, XPath containment is in PTIME

Complexity Result (I) Depth Fanout FixedArbitrary = 1PTIME Arbitrary coNP complete In coNEXPTIME

Complexity Result (II) Query Type No tag variables With tag variables With unions With neg With // With euiq- join on tags With arith comp Un- nested PTIME coNP complete NP complete  2 P complete Fan- out=1 PTIME Fixed- depth coNP complete General in coNEXP TIME

Complexity Result (II) Query Type No tag variables With tag variables With unions With neg With // With euiq- join on tags With arith comp Un- nested PTIME coNP complete NP complete  2 P complete Fan- out=1 PTIME Fixed- depth coNP complete General in coNEXP TIME

Complexity Result (II) Query Type No tag variables With tag variables With unions With neg With // With euiq- join on tags With arith comp Un- nested PTIME coNP complete NP complete  2 P complete Fan- out=1 PTIME coNP complete NP complete  2 P complete Fixed- depth coNP complete  2 P complete Generalin coNEXPTIME

Roadmap  Introduction and problem definition  Containment of a subset of XML queries  Query containment is decidable   Query containment in practice  Relaxing the assumptions  Conclusions Depth Fanout FixedArbitrary = 1PTIME Arbitrary coNP complete In coNEXPTIME

Deciding Q Q’? How to find a property for an infinite number of input XML instances Standard technique  Find a finite set of input representatives – Canonical Databases  Relational query: each canonical database is a minimal input to generate the answer template  XML query answers have infinite number of shapes Find a finite set of answer templates – Canonical Answers

Answer Shapes Determined by the Head Tree Q’: for $x in /project return { for $y in /project/member return { where $y=“Alice” return where $y=“Bob” return } Alice Bob Head Tree: group name group name group Alice name group name Bob

group Alice name Bob Head Tree: An Additional Candidate Answer name group name AliceBob group name group Alice name group name Bob

group Alice name Bob Head Tree: Why Consider the Additional Case name group name AliceBob project member AliceBob Q(D): group name group name AliceBob Q’(D): D:

What can Serve as Canonical Answers?  Prefix subtrees of the head tree? – necessary but not sufficient  Trees contained in the head tree? – necessary and sufficient – but, too many and too complex

A Head Tree can Have Many Trees Contained in it group name AliceBobAlice group name Alice Bob AliceBob name group Alice Bob AliceBob group name group Alice name Bob Head Tree:

What can Serve as Canonical Answers?  Prefix subtrees of the head tree? – necessary but not sufficient  Trees contained in the head tree? – necessary and sufficient – but, too many and too complex Our solution: consider only minimal trees that are contained in the head tree

Canonical Answer A minimal XML instance: No two sibling subtrees where one is contained in the other Canonical Answer : A minimal XML instance contained in the head tree Every answer A of query Q corresponds to a unique canonical answer CA, s.t. A CA, CA A group name Alice Bob Alice group Alice name Bob  group name AliceBob

Canonical Database Canonical Database: DB CA  The minimal XML instance to generate CA project member project member Alice Bob project group name AliceBob CA: DB: for $x in /project return { for $y in /project/member return { where $y=“Alice” return where $y=“Bob” return }

Sound and Complete Conditions for Nested Query Containment Theorem 1. Q Q’, if and only if for every canonical database DB of Q, Q(DB) Q’(DB) Theorem 2. Q Q’, if and only if for every canonical answer CA of Q, CA is a canonical answer of Q’ DB’ CA DB CA

Query Containment Algorithm Algorithm: for every canonical answer CA of Q do 1. check whether CA is a canonical answer of Q’ 2. generate DB CA and DB’ CA 3. check DB’ CA DB CA

Roadmap  Introduction and problem definition  Containment of a subset of XML queries  Query containment is decidable   Query containment in practice  Relaxing the assumptions  Conclusions Depth Fanout FixedArbitrary = 1?? Arbitrary??

Query Containment Algorithm Algorithm: for every canonical answer CA of Q do 1. check whether CA is a canonical answer of Q’ 2. generate DB CA and DB’ CA 3. check DB’ CA DB CA Polynomial in the size and number of canonical answers  What are the sizes of canonical answers?  What is the number of canonical answers?

Containment of XML Queries with Fanout 1 E.g. d=3 – the depth; m=1 – the maximum fanout Canonical Answers and Complexity  Number: the depth of the query  Size: bounded by the depth of the query  Complexity: O( d·|Q|·|Q’|) Theorem: Testing containment of XML Queries with fanout 1 is in PTIME for $x in /project return {for $y in /project/member return {where $y =“Alice” return } group Alice name group name group Nesting with fanout 1 does not increase complexity

Roadmap  Introduction and problem definition  Containment of a subset of XML queries  Query containment is decidable   Query containment in practice  Relaxing the assumptions  Conclusions Depth Fanout FixedArbitrary = 1PTIME Arbitrary??

Containment of XML Queries with Arbitrary Fanout E.g. d=4 – the depth; m=3 – the maximum fanout Canonical AnswersComplexity  Number:  Size: Theorem: Testing containment of XML Queries with depth 2 and arbitrary fanout is coNP-hard d-1 d-2 d-1

Roadmap  Introduction and problem definition  Containment of a subset of XML queries  Query containment is decidable  NOT TIGHT  Query containment in practice  Relaxing the assumptions  Conclusions Depth Fanout FixedArbitrary = 1PTIME ArbitrarycoNP hard

Effect of the Depth on Containment of XML Queries Insight: Kernel Canonical Answer  The root node has a single child  In any subtree, a path pattern is repeated no more than cd times. d – query depth c – #(maximum path steps in a query block) The size of kernel canonical answers  Polynomial in the query size  Exponential in the query depth Theorem:  Testing containment of XML queries with fixed depth is coNP-complete  Testing containment of XML queries with arbitrary depth is in coNEXPTIME

Roadmap  Introduction and problem definition  Containment of a subset of XML queries  Query containment is decidable   Query containment in practice  Relaxing the assumptions  Conclusions Depth Fanout FixedArbitrary = 1PTIME Arbitrary coNP complete In coNEXPTIME

Containment Checking in Practice Q: for $g in /group where $g/gname/text() = “database” return { for $p in $g/person return {$p/text()} {for $q in $g/paper where $q/author/text() = $p/text() return {$q/title/text()} } } Q’: for $g in /group return { for $p in $g/person return {$p/text()} {$g/gname/text()} {for $q in $g/paper where $q/author/text() = $p/text() return {$q/title/text()} } } Analyze element cardinality to reduce the number of canonical answers for containment checking #canonical answers – originally : 71  after analysis : 2

Roadmap  Introduction and problem definition  Containment of a subset of XML queries  Query containment is decidable   Query containment in practice  Relaxing the assumptions  Conclusions Depth Fanout FixedArbitrary = 1PTIME Arbitrary coNP complete In coNEXPTIME

An Example Query that Returns Tag Variables for $x in dbGrp return { for $y in $x/proj return { for $u in $y/member return $u/text() for $v in $y/paper return $v/text() }

Deciding Query Containment Leverage previous results – simulation mapping [Levy and Suciu, PODS’97] Check query simulation mapping for every canonical answer Complexity  Simulation mapping can be checked in polynomial time in terms of query size  Complexity of checking containment does not arise

Other Extensions Query Type No tag variables With tag variables With unions With neg With // With euiq- join on tags With arith comp Un- nested PTIME coNP complete NP complete  2 P complete Fan- out=1 PTIME coNP complete NP complete  2 P complete Fixed- depth coNP complete  2 P complete Generalin coNEXPTIME

Conclusions Contributions  A sound and complete condition for containment of nested XML queries  Detailed complexity analysis Future work  Fill in the open gap of complexity in case of queries with arbitrary fanout and arbitrary nesting depth  Evaluate and optimize the containment algorithm with element cardinality analysis  Answering nested XML queries using views

Containment of Nested XML 2004 Xin (Luna) Dong, Alon Halevy, Igor Tatarinov University of Washington