1 Searching for Solutions Careful Analysis of Expansions The Bucket Algorithm.

Slides:



Advertisements
Similar presentations
1 EE5900 Advanced Embedded System For Smart Infrastructure Advanced Theory.
Advertisements

CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman.
© 2014 Zvi M. Kedem 1 Unit 12 Advanced Concepts. © 2014 Zvi M. Kedem 2 Characteristics of Some Applications uA typical application: security trading system.
The Assembly Language Level
1 More NP-Complete Problems NP-Hard Problems Tautology Problem Node Cover Knapsack.
SECTION 21.5 Eilbroun Benjamin CS 257 – Dr. TY Lin INFORMATION INTEGRATION.
PZ09B Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ09B - Parameter transmission Programming Language Design.
Deductive Database. Relation Database TitleYearLengthType Harry Porter Color Gone with the wind Black and White Snow White195090Color.
1.2 Row Reduction and Echelon Forms
Linear Equations in Linear Algebra
Extension of DGIM to More Complex Problems
A second order ordinary differential equation has the general form
1 Intractable Problems Time-Bounded Turing Machines Classes P and NP Polynomial-Time Reductions.
1 Multivalued Dependencies Fourth Normal Form Source: Slides by Jeffrey Ullman.
1 Using Views to Implement Datalog Programs Inverse Rules Duschka’s Algorithm.
CURE Algorithm Clustering Streams
1 Multivalued Dependencies Fourth Normal Form. 2 Definition of MVD uA multivalued dependency (MVD) on R, X ->->Y, says that if two tuples of R agree on.
Normal Forms for CFG’s Eliminating Useless Variables Removing Epsilon
CSE 636 Data Integration Datalog Rules / Programs / Negation Slides by Jeffrey D. Ullman.
Local-as-View Mediators Priya Gangaraju(Class Id:203)
1 Information Integration Mediators Semistructured Data Answering Queries Using Views.
Slides 09 1 Counting the Inhabitants of a Type Given a type , how many closed -terms in  - normal form can receive the type  in TA ? There exists an.
Credit: Slides are an adaptation of slides from Jeffrey D. Ullman 1.
CSE 636 Data Integration Answering Queries Using Views Overview.
1 Mining Data Streams The Stream Model Sliding Windows Counting 1’s.
1 The first step in understanding pointers is visualizing what they represent at the machine level. In most modern computers, main memory is divided into.
CHAPTER 1: Graphs, Functions, and Models
Credit: Slides are an adaptation of slides from Jeffrey D. Ullman 1.
Copyright © 2005 Pearson Education, Inc. Slide 9-1.
1 Mining Data Streams The Stream Model Sliding Windows Counting 1’s.
1 Datalog Logical Rules Recursion. 2 Logic As a Query Language uIf-then logical rules have been used in many systems. wMost important today: EII (Enterprise.
Credit: Slides are an adaptation of slides from Jeffrey D. Ullman 1.
Table of Contents The independent variable, x, denotes a member of the domain and the dependent variable, y, denotes a member of the range. We say, "y.
Solving Systems of Linear Equations by Graphing
Mohammed Nasser Acknowledgement: Steve Cunningham
Linear Equations in Linear Algebra
Lecture 21: Languages and Grammars. Natural Language vs. Formal Language.
Database Systems Normal Forms. Decomposition Suppose we have a relation R[U] with a schema U={A 1,…,A n } – A decomposition of U is a set of schemas.
1 Data-Flow Analysis Proving Little Theorems Data-Flow Equations Major Examples.
1 Normalization Anomalies Boyce-Codd Normal Form 3 rd Normal Form.
1 Simplification of Boolean Functions:  An implementation of a Boolean Function requires the use of logic gates.  A smaller number of gates, with each.
3x – 5y = 11 x = 3y + 1 Do Now. Homework Solutions 2)2x – 2y = – 6 y = – 2x 2x – 2(– 2x) = – 6 2x + 4x = – 6 6x = – 6 x = – 1y = – 2x y = – 2(– 1) y =
Chapter 4 Section 1 Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Copyright © 2013, 2009, 2005 Pearson Education, Inc. 1 2 Graphs and Functions Copyright © 2013, 2009, 2005 Pearson Education, Inc.
Linear Equations in Linear Algebra
1 Cluster Computing and Datalog Recursion Via Map-Reduce Seminaïve Evaluation Re-engineering Map-Reduce for Recursion.
Course: Software Engineering ©Alessandra RussoUnit 2: States and Operations, slide number 1 States and Operations This unit aims to:  Define: State schemas.
CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman Fall 2006.
Linear Equations in Two Variables A Linear Equation in Two Variables is any equation that can be written in the form where A and B are not both zero.
Formal Specification of Intrusion Signatures and Detection Rules By Jean-Philippe Pouzol and Mireille Ducassé 15 th IEEE Computer Security Foundations.
Overview Concept Learning Representation Inductive Learning Hypothesis
Chapter 4 Section 1. Objectives 1 Copyright © 2012, 2008, 2004 Pearson Education, Inc. Solving Systems of Linear Equations by Graphing Decide whether.
Chapter 5 Notes. P. 189: Sets, Bags, and Lists To understand the distinction between sets, bags, and lists, remember that a set has unordered elements,
Copyright © Cengage Learning. All rights reserved.
Copyright © 2015, 2008, 2011 Pearson Education, Inc. Section 3.1, Slide 1 Chapter 3 Systems of Linear Equations.
Lecture - 10 on Data Structures. 6:05:57 PM Prepared by, Jesmin Akhter, Lecturer, IIT,JU.
1 Multivalued Dependencies Fourth Normal Form Reasoning About FD’s + MVD’s.
Sections 7.1, 7.2 Sections 7.1, 7.2 Functions and Domain.
Introduction to Finite Automata
1 1.2 Linear Equations in Linear Algebra Row Reduction and Echelon Forms © 2016 Pearson Education, Ltd.
Mrs. Manley Systems of Equations How do you find solutions to systems of two linear equations in 2 variables?
Section 1.2 Functions and Graphs.
Solving Systems of Linear Equations by Graphing
Unit C Solving Systems of Equations by Graphing
Please close your laptops
A second order ordinary differential equation has the general form
Containment Mappings Canonical Databases Sariaya’s Algorithm
Unification Algorithm ChuChen
Copyright © Cengage Learning. All rights reserved.
Local-as-View Mediators
Presentation transcript:

