informationsintegration containment und local-as-view anfragebearbeitung 12.1.2006 felix naumann

41
Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

Upload: ursel-bongard

Post on 05-Apr-2015

109 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

Informationsintegration

Containment und Local-as-View

Anfragebearbeitung

12.1.2006

Felix Naumann

Page 2: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 2

Überblick

Wiederholung Global-as-View (GaV) & GaV

Anfragebearbeitung Local-as-View (LaV)

LaV Anfragebearbeitung Containment

Definition Test

Nutzbarkeit und Nützlichkeit von Views

Page 3: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 3

Global as View / Local as View

Global as View Relationen des globalen

Schemas werden als Sichten auf die lokalen Schemas der Quellen ausgedrückt

Local as View Relationen der Schemas der

Quellen werden als Sichten auf das globale Schema ausgedrückt.

Page 4: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 4

Global as View (GaV) – Beispiel

Globales Schema Film(Titel, Regie, Jahr, Genre)

S1: IMDB(Titel, Regie, Jahr, Genre)S2: MyMovies(Titel, Regie, Jahr, Genre)S3: RegieDB(Titel, Regie)S4: GenreDB(Titel, Jahr, Genre)

CREATE VIEW Film ASSELECT * FROM IMDB

UNIONSELECT * FROM MyMovies

UNIONSELECT RegieDB.Titel, RegieDB.Regie, GenreDB.Jahr, GenreDB.GenreFROM RegieDB, GenreDBWHERE RegieDB.Titel = GenreDB.Titel

Quelle: VL „Data Integration“, Alon Halevy, University of Washington, 2002

Page 5: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 5

Anfragebearbeitung – GaV

Gegeben: Anfrage an globales Schema

Insbesondere: Auf Relationen des globalen Schemas Für jede globale Relation genau eine Sicht auf lokale

Quellen Gesucht:

Alle Tupel, die die Anfragebedingungen erfüllen Aber: Daten sind in lokalen Quellen gespeichert.

Idee: Ersetze jede Relation der Anfrage durch ihre Sicht

(View Expansion, Query Unfolding). Geschachtelte Anfrage

Page 6: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 6

GaV – Beispiel

Globales Schema Film(Titel, Regie, Jahr, Genre) Programm(Kino, Titel, Zeit)

SELECT Titel, JahrFROM FilmWHERE Jahr = ‚2003‘

SELECT Titel, Jahr FROM ( SELECT * FROM IMDB

UNION SELECT R.Titel, R.Regie, G.Jahr, G.Genre FROM RegieDB R, GenreDB G WHERE R.Titel = G.Titel

)WHERE Jahr = ‚2003‘

S1: IMDB(Titel, Regie, Jahr, Genre)S2: RegieDB(Titel, Regie)S3: GenreDB(Titel, Jahr, Genre)

Page 7: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 7

GaV – Beispiel

SELECT F.Titel, P.KinoFROM Film F, Programm PWHERE F.Titel = P.TitelAND P.Zeit > 20:00

SELECT F.Titel, F.Jahr FROM ( SELECT * FROM IMDB

UNION SELECT R.Titel, R.Regie, G.Jahr, G.Genre FROM RegieDB R, GenreDB G WHERE R.Titel = G.Titel

) AS F, ( SELECT * FROM KinoDB ) AS PWHERE F.Titel = P.TitelAND P.Zeit > 20:00

S1: IMDB(Titel, Regie, Jahr, Genre)S2: RegieDB(Titel, Regie)S3: GenreDB(Titel, Jahr, Genre)S7: KinoDB(Kino, Genre, Zeit)

Page 8: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 8

Global as View (GaV) Anfrageumschreibung entspricht Sichtentfaltung

Ersetze Sicht durch Sicht-Definition. Konzeptionell:

Ausführung der Anfragen von innen nach außen und Speicherung in temporären Relationen.

Tatsächlich: Optimierungspotential durch Umschreiben der Anfrage (Entschachtelung)

Konzeptionell simpel Neue Quellen hinzufügen ist schwierig.

Alle bisherigen Quellen müssen betrachtet werden. Geeignet für materialisierte Integration

Page 9: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 9

Überblick

Wiederholung Global-as-View (GaV) & GaV

Anfragebearbeitung Local-as-View (LaV)

