Local-as-View Mediators

Slides:



Advertisements
Similar presentations
1 Datalog: Logic Instead of Algebra. 2 Datalog: Logic instead of Algebra Each relational-algebra operator can be mimicked by one or several Database Logic.
Advertisements

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.
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.
Answer Set Programming Overview Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma de Guadalajara
SECTION 21.5 Eilbroun Benjamin CS 257 – Dr. TY Lin INFORMATION INTEGRATION.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
SECTIONS 21.4 – 21.5 Sanuja Dabade & Eilbroun Benjamin CS 257 – Dr. TY Lin INFORMATION INTEGRATION.
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)
2005lav-iv1  On the Inverse rules algorithm It is guaranteed to compute the certain answers But, what about its efficiency? As presented, it computes.
CSE 636 Data Integration Answering Queries Using Views Overview.
2005lav-iii1 The Infomaster system & the inverse rules algorithm  The InfoMaster system  The inverse rules algorithm  A side trip – equivalence & containment.
1/25 Pointer Logic Changki PSWLAB Pointer Logic Daniel Kroening and Ofer Strichman Decision Procedure.
Submitted by: Deepti Kundu Submitted to: Dr.T.Y.Lin
CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman Fall 2006.
Copyright © Cengage Learning. All rights reserved.
APPLICATIONS OF DIFFERENTIATION Antiderivatives In this section, we will learn about: Antiderivatives and how they are useful in solving certain.
CS589 Principles of DB Systems Fall 2008 Lecture 4c: Query Language Equivalence Lois Delcambre
7.3 Linear Systems of Equations. Gauss Elimination
ISHIK UNIVERSITY FACULTY OF EDUCATION Mathematics Education Department
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
WARM UP Find each equation, determine whether the indicated pair (x, y) is a solution of the equation. 2x + y = 5; (1, 3) 4x – 3y = 14; (5, 2)
Relations, Functions, and Matrices
Axiomatic Number Theory and Gödel’s Incompleteness Theorems
15.1 – Introduction to physical-Query-plan operators
Derivative of f (x) =sin (x)
5 Systems of Linear Equations and Matrices
Answering Queries using Templates with Binding Patterns
Goal for this lecture Demonstrate how we can prove that one query language is more expressive than (i.e., “contained in” as described in the book) another.
Copyright © Cengage Learning. All rights reserved.
1 Functions and Applications
Chapter 2 Sets and Functions.
CALCULUS AND ANALYTIC GEOMETRY CS 001 LECTURE 02.
Horn Clauses and Unification
Ordering of Hypothesis Space
Chapter 2: Intro to Relational Model
Containment Mappings Canonical Databases Sariaya’s Algorithm
Chapter 15 QUERY EXECUTION.
Context-Free Languages
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Transformations of Functions
Cse 344 January 29th – Datalog.
Systems of Linear Equations in Engineering
Horn Clauses and Unification
Graphs, Linear Equations, and Functions
Horn Clauses and Unification
Mathematical Background 1
Horn Clauses and Unification
Ch 3.2: Fundamental Solutions of Linear Homogeneous Equations
INFORMATION INTEGRATION
Information Integration
Copyright © Cengage Learning. All rights reserved.
Chen Li Information and Computer Science
Horn Clauses and Unification
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Subject Name: FORMAL LANGUAGES AND AUTOMATA THEORY
Foundations of Discrete Mathematics
Materializing Views With Minimal Size To Answer Queries
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Implementation of Learning Systems
Representations & Reasoning Systems (RRS) (2.2)
Copyright © Cengage Learning. All rights reserved.
Lecture 6 - Recursion.
Presentation transcript:

Local-as-View Mediators

In a LAV mediator, we define global predicates at the mediator. We define, for each source, one or more expressions involving the global predicates that describe the tuples that the source is able to produce. Queries are answered at the mediator by discovering all possible ways to construct the query using the views provided by the source.

Motivation for LAV Mediators Sometimes there can be situation where the relationship between what we want to provide to users of the mediator and what the sources provide is more subtle. For example, consider the predicate Par(c, p) meaning that p is a parent of c which represents the set of all child parent facts that could ever exist. The sources will provide information about whatever child-parent facts they know.

There can be sources which may provide child-grandparent facts but not child- parent facts at all. This source can never be used to answer the child-parent query under GAV mediators. LAV mediators allow us to say that a certain source provides grand parent facts. They let us discover how and when to use that source in a given query.

Terminology The queries at the mediator and the queries that describe the source will be single Datalog rules. A query that is a single Datalog rule is often called a conjunctive query. A LAV mediator has a set of global predicates, which are used as the subgoals of mediator queries. There are conjunctive queries that define views.