1 Searching for Solutions Careful Analysis of Expansions The Bucket Algorithm

2 Solutions and Expansions uFor every subgoal p(X,Y) of a query, each solution must have a subgoal (view) whose expansion allows a containment mapping to p(X,Y). u“Bucket” for a subgoal = set of views that “cover” the subgoal. uA solution must include > 1 view from each bucket.

3 But … uThere’s much more to the story. uA careful examination of how variables from the view definitions, query, solution, and expansion relate will eventually reveal additional constraints on the structure of the solutions.

4 (Non)Distinguished Variables uA variable that appears in the head of a CQ is said to be distinguished ; otherwise nondistinguished. p(X,Y) :- q(X,Z) & r(Z,Y) DistinguishedNondistinguished

5 Local Variables of Expansions uWhen we expand a view subgoal of a solution, the nondistinguished variables of the view definition become local. wA local variable may not appear anywhere else in the expansion. uVariables of the solution substitute for the distinguished variables of a view definition.

6 Picture v(X,Y) :- p(X,Z) & q(Z,Y) sol(U,V) :- … & v(U,W) & … exp(U,V) :- … & p(U,Z1) & q(Z1,W) … Distinguished in solution; may appear elsewhere Nondistinguished in solution; may appear elsewhere Local from view; may not appear except as shown Exposed variables Correspond to dist- inguished of the view

7 Exposed Variables uVariables of the expansion that have substituted for distinguished variables of a view. uThese are the only variables that may appear in subgoals belonging to the expansion of two different solution subgoals.

8 The Variables of the Query uA query variable is shared if it appears more than once; otherwise it is unique. uA distinguished query variable can only map to the corresponding distinguished variable of the expansion/solution. uA nondistinguished, unique variable of the query maps to any variable of the expansion.

9 Mapping Shared Variables uThere are two options for shared variables: 1.Map to a local variable of one expansion. 2.Map to an exposed variable. uOnly in case (2) can the query subgoals with a shared variable map to expansion subgoals that come from more than one solution subgoal.

10 Picture --- Map to Exposed v(X,Y) :- p(X,Z) & q(Z,Y) sol(U,V) :- … v(U,W) … u(W,V) … exp(U,V) :- p(U,Z1) & q(Z1,W) … r(W,T) … que(A,B) :- … q(C,D) … r(D,E) … Shared variable D maps to exposed variable W. We can map another occurrence of D to a copy of W that comes from another view. W duplicated so D can be handled

11 Picture v(X,Y) :- p(X,Z) & q(Z,Y) sol(U,V) :- … & v(U,W) & … exp(U,V) :- … & p(U,Z1) & q(Z1,W) … que(U,V) :- … p(U,A) & q(A,D) … All occurrences of shared variable A map to local variable Z1.

12 Buckets uTo help search for solutions, we create buckets: 1.One bucket for each subgoal of the query. 2.One bucket for each shared variable in the query.

13 Buckets for Subgoals uMembers of the bucket for a subgoal p(A,B) are pairs consisting of: 1.A view v. 2.A particular p -subgoal in the body of v. uThere are conditions on p(A,B) and the target subgoal p(X,Y) described on the next slide.

14 Buckets for Subgoals --- (2) 1.p(A,B) must be mappable to p(X,Y). That is, if A=B, then X=Y. 2.If (say) A is a distinguished variable of the query, then X is distinguished in the view. 3.If (say) A is a shared variable, then X is distinguished in the view. uObvious extension to > 2 arguments.

