130 likes | 230 Views
Anfragesprachen für XML. Björn Gehl Betreuer: Tim Priesnitz SS2003 Proseminar “Logische Aspekte von XML”. Gert Smolka - PS-Lab - Universität Saarland. Motivation. select x from biblio.paper.author x. Roux 1976 Database Systems XML Systems Smith 1999 Data Production Cassio.
E N D
Anfragesprachen für XML Björn Gehl Betreuer: Tim Priesnitz SS2003 Proseminar “Logische Aspekte von XML” Gert Smolka - PS-Lab - Universität Saarland
Motivation select x from biblio.paper.author x Roux 1976 Database Systems XML Systems Smith 1999 Data Production Cassio author date title book title Roux biblio article author date paper title author
Übersicht • Anfragen • Datalog • Optimierung
Anfrage 1. Ordnung 111 Roux 1976 Database Systems Database Systems Smith 1999 Data Production Cassio 1 select xfrom 1.2 y, y.2 xwhere Database Systems in y.1 2 112 11 3 113 1 121 1 1 2 2 ε 1 12 122 3 123 Smith 3 131 1 13 2 132
where<book> <title> Database Systems </title> <author> $A </author> <year> $Y </year> </book> in db.xml construct $A Anfrage 2. Ordnung , $Y > 1990 Roux 1976 Database Systems Database Systems Smith 1999 Data Production Cassio author date title Roux, Smith book title biblio book author date paper title author
P0 P1 ∧ P2 ∧ … ∧ Pn Pi ::= P(x)|x Definition von Datalog • Syntax: Menge Hornklauseln mit Prädikaten •keine Negation • Rekursion • Teilsprache von Prolog T(x,y) G(x,y) T(x,y) G(x,z), T(z,y) x,y (T(x,y) G(x,y)) x,y,z (T(x,y) (G(x,z) ∧ T(z,y)))
Kantenmenge E: Start a Ziel E(ans,author,x) ← E(ε,biblio,w), E(w,book,y), E(y,author,x), E(y,title,v), L(v,Database Systems) biblio book book 1 11 12 ε 1 1 111 Roux 1976 Database Systems Database Systems Smith 1999 Data Production Cassio author date 112 11 title 113 . . book 121 : : Knotenlabels L: title biblio Obj Wert book author ε 1 12 122 111 112 113 Roux 1976 Database System date 123 paper 131 title 13 author 132 1 author ans author 2 Datalog als Anfragesprache
Optimierung für Anfragen Datenbankoptimierung… 1) Baumstrukturen 2) Auffalten 3) Bisimulation
author 113 Smith book 131 title Datasystems Smith 13 author 132 Optimierung auf Baumstrukturen 111 Smith Datasystems Database Systems Roux 1999 author title 112 11 book 121 title biblio book author ε 1 12 122 date 123
a b a b b b b Optimierung auf Graphen b a a . . .
Bisimulation Seien g1 und g2 Graphen; x, x‘: Knoten in g1 y, y‘: Knoten in g2 1) root(g1) = x , root(g2) = y x~y 2) x~y & x = root(g1) y = root(g2) x~y & y = root(g2) x = root(g1) 3) x~y & (x,l,x’) ist Kante in g1 Kante (y,l,y’) in g2 mit selbem Label, so dassx’~y’ [auch umgekehrt mit x~y & (y,l,y’)] 4) x~y & x ist ein Blatt mit dem Wert v in g1 y ist auch ein Blatt mit gleichem Wert v in g2 [auch umgekehrt]
Smith Smith Datasystems g1: g2: Smith Datasystems x3 y3 author author book author book x2 x4 x1 y2 y1 title title x5 y4 Beispiel für Bisimulation x1~y1, x2~y2, x3~y3, x4~y3, x5~y4 Bisimultation g1 & g2 sind gleich
Referenzen [1] Serge Abiteboul, Peter Buneman and Dan Suciu. Data on the Web, Kapitel 2-3, Morgan Kaufmann, 2000. [2] Serge Abiteboul, Semistructured Data: from Practice to Theory, LICS 2001.