LaV Anfragebearbeitung Containment

Definition Test

Nutzbarkeit und Nützlichkeit von Views

Page 10: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 10

Local as View (LaV) – Beispiel

Globales Schema Film(Titel, Regie, Jahr, Genre)

S1: IMDB(Titel, Regie, Jahr, Genre)S2: MyMovies(Titel, Regie, Jahr, Genre)S3: RegieDB(Titel, Regie)S4: GenreDB(Titel, Jahr, Genre)

CREATE VIEW S1 ASSELECT * FROM Film

CREATE VIEW S2 ASSELECT * FROM Film

CREATE VIEW S3 ASSELECT Film.Titel, Film.RegieFROM Film

CREATE VIEW S4 ASSELECT Film.Titel, Film.Jahr,

Film.GenreFROM Film

Quelle: VL „Data Integration“, Alon Halevy, University of Washington, 2002

Page 11: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 11

Local as View (LaV) – Beispiel

Globales Schema Film(Titel, Regie, Jahr, Genre)

S9: ActorDB(Titel, Schauspieler, Jahr)

CREATE VIEW S9 ASSELECT Titel, NULL, JahrFROM Film

Page 12: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 12

Local as View (LaV) – Beispiel

Globales Schema Film(Titel, Regie, Jahr, Genre) Programm(Kino, Titel, Zeit)

S7: KinoDB(Kino, Genre)

CREATE VIEW S7 ASSELECT Programm.Kino, Film.GenreFROM Film, ProgrammWHERE Film.Titel = Programm.Titel

Assoziationen des globalenSchemas können in derSicht hergestellt werden.

Page 13: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 13

Local as View (LaV) – Beispiel

Globales Schema Film(Titel, Regie, Jahr, Genre) Programm(Kino, Titel, Zeit)

S8: NeueFilme(Titel, Regie, Genre)(Nebenbedingung: Jahr > 2000)

CREATE VIEW S8 ASSELECT Titel, Regie, NULL, GenreFROM FilmWHERE Jahr > 2000

Page 14: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 14

Local as View (LaV) – Beispiel

Globales Schema NeuerFilm(Titel, Regie, Jahr, Genre) Programm(Kino, Titel, Zeit) Nebenbedingung: Jahr > 2000

S1: IMDB(Titel, Regie, Jahr, Genre)S2: MyMovies(Titel, Regie, Jahr, Genre)

CREATE VIEW S1 ASSELECT * FROM NeuerFilm

CREATE VIEW S2 ASSELECT * FROM NeuerFilm

Page 15: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 15

Local as View (LaV)

Flexibel Beschreibung der Quellen mit voller Mächtigkeit

der Anfragesprache Quellen können leicht hinzugefügt werden

(unabhängig von bisherigen Quellen) Anfrageumschreibung schwierig

Answering Queries using Views Viele potentielle (und überlappende) Pläne

Geeignet für virtuelle Integration

Page 16: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 16

Überblick

Wiederholung Global-as-View (GaV) & GaV

Anfragebearbeitung Local-as-View (LaV)

LaV Anfragebearbeitung Containment

Definition Test

Nutzbarkeit und Nützlichkeit von Views

Page 17: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 17

Problem Anfrageverarbeitung

Globales Schema Film(Titel, Regie, Jahr, Genre)

S1: IMDB(Titel, Regie, Jahr, Genre)S2: RegieDB(Titel, Regie)S3: GenreDB(Titel, Jahr, Genre)

GaVCREATE VIEW Film ASSELECT * FROM IMDB

UNIONSELECT R.Titel, R.Regie, G.Jahr, G.GenreFROM RegieDB R, GenreDB GWHERE R.Titel = G.Titel

LaVCREATE VIEW S1 ASSELECT * FROM Film

CREATE VIEW S2 ASSELECT Film.Titel, Film.RegieFROM Film

CREATE VIEW S3 ASSELECT Film.Titel, Film.Jahr,

Film.GenreFROM Film

Page 18: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 18

Anfragebearbeitung – LaV Gegeben:

Anfrage an globales Schema Insbesondere: Auf Relationen des globalen Schemas

Für jede lokale Relation genau eine Sicht auf globales Schema

Gesucht: Alle Tupel, die die Anfragebedingungen erfüllen Aber: Daten sind in lokalen Quellen gespeichert.