15 Buckets for Shared Variables uMembers of the bucket for a shared variable A consist of: 1.A view v, and 2.A set of subgoals S of v such that there is a CM from all the query subgoals containing A to S. uIn this mapping, distinguished variables of the query map to distinguished variables of the view.

16 Example v(X,Y) :- p(X,Z) & p(Z,Y) w(U,V) :- p(U,S) & p(S,T) & p(T,V) q(A,B) :- p(A,C) & p(C,D) & p(D,E) & p(E,F) & p(F,G) & p(G,B) uv = “grandparent”; w = “great- grandparent”; query q = “sixth-generation ancestors.”

17 Example --- p(A,C) v(X,Y) :- p(X,Z) & p(Z,Y) w(U,V) :- p(U,S) & p(S,T) & p(T,V) q(A,B) :- p(A,C) & p(C,D) & p(D,E) & p(E,F) & p(F,G) & p(G,B) uThe bucket for p(A,C) is empty. wA is distinguished; C is shared. wNo view subgoal has distinguished variables in both positions.

18 Example --- p(C,D) v(X,Y) :- p(X,Z) & p(Z,Y) w(U,V) :- p(U,S) & p(S,T) & p(T,V) q(A,B) :- p(A,C) & p(C,D) & p(D,E) & p(E,F) & p(F,G) & p(G,B) uThe bucket for p(C,D) is empty. wBoth C and D are shared. wNo view subgoal has distinguished variables in both positions. uLikewise, all subgoals of q have empty buckets.

19 Example --- Shared Variable C v(X,Y) :- p(X,Z) & p(Z,Y) w(U,V) :- p(U,S) & p(S,T) & p(T,V) q(A,B) :- p(A,C) & p(C,D) & p(D,E) & p(E,F) & p(F,G) & p(G,B) uThe bucket for C : 1.{p(X,Z), p(Z,Y)} from v. uImportant: X is distinguished (since A maps to X ). 2.{p(U,S), p(S,T)} from w. uImportant: U is distinguished (since A maps to U ).

20 Shared Variable C --- Continued v(X,Y) :- p(X,Z) & p(Z,Y) w(U,V) :- p(U,S) & p(S,T) & p(T,V) q(A,B) :- p(A,C) & p(C,D) & p(D,E) & p(E,F) & p(F,G) & p(G,B) uThe bucket for C does not contain {p(S,T), p(T,V)} from w. wBecause distinguished variable A of the query would have to map to S, which is local in the view definition.

21 Example --- Shared Variable D v(X,Y) :- p(X,Z) & p(Z,Y) w(U,V) :- p(U,S) & p(S,T) & p(T,V) q(A,B) :- p(A,C) & p(C,D) & p(D,E) & p(E,F) & p(F,G) & p(G,B) uThe bucket for D : 1.{p(X,Z), p(Z,Y)} from v. 2.{p(U,S), p(S,T)} and {p(S,T), p(T,V)} from w. uEither is OK, since neither C nor E is distinguished. uE, F like D ; G like A.

22 Example --- Continued uEach of the six query subgoals must be covered by at least one member of a bucket. uSince the subgoals themselves have empty buckets, we must group them according to their shared variables and cover them, in groups, from the buckets for the variables.

23 Example --- Continued uOne possibility: use the members from v in the buckets for C, E, and G. uSince shared variables D and F map to distinguished variables of the view definition, we can use v three times in the solution, and equate the corresponding variables.

24 First Solution v(X,Y):- p(X,Z) & p(Z,Y) w(U,V):- p(U,S) & p(S,T) & p(T,V) q(A,B):- p(A,C) & p(C,D) & p(D,E) & p(E,F) & p(F,G) & p(G,B) s(A,B):- v(A,J) & v(J,K) & v(K,B) e(A,B):- p(A,Z1) & p(Z1,J) & p(J,Z2) & p(Z2,K) & p(K,Z3) & p(Z3,B)

25 Example --- Continued uAnother possibility is to use one copy of w to cover the first three query subgoals and another copy of w to cover the last three. uThe first copy covers shared variables C and D ; the second covers F and G. uShared variable E maps to distinguished variables of w.

26 Second Solution v(X,Y) :- p(X,Z) & p(Z,Y) w(U,V) :- p(U,S) & p(S,T) & p(T,V) q(A,B) :- p(A,C) & p(C,D) & p(D,E)& p(E,F) & p(F,G) & p(G,B) s(A,B) :- w(A,J) & w(J,B) e(A,B) :- p(A,S1) & p(S1,T1) & p(T1,J) & p(J,S2) & p(S2,T2) & p(T2,B)

27 Why There Are No More Solutions uFor instance, we cannot use one v subgoal v(A,J) in the solution to cover shared variable C and another v(K,L) to cover D. uv(A,J) expands to p(A,Z1) & p(Z1,J), forcing D to map to J. uBut v(K,L) expands to p(K,Z2) & p(Z2,L), forcing D to map to Z2.