1 / 21

XML Databases

XML Databases. by Sebastian Graf. Table of Contents. XML Database Overview XML Database Example XPath XML-QL XQuery Storing of XML Databases Relational DB vs. XML XML based Systems. XML Database Overview. XML DB Tree structure Think in nodes & axes Navigation in Tree XPath.

elysia
Télécharger la présentation

XML Databases

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. XML Databases by Sebastian Graf

  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

  3. XML Database Overview • XML DB • Tree structure • Think in nodes & axes • Navigation in Tree • XPath

  4. XML Database Example <europe> <country car_code = D memberships = org-eu org-nato …> <name>Germany</name> <capital>Berlin</capital> <poulation> 82 440 134</population> <country code>de</country code> <bundesland> <name>NRW</name> <capital>Düsseldorf</captial> <population>18 052 000 </population> </bundesland> </country> </europe>

  5. XPath • Describes how to process XML items • logical path to a node (location path) • Provides abstraction for XML languages • XSLT • XPointer • XQuery

  6. XPath /europe/country/name Selects all names • With predecessor „country“ • With predecessor „europe“

  7. XPath examples /europe/country[population > 50 000 000]  All countries with population > 50 000 000 /europe/country/@car_code  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

  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>

  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)…

  13. XQuery example • Task : find all countires, that have a population > 1 000 000 and have at least 10 cities FOR $c IN document(„europe.xml“) // country LET $cities := $c // city WHERE $c/@population > 1 000 000 AND count($cities) > 10 RETURN <bigcountry population = {$c/@population}> <name>{$c/@name}</name> {$cities} </bigcountry>

  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()} country={$country/@car_code} city={$city/@country}>

  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

  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

  18. Relational DB vs. XML • The SilkRoute • 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 • Tamino • XML platform • Storing • Development • Integreation • eXcelon • Query interface for XPath

  20. More about XML databases Web & Datenbanken dpunkt.verlag by Erhard Rahm & Gottfried Vossen ISBN : 3-89864-189-9 BA Library : INF G 5100.62

  21. THE END Thanks for your attention

More Related