Idee: Anfrageumschreibung durch Einbeziehung der Sichten Kombiniere geschickt die einzelnen Sichten zu einer

Anfrage, so dass deren Ergebnis einen Teil der Anfrage (oder die ganze Anfrage) beantworten.

Page 19: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 19

LaV Anfrageumschreibung – BeispielAusschnitt Globales Schema Lehrt(prof,kurs_id, sem, eval, univ) Kurs(kurs_id, titel, univ)

Quelle 1: Alle Datenbankveranstalt. CREATE VIEW DB-kurs AS SELECT K.titel, L.prof, K.kurs_id, K.univ FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND L.univ = K.univ AND K.titel LIKE „%_Datenbanken“

Quelle 2: Alle Humboldtvorlesungen CREATE VIEW Hum-VL AS SELECT K.titel, L.prof, K.kurs_id, K.univ FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND K.univ = „Humboldt“ AND L.univ = „Humboldt“ AND K.titel LIKE „%VL_%“

Globale Anfrage SELECT prof FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND K.titel LIKE „%_Datenbanken“ AND L.univ = „Humboldt“

Umgeschriebene Anfrage SELECT prof FROM DB-kurs D WHERE D.univ = „Humboldt“

Frage: Warum nicht Quelle 2 einbeziehen?

Page 20: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 20

LaV Visualisierung (OWA)

Globales Schema

Lokales Schema

RelA RelB

RelC

LaV

RelC = RelA ⋈ RelB

Lokales Schema

RelD

RelD = RelB

Nutzer-Anfrage

SELECT ???FROM RelBWHERE ???

Umgeschriebene AnfrageSELECT ???FROM RelDWHERE ???UNIONSELECT Attr(B)FROM RelCWHERE ???

Anfrage-umschreibung

Page 21: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 21

LaV Visualisierung

Globales Schema

Lokales Schema

RelA RelB

RelC

LaV

RelC = RelA ⋈ RelB

Lokales Schema

RelD

RelB = RelD

Nutzer-Anfrage

SELECT ???FROM RelA, RelBWHERE ???

Umgeschriebene Anfrage

SELECT ???FROM RelCWHERE ???

Anfrage-umschreibung

Page 22: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 26

LaV – Beispiel

Ausschnitt Globales Schema Lehrt(prof,kurs_id, sem, eval, univ) Kurs(kurs_id, titel, univ)Quelle 1: Alle Datenbankveranstalt. CREATE VIEW DB-kurs AS SELECT K.titel, L.prof, K.kurs_id, K.univ FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND L.univ = K.univ AND K.titel LIKE „%_Datenbanken“

Quelle 2: Alle Humboldtvorlesungen CREATE VIEW Hum-VL AS SELECT K.titel, L.prof, K.kurs_id, K.univ FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND K.univ = „Humboldt“ AND L.univ = „Humboldt“ AND K.titel LIKE „%VL_%“

Globale Anfrage SELECT titel, kurs_id FROM Kurs K WHERE L.univ = „Humboldt“

Umgeschriebene Anfrage SELECT titel, kurs_id FROM DB-kurs D WHERE D.univ = „Humboldt“ UNION SELECT titel, kurs_id FROM Hum-VL Frage:

Warum hier dochQuelle 2 einbeziehen?

Page 23: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 27

LaV – Beispiel Vergleich

Globale Anfrage SELECT titel, kurs_id FROM Kurs K WHERE L.univ = „Humboldt“

Umgeschriebene Anfrage SELECT titel, kurs_id FROM DB-kurs D WHERE D.univ = „Humboldt“ UNION SELECT titel, kurs_id FROM Hum-VL

Globale Anfrage SELECT prof FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND K.titel = „%_Datenbanken“ AND L.univ = „Humboldt“

Umgeschriebene Anfrage SELECT prof FROM DB-kurs D WHERE D.univ = „Humboldt“

Vollständige Antwort (CWA)

Frage: Welche Daten fehlen hier?

MaximaleAntwort

Page 24: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 28

LaV – Anfragebearbeitung

Gegeben: Anfrage Q und Sichten V1, ..., Vn

Gesucht: Umgeschriebene Anfrage Q‘, die bei Optimierung (mit MVs): äquivalent ist (Q = Q‘). bei Integration: maximal enthalten ist.

