Non-Standard-Datenbanken Probabilistische Datenbanken Prof. Dr. Ralf Möller Universität zu Lübeck Institut für Informationssysteme.

Slides:



Advertisements
Ähnliche Präsentationen
Algorithmentheorie 08 – Dynamische Programmierung (1)
Advertisements

ER-Datenmodell und Abfragen in SQL
6. Regelbasierte Systeme
Datenbanken Einführung.
Objekt – Relationales – Modell Tomasz Makowski IN
Bauinformatik II Softwareanwendungen 1
Systemüberblick Beispiele: Microsoft Access Oracle Ingres Informix
Informatik II, SS 2008 Algorithmen und Datenstrukturen Vorlesung 4 Prof. Dr. Thomas Ottmann Algorithmen & Datenstrukturen, Institut für Informatik Fakultät.
SQL als Abfragesprache
SQL als Abfragesprache
SQL/XML. © Prof. T. Kudraß, HTWK Leipzig 2 2 Motivation Speicherung von XML in allen großen kommerziellen DBMS vorhanden proprietäre Lösungen für die.
Prof. Dr. T. Kudraß1 Relationenkalkül. Prof. Dr. T. Kudraß2 Relationenkalkül Zwei Ausprägungen: Tupelrelationenkalkül (TRK) und Domänenrelationenkalkül.
Prof. Dr. T. Kudraß1 Relationen-Algebra. Prof. Dr. T. Kudraß2 Relationale Anfragesprachen Query Language (QL): Manipulation und Retrieval von Daten einer.
Text-Retrieval mit Oracle Vortrag von Andreas Mück & David Diestel.
Übung Datenbanksysteme SQL-Anfragen (2)
Datenintegrität Referentielle Integrität create table
Einführung Dateisystem <-> Datenbanksystem
Abfragen – Tipps und Tricks Buch S102ff (Informatik I, Oldenbourg-Verlag) Nach einer Vorlage von Dieter Bergmann.
Universität Karlsruhe (TH) © 2009 Univ,Karlsruhe, IPD, Prof. LockemannDBI 10 Kapitel 10 Anfragebearbeitung.
SQL in Visual FoxPro. © 1999 TMN-Systemberatung GmbH SQL Historie n SQL - Structured Query Language n In den 70er Jahren von IBM entwickelt n 1986 zum.
Wahrscheinlichkeitsrechnung
SQL PHP und MySQL Referat von Katharina Stracke und Carina Berning
Effiziente Algorithmen
Die Grundterminologie
Betrieb von Datenbanken Marco Skulschus & Marcus Wiederstein Datenmanipulation Lehrbuch, Kapitel 4.
Black Box Algorithmen Hartmut Klauck Universität Frankfurt SS
Quantum Computing Hartmut Klauck Universität Frankfurt WS 05/
XML-Query. Übersicht Was ist XML-Query? Vergleich RDB XML-Dokument Syntaktisches und Use-Cases Kritik und Diskussion.
SQL Überblick Abfragen aus einer Tabelle
SS 2004 Datenbanken 4W Mi 13:30 – 15:00 G 2.30 Vorlesung #7 SQL (Teil 2)
SS 2004 Datenbanken 4W Mi 13:30 – 15:00 G 2.30 Vorlesung #5 Relationale Anfragesprachen.
WS 2013/14 Datenbanksysteme D0 15:15 – 16:45 R Vorlesung #5 SQL (Teil 2)
Erfindervon Fuzzy Logic
Datenbanksysteme für hörer anderer Fachrichtungen
DI (FH) DI Roland J. Graf MSc (GIS) U N I V E R S I T Ä T S L E H R G A N G Geographical Information Science & Systems UNIGIS.
Generalisiertes Vektorraummodell (Generalized Vector Space Model, GSVM) Karin Haenelt
Einführung in Datenbankmodellierung und SQL
Freiwillige Feuerwehr der Stadt Perg
WS 2011/12 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #5 SQL (Teil 2)
1 Gruppierung, Aggregierung und Sortierung (2) Abarbeitungsmodell bei Gruppierung: Werte from- und where-Klauseln aus wie bisher (Bildung von Kreuzprodukt.
Trust and context using the RDF- Source related Storage System (RDF‑S3) and easy RQL (eRQL) Karsten Tolle und Fabian Wleklinski.
SQL - Structured Query Language AIFB SS (1/9) Join-Operationen in SQL-92(1/9) Syntax einer Join-Operation: join-op := CROSS JOIN | [NATURAL]
Structured Query Language
Eike Schallehn, Martin Endig
WS 2004/2005 Datenbanken II - 5W Mi 17:00 – 18:30 G 3.18 Vorlesung #3 Anfragebearbeitung (Teil 1)
Non-Standard-Datenbanken
Einführung Dateisystem <-> Datenbanksystem
WS 2014/15 Datenbanksysteme D0 15:15 – 16:45 R Vorlesung #6 SQL (Teil 3)
Vordefinierte Datentypen (1)
1 Syntaktische Grundform selectA 1, A 2, …, A n fromR 1, R 2, …, R m wherebedingung w ;
Datenbank System (DBS) - Warum?
Vorlesung Datenbanksysteme vom Anfragebearbeitung  Logische Optimierung.
Algorithmen und Datenstrukturen
Algorithmen und Datenstrukturen
Datenbanken erstellen mit PostgreSQL
Datenbanken abfragen mit SQL
Geoinformationssysteme
Non-Standard-Datenbanken Prof. Dr. Ralf Möller Universität zu Lübeck Institut für Informationssysteme Marc Stelzner (Übungen)
Dr. Klaus Ruhlig Technology & Product Consulting Sun Microsystems, München Skalierbare Rechnerarchitekturen für ein DWH: Eine vergleichende Analyse.
Non-Standard-Datenbanken
DOAG SID Data Warehouse
Algorithmen und Datenstrukturen
Vorlesung #4 Relationales Kalkül und SQL (Teil 1)
Non-Standard-Datenbanken
Non-Standard-Datenbanken
Non-Standard-Datenbanken
Indexierung Oracle: indexes Indexierung.
Non-Standard-Datenbanken und Data Mining
Algorithmen und Datenstrukturen
(Structured Query Language)
 Präsentation transkript:

Non-Standard-Datenbanken Probabilistische Datenbanken Prof. Dr. Ralf Möller Universität zu Lübeck Institut für Informationssysteme

Probabilistisches Datenmodell Non-Standard-Datenbanken Extensionale Anfragepläne Extensionale Evaluation Probabilistische Datenbanken Einführung: Motivierende Anwendungen

Danksagung Die Präsentationen sind nach einem Tutorial von Dan Suciu gestaltet und basieren auf dem Lehrbuch Probabilistic Databases 3

Probabilistische Datenbanken Daten: Relationale Daten plus Wahrscheinlichkeiten, um Grad der Unsicherheit auszudrücken Anfragen: SQL-Anfragen, deren Antworten annotiert sind mit Ausgabewahrscheinlichkeiten Formale Logik kombiniert mit Inferenzen über Wahrscheinlichkeiten Ermöglicht Ihnen einen neuen Blick auf beides, Datenbanken und Wahrscheinlichkeiten 4 Probabilistic Databases - Dan Suciu

Beispiel 1: Informationsextraktion 52-A Goregaon West Mumbai Extraktion Standard DB: Speichere nur wahrscheinlichste Extraktion Probabilistische DB: Speichert die meisten/alle Extraktionen um Recall zu erhöhen 5 Kernidee: Wahrscheinlichkeiten gegeben durch Extraktion korrelieren mit der Präzision der Extraktion Gupta, Sarawagi: Creating Probabilistic Databases from Information Extraction Models. VLDB 2006 Probabilistic Databases - Dan Suciu

Beispiel 2: Modellierung fehlender Daten Standard-DB: NULL Probabilistische DB: Verteilung auf mögl. Werten 6 Kernidee: Inferiere Verteilung für fehlende Daten. Kernidee: Inferiere Verteilung für fehlende Daten. Stoyanovich, Davidson, Milo, Tannen: Deriving probabilistic databases with inference ensembles. ICDE 2011 Probabilistic Databases - Dan Suciu

Beispiel 3: Datenreinigung Standard-DB Reinigung bedeutet eine mögliche Reparatur zu wähen Probabilistische DB Speichere viele/alle möglichen Reparaturen 7 Herausforderung: Representation von multiplen Reparaturen Beskales, Soliman, Ilyas, Ben-David: Modeling and Querying Possible Repairs in Duplicate Detection. PVLDB 2009 Probabilistic Databases - Dan Suciu

Beispiel 4: OCR Verwendung von OCRopus von Google Books: Ausgabe ist stochastischer Automat Üblicherweise wird nur Maximum Apriori Estimate (MAP) gespeichert Mit probabilistischer Databasis: Speicherung verschiedener Möglichkeiten: Erhöhe Recall. 8 SELECT DocId, Loss FROM Claims WHERE Year = 2010 AND DocData LIKE '%Ford%’; Kumar, Ré: Probabilistic Management of OCR Data using an RDBMS. PVLDB 2011 Probabilistic Databases - Dan Suciu

Zusammenfassung der Anwendungen Strukturierte, aber unsichere Daten Modelliert als probabilistische Daten Antworten für SQL queries annotiert mit Wahrscheinlichkeiten 9 Probabilistische Datenbank: Kombination aus Standard-Datenmanagement mit probabilistischer Inferenz Probabilistische Datenbank: Kombination aus Standard-Datenmanagement mit probabilistischer Inferenz Probabilistic Databases - Dan Suciu

Probabilistisches Datenmodell Non-Standard-Datenbanken Extensionale Anfragepläne Extensionale Evaluation Probabilistische Datenbanken Einführung: Motivierende Anwendungen

Wiederholung: Relationales Datenmodell 11 ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner Daten: gespeichert in Relationen (= Tabellen) Probabilistic Databases - Dan Suciu

Wiederholung: Relationales Datenmodell 12 ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner Anfragen: SQL, Daten: gespeichert in Relationen (= Tabellen) Find all owners of objects in the Office -- SQL: z.B. Postgres SELECT DISTINCT Owner.name FROM Owner, Location WHERE Owner.object = Location.object and Location.loc = ‘Office’ -- SQL: z.B. Postgres SELECT DISTINCT Owner.name FROM Owner, Location WHERE Owner.object = Location.object and Location.loc = ‘Office’ Probabilistic Databases - Dan Suciu

Wiederholung: Relationales Datenmodell 13 ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner Daten: gespeichert in Relationen (= Tabellen) Anfragen: SQL, Find all owners of objects in the Office Vereinigung konjunktiver Anfragen Unions of Conjunctive Queries (UCQs) -- SQL: z.B. Postgres SELECT DISTINCT Owner.name FROM Owner, Location WHERE Owner.object = Location.object and Location.loc = ‘Office’ -- SQL: z.B. Postgres SELECT DISTINCT Owner.name FROM Owner, Location WHERE Owner.object = Location.object and Location.loc = ‘Office’ NB x,t sind existenzquantifiziert: Q(z) = Owner(z,x), Location(x,t,y),y=‘Office’ Q(z) = ∃ x ∃ t (Owner(z,x), Location(x,t,’Office’)) Probabilistic Databases - Dan Suciu

Wiederholung: Relationales Datenmodell 14 ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner Antwort: Q= Name Joe Jim Daten: gespeichert in Relationen (= Tabellen) Anfragen: SQL, Find all owners of objects in the Office Vereinigung konjunktiver Anfragen Unions of Conjunctive Queries (UCQs) -- SQL: z.B. Postgres SELECT DISTINCT Owner.name FROM Owner, Location WHERE Owner.object = Location.object and Location.loc = ‘Office’ -- SQL: z.B. Postgres SELECT DISTINCT Owner.name FROM Owner, Location WHERE Owner.object = Location.object and Location.loc = ‘Office’ NB x,t sind existenzquantifiziert: Q(z) = Owner(z,x), Location(x,t,y),y=‘Office’ Q(z) = ∃ x ∃ t (Owner(z,x), Location(x,t,’Office’)) Probabilistic Databases - Dan Suciu

Wiederholung: Relationales Datenmodell 15 ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner Antwort: Q= Name Joe Jim Daten: gespeichert in Relationen (= Tabellen) Anfragen: SQL, Find all owners of objects in the Office Vereinigung konjunktiver Anfragen Unions of Conjunctive Queries (UCQs) -- SQL: z.B. Postgres SELECT DISTINCT Owner.name FROM Owner, Location WHERE Owner.object = Location.object and Location.loc = ‘Office’ -- SQL: z.B. Postgres SELECT DISTINCT Owner.name FROM Owner, Location WHERE Owner.object = Location.object and Location.loc = ‘Office’ NB x,t sind existenzquantifiziert: Q(z) = Owner(z,x), Location(x,t,y),y=‘Office’ Q(z) = ∃ x ∃ t (Owner(z,x), Location(x,t,’Office’)) Probabilistic Databases - Dan Suciu

Wiederholung: Komplexität der Anfragebeantwortung Anfrage Q, Datenbank D Datenkomplexität: fix Q, Komplexität = f(D) Anfragekomplexität: fix D, Komplexität = f(Q) Kombinierte Komplexität: Komplexität = f(D,Q) Datenkomplexität wird im Bereich der Datenbankforschung betrachtet Probabilistic Databases - Dan Suciu

Probabilistisches Datenmodell Non-Standard-Datenbanken Extensionale Anfragepläne Extensionale Evaluation Probabilistische Datenbanken Einführung: Motivierende Anwendungen

Unvollständige Datenbank 18 Definition Eine unvollständige Datenbank ist eine endliche Menge von Datenbankinstanzen W = (W 1, W 2, …, W n ) Jedes W i heißt mögliche Welt Probabilistic Databases - Dan Suciu

Unvollständige Datenbank 19 Definition Eine unvollständige Datenbank ist eine endliche Menge von Datenbankinstanzen W = (W 1, W 2, …, W n ) Jedes W i heißt mögliche Welt ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner Probabilistic Databases - Dan Suciu

Unvollständige Datenbank 20 Definition Eine unvollständige Datenbank ist eine endliche Menge von Datenbankinstanzen W = (W 1, W 2, …, W n ) Jedes W i heißt mögliche Welt ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Probabilistic Databases - Dan Suciu

Unvollständige Datenbank 21 Definition Eine unvollständige Datenbank ist eine endliche Menge von Datenbankinstanzen W = (W 1, W 2, …, W n ) Jedes W i heißt mögliche Welt ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Location NameObject JimLaptop77 Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Probabilistic Databases - Dan Suciu

Unvollständige Datenbank: Anfragesemantik 22 Definition Gegeben eine Anfrage Q, eine unvollständige DB W: Eine Antwort t ist sicher (certain), falls ∀ W i, t ∈ Q(W i ) Eine Antwort t ist möglich (possible) falls ∃ W i, t ∈ Q(W i ) Definition Gegeben eine Anfrage Q, eine unvollständige DB W: Eine Antwort t ist sicher (certain), falls ∀ W i, t ∈ Q(W i ) Eine Antwort t ist möglich (possible) falls ∃ W i, t ∈ Q(W i ) Probabilistic Databases - Dan Suciu

Unvollständige Datenbank: Anfragesemantik 23 Definition Gegeben eine Anfrage Q, eine unvollständige DB W: Eine Antwort t ist sicher (certain), falls ∀ W i, t ∈ Q(W i ) Eine Antwort t ist möglich (possible) falls ∃ W i, t ∈ Q(W i ) Definition Gegeben eine Anfrage Q, eine unvollständige DB W: Eine Antwort t ist sicher (certain), falls ∀ W i, t ∈ Q(W i ) Eine Antwort t ist möglich (possible) falls ∃ W i, t ∈ Q(W i ) ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Location NameObject JoeLaptop77 Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Q(z) = Owner(z,x), Location(x,t,’Office’) Q(z) = Owner(z,x), Location(x,t,’Office’) Probabilistic Databases - Dan Suciu

Unvollständige Datenbank: Anfragesemantik 24 Definition Gegeben eine Anfrage Q, eine unvollständige DB W: Eine Antwort t ist sicher (certain), falls ∀ W i, t ∈ Q(W i ) Eine Antwort t ist möglich (possible) falls ∃ W i, t ∈ Q(W i ) Definition Gegeben eine Anfrage Q, eine unvollständige DB W: Eine Antwort t ist sicher (certain), falls ∀ W i, t ∈ Q(W i ) Eine Antwort t ist möglich (possible) falls ∃ W i, t ∈ Q(W i ) ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Location NameObject JoeLaptop77 Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Joe Jim Joe Jim Q(z) = Owner(z,x), Location(x,t,’Office’) Q(z) = Owner(z,x), Location(x,t,’Office’) Probabilistic Databases - Dan Suciu

Unvollständige Datenbank: Anfragesemantik 25 Definition Gegeben eine Anfrage Q, und eine unvollständige Datenbasis W: Eine Antwort t heißt sicher (certain), falls ∀ W i : t ∈ Q(W i ) Eine Antwort t heißt possible, falls ∃ W i : t ∈ Q(W i ) Definition Gegeben eine Anfrage Q, und eine unvollständige Datenbasis W: Eine Antwort t heißt sicher (certain), falls ∀ W i : t ∈ Q(W i ) Eine Antwort t heißt possible, falls ∃ W i : t ∈ Q(W i ) ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Location NameObject JoeLaptop77 Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Joe Jim Joe Jim Sichere Antwort für Q: Joe Mögliche Antwort f. Q: Joe, Jim Q(z) = Owner(z,x), Location(x,t,’Office’) Q(z) = Owner(z,x), Location(x,t,’Office’) Probabilistic Databases - Dan Suciu

Probabilistische Datenbank 26 Definition Eine probabilistische DB ist ein Tupel (W, P), wobei W eine unvoll- ständige DB und P: W  [0,1] eine Wahrscheinlichkeitsverteilung ist: Σ i=1,n P(W i ) = 1 Probabilistic Databases - Dan Suciu

Probabilistische Datenbank 27 ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Location NameObject JimLaptop77 Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Definition Eine probabilistische DB ist ein Tupel (W, P), wobei W eine unvoll- ständige DB und P: W  [0,1] eine Wahrscheinlichkeitsverteilung ist: Σ i=1,n P(W i ) = 1 Probabilistic Databases - Dan Suciu

Probabilistische Datenbank: Anfragesemantik 28 Definition Gegeben eine Anfrage Q, eine probabilistische DB (W,P): Die Randwahrscheinlichkeit einer Antwort t ist: P(t) = Σ { P(W i ) | W i ∈ W, t ∈ Q(W i ) } Definition Gegeben eine Anfrage Q, eine probabilistische DB (W,P): Die Randwahrscheinlichkeit einer Antwort t ist: P(t) = Σ { P(W i ) | W i ∈ W, t ∈ Q(W i ) } Probabilistic Databases - Dan Suciu

Probabilistische Datenbank: Anfragesemantik 29 Definition Gegeben eine Anfrage Q, eine probabilistische DB (W,P): Die Randwahrscheinlichkeit einer Antwort t ist: P(t) = Σ { P(W i ) | W i ∈ W, t ∈ Q(W i ) } Definition Gegeben eine Anfrage Q, eine probabilistische DB (W,P): Die Randwahrscheinlichkeit einer Antwort t ist: P(t) = Σ { P(W i ) | W i ∈ W, t ∈ Q(W i ) } ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Location NameObject JimLaptop77 Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Q(z) = Owner(z,x), Location(x,t,’Office’) Q(z) = Owner(z,x), Location(x,t,’Office’) Probabilistic Databases - Dan Suciu

Probabilistische Datenbank: Anfragesemantik 30 Definition Gegeben eine Anfrage Q, eine probabilistische DB (W,P): Die Randwahrscheinlichkeit einer Antwort t ist: P(t) = Σ { P(W i ) | W i ∈ W, t ∈ Q(W i ) } Definition Gegeben eine Anfrage Q, eine probabilistische DB (W,P): Die Randwahrscheinlichkeit einer Antwort t ist: P(t) = Σ { P(W i ) | W i ∈ W, t ∈ Q(W i ) } ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Location NameObject JoeLaptop77 Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Joe Jim Joe Jim Q(z) = Owner(z,x), Location(x,t,’Office’) Q(z) = Owner(z,x), Location(x,t,’Office’) Probabilistic Databases - Dan Suciu

Probabilistische Datenbank: Anfragesemantik 31 Definition Gegeben eine Anfrage Q, eine probabilistische DB (W,P): Die Randwahrscheinlichkeit einer Antwort t ist: P(t) = Σ { P(W i ) | W i ∈ W, t ∈ Q(W i ) } Definition Gegeben eine Anfrage Q, eine probabilistische DB (W,P): Die Randwahrscheinlichkeit einer Antwort t ist: P(t) = Σ { P(W i ) | W i ∈ W, t ∈ Q(W i ) } ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JoeLaptop77 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Location NameObject JoeLaptop77 Owner ObjectTime Loc Laptop775:07Hall Laptop779:05Office Book3028:18Office Location NameObject JoeBook302 JimLaptop77 FredGgleGlass Owner Joe Jim Joe Jim P(Joe) = 1.0 P(Jim) = 0.4 Q(z) = Owner(z,x), Location(x,t,’Office’) Q(z) = Owner(z,x), Location(x,t,’Office’) Probabilistic Databases - Dan Suciu

Diskussion Intuition: Eine probabilistische Datenbank sagt aus, dass eine Datenbank in einem von verschiedenen möglichen Zuständen ist. Jeder Zustand hat eine Wahrscheintlichkeit Mögliche Anfrageantworten: Eine Menge von Antworten, annotiert mit Wahrscheinlichkeiten: (t 1, p 1 ), (t 2, p 2 ), (t 3, p 3 ), … Üblicherweise: p 1 ≥ p 2 ≥ p 3 ≥ … Problem: Die Anzahl der möglichen Welten in einer probabilistischen Datenbank ist sehr groß. Ziel: Anfragebeantwortung ohne explizite Generierung aller möglichen Welten (eventuell Einschränkungen in der Ausdrucksstärke hinnehmen) 32 Probabilistic Databases - Dan Suciu

Unabhängige und disjunkte Tupel 33 Definition Gegeben eine probabilistische DB (W, P). Zwei Tupel t 1, t 2 werden heißen: unabhängig, falls:P(t 1 t 2 ) = P(t 1 ) P(t 2 ) disjunkt (or exklusiv), falls:P(t 1 t 2 ) = 0 Definition Gegeben eine probabilistische DB (W, P). Zwei Tupel t 1, t 2 werden heißen: unabhängig, falls:P(t 1 t 2 ) = P(t 1 ) P(t 2 ) disjunkt (or exklusiv), falls:P(t 1 t 2 ) = 0 Probabilistic Databases - Dan Suciu

Unabhängige und disjunkte Tupel 34 Definition Eine probabilistische DB heißt block-unabhängig-disjunkt (BUD), falls die Tupel in Blöcke gruppiert werden können, so dass: Tupel vom gleichen Block disjunkt sind Tuplel von verschiedenen Blöcken unabhängig sind. Definition Eine probabilistische DB heißt block-unabhängig-disjunkt (BUD), falls die Tupel in Blöcke gruppiert werden können, so dass: Tupel vom gleichen Block disjunkt sind Tuplel von verschiedenen Blöcken unabhängig sind. Definition Gegeben eine probabilistische DB (W, P). Zwei Tupel t 1, t 2 werden heißen: unabhängig, falls:P(t 1 t 2 ) = P(t 1 ) P(t 2 ) disjunkt (or exklusiv), falls:P(t 1 t 2 ) = 0 Definition Gegeben eine probabilistische DB (W, P). Zwei Tupel t 1, t 2 werden heißen: unabhängig, falls:P(t 1 t 2 ) = P(t 1 ) P(t 2 ) disjunkt (or exklusiv), falls:P(t 1 t 2 ) = 0 Probabilistic Databases - Dan Suciu

Beispiel: BUD-Tabelle W={ ObjectTime Loc Laptop779:07Rm444 Book3029:18Office ObjectTime Loc Laptop779:07Rm444 Book3029:18Rm444 ObjectTime Loc Laptop779:07Rm444 Book3029:18Lift ObjectTime Loc Laptop779:07Hall Book3029:18Office ObjectTime Loc Laptop779:07Hall Book3029:18Rm444 ObjectTime Loc Laptop779:07Hall Book3029:18Lift ObjectTime Loc Laptop779:07Rm444 ObjectTime Loc Laptop779:07Hall ObjectTime Loc Book3029:18Office ObjectTime Loc Book3029:18Rm444 ObjectTime Loc Book3029:18Lift ObjectTime Loc } p1p3p1p3 p1p4p1p4 p 1 (1- p 3 -p 4 -p 5 ) Mögliche Welten BUD Tabelle 35 disjunkt Unab- hängig disjunkt ObjectTime LocP Laptop779:07Rm444p1p1 Laptop779:07Hallp2p2 Book3029:18Officep3p3 Book3029:18Rm444p4p4 Book3029:18Liftp5p5 Probabilistic Databases - Dan Suciu

Das Anfrage-Evaluationsproblem Gegeben: BUD-Datenbank D, Anfrage Q, Ausgabetupel t Berechne: P(t) NB: D habe, sagen wir, Tupel, dann ist die Anzahl der möglichen Welten: Herausforderung: Berechne P(t) effizient, in der Größe von D 36 Datenkomplexität: die Komplexität von P hängt von D, der Anzahl der Datenelemente, ab. Probabilistic Databases - Dan Suciu

xyP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 S xP a1p1 a2p2 a3p3 R P(Q) =1-(1-q1)*(1-q2)p1*[ ] 1-(1-q3)*(1-q4)*(1-q5)p2*[ ] 1- {1- } * {1- } SELECT DISTINCT ‘true’ FROM R, S WHERE R.x = S.x SELECT DISTINCT ‘true’ FROM R, S WHERE R.x = S.x Ein Beispiel 37 Boolesche Anfrage: Join-Tupel vorhanden? Q() = R(x), S(x,y) Man kann P(Q) in PTIME bzgl. der Größe der DB D bestimmen Probabilistic Databases - Dan Suciu

Zusammenfassung: Das probabilistische Datenmodell Mögliche-Welten-Semantik: Mächtig, aber schwierig zu repräsentieren Block-unabhängig-disjunkte Datenbasen haben effiziente Repräsentationen: D wird in traditioneller DB gespeichert Unabhängige Datenbasen: noch einfacher Herausforderung: evaluiere Q effizient bzgl. der Größe von D 38 Probabilistic Databases - Dan Suciu

Probabilistisches Datenmodell Non-Standard-Datenbanken Extensionale Anfragepläne Extensionale Evaluation Probabilistische Datenbanken Einführung: Motivierende Anwendungen Probabilistic Databases - Dan Suciu

Relationale Algebra 1.Verbund (join) 2.Projektion (mit Duplikat- Elimination) 3.Vereinigung 1.Auswahl (selection) 2.Differenz: hier nicht verwendet 40 ⋈ Π σ ∪ - Probabilistic Databases - Dan Suciu

Wiederholung: Anfragebearbeitungspläne 41 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 Q(z) = R(z,x), S(x,y),T(y,u) Probabilistic Databases - Dan Suciu

Wiederholung: Anfragebearbeitungspläne 42 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) Q(z) = R(z,x), S(x,y),T(y,u) Probabilistic Databases - Dan Suciu

