A Tutorial on Database Theory and a Talk on Database Query Answering Under Updates
Total Page:16
File Type:pdf, Size:1020Kb
KAPITEL 3 BERUHT AUF EINEM AUSZUG AUS DEM FOLGENDEN VORTRAG: A tutorial on Database Theory and a talk on database query answering under updates Nicole Schweikardt Humboldt-Universität zu Berlin 24th Workshop on Logic, Language, Information and Computation (WoLLIC 2017) London, July 19 & 20, 2017 database schema : relational signature σ := fM; Dg a db : D = (MD ; PD ), where MD : a finite subset of dom2 PD : a finite subset of dom3 dom : a fixed, infinite domain of potential db entries adom(D) : the set of all d 2 dom that occur in MD or PD View D as a finite σ-structure with universe adom(D)! Return all titles of movies y in which Sigourney Weaver stars: '1(y) := Movie(y; "Sigourney Weaver") Return all tuples (x; y) of cinemas x and movie titles y such that x plays movie y in which Sigourney Weaver stars: '2(x; y) := 9 z Programme(x; y; z) ^ Movie(y; "Sigourney Weaver") Conjunctive queries! Example database and two queries A logician’s point of view: Movie Programme NameMovie Actor: a 2-ary relationCinema symbol M Movietitle Time Alien Sigourney Weaver Babylon Casablanca 17:30 ProgrammeBlade Runner Harrison: a Ford 3-ary relationBabylon symbol P Gravity 20:15 Blade Runner Sean Young Casablanca Blade Runner 15:30 Brazil Jonathan Pryce Casablanca Alien 18:15 Brazil Kim Greist Casablanca Blade Runner 20:30 Casablanca Humphrey Bogart Casablanca Resident Evil 20:30 Casablanca Ingrid Bergmann Kino International Casablanca 18:00 Gravity Sandra Bullock Kino International Brazil 20:00 Gravity George Clooney Kino International Brazil 22:00 Resident Evil Milla Jovovich Moviemento Gravity 17:00 Terminator Arnold Schwarzenegger Moviemento Gravity 19:30 Terminator Linda Hamilton Moviemento Alien 22:00 Terminator Michael Biehn Urania Resident Evil 20:00 . Urania Resident Evil 21:30 . Urania Resident Evil 23:00 Nicole Schweikardt (HU Berlin) Database Theory and Query Answering under Updates 2/ 43 database schema : relational signature σ := fM; Dg a db : D = (MD ; PD ), where MD : a finite subset of dom2 PD : a finite subset of dom3 dom : a fixed, infinite domain of potential db entries adom(D) : the set of all d 2 dom that occur in MD or PD View D as a finite σ-structure with universe adom(D)! Return all tuples (x; y) of cinemas x and movie titles y such that x plays movie y in which Sigourney Weaver stars: '2(x; y) := 9 z Programme(x; y; z) ^ Movie(y; "Sigourney Weaver") Conjunctive queries! Example database and two queries A logician’s point of view: Movie Programme NameMovie Actor: a 2-ary relationCinema symbol M Movietitle Time Alien Sigourney Weaver Babylon Casablanca 17:30 ProgrammeBlade Runner Harrison: a Ford 3-ary relationBabylon symbol P Gravity 20:15 Blade Runner Sean Young Casablanca Blade Runner 15:30 Brazil Jonathan Pryce Casablanca Alien 18:15 Brazil Kim Greist Casablanca Blade Runner 20:30 Casablanca Humphrey Bogart Casablanca Resident Evil 20:30 Casablanca Ingrid Bergmann Kino International Casablanca 18:00 Gravity Sandra Bullock Kino International Brazil 20:00 Gravity George Clooney Kino International Brazil 22:00 Resident Evil Milla Jovovich Moviemento Gravity 17:00 Terminator Arnold Schwarzenegger Moviemento Gravity 19:30 Terminator Linda Hamilton Moviemento Alien 22:00 Terminator Michael Biehn Urania Resident Evil 20:00 . Urania Resident Evil 21:30 . Urania Resident Evil 23:00 Return all titles of movies y in which Sigourney Weaver stars: '1(y) := Movie(y; "Sigourney Weaver") Nicole Schweikardt (HU Berlin) Database Theory and Query Answering under Updates 2/ 43 database schema : relational signature σ := fM; Dg a db : D = (MD ; PD ), where MD : a finite subset of dom2 PD : a finite subset of dom3 dom : a fixed, infinite domain of potential db entries adom(D) : the set of all d 2 dom that occur in MD or PD View D as a finite σ-structure with universe adom(D)! Conjunctive queries! Example database and two queries A logician’s point of view: Movie Programme NameMovie Actor: a 2-ary relationCinema symbol M Movietitle Time Alien Sigourney Weaver Babylon Casablanca 17:30 ProgrammeBlade Runner Harrison: a Ford 3-ary relationBabylon symbol P Gravity 20:15 Blade Runner Sean Young Casablanca Blade Runner 15:30 Brazil Jonathan Pryce Casablanca Alien 18:15 Brazil Kim Greist Casablanca Blade Runner 20:30 Casablanca Humphrey Bogart Casablanca Resident Evil 20:30 Casablanca Ingrid Bergmann Kino International Casablanca 18:00 Gravity Sandra Bullock Kino International Brazil 20:00 Gravity George Clooney Kino International Brazil 22:00 Resident Evil Milla Jovovich Moviemento Gravity 17:00 Terminator Arnold Schwarzenegger Moviemento Gravity 19:30 Terminator Linda Hamilton Moviemento Alien 22:00 Terminator Michael Biehn Urania Resident Evil 20:00 . Urania Resident Evil 21:30 . Urania Resident Evil 23:00 Return all titles of movies y in which Sigourney Weaver stars: '1(y) := Movie(y; "Sigourney Weaver") Return all tuples (x; y) of cinemas x and movie titles y such that x plays movie y in which Sigourney Weaver stars: '2(x; y) := 9 z Programme(x; y; z) ^ Movie(y; "Sigourney Weaver") Nicole Schweikardt (HU Berlin) Database Theory and Query Answering under Updates 2/ 43 database schema : relational signature σ := fM; Dg a db : D = (MD ; PD ), where MD : a finite subset of dom2 PD : a finite subset of dom3 dom : a fixed, infinite domain of potential db entries adom(D) : the set of all d 2 dom that occur in MD or PD View D as a finite σ-structure with universe adom(D)! Example database and two queries A logician’s point of view: Movie Programme NameMovie Actor: a 2-ary relationCinema symbol M Movietitle Time Alien Sigourney Weaver Babylon Casablanca 17:30 ProgrammeBlade Runner Harrison: a Ford 3-ary relationBabylon symbol P Gravity 20:15 Blade Runner Sean Young Casablanca Blade Runner 15:30 Brazil Jonathan Pryce Casablanca Alien 18:15 Brazil Kim Greist Casablanca Blade Runner 20:30 Casablanca Humphrey Bogart Casablanca Resident Evil 20:30 Casablanca Ingrid Bergmann Kino International Casablanca 18:00 Gravity Sandra Bullock Kino International Brazil 20:00 Gravity George Clooney Kino International Brazil 22:00 Resident Evil Milla Jovovich Moviemento Gravity 17:00 Terminator Arnold Schwarzenegger Moviemento Gravity 19:30 Terminator Linda Hamilton Moviemento Alien 22:00 Terminator Michael Biehn Urania Resident Evil 20:00 . Urania Resident Evil 21:30 . Urania Resident Evil 23:00 Return all titles of movies y in which Sigourney Weaver stars: '1(y) := Movie(y; "Sigourney Weaver") Return all tuples (x; y) of cinemas x and movie titles y such that x plays movie y in which Sigourney Weaver stars: '2(x; y) := 9 z Programme(x; y; z) ^ Movie(y; "Sigourney Weaver") Conjunctive queries! Nicole Schweikardt (HU Berlin) Database Theory and Query Answering under Updates 2/ 43 database schema : relational signature σ := fM; Dg a db : D = (MD ; PD ), where MD : a finite subset of dom2 PD : a finite subset of dom3 dom : a fixed, infinite domain of potential db entries adom(D) : the set of all d 2 dom that occur in MD or PD View D as a finite σ-structure with universe adom(D)! Example database and two queries A logician’s point of view: Movie Programme NameMovie Actor: a 2-ary relationCinema symbol M Movietitle Time Alien Sigourney Weaver Babylon Casablanca 17:30 ProgrammeBlade Runner Harrison: a Ford 3-ary relationBabylon symbol P Gravity 20:15 Blade Runner Sean Young Casablanca Blade Runner 15:30 Brazil Jonathan Pryce Casablanca Alien 18:15 Brazil Kim Greist Casablanca Blade Runner 20:30 Casablanca Humphrey Bogart Casablanca Resident Evil 20:30 Casablanca Ingrid Bergmann Kino International Casablanca 18:00 Gravity Sandra Bullock Kino International Brazil 20:00 Gravity George Clooney Kino International Brazil 22:00 Resident Evil Milla Jovovich Moviemento Gravity 17:00 Terminator Arnold Schwarzenegger Moviemento Gravity 19:30 Terminator Linda Hamilton Moviemento Alien 22:00 Terminator Michael Biehn Urania Resident Evil 20:00 . Urania Resident Evil 21:30 . Urania Resident Evil 23:00 Return all titles of movies y in which Sigourney Weaver stars: '1(y) := Movie(y; "Sigourney Weaver") Return all tuples (x; y) of cinemas x and movie titles y such that x plays movie y in which Sigourney Weaver stars: '2(x; y) := 9 z Programme(x; y; z) ^ Movie(y; "Sigourney Weaver") Conjunctive queries! Nicole Schweikardt (HU Berlin) Database Theory and Query Answering under Updates 2/ 43 a db : D = (MD ; PD ), where MD : a finite subset of dom2 PD : a finite subset of dom3 dom : a fixed, infinite domain of potential db entries adom(D) : the set of all d 2 dom that occur in MD or PD View D as a finite σ-structure with universe adom(D)! Example database and two queries A logician’s point of view: Movie Programme NameMovie Actor: a 2-ary relationCinema symbol M Movietitle Time Alien Sigourney Weaver Babylon Casablanca 17:30 ProgrammeBlade Runner Harrison: a Ford 3-ary relationBabylon symbol P Gravity 20:15 Blade Runner Sean Young Casablanca Blade Runner 15:30 databaseBrazil schema Jonathan: relational Pryce signatureCasablancaσ := fMAlien; Dg 18:15 Brazil Kim Greist Casablanca Blade Runner 20:30 Casablanca Humphrey Bogart Casablanca Resident Evil 20:30 Casablanca Ingrid Bergmann Kino International Casablanca 18:00 Gravity Sandra Bullock Kino International Brazil 20:00 Gravity George Clooney Kino International Brazil 22:00 Resident Evil Milla Jovovich Moviemento Gravity 17:00 Terminator Arnold Schwarzenegger Moviemento Gravity 19:30 Terminator Linda Hamilton Moviemento Alien 22:00 Terminator Michael Biehn Urania Resident Evil 20:00 . Urania Resident Evil 21:30 . Urania Resident Evil 23:00 Return all titles