D.h. Q Q‘ und es existiert kein Q‘‘ mit Q Q‘‘ Q‘ wobei Q‘‘ Q‘.

Problem: Wie definiert und testet man Äquivalenz bzw.

maximal containment?

Page 25: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 29

Überblick

Wiederholung Global-as-View (GaV) & GaV

Anfragebearbeitung Local-as-View (LaV)

LaV Anfragebearbeitung Containment

Definition Test

Nutzbarkeit und Nützlichkeit von Views

Page 26: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 30

LaV – Anfrageumschreibungen

Gegeben Anfrage Q (query) Sicht V (view)

Fragen Ist Ergebnis von V identisch dem Ergebnis von Q? Kurz: Ist V äquivalent zu Q, V = Q ?

Rückführung auf „Enthalten sein“ (containment) Ist das Ergebnis von V in Q enthalten? Kurz: Ist V in Q enthalten, V Q ?

Denn V Q, Q V V = Q

Quelle: VL Data Warehousing, Prof. Ulf Leser, HU Berlin

Page 27: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 31

LaV – Anfrageumschreibungen

Query containment (Anfrage-“Enthaltensein“) Sei S ein Schema. Seien Q und Q‘ Anfragen gegen S. Eine Instanz von S ist eine beliebige Datenbank D mit

Schema S. Das Ergebnis einer Anfrage Q gegen S auf einer

Datenbank D, geschrieben Q(D), ist die Menge aller Tupel, die die Ausführung von Q in D ergibt.

Q‘ ist contained (enthalten) in Q, geschrieben Q‘ Q, gdw. Q‘(D) Q(D) für jedes mögliche D.

Quelle: VL Data Warehousing, Prof. Ulf Leser, HU Berlin

Page 28: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 32

LaV – Anfrageumschreibungen

Query equivalence (Anfrageäquivalenz) Q ist äquivalent mit Q‘, geschrieben Q = Q‘, gdw.

Q(D) Q‘(D) und Q(D) Q‘(D) für jede mögliche Datenbank D.

Wichtig Es zählt das Ergebnis einer Anfrage, nicht die

Syntax.

Page 29: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 33

LaV – Beispiele

SELECT K.titel, L.prof, K.kurs_id, K.univ FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND K.univ = „Humboldt“ AND L.univ = „Humboldt“ AND K.titel LIKE „%VL_%“

SELECT K.titel, L.prof, K.kurs_id, K.univ FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND K.univ = „Humboldt“ AND L.univ = „Humboldt“

???

Page 30: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 34

LaV – Beispiele

SELECT K.titel, K.kurs_id FROM Kurs K AND K.univ = „Humboldt“ AND K.titel LIKE „%VL_%“

???SELECT K.titel, K.univ FROM Kurs K AND K.univ = „Humboldt“ AND K.titel LIKE „%VL_%“

SELECT K.titel, K.kurs_id FROM Kurs K AND K.univ = „Humboldt“

???SELECT K.titel FROM Kurs K AND K.univ = „Humboldt“

Page 31: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 35

LaV – Beispiele

Prüfung von containment durch Prüfung aller möglichen Datenbanken? Zu complex!

Prüfung von containment durch Existenz eines containment mapping. NP-vollständig in |Q|+|Q‘|

nach [CM77] Mehrere Algorithmen

???Quelle 5: CREATE VIEW Kurse2 AS SELECT K.titel, K.univ FROM Kurs K AND K.univ = „Humboldt“

Quelle 3: CREATE VIEW Hum-Kurse AS SELECT K.titel, K.univ FROM Lehrt L, Kurs K WHERE L.kurs_id = K.kurs_id AND K.univ = „Humboldt“ AND L.univ = „Humboldt“

Page 32: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 36

Datalog Notation Im Folgenden: Nur Konjunktive Anfragen

Nur Equijoins und Bedingungen mit =,<,> zw. Attribut und Konstanten

Kein NOT, EXISTS, GROUP BY, , X>Y, ... Schreibweise: Datalog / Prolog

SELECT Klausel Regelkopf, Exportierte Attribute

FROM Klausel Relationen werden zu Prädikaten

WHERE Klausel Joins werden durch gleiche Attributnamen angezeigt Bedingungen werden explizit angegeben