Wiederholung: Anfragebearbeitungspläne 43 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) Q(z) = R(z,x), S(x,y),T(y,u) Probabilistic Databases - Dan Suciu

Wiederholung: Anfragebearbeitungspläne 44 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) Q(z) = R(z,x), S(x,y),T(y,u) Probabilistic Databases - Dan Suciu

Wiederholung: Anfragebearbeitungspläne 45 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 SELECT DISTINCT R.z FROM R, S, T WHERE R.x = S.x and S.y=T.y and T.u = 123 ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) ⋈y⋈y ΠzΠz ⋈x⋈x σ u=123 R(z,x)S(x,y)T(y,u) Q(z) = R(z,x), S(x,y),T(y,u) Diese Pläne sind äquivalent (liefern gleiche Ergebnisse) Der Anfrageoptimierer wählt den Plan mit den geringsten Kosten Diese Pläne sind äquivalent (liefern gleiche Ergebnisse) Der Anfrageoptimierer wählt den Plan mit den geringsten Kosten Probabilistic Databases - Dan Suciu

Extensionale Pläne Kernidee: –Modifiziere jeden Operator, sodass Wahrscheinlichkeiten für die Ausgabe berechnet werden Annahmen notwendig: –Ereignisse sind unabhängig oder disjunkt (exklusive) 46 Probabilistic Databases - Dan Suciu

