Download presentation
Published byAshlie Stephens Modified over 9 years ago
1
XML Databases by Sebastian Graf Hier beginnt mein toller Vortrag
2
Table of Contents XML Database Overview XML Database Example XPath
XML-QL XQuery Storing of XML Databases Relational DB vs. XML XML based Systems Hier sieht man gerade das Inhaltsverzeichnis. Echt jetzt.
3
XML Database Overview XML DB Navigation in Tree Tree structure
Think in nodes & axes Navigation in Tree XPath Tree structure contrast to SQL where relations are basic Big difference between SQL & XML SQL says what should be selected, but not how ( Oracle,DB2) Very important in the navigation XPath
4
XML Database Example <europe>
<country car_code = D memberships = org-eu org-nato …> <name>Germany</name> <capital>Berlin</capital> <poulation> </population> <country code>de</country code> <bundesland> <name>NRW</name> <capital>Düsseldorf</captial> <population> </population> </bundesland> </country> </europe> As every XML File, a XML Database has a root europe Elemets in country cannot have childs could also be written as childs Design Feature 2 Capitals !!! no problem because they are on different hirachy level
5
XPath Describes how to process XML items
logical path to a node (location path) Provides abstraction for XML languages XSLT XPointer XQuery XPath is a language that describes a way to locate and process items in Extensible Markup Language XSLT Extensible Stylesheet Language Transformations XPointer XPointer is a language for locating data within a XML document based on properties such as location within the document, character content, and attribute values
6
XPath /europe/country/name Selects all names
With predecessor „country“ With predecessor „europe“ Addressing like in the Unix Filesystem /europe/country/name selects all nodes „name“ that have a predecessor (father) country which has a father europe
7
XPath examples /europe/country[population > 50 000 000]
All countries with population > All car_codes of Europe /europe/country[name = Germany]//capital All captials in Germany
8
XPath Conclusion XPath offers basics navigation and selection features
However it is no complete XML Query Language No joins possible
9
Table of Contents XML Database Overview XML Database Example XPath
XML-QL XQuery Storing of XML Databases Relational DB vs. XML XML based Systems
10
XML-QL Early proposal for XML Query language Structure:
<Selection part> <construction part> WHERE #### IN #### CONSTRUCT #### Result : XML Document Selection Part : conditions for finding Construction Part : way of creating an XML document Structure : like SQL : select #### from #### where #### only the other way round
11
XML-QL Example WHERE <country car_code=$id> <name>$name</> </> IN “…/europe.xml“ CONSTRUCT <country car_code=$id name=$name</> <result> <country car_code=“D” name=“Germany”></> <country car_code=“F” name=“France”></> ….. </result> $id und $name are bonded to the car_code attribute and the content of the name element For every variable bounding a new country element ist created
12
XQuery XQuery should extend functionality of XML-QL
Design was related to SQL XQueries are of the form : FOR ### LET ### WHERE ### RETURN ### FLWR or Flower Also possible: FOR-IN (FLWR) WHERE … (FLWR) … RETURN … (FLWR)… Extended to XML-QL joins are possible Like XML-QL, Xquery returns a XML decument The basic structure cann be enhanced by putting more variables into the FOR and LET parts Where gives conditions like in SQL Return produces XML document Nested queries are possible
13
XQuery example Task : find all countires, that have a population > and have at least 10 cities FOR $c IN document(„europe.xml“) // country LET $cities := $c // city WHERE > AND count($cities) > 10 RETURN <bigcountry population = {$cities} </bigcountry> $c runs over all country elements. For every „$c“ the variable $cities is connected to all cities of $c
14
XQuery Join example Task : find all pairs of countires and cities, that have the same name FOR $country IN //country, $city IN //city WHERE $country/name/text() = $city/name/text() RETURN <pair name={$country/name/text()} This is a nested query
15
XQuery – what is missing?
No data manipulation in version 1.0 Raw Data has to be accessed for data manipulation Planned for later versions: Delete Rename Insert Replace What does this mean? Data can only be manipulated, by directly accessing the raw data
16
Table of Contents XML Database Overview XML Database Example XPath
XML-QL XQuery Storing of XML Databases Relational DB vs. XML XML based Systems
17
Storing of XML Databases
First Approach : one CLOB Whole Database stored as value Very easy to implement SQL statements cannot be used for query Second Approach : transformation Transformation to Relations SQL statements can be used High transformation effort Relational Databases!! A Character Large OBject (CLOB) is a varying-length string, measured in bytes, that can be up to 2 gigabytes long. A CLOB is used to store large single-byte character set data such as documents. A CLOB is considered to be a character string.
18
Relational DB vs. XML The SilkRoute Xperanto
Automatic transformation : relations XML Predefined DTD Xperanto Mapping of relational Database to XML Adds XML functionality to DB2
19
XML based Systems (B2B) Software AG eXcelon Tamino
XML platform Storing Development Integreation eXcelon Query interface for XPath Software AG Tamino XML platform Storing Development Integreation
20
More about XML databases
Web & Datenbanken dpunkt.verlag by Erhard Rahm & Gottfried Vossen ISBN : BA Library : INF G
21
Thanks for your attention
THE END Thanks for your attention
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.