17
Data Sharing Through Query Translation in Peer-to-Peer Systems Md. Mehedi Masud http://www.site. uottawa .ca/~ mmasud Fazel Keshtkar http://www.site. uottawa .ca/~akesh081 Course: CSI5311 Prof: Dr. Iluju Kiringa http://www.site. uottawa .ca/~ kiringa March 24,2004

Data Sharing Through Query Translation in Peer-to-Peer Systems

Embed Size (px)

DESCRIPTION

Data Sharing Through Query Translation in Peer-to-Peer Systems. Md. Mehedi Masud http://www.site.uottawa.ca/~mmasud Fazel Keshtkar http://www.site.uottawa.ca/~akesh081. Course: CSI5311 Prof: Dr. Iluju Kiringa http://www.site.uottawa.ca/~kiringa March 24,2004. Outline. Problem Statement - PowerPoint PPT Presentation

Citation preview

Page 1: Data Sharing Through Query Translation in Peer-to-Peer Systems

Data Sharing Through Query Translation in Peer-to-Peer Systems

Md. Mehedi Masudhttp://www.site.uottawa.ca/~mmasud

Fazel Keshtkarhttp://www.site.uottawa.ca/~akesh081

Course: CSI5311

Prof: Dr. Iluju Kiringa

http://www.site.uottawa.ca/~kiringa

March 24,2004

Page 2: Data Sharing Through Query Translation in Peer-to-Peer Systems

2

Outline

Problem Statement Motivating Example Scenario Peer-to-Peer Query Query Translation Algorithm Future Work and Conclusion

Page 3: Data Sharing Through Query Translation in Peer-to-Peer Systems

3

Problem Description

We have autonomous nodes/peers Autonomous structured Data source(Database) No global schema, no centralized control Query is posed against the schema of local

peer/node Query propagates to other peers to retrieve

related data from other peers

Page 4: Data Sharing Through Query Translation in Peer-to-Peer Systems

4

Related Work

Mapping table and their Semantics [Kementsietsdis] Keyword-based search [Y. Sagiv and M. Yannakakis] Queries on Homogeneous Schemas [ Huebsch] Queries using syntactic rule [C.C. K. Chang and H. Garcia-Molin]

Page 5: Data Sharing Through Query Translation in Peer-to-Peer Systems

5

Flight Dt Tm To

UA120UA134UA135UA141

11/1511/1511/2111/22

10:3011:0012:0007:00

JFKLAXONTORD

(b) United Instance

Fno Date Time Dest

LH401LH541LH690LH691

11/0511/1511/2111/22

10:0010:3012:0012:00

S.F.N.Y.L.A.L.A.

(a) Lufthansa Instance

Fno Flight

LH541LH690

UA120UA135

(c)Table fno2flight

Dest To

N.Y.N.Y.N.Y.L.A.L.A.

JFKLGAEWRLAXONT

(e) Table dest2toDate Dt

X X(d) Table date2dt

Q1. Select *

from LH

where dest = “L.A”

What if user also wants to retrieve information from UA flights to Los Angels. The following will be like

Q2. Select *

from UA

where (to= “LAX” OR to = “ONT”)

How this is achieved?

EXAMPLE SCENARIO

Page 6: Data Sharing Through Query Translation in Peer-to-Peer Systems

6

Peer-2-Peer Query

•Query Semantics

•Mapping Tables

•Sound and Complete Translations of Query

Page 7: Data Sharing Through Query Translation in Peer-to-Peer Systems

7

Query Semantics

•Local Query

•Global Query

•Query Dependencies ( dep(qk)= qj )

P1

P3

P5 P2

P6P4

Peer-to-peer Network

P1

P3

P5 P2

P6

P4

q26

q4

q3

q2

q1

q25

q15

q16

Annotated Network

q1

q3

q52

q4q61 q5

1

q62 q2

Query Dependency Graph

How exactly and possible translation of queries are achieved?

qP=(q1,q2,q3,q4,q15, q2

5, q16 q2

6 )

Page 8: Data Sharing Through Query Translation in Peer-to-Peer Systems

8

Sound and Complete Translations

•Let q1 and q2 be queries over peers P1 and P2 and m be a mapping table of the two peers and q1= E(R)

•Then q2 is a sound translation of q1 with respect to mapping table m, denoted by q1| q2, if for every relation instance r2 of P2 and t2 q2(r2), there exists a valuation of m and a tuple t E((m)) such that att(q2)(t) = t2

m

Page 9: Data Sharing Through Query Translation in Peer-to-Peer Systems