ABP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 S(A,B) AP a1p1 a2p2 a3p3 R(A) ⋈ ABP a1b1p1*q1 a1b2p1*q2 a2b3p2*q3 a2b4p2*q4 a2b5p2*q5 Extensionale Operatoren 47 i Independent join i für independent Probabilistic Databases - Dan Suciu

ABP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 S(A,B) AP a1p1 a2p2 a3p3 R(A) ⋈ ABP a1b1p1*q1 a1b2p1*q2 a2b3p2*q3 a2b4p2*q4 a2b5p2*q5 Extensionale Operatoren 48 i S(A,B) AP a11 - (1-q1)*(1-q2) a21 - (1-q3)*(1-q4)*(1-q5) ΠAΠA i ABP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 Independent join Independent project i für independent Probabilistic Databases - Dan Suciu

ABP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 S(A,B) AP a1p1 a2p2 a3p3 R(A) ⋈ ABP a1b1p1*q1 a1b2p1*q2 a2b3p2*q3 a2b4p2*q4 a2b5p2*q5 Extensionale Operatoren 49 i S(A,B) AP a11 - (1-q1)*(1-q2) a21 - (1-q3)*(1-q4)*(1-q5) ΠAΠA i ABP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 ABP a1b1q1 a1b1q2 a2b2q3 a2b3q4 a2b2q5 S(A,B) σ A=a2 ABP a2b2q3 a2b3q4 a2b2q5 Independent join Independent project Selection i für independent Probabilistic Databases - Dan Suciu

