data exchange & composition of schema mappings phokion g. kolaitis ibm almaden research center

22
Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

Post on 20-Dec-2015

228 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

Data Exchange &

Composition of Schema Mappings

Phokion G. Kolaitis

IBM Almaden Research Center

Page 2: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

2

Joint work with

Ron Fagin, IBM Almaden Research Center Renee Miller, University of Toronto Lucian Popa, IBM Almaden Research Center Wang-Chiew Tan, UC Santa Cruz

Studied foundational aspects of schema mappings: data exchange based on schema mappings composition of schema mappings

Page 3: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

3

Schema Mappings & Data Exchange

Schema S1 Schema S2

12

Schema Mappings are logic-based specifications that describe the relationship between a “source” schema S1 and a “target” schema S2

The Data Exchange Problem associated with such a schema mapping M12 is as follows:

Input: Source instance I1 Output: Target instance I2 such that < I1,I2 > satisfy the

specifications of the schema mapping

I1 I2

q

Page 4: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

4

Main issues in data exchange

For a given source instance, there may be more than one target instance satisfying the specifications of the schema mapping. Thus,

When more than one solution exist, which solutions are “better” than others?

How do we compute a “best” solution?

Can the certain answers of target queries be obtained by evaluating them on a “best” solution?

Page 5: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

5

Schema Mapping Specification Language

The relationship between the source and the target is given by a set Σ12 of source-to-target tuple generating dependencies (s-t tgds)

(x) y (x, y), where (x) is a conjunction of atoms over the source and (x, y) is a conjunction of atoms over the target.

Among the most general assertions used in data integration Generalize LAV (local-as-views) and GAV (global-as-

views) specifications in data integration Equivalent to GLAV (local-and-global-as-views)

specifications

Page 6: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

6

Universal Solutions in Data Exchange

We introduced the notion of universal solutions as the “best” solutions in data exchange By definition, they have homomorphisms to all other

solutions (thus, they are the most general solutions).

Main Results (FKMP in ICDT 2003) Universal solutions are unique up to homomorphic

equivalence; they represent the entire solution space. The chase procedure produces a universal solution in

polynomial time. The certain answers of target conjunctive queries can be

obtained by evaluation on an arbitrary universal solution

Page 7: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

7

Composing Schema Mappings

Given 12 = (S1, S2, 12) and 23 = (S2, S3, 23), derive a

schema mapping 13 = (S1, S3, 13) that is “equivalent” to the

successive application of 12 and 23.

What is the semantics of composition of schema mappings? What does “equivalent” mean in this context?

Schema S1 Schema S2 Schema S3

12 23

13

Page 8: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

8

Earlier Work

Metadata Model Management (Bernstein in CIDR 2003) Composition is one of the fundamental operators However, no semantics is given

Composing Mappings among Data Sources

(Madhavan & Halevy in VLDB 2003) First to propose a semantics for composition However, their definition is in terms of maintaining the

same certain answers relative to a class of queries. Their notion of composition depends on the class of

queries and may not be unique up to logical equivalence.

Page 9: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

9

Semantics of Composition

Definition: (FKPT in PODS 2004) A schema mapping 13 is a composition of 12 and 23 if for every instance I1 of S1 and every instance I3 of S3,

<I1,I3> 13 if and only if

there exists I2 such that <I1,I2> 12 and <I2,I3> 23.

In other words, Inst(13) = Inst(12) Inst(23), where

Inst() = { <I,J> | <I,J> ST }

Thus, 13 defines the composition of the binary relations of the instances associated with 12 and 23.

Schema S1 Schema S2 Schema S3

12 23

13

Page 10: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

10

The Composition of Schema Mappings

Fact: If = (S1, S3, ) and ’ = (S1, S3, ’) are both

compositions of 12 and 23, then are ’ are logically

equivalent. For this reason:

We say that (or ’) is the composition of 12 and 23.

We write 12 23 to denote it

Definition: The composition query of 12 and 23 is the set

Inst(12) Inst(23)

Page 11: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

11

Issues in Composition of Schema Mappings

The semantics of composition was the first main issue.

Some other key issues:

Is the language of finite sets of s-t tgds closed under composition?

That is, if 12 and 23 are specified by finite sets of s-t tgds, is

12 23 also specified by a finite set of s-t tgds?

If not, what is the “right” language for composing schema mappings?

What is the complexity of the associated composition query?

Page 12: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

12

Composition: Expressibility & Complexity

Σ12 Σ23 Σ13 Composition

Query

finite set of full

s-t tgds

(x) (x)

finite set of

s-t tgds

(x) y (x, y)

finite set of

s-t tgds

(x)y(x,y)

in PTIME

finite set of

s-t tgds

(x) y (x,y)

finite set of (full)