Their heads each have a unique view predicate that is the name of a view. Each view definition has a body consisting of global predicates and is associated with a particular source, from which that view can be constructed. We assume that each view can be constructed with an all-free adornment.

Example.. Suppose there is one global predicate Par(c, p) meaning that p is a parent of c. One source produces some of the possible parent facts. Its view is defined by the conjunctive query- V1(c, p)  Par(c, p) Another source produces some grand parents facts. Then its conjunctive query will be – V2(c, g)  Par(c, p) AND Par(p, g)

The query at the mediator will ask for great-grand parent facts that can be obtained from the sources. The mediator query is – Q(w, z)  Par(w, x) AND Par(x, y) AND Par(y, z) One solution can be using the parent predicate(V1) directly three times. Q(w, z)  V1(w, x) AND V1 (x, y) AND V1(y, z)

Another solution can be to use V1(parent facts) to make a step of one generation and V2(grandparent facts) to make a step of two generations. Q(w, z)  V1(w, x) AND V2(x, z) Or Q(w, z)  V2(w, y) AND V1(y, z)

Expanding Solutions Consider a query Q, a solution S that has a body whose subgoals are views and each view V is defined by a conjunctive query with that view as the head. We can substitute the body of V’s conjunctive query for a subgoal in S that uses the predicate Vas long as we are careful not to confuse variable names from one body with those of another.

Expansion Algorithm A solution S has a subgoal V(a1, a2,…an) where ai’s can be any variables or constants. The view V can be of the form V(b1, b2,….bn)  B Where B represents the entire body. We can replace V(a1, a2, … an) in solution S by a version of body B that has all the subgoals of B with variables possibly altered.

The rules for altering the variables of B are: First identify the local variables B, variables that appear in the body but not in the head. If there are any local variables of B that appear in B or in S, replace each one by a distinct new variable that appears nowhere in the rule for V or in S. In the body, replace each bi by ai for i = 1,2…n.

In the child-parent example, we had view definitions, V1(c, p)  Par(c, p) V2(c, g)  Par(c, p) AND Par(p, g) One of the proposed solutions S is Q(w, z)  V1(w, x) AND V2(x, z) The first subgoal with predicate V1 in the solution can be expanded as Par(w, x) as there are no local variables.

The V2 subgoal has a local variable p which doesn’t appear in S nor it has been used as a local variable in another substitution. So p can be left as it is. Only x and z are to be substituted for variables c and g. The Solution S now will be Q(w, z)  Par(w, x) AND Par(x, p) AND Par(p,z)

Containment of Conjunctive Queries A containment mapping from Q to E is a function т from the variables of Q to the variables and constants of E, such that: If x is the ith argument of the head of Q, then т(x) is the ith argument of the head of E. Add to т the rule that т(c)=c for any constant c. If P(x1,x2,… xn) is a subgoal of Q, then P(т(x1), т(x2),… т(xn)) is a subgoal of E.

Example.. Consider two Conjunctive queries: Q1: H(x, y)  A(x, z) and B(z, y) Q2: H(a, b)  A(a, c) AND B(d, b) AND A(a, d) We can say there is a containment mapping from Q1 to Q2. When we apply the substitution, Т(x) = a, Т(y) = b, Т(z) = d, the head of Q1 becomes H(a, b) which is the head of Q2.

The first subgoal of Q1 becomes A(a, d) which is the third subgoal of Q2. The second subgoal of Q1 becomes the second subgoal of Q2. There is also a containment mapping from Q2 to Q1 so the two conjunctive queries are equivalent.

Why the Containment-Mapping Test Works Suppose there is a containment mapping т from Q1 to Q2. When Q2 is applied to the database, we look for substitutions σ for all the variables of Q2. The substitution for the head becomes a tuple t that is returned by Q2. If we compose т and then σ, we have a mapping from the variables of Q1 to tuples of the database that produces the same tuple t for the head of Q1.

Finding Solutions to a Mediator Query LMSS Theorem states that If a query Q has n subgoals, then any answer produced by any solution is also produced by a solution that has at most n subgoals.

Recall the query Q1: Q(w, z) Par(w, x) AND Par(x, y) AND Par(y, z) This query has three subgoals, so we don’t have to look at solutions with more than three subgoals.

Why the LMSS Theorem Holds Suppose we have a query Q with n subgoals and there is a solution S with more than n subgoals. The expansion E of S must be contained in Query Q, which means that there is a containment mapping from Q to E. We remove from S all subgoals whose expansion was not the target of one of Q’s subgoals under the containment mapping.

We would have a new conjunctive query S’ with at most n subgoals. If E’ is the expansion of S’ then, E’ is a subset of Q. S is a subset of S’ as there is an identity mapping. Thus S need not be among the solutions to query Q.