Beispiel 50 S R SELECT DISTINCT ‘true’ FROM R, S WHERE R.x = S.x SELECT DISTINCT ‘true’ FROM R, S WHERE R.x = S.x Q() = R(x), S(x,y) xP a1a1 p1p1 a2a2 p2p2 a3a3 p3p3 xyP a1a1 b1b1 q1q1 a1a1 b2b2 q2q2 a2a2 b3b3 q3q3 a2a2 b4b4 q4q4 a2a2 b5b5 q5q5 P(Q) = 1 – [1-p 1 *(1-(1-q 1 )*(1-q 2 ))] *[1- p 2 *(1-(1-q 3 )*(1-q 4 )*(1-q 5 ))] Probabilistic Databases - Dan Suciu

xP a1a1 p1p1 a2a2 p2p2 a3a3 p3p3 ⋈ p 1 q 1 p 1 q 2 p 2 q 3 p 2 q 4 p 2 q 5 ΠΦΠΦ S(x,y)R(x) 1-(1-p 1 q 1 )(1-p 1 q 2 )(1-p 2 q 3 )(1-p 2 q 4 )(1-p 2 q 5 ) ⋈ ΠΦΠΦ S(x,y) R(x) ΠxΠx 1-(1-q 1 )(1-q 2 ) 1-(1-q 4 )(1-q 5 ) (1-q 6 ) 1-{1-p 1 [1-(1-q 1 )(1-q 2 )]}* {1-p 2 [1-(1-q 4 )(1-q 5 ) (1-q 6 )]} Falsch Richtig 51 P(Q) = 1 – [1-p 1 *(1-(1-q 1 )*(1-q 2 ))] *[1- p 2 *(1-(1-q 3 )*(1-q 4 )*(1-q 5 ))] SELECT DISTINCT ‘true’ FROM R, S WHERE R.x = S.x SELECT DISTINCT ‘true’ FROM R, S WHERE R.x = S.x Q() = R(x), S(x,y) xyP a1a1 b1b1 q1q1 a1a1 b2b2 q2q2 a2a2 b3b3 q3q3 a2a2 b4b4 q4q4 a2a2 b5b5 q5q5 Probabilistic Databases - Dan Suciu