s-t tgds

(x) (x)

may not be definable:

by any set of s-t tgds;

in FO-logic;

in Datalog

in NP;

can be

NP-complete

Page 13: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

15

Employee Example

12 : e ( Emp(e) m Mgr1(e,m) )

23 : em( Mgr1(e,m) Mgr(e,m) ) e ( Mgr1(e,e) SelfMgr(e) )

Theorem: The composition 12 23 is not definable by any finite set of s-t tgds; is not FO-definable; is not definable in Datalog.

Emp e

Mgr1 e m

Mgr e m

SelfMgr e

Page 14: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

16

Second-Order Tgds

Definition: Let S be a source schema and T a target schema.

A second-order tuple-generating dependency (SO tgd) is a formula of the form:

f1 … fm( (x1(1 1)) … (xn(n n)) ), where

Each fi is a function symbol

Each i is a conjunction of atoms from S and equalities of

terms

Each i is a conjunction of atoms from T

Theorem: The composition of two finite sets of s-t tgds is always definable by a SO-tgd.

Page 15: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

17

Employee Example - revisited

12 : e ( Emp(e) m Mgr1(e,m) )

23 : em( Mgr1(e,m) Mgr(e,m) ) e ( Mgr1(e,e) SelfMgr(e) )

Fact: The composition is definable by the SO-tgd

13 : f (e( Emp(e) Mgr(e,f(e) )

e( Emp(e) (e=f(e)) SelfMgr(e) ) )

Page 16: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

18

Composing SO-Tgds and Data Exchange

Theorem: The composition of two SO-tgds is definable by a SO-tgd

There is a polynomial-time algorithm for composing SO-tgds

The chase procedure can be extended to schema mappings specified by SO-tgds, so that it produces universal solutions in polynomial time

For schema mappings specified by SO-tgds, the certain answers of target conjunctive queries are polynomial-time computable.

Page 17: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

19

Synopsis of Schema Mapping Composition

s-t tgds are not closed under composition.

SO-tgds form a well-behaved fragment of second-order logic. SO-tgds are closed under composition; thus, they are a

“good” language for composing schema mappings. SO-tgds are “chasable”.

Polynomial-time data exchange with universal solutions Polynomial-time computation of certain answers of

target conjunctive queries. SO-tgds form the basis of the schema-mapping language

used in the Criollo metadata management system.

Page 18: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

20

"The notion of composition of maps leads to the most natural

account of fundamental notions of mathematics, from multiplication, addition, and exponentiation, through

the basic notions of logic."

Conceptual Mathematics

by

F.W. Lawevere and S.H. Schanuel

Page 19: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

21

Reduction from 3-Colorability

12 xy (E(x,y) uv (C(x,u) C(y,v))) xy (E(x,y) F(x,y))

23 xyuv (C(x,u) C(y,v) F(x,y) D(u,v))

Let I3 = { (r,g), (g,r), (b,r), (r,b), (g,b), (b,g) }

Given G=(V, E), let I1 be the instance over S1 consisting of the edge relation E

of G

G is 3-colorable iff <I1,I3> Inst(12) Inst(23)

[Dawar98] showed that 3-colorability is not expressible in L

Page 20: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

22

Algorithm Compose(12, 23)

Input: Two schema mappings 12 and 23

Output: A schema mapping 13 = 12 23

Step 1: Split up tgds in 12 and 23

C12 = Emp(e) (Mgr1(e, f(e)) C23 =

Mgr1(e,m) Mgr(e,m) Mgr1(e,e) SelfMgr(e)

Step 2: Compose C12 with C23

1 : Emp(e0) (e=e0) (m=f(e0)) Mgr1(e,m) 2 : Emp(e0) (e=e0) (e=f(e0)) SelfMgr(e)

Step 3: Construct 13

Return 13 = (S1, S3, 13) where 13 = f(e0 em 1 e0e 2)

Page 21: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

23

Data Exchange with SO tgds

Example

Let = (S, T, ST) where ST is:

f( xy (R(x,y) U(x,y,f(x)) xx’yy’ (R(x,y) R(x’,y’) (f(x)=f(x’)) T(y,y’)) )

a b f(a)

a c f(a)

d e f(d)

a b

a c

d e

R Ub b

b c

c b

c c

e e

T

Page 22: Data Exchange & Composition of Schema Mappings Phokion G. Kolaitis IBM Almaden Research Center

24

Data Exchange with SO tgds

Example

Let = (S, T, ST) where ST is:

f( xy (R(x,y) U(x,y,f(x)) xx’yy’ (R(x,y) R(x’,y’) (f(x)=f(x’)) T(y,y’)) )

a b N0

a c N0

d e N1

a b

a c

d e

R Ub b

b c

c b

c c

e e

T