9

Example

Flight Dt Tm To

UA120UA134UA135UA141

11/1511/1511/2111/22

10:3011:0012:0007:00

JFKLAXONTORD

(b) United Instance

Fno Date Time Dest

LH401LH541LH690LH691

11/0511/1511/2111/22

10:0010:3012:0012:00

S.F.N.Y.L.A.L.A.

(a) Lufthansa Instance

Q1. Select *

from LH

where dest = “L.A”

Q2. Select *

from UA

where (to= “LAX OR to = “ONT”)

Mapping table LH2UA

Q3. select * from UA where to=“LAX”

Q4. select * from UA

where to = “LAX” OR to =“JFK”

Fno Date Time Dest Flight Dt Tm To

X1X2

Y1Y2

Z1Z1

L.A.L.A.

X2X4

Y2Y4

Z2Z4

LAXONT

Page 10: Data Sharing Through Query Translation in Peer-to-Peer Systems

10

Algorithm for Sound and Complete translation

Let two queries q and q over peer P and P and the mapping table is m between them

1. Converts both q and q to their corresponding T-queries

qT= T and qT = T

2. Constructs a T-query qcT with attributes att(q) defined as

qTc = att(q)(T m T)

3. Checks whether qTc is equivalent to qT that is. For every instance r of peer P,

qTc (r) = qT(r)

4. If qTc is equivalent qT then the algorithm output yes

P

P

q

q

qT

qT

T

T

m qTc Check(qT

C(r/) = q/T(r/))

Yes No

Page 11: Data Sharing Through Query Translation in Peer-to-Peer Systems

11

Computing Translation

- Let P and P/ be two peers that expose attributes U and U/

- q is query over P

- m is mapping table between the set of attributes U and U/

- convert q to q/ with respect to mapping table m

Algorithm

Step1. Convert query q to its corresponding T-query qT = T

Step2. Computes T-query q/T = U(T m)

Step3. Outputs the query q from q/T

Page 12: Data Sharing Through Query Translation in Peer-to-Peer Systems

12

Example

Fno Date Time Dest

X1 Y1 Z1 LA

Step 1: Create T-query

Step 2: Computes T-query

q/T = U(T m)

Relation at peer P1 Relation at peer P2 LH ( fno, date, time, dest) UA ( flight, dt, tm, to)

Query: Select * from LH where dest = “L.A”

Flight Dt Tm To

X2

X4

Y2

Y4

Z2

Z4

LAX

ONT

Step 3: Translated Query

q/ = select * from UA where to = “LAX” or to=“ONT”

q/T

Fno Date Time Dest Flight Dt Tm To

X1X2

Y1Y2

Z1Z1

L.A.L.A.

X2X4

Y2Y4

Z2Z4

LAXONT

Mapping Table

Page 13: Data Sharing Through Query Translation in Peer-to-Peer Systems

13

Using Multiple Mapping Tables

•Converts q into its equivalent disjunctive normal form

•Proceed with each disjunct Dj

•For each Dj, select a mapping table mj for the translation

•For each Dj consider it as T-query Tj

Query posed in Peer 1

Select * from LH

where dest =“LA” AND date=“11/21”

Translated query

Select * from UA

where (to=“LAX” OR to=“ONT”) AND dt= “11/21”

Mapping table used

date2dt and dest2to

Page 14: Data Sharing Through Query Translation in Peer-to-Peer Systems

14

Query ProcessingEngine

Map. TableManager

SQLParser

Network Layer

Servant

GraphicalUser Interface

Local DB

Map. Tables

To Peer-to-Peer

Network

The Architecture of peer

Page 15: Data Sharing Through Query Translation in Peer-to-Peer Systems

15

Future work and Conclusion

•Problems of data sharing between autonomous source have been discussed

•How to use mapping tables to translate query

•Proposed algorithm to compute sound and complete

translation of query

The idea can be enhanced to support more expressive query, like negation, join and complex query

Page 16: Data Sharing Through Query Translation in Peer-to-Peer Systems

16

Thanx

Page 17: Data Sharing Through Query Translation in Peer-to-Peer Systems

17

T-Queries

How to construct T-Query?

• Transform query q into an equivalent query q/ of

the from E(R), where E is in disjunctive form.

•Create table with attribute R and add each row for

each disjunctive form

Example:

select * from LH where dest =“L.A” OR dest = “S.F”

Fno Date Time Dest

X1

X2

Y1

Y2

Z1

Z2

LA

SF

T-Query qT