Page 33: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 37

SQL – DatalogSELECT S.price, L.region_nameFROM sales S, time T, ... WHERE S.day_id = T.day_id AND

S.product_id = P.product_id ANDS.shop_id = L.shop_id ANDL.shop_id = 123 ANDT.year > 1999

q(P,RN) :- sales(SID,PID,TID,RID,P,...), time(TID,D,M,Y), localization(LID,SN,RN), product(PID,PN,PGN), Y > 1999, SID = 123

SELECT FROM WHERE Joins

Page 34: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 38

Query Containment

A query p is contained in a query u, p u, iff all tuples computed by p are also computed by u for every DB.

Beispiele (Regelkopf weggelassen) map(Mn,Ms) map(Mn,Ms); map(Mn,Ms), Mn = ‘HGM’ map(Mn,Ms); map(Mn,Ms), Ms<500 map(Mn,Ms); map(Mn,Ms), clone(Mn,Cn,-) map(Mn,Ms); clone(Mn,Cn,Cs), clone(Mn,Cn,Cs)

clone(Mn,Cn,Cs);Quelle: Folien Ulf Leser

Page 35: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 39

Beweis für Query Containment

p u gdw ein containment mapping von u nach p existiert. Containment mapping:

h: sym(u) → sym(p) (Abbildung der Symbole) CM1: Jede Konstante in u wird auf die gleiche Konstante in p

abgebildet. CM2: Jede exportierte Variable in u wird auf eine exportierte

Variable in p abgebildet. CM3: Jedes Literal (Relation) in u wird auf mindestens ein Literal in

p abgebildet CM4: Die Bedingungen von p implizieren die Bedingungen von u

Beweis: [CM77]

map(Mn,Ms),clone(Mn,Cn,-,-) map(Mn,Ms);Quelle: Folien Ulf Leser

Page 36: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 40

Finden von Containment Mappings

Problem ist NP vollständig Exponentiell in der Anzahl der Literale Beweis: Reduktion auf „Exakt Cover“

Also: Alles ausprobieren Aufbau eines Suchbaums

Jede Ebene entspricht einem Literal Auffächerung nach möglichen CMs

Algorithmus Nicht hier siehe DWH VL Ulf Leser

Page 37: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 41

CM Beispiele

Quelle: DWH VL Leser

Page 38: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 42

CM Beispiele

Quelle: DWH VL Leser

Page 39: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 43

Erzeugung der Anfragen

Beobachtung: Interpretation als containment

name,spendeID,betrag(spendenDB.firmen spendenDB.spenden)

orgname,spendeID,menge(haushaltDB.stadtHaushalt.org.einnahmen haushaltDB.stadtHaushalt.buchungen)

name(spendenDB.firmen)

orgname(haushaltDB.stadtHaushalt.org)

Page 40: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 44

Literatur Gute Zusammenfassung für LaV und weiterführende Literatur:

[Hal01] Alon Y. Halevy: Answering queries using views: A survey, in VLDB Journal 10: 270-294, 2001.

Weitere Literatur [Ull97] Jeffrey D. Ullman: Information Integration Using Logical

Views. ICDT 1997: 19-40 [CM77] Ashok K. Chandra and Philip M. Merlin. Optimal

implementation of conjunctive queries in relational data bases. In Conference Record of the Ninth Annual ACM Symposium on Theory of Computing, pages 77-90, Boulder, Colorado, 2-4 May 1977.

[LMSS95] Alon Y. Levy, Alberto O. Mendelzon, Yehoshua Sagiv, Divesh Srivastava: Answering Queries Using Views. PODS 1995: 95-104

Page 41: Informationsintegration Containment und Local-as-View Anfragebearbeitung 12.1.2006 Felix Naumann

12.1.2006 Felix Naumann, VL Informationsintegration, WS 05/06 45

LaV – Beispiel

Globales Schema Prof(name, bereich) Kurs(kurs_id, titel, univ) Lehrt(prof,kurs_id, sem, eval, univ) Eingeschrieben(stud, kurs_id, sem) Vertiefung(stud, fach) Arbeitet(prof, fach) Betreut(prof, stud)

Prof

fach

stud

name

Kurs

name name

bereich

lehrteval

sem

Betreut

Eingeschrieben

sem

VertiefungArbeitet

titel kurs_id