Sichere Pläne Sei ein Schema für eine probabilist. DB gegeben Relationen tupel-unabhängig oder BUD bei gegebenem Schlüssel Anfrageoptimierung: Finde kostengünstigen aber sicheren Plan 52 Definition: Ein Plan heißt sicher, wenn er die Wahrscheinlichkeiten für die Ausgabe richtig berechnet Probabilistic Databases - Dan Suciu

Einsichten 1 Äquivalente Pläne können unter Betrachtung der Wahrscheinlichkeiten inäquivalent werden Ein korrekter Plan wird sicher genannt Ziel: Finde sicheren Plan! Gibt es für jede Anfrage einen sicheren Plan? 53 Probabilistic Databases - Dan Suciu

Unsichere Anfragen XY x1y1 x1y2 x2y2 XP x1p1 x2p2 YP y1q1 y2q2 R T S ⋈  ⋈  RS T p1 p2 p1q1 (1-(1-p1)(1-p2))q2 p1 p2 Wrong H 0 :- R(x),S(x,y),T(y) SELECT DISTINCT ‘yes’ FROM R, S, T WHERE R.x = S.x and S.y = T.y SELECT DISTINCT ‘yes’ FROM R, S, T WHERE R.x = S.x and S.y = T.y Der Plan bestimmt eine obere Grenze 1-(1-p1q1)(1-(1-(1-p1)(1-p2))q2) 54 W Gatterbauer, D Suciu, Oblivious bounds on the probability of Boolean functions, ACM Transactions on Database Systems (TODS) 39 (1), 5, 2013 Probabilistic Databases - Dan Suciu

Diskussion Sichere Anfragen haben einen sicheren Plan und können effektiv berechnet werden Für unsichere Anfragen kann kein sicherer Plan bestimmt werden, und es kann gezeigt werden, dass sie nicht effizient berechnet werden können Jeder extensionale Plan (sicher oder unsicher) kann direkt in SQL ausgedrückt werden – gezeigt am Beispiel von PostgreSQL 55 Probabilistic Databases - Dan Suciu

ABP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 S(A,B) AP a1p1 a2p2 a3p3 R(A) ⋈ ABP a1b1p1*q1 a1b2p1*q2 a2b3p2*q3 a2b4p2*q4 a2b5p2*q5 Extensionale Pläne in PostgreSQL SELECT R.A, S.B, R.P*S.P FROMR, S WHERE R.A=S.A 56 i Probabilistic Databases - Dan Suciu

