1 / 24

XML Databases

XML Databases. CS315b Domain-specific Languages for Parallelism. Xquery / XQueryP. Charis Charitsis & Nicolas Kokkalis. Outline. XML: What and Why? Application: Web Services XQuery: The XML Query Language

elisha
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 CS315b Domain-specific Languages for Parallelism Xquery / XQueryP CharisCharitsis & Nicolas Kokkalis

  2. Outline • XML: What and Why? • Application: Web Services • XQuery: The XML Query Language • Good News: XQuery, as a declarative language, is ideal for automatic parallel execution • Bad News: We still need Java  We limmit the “automatic parallel execution” • XQueryP scripting extension and the tradeoff CS315B

  3. What is XML ? <language type=”computer language”> <name> XML </name> <description> A universal format for structured documents and data. </description></language> • XML is designed to describe data and to focus on what data is. • HTML is designed to display data and to focus on how data looks. • Thus, HTML is about displaying information, while XML is about describing information. CS315B – Domain-specific Languages for Parallelism

  4. Why so much popularity ? • Can represent a wide variety of both structured and unstructured data • Can be used in integrating heterogeneous data sources (traditional/relational databases , data files, email messages, web pages, etc.) • Can be used on a variety if devices including PCs, PDAs, smart mobile phones, etc. B U T M A I N L Y . . . • ”Helps companies to cut costsin information exchange” CS315B – Domain-specific Languages for Parallelism

  5. XML vs. Relational Data Model • Differences • Commonalities CS315B – Domain-specific Languages for Parallelism

  6. Application: Web Services A WS is a class on the Web. Like an RPC, which • identified by a URI (e.g. http://my.service:234) • accepts as argument an XML envelope • returns an XML response. Client Client Client XML XML XML Server Application Logic Web Service CS315B – Domain-specific Languages for Parallelism

  7. Server Application Logic (Java / .NET) Web Service (XML Domain) Client XQuery (XML Domain) XML XML XML DB Server Application Logic Web Service CS315B – Domain-specific Languages for Parallelism Typical Architecture

  8. Xquery: The XML query language • XQuery is a declarative programming language, designed to manipulate and query XML data. • With XQuery you describe ’’what’’ you want to achieve and leave the ’’how’’ to the runtime system • It is essentially designed for optimizability, including automatic parallelization of the execution of the queries CS315B – Domain-specific Languages for Parallelism

  9. The XML Data Model <book> <ISBN> 333 </ISBN> <title> RDBMS </title><author> Paul </author><chapter><num> I </num><title> Information Retrieval using RDBMS </title><section><title> Beyond Simple Information Retrieval </title><section><title> Extension of RDBMS features </title></section></section></chapter></book> CS315B – Domain-specific Languages for Parallelism

  10. RETURN expr FOR var IN expr LET var := expr WHERE expr Illustrative e.g.:FLW(O)R Expression • Syntactic sugar that combines FOR, LET, IF • Example • Return the number of title elements of the chapter ”I” of the book CS315B – Domain-specific Languages for Parallelism

  11. (docId, sPos, ePos, level) docId: identifier of the document sPos: starting position of the element or string within the XML doc ePos: end position of the element (for string => same as sPos) level: nesting depth within the document CS315B – Domain-specific Languages for Parallelism

  12. To facilitate the evaluation of the XQuery expressions, an index is created for all the nodes within the XML database. • Example: Suppose we have the containment query : • ”chapter//title” • Search the table for all entries in which term= ”chapter” • { (1,11,35,1) } • Search the table for all entries in which term= ”title” • { (1,5,7,1) , (1,15,20,2), • (1,22,26,3), (1,28,32,4) } • Combine them! • { <(1,11,35,1) , (1,5,7,1) > , • <(1,11,35,1) , (1,15,20,2)>, • <(1,11,35,1) , (1,22,26,3)>, • <(1,11,35,1) , (1,28,32,4) > } CS315B – Domain-specific Languages for Parallelism

  13. Supporting H/W: Cluster Computing • ”Beowulf cluster”: An example of a high performance parallel computing system used for parallel processing of XML Queries • Several processing nodes interconnected via a switch • Each node has its own CPU with a sizable cache, a large main memory (typically>1GB) and a hd CS315B – Domain-specific Languages for Parallelism

  14. Master: runs the file. Serves as the point system for the clustering S/W to route duties and monitor all individual nodes (i.e., slaves) • Beowulf: • Open source s/w like Linux • MPI library for broadcasting and point-to-point messages among the cluster’s nodes. CS315B – Domain-specific Languages for Parallelism

  15. How the parallel processing is done • Phase 1: Distribute the entries of the fully-inverted index among the cluster nodes for processing (e.g., round-robin distribution, hash-based distribution). • Phase 2: Each cluster processes the containment query to generate the corresponding lists of index entries. • Phase 3: The elements of the generated list are checked against one another to produce the result set. CS315B – Domain-specific Languages for Parallelism

  16. XQuery open challenges • Despite of XQuery we still need Java/.NET to: • implement user interfaces • call Web services; interact with other programs • expose functions as Web service • write complex applications • Trade-off between optimizability (on one side) & flexibility, determinism and expressive power (on the other side) • Query languages are more optimizable but pay a price on the other side • Imperative languages lack optimizability but the semantics are simpler, deterministic and richer CS315B – Domain-specific Languages for Parallelism

  17. XQuery push The ultimate goal: get rid of Java => all XQuery • XQueryP: Extension of XQuery for scripting Server Application Logic (Java / .NET) Web Service (XML Domain) Client XQuery (XML Domain) XML XML XML DB Server Application Logic Web Service CS315B – Domain-specific Languages for Parallelism

  18. XQueryP implementations • Prototype in Big OracleDB • Presented at Plan-X 2005 • Prototype in BerkeleyDB-XML • Might be open sourced (if interest) • MXQuery • http://www.mxquery.org(Java) • Runs on mobile phones: Java CLDC1.1; some cuts even run CLDC 1.0 • Eclipse Plugin available since March 2007 • Zorba C++ engine (FLWOR Foundation) • Small footprint, performance, extensibility, potentially embeddable in many contexts CS315B – Domain-specific Languages for Parallelism

  19. List of references • Ghassan Z. Qadah: ”Parallel processing of xml databases” [2005 IEEE CCECE/CCGEI] • Xiaogang Li, Swarup Kumar Sahoo, GaganAgrawal: ”XQuery Perspective: Using XML/XQuery for Scientific Applications and Applying Scientific CompilationTechniques” [2004 SIGMOD] • Daniela Florescu, Donald Kossmann. ”CS345B: XML and Databases”. http://www.stanford.edu/class/cs345b/ • W3C XML Query XQuery http://www.w3.org/XML/Query/ CS315B – Domain-specific Languages for Parallelism

  20. Backup slides CS315B – Domain-specific Languages for Parallelism

  21. XQueryP breaks the sweetness • Introduces parts of code that will: • Run in Sequential Mode • Define the order in which expressions will be evaluated • Be strictly deterministic • Manually handle exceptions CS315B

  22. Some vertical application domains for XML • HealthCare Level Seven http://www.hl7.org/ • Geography Markup Language (GML) • Systems Biology Markup Language (SBML) http://sbml.org/ • XBRL, the XML based Business Reporting standard http://www.xbrl.org/ • Global Justice XML Data Model (GJXDM) http://it.ojp.gov/jxdm • ebXMLhttp://www.ebxml.org/ • e.g. Encoded Archival Description Applicationhttp://lcweb.loc.gov/ead/ • Digital photography metadata XMP • An XML grammar for sensor data (SensorML) • Real Simple Syndication (RSS 2.0) CS315B – Domain-specific Languages for Parallelism

  23. XQuery, Xpath, XSLT XQuery 1.0 XSLT 2.0 extends uses FLWOR expressions Node constructors Validation Xpath 2.0 2007 extends, almost backwards compatible Xpath 1.0 uses 1999 XSLT 1.0 CS315B – Domain-specific Languages for Parallelism

  24. How can we achieve better performance ? • Allow to execute sub-computations in a different order  Parallelization, rescheduling • Possible to use various data access paths • Allow lazy evaluation • Allow streaming/pipelining between operations (no materialization of intermediate results) • Allow various evaluation algorithms for the same logical operation CS315B – Domain-specific Languages for Parallelism

More Related