ABP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 S(A,B) AP a1p1 a2p2 a3p3 R(A) ⋈ ABP a1b1p1*q1 a1b2p1*q2 a2b3p2*q3 a2b4p2*q4 a2b5p2*q5 Extensional Plans in Postgres SELECT R.A, S.B, R.P*S.P FROMR, S WHERE R.A=S.A 57 i S(A,B) AP a11 - (1-q1)*(1-q2) a21 - (1-q3)*(1-q4)*(1-q5) ΠAΠA i ABP a1b1q1 a1b2q2 a2b3q3 a2b4q4 a2b5q5 SELECT S.A, 1.0-prod(1.0 - S.p) FROMS GROUP BY S.A create or replace function combine_prod(float, float) returns float as 'select $1 * $2' language SQL; create or replace function final_prod(float) returns float as 'select $1' language SQL; drop aggregate if exists prod (float); create aggregate prod(float) ( sfunc = combine_prod, stype = float, finalfunc = final_prod, initcond = '1.0' ); create or replace function combine_prod(float, float) returns float as 'select $1 * $2' language SQL; create or replace function final_prod(float) returns float as 'select $1' language SQL; drop aggregate if exists prod (float); create aggregate prod(float) ( sfunc = combine_prod, stype = float, finalfunc = final_prod, initcond = '1.0' ); Probabilistic Databases - Dan Suciu

Extensional Plans in Postgres ⋈ ΠΦΠΦ S(x,y) R(x) ΠxΠx SELECT DISTINCT ‘true’ FROM R, S WHERE R.x = S.x SELECT DISTINCT ‘true’ FROM R, S WHERE R.x = S.x WITH Temp AS (SELECT S.x, 1.0-prod(1.0 - S.p) as p FROM S GROUP BY S.x) SELECT ‘true’ as z, 1.0-prod(1.0 – R.P * Temp.P) as p FROM R, Temp WHERE R.x = Temp.x WITH Temp AS (SELECT S.x, 1.0-prod(1.0 - S.p) as p FROM S GROUP BY S.x) SELECT ‘true’ as z, 1.0-prod(1.0 – R.P * Temp.P) as p FROM R, Temp WHERE R.x = Temp.x 58 i i i Probabilistic Databases - Dan Suciu

Eingaben für PostgreSQL: First step: download postgres from -- Second step: run the command "createdb pdb" -- Third step: run the command "psql pdb" then cut/paste commands below define an aggregate function to compute the product create or replace function combine_prod (float, float) returns float as 'select $1 * $2' language SQL; create or replace function final_prod (float) returns float as 'select $1' language SQL; drop aggregate if exists prod (float); create aggregate prod (float) ( sfunc = combine_prod, stype = float, finalfunc = final_prod, initcond = '1.0' ); simple tables, similar to those used in the tutorial create table R(z char(8), x char(8), p float); create table S(x char(8), y char(8), p float); insert into R values('c', 'a1', 0.5); insert into R values('c', 'a2', 0.5); insert into R values('c', 'a3', 0.5); insert into S values('a1', 'b1', 0.5); insert into S values('a1', 'b2', 0.5); insert into S values('a2', 'b2', 0.5); insert into S values('a2', 'b3', 0.5); insert into S values('a2', 'b4', 0.5); -- computing the query Q(z) = R(z,x),S(x,y) -- a safe plan: with Temp as (select S.x, 1.0-prod(1.0-p) as p from S group by S.x) select R.z, 1.0-prod(1-R.p*Temp.p) from R, Temp where R.x=Temp.x group by R.z; -- an unsafe plan; guaranteed to return an upper bound on the probability select R.z, 1.0-prod(1-R.p*S.p) from R, S where R.x=S.x group by R.z; Probabilistic Databases - Dan Suciu

Extensionale Pläne in PostgreSQL 60 SELECT DISTINCT ‘yes’ FROM R, S, T WHERE R.x = S.x and S.y = T.y SELECT DISTINCT ‘yes’ FROM R, S, T WHERE R.x = S.x and S.y = T.y ⋈ ΠΦΠΦ S(x,y) R(x) ΠxΠx i i i ⋈ i T(y) Der Plan ist unsicher, aber er liefert eine obere Grenze für den Wahrscheinlichkeitswert, dass die Anfrage mit ‘yes’ beantwortet wird. Der Plan generiert eine untere Grenze, wenn die Wahrscheinlichkeiten in T entsprechend angepasst werden (siehe Literatur) Diese Anfrage ist unsicher. W Gatterbauer, D Suciu, Oblivious bounds on the probability of Boolean functions, ACM Transactions on Database Systems (TODS) 39 (1), 5, 2013 Probabilistic Databases - Dan Suciu

Eingaben für PostgreSQL: The following approximation plans for unsafe queries are from -- Gatterbauer, Suciu: Oblivious Bounds on the Probability of Boolean Functions -- create a third table create table T(y char(8), p float); insert into T values('b1', 0.5); insert into T values('b2', 0.5); insert into T values('b3', 0.5); insert into T values('b4', 0.5); -- computing the query Q(z) = R(z,x),S(x,y),T(y) -- This query has no safe plans -- Next two unsafe plans compute upper bounds on the probability: -- Unsafe plan #1 with Temp as (select S.x, 1.0-prod(1.0-S.p*T.p) as p from S,T where S.y=T.y group by S.x) select R.z, 1.0-prod(1-R.p*Temp.p) from R, Temp where R.x=Temp.x group by R.z; -- Unsafe plan #2 with Temp as (select R.z,S.y,1.0-prod(1.0-R.p*S.p) as p from R,S where R.x=S.x group by R.z,S.y) select Temp.z, 1.0-prod(1-Temp.p*T.p) from Temp, T where Temp.y=T.y group by Temp.z; -- Next two unsafe plans compute lower bounds on the probability: with newT as (select T.y, 1-exp((ln(1-T.p))/count(*)) as p from S,T where S.y=T.y group by T.y, T.p), Temp as (select S.x, 1.0-prod(1.0-S.p*newT.p) as p from S,newT where S.y=newT.y group by S.x) select R.z, 1.0-prod(1-R.p*Temp.p) from R, Temp where R.x=Temp.x group by R.z; with newR as (select R.z, R.x, 1-exp((ln(1-R.p))/count(*)) as p from R,S where R.x=S.x group by R.z,R.x,R.p), Temp as (select newR.z, S.y, 1.0-prod(1.0-newR.p*S.p) as p from newR, S where newR.x=S.x group by newR.z, S.y) select Temp.z, 1.0-prod(1-Temp.p*T.p) from Temp, T where Temp.y=T.y group by Temp.z; Probabilistic Databases - Dan Suciu

Einsichten 2 Man benötigt kein neues probabilistisches DB- System für eine probabilistische Datenbasis! Was man benötigt, sind SQL-Kenntnisse und Kenntnisse in Wahrscheinlichkeitstheorie Im Buch über probabilistische Datenbanken steht auch, wie’s geht! 62 Probabilistic Databases - Dan Suciu

Wiederholung: Unions of Conjunctive Queries 63 Q(z) = ∃ x 1 ∃ t 1 (Owner(z,x 1 ) ∧ Location(x 1,t 1,”Office444”)) ∨ ∃ x 2 ∃ t 2 (Owner(z,x 2 ) ∧ Location(x 2,t 2,”Hall7”)) Q(z) = Owner(z,x 1 ),Location(x 1,t 1,”Office444”) ∨ Owner(z,x 2 ),Location(x 2,t 2,”Hall7”) Ohne Quantoren: Owners of items in either “Office444” or “Hall7”: Probabilistic Databases - Dan Suciu Atom

Wiederholung: Unions of Conjunctive Queries 64 Q(z) = ∃ x 1 ∃ t 1 (Owner(z,x 1 ) ∧ Location(x 1,t 1,”Office444”)) ∨ ∃ x 2 ∃ t 2 (Owner(z,x 2 ) ∧ Location(x 2,t 2,”Hall7”)) Q(z) = Owner(z,x 1 ),Location(x 1,t 1,”Office444”) ∨ Owner(z,x 2 ),Location(x 2,t 2,”Hall7”) Ohne Quantoren: Owners of items in either “Office444” or “Hall7”: Union of conjunctive queries Probabilistic Databases - Dan Suciu

Wiederholung: Unions of Conjunctive Queries 65 Q(z) = ∃ x 1 ∃ t 1 (Owner(z,x 1 ) ∧ Location(x 1,t 1,”Office444”)) ∨ ∃ x 2 ∃ t 2 (Owner(z,x 2 ) ∧ Location(x 2,t 2,”Hall7”)) Q(z) = Owner(z,x 1 ),Location(x 1,t 1,”Office444”) ∨ Owner(z,x 2 ),Location(x 2,t 2,”Hall7”) Ohne Quantoren: Owners of items in either “Office444” or “Hall7”: Union of conjunctive queries Nach Umformung: Q(z) = Owner(z,x) ∧∃ t [Location(x,t,”Office444”) ∨ Location(x,t,”Hall7”)] Probabilistic Databases - Dan Suciu

Wiederholung: Unions of Conjunctive Queries 66 Q(z) = ∃ x 1 ∃ t 1 (Owner(z,x 1 ) ∧ Location(x 1,t 1,”Office444”)) ∨ ∃ x 2 ∃ t 2 (Owner(z,x 2 ) ∧ Location(x 2,t 2,”Hall7”)) Q(z) = Owner(z,x 1 ),Location(x 1,t 1,”Office444”) ∨ Owner(z,x 2 ),Location(x 2,t 2,”Hall7”) Ohne Quantoren: Owners of items in either “Office444” or “Hall7”: Union of conjunctive queries Nach Umformung: Q(z) = Owner(z,x) ∧∃ t [Location(x,t,”Office444”) ∨ Location(x,t,”Hall7”)] 1.Distributivgesetz für ∨, ∧ 2.Kommutativgesetz für ∃, ∨ : ( ∃ x P(x)) ∨ ( ∃ y T(y)) = ∃ z (P(z) ∨ T(z)) 1.Distributivgesetz für ∨, ∧ 2.Kommutativgesetz für ∃, ∨ : ( ∃ x P(x)) ∨ ( ∃ y T(y)) = ∃ z (P(z) ∨ T(z)) Unter Verwendung von: Probabilistic Databases - Dan Suciu

Vier Regeln, um sichere Anfragen zu erzeugen Independent join Independent project Independent union Inclusion/exclusion Wir beschränken uns auf Boolesche Anfragen. 67 Probabilistic Databases - Dan Suciu

68 P(Q1 ∧ Q2) = P(Q1)P(Q2) Wenn Q1 und Q2 unabhängig sind (also keine gemeinsamen Atome haben) Probabilistic Databases - Dan Suciu Regel 1: Independent Join

69 P(Q1 ∧ Q2) = P(Q1)P(Q2) Wenn Q1 und Q2 unabhängig sind (also keine gemeinsamen Atome haben) P( ∃ z Q) = 1 – Π a ∈ Domain (1– P(Q[a/z]) Wenn z eine “Separatorvariable” in Q ist, also für Konstanten a,b, Q[a/z] und Q[b/z] unabhängig sind Regel 2: Independent Project Probabilistic Databases - Dan Suciu Regel 1: Independent Join

70 P(Q1 ∧ Q2) = P(Q1)P(Q2) Wenn Q1 und Q2 unabhängig sind (also keine gemeinsamen Atome haben) P( ∃ z Q) = 1 – Π a ∈ Domain (1– P(Q[a/z]) Wenn z eine “Separatorvariable” in Q ist, also für Konstanten a,b, Q[a/z] und Q[b/z] unabhängig sind P(Q1 ∨ Q2) =1 – (1 – P(Q1))(1 – P(Q2)) Regel 2: Independent Project Regel 3: Independent Union Wenn Q1 und Q2 unabhängig sind (also keine gemeinsamen Atome haben) Probabilistic Databases - Dan Suciu Regel 1: Independent Join

Beispiel 71 Q U = R(x 1 ),S(x 1,y 1 ) ∨ T(x 2 ),S(x 2,y 2 ) = ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 ) ∨ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 ) Probabilistic Databases - Dan Suciu

Beispiel 72 Q U = R(x 1 ),S(x 1,y 1 ) ∨ T(x 2 ),S(x 2,y 2 ) Kommutiere ∃ mit ∨ Q U = ∃ z [R(z) ∧ S(z,y 1 ) ∨ T(z) ∧ S(z,y 2 )] = ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 ) ∨ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 ) Probabilistic Databases - Dan Suciu

Beispiel 73 Q U = R(x 1 ),S(x 1,y 1 ) ∨ T(x 2 ),S(x 2,y 2 ) Kommutiere ∃ mit ∨ Q U = ∃ z [R(z) ∧ S(z,y 1 ) ∨ T(z) ∧ S(z,y 2 )] P(Q U ) = 1 – Π a ∈ Domain (1– P[R(a) ∧ S(a,y 1 ) ∨ T(a) ∧ S(a,y 2 ))] Independent project: Für a≠b, sind Q U [a/z] und Q U [b/z] unabhängig weil die Atome R(a),S(a,y 1 ),T(a),S(a,y 2 ) disjunkt sind von R(b),S(b,y 1 ),T(b),S(b,y 2 ) = ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 ) ∨ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 ) Probabilistic Databases - Dan Suciu

Beispiel 74 Q U = R(x 1 ),S(x 1,y 1 ) ∨ T(x 2 ),S(x 2,y 2 ) Kommutiere ∃ mit ∨ Q U = ∃ z [R(z) ∧ S(z,y 1 ) ∨ T(z) ∧ S(z,y 2 )] P(Q U ) = 1 – Π a ∈ Domain (1– P[R(a) ∧ S(a,y 1 ) ∨ T(a) ∧ S(a,y 2 ))] Independent project: Für a≠b, sind Q U [a/z] und Q U [b/z] unabhängig weil die Atome R(a),S(a,y 1 ),T(a),S(a,y 2 ) disjunkt sind von R(b),S(b,y 1 ),T(b),S(b,y 2 ) = ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 ) ∨ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 ) P(Q U ) = 1 – Π a ∈ Domain (1– P[(R(a) ∨ T(a)) ∧ ∃ y. S(a,y)] Distribution ∧ über ∨ Probabilistic Databases - Dan Suciu

Beispiel 75 Q U = R(x 1 ),S(x 1,y 1 ) ∨ T(x 2 ),S(x 2,y 2 ) Kommutiere ∃ mit ∨ Q U = ∃ z [R(z) ∧ S(z,y 1 ) ∨ T(z) ∧ S(z,y 2 )] P(Q U ) = 1 – Π a ∈ Domain (1– P[R(a) ∧ S(a,y 1 ) ∨ T(a) ∧ S(a,y 2 ))] Independent project: Für a≠b, sind Q U [a/z] und Q U [b/z] unabhängig weil die Atome R(a),S(a,y 1 ),T(a),S(a,y 2 ) disjunkt sind von R(b),S(b,y 1 ),T(b),S(b,y 2 ) = ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 ) ∨ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 ) P(Q U ) = 1 – Π a ∈ Domain (1– P[(R(a) ∨ T(a)) ∧ ∃ y. S(a,y)] P(Q U ) = 1 – Π a ∈ Domain (1– P[R(a) ∨ T(a)] P[ ∃ y. S(a,y)] Distribution ∧ über ∨ Independent join Probabilistic Databases - Dan Suciu

Beispiel 76 Q U = R(x 1 ),S(x 1,y 1 ) ∨ T(x 2 ),S(x 2,y 2 ) Kommutiere ∃ mit ∨ Q U = ∃ z [R(z) ∧ S(z,y 1 ) ∨ T(z) ∧ S(z,y 2 )] P(Q U ) = 1 – Π a ∈ Domain (1– P[R(a) ∧ S(a,y 1 ) ∨ T(a) ∧ S(a,y 2 ))] Independent project: Für a≠b, sind Q U [a/z] und Q U [b/z] unabhängig weil die Atome R(a),S(a,y 1 ),T(a),S(a,y 2 ) disjunkt sind von R(b),S(b,y 1 ),T(b),S(b,y 2 ) = ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 ) ∨ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 ) P(Q U ) = 1 – Π a ∈ Domain (1– P[(R(a) ∨ T(a)) ∧ ∃ y. S(a,y)] P(Q U ) = 1 – Π a ∈ Domain (1– P[R(a) ∨ T(a)] P[ ∃ y. S(a,y)] Distribution ∧ über ∨ Independent join P(Q U ) = 1 – Π a ∈ Domain (1– (1-(1-P[R(a)])(1-P[T(a)])) (1-Π b ∈ Domain (1– P[S(a,b)]))) Probabilistic Databases - Dan Suciu

77 Hierarchische Anfragen at(x) = Menge von Atomen mit Variable x R S xy T Nicht-hierarchisch R S x z Hierarchisch y Q = R(x,y),S(x,z) H 0 = R(x), S(x, y), T(y) Definition Eine Anfrage Q ist hierarchisch falls für alle existentiellen Variables x, y gilt: at(x)  at(y) oder at(x) ⊇ at(y) oder at(x)  at(y) =  Definition Eine Anfrage Q ist hierarchisch falls für alle existentiellen Variables x, y gilt: at(x)  at(y) oder at(x) ⊇ at(y) oder at(x)  at(y) =  Probabilistic Databases - Dan Suciu Regeln funktionieren für hierarchische Anfragen ( Unabhängigkeit ) N. Dalvi, D. Suciu, The dichotomy of probabilistic inference for unions of conjunctive queries, Journal of the ACM (JACM) 59 (6), 30, 2012

Regel 4: Inclusion-Exclusion P(Q1 ∧ Q2 ∧ Q3) = P(Q1) + P(Q2) + P(Q3) - P(Q1 ∨ Q2) – P(Q1 ∨ Q3) – P(Q2 ∨ Q3) + P(Q1 ∨ Q2 ∨ Q3) P(Q1 ∧ Q2 ∧ Q3) = P(Q1) + P(Q2) + P(Q3) - P(Q1 ∨ Q2) – P(Q1 ∨ Q3) – P(Q2 ∨ Q3) + P(Q1 ∨ Q2 ∨ Q3) 78 NB: Dieses ist dual zur häufiger verwendeten Formel: P(Q1 ∨ Q2 ∨ Q3) = P(Q1) + P(Q2) + P(Q3) - P(Q1 ∧ Q2) – P(Q1 ∧ Q3) – P(Q2 ∧ Q3) + P(Q1 ∧ Q2 ∧ Q3) Probabilistic Databases - Dan Suciu

Beispiel 79 Q J = R(x 1 ),S(x 1,y 1 ), T(x 2 ),S(x 2,y 2 ) = [ ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 )] ∧ [ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 )] Probabilistic Databases - Dan Suciu

Beispiel 80 Q J = R(x 1 ),S(x 1,y 1 ), T(x 2 ),S(x 2,y 2 ) = [ ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 )] ∧ [ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 )] Q 1 = R(x 1 ),S(x 1,y 1 ) Q 2 = T(x 2 ),S(x 2,y 2 ) Q J = Q 1 ∧ Q 2 wobei Probabilistic Databases - Dan Suciu

Beispiel 81 Q J = R(x 1 ),S(x 1,y 1 ), T(x 2 ),S(x 2,y 2 ) = [ ∃ x 1 ∃ y 1 R(x 1 ) ∧ S(x 1,y 1 )] ∧ [ ∃ x 2 ∃ y 2 T(x 2 ) ∧ S(x 2,y 2 )] Q 1 = R(x 1 ),S(x 1,y 1 ) Q 2 = T(x 2 ),S(x 2,y 2 ) Q J = Q 1 ∧ Q 2 wobei P(Q J ) = P(Q 1 ) + P(Q 2 ) - P(Q 1 ∨ Q 2 ) Q 1 = eine hierarchische CQ ohne Self-Joins Q 2 = dito Q 1 ∨ Q 2 = Q U, siehe vorige Folien Probabilistic Databases - Dan Suciu

Einsicht 3 Vereinigung (union) für Self-Joins! Conjunctive Queries = Keine “natürliche” Klassen von Anfragen von Probabilistische DBs Unions of Conjunctive Queries = die “natürliche” Klasse von Anfragen 82 Probabilistic Databases - Dan Suciu

Zusammenfassung Falls Anfrageformeln mit Regeln transformiert werden kann, dann ist das Ergebnis sicher (Korrektheit) Regeln sind aber nicht vollständig –Suciu stellen noch eine weitere Regel vor (hier nicht behandelt) –Damit lassen sich alle sicheren Pläne erzeugen Aber: Nicht alle Anfragen lassen sich mit den Regeln behandeln (  nicht immer gibt es einen sicheren Plan) –Für bestimmte Anfragen müssen die Welten betrachtet werden –Praktisches System: MayBMS - A Probabilistic Database Management System ( 83 L. Antova, T. Jansen, C. Koch, and D. Olteanu. Fast and Simple Relational Processing of Uncertain Data, Proc. 24th International Conference on Data Engineering, ICDE 2008, , 2008

Probabilistisches Datenmodell Non-Standard-Datenbanken Extensionale Anfragepläne Extensionale Evaluation Probabilistische Datenbanken Einführung: Motivierende Anwendungen