XQuery 1.0 and XPath 2.0 Data Model (XDM)

XML Foundations [./]
Fall 2008 — INFO 242 (CCN 42572)

Erik Wilde, UC Berkeley School of Information
2008-10-21

Creative Commons License [http://creativecommons.org/licenses/by/3.0/]

This work is licensed under a CC
Attribution 3.0 Unported License
[http://creativecommons.org/licenses/by/3.0/]

Contents E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

Contents

E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(2) Abstract

While XPath 2.0 syntactically is an extension of XPath 1.0, the underlying data model has changed quite radically. Instead of XPath 1.0's simple concept of four datatypes (node set, number, string, boolean), the XQuery 1.0 and XPath 2.0 Data Model (XDM) is based on sequences and allows much more sophisticated ways of data representation and manipulation. Furthermore, XDM includes the datatypes defined by XSD, which results in an complex and powerful collection of built-in datatypes and operations on these datatypes.



Sets vs. Sequences

Outline (Sets vs. Sequences)

  1. Sets vs. Sequences [2]
  2. Comparisons [4]
  3. Available Datatypes [5]
  4. Working with Sequences [5]
  5. Working with Values [1]
  6. Conclusions [3]
Sets vs. Sequences E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(4) XPath 1.0 Sets



Sets vs. Sequences E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(5) XPath 2.0 Sequences



Comparisons

Outline (Comparisons)

  1. Sets vs. Sequences [2]
  2. Comparisons [4]
  3. Available Datatypes [5]
  4. Working with Sequences [5]
  5. Working with Values [1]
  6. Conclusions [3]
Comparisons E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(7) General Comparisons

= != < <= > >=


Comparisons E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(8) Value Comparisons

eq ne lt le gt ge


Comparisons E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(9) Node Comparisons

is << >>


Comparisons E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(10) Some Surprises



Available Datatypes

Outline (Available Datatypes)

  1. Sets vs. Sequences [2]
  2. Comparisons [4]
  3. Available Datatypes [5]
  4. Working with Sequences [5]
  5. Working with Values [1]
  6. Conclusions [3]
Available Datatypes E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(12) XSD Everywhere



Available Datatypes E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(13) XSD Type Hierarchy

xsd-type-hierarchy.gif

Available Datatypes E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(14) XDM Type Hierarchy

xdm-type-hierarchy.png

Available Datatypes E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(15) Simplified XDM Type Hierarchy

xdm-type-hierarchy-simplified.jpg

Available Datatypes E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(16) Atomic Types



Working with Sequences

Outline (Working with Sequences)

  1. Sets vs. Sequences [2]
  2. Comparisons [4]
  3. Available Datatypes [5]
  4. Working with Sequences [5]
  5. Working with Values [1]
  6. Conclusions [3]
Working with Sequences E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(18) Testing Sequence Cardinality



Working with Sequences E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(19) Set Operations on Sequences



Working with Sequences E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(20) Manipulating Sequences (I)



Working with Sequences E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(21) Manipulating Sequences (II)



Working with Sequences E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(22) Aggregating Sequences



Working with Values

Outline (Working with Values)

  1. Sets vs. Sequences [2]
  2. Comparisons [4]
  3. Available Datatypes [5]
  4. Working with Sequences [5]
  5. Working with Values [1]
  6. Conclusions [3]
Working with Values E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(24) Type Casting



Conclusions

Outline (Conclusions)

  1. Sets vs. Sequences [2]
  2. Comparisons [4]
  3. Available Datatypes [5]
  4. Working with Sequences [5]
  5. Working with Values [1]
  6. Conclusions [3]
Conclusions E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(26) Advanced Selections



Conclusions E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(27) Sample XML

 <reference name="kau03">
  <names type="author">
   <person>
    <givenname>Roland</givenname>
    <surname>Kaufmann</surname>
   </person>
  </names>
  <date value="2003-05"/>
  <abstract>
   <richtext>
    <p>The work presented here extends an existing algorithm for testing if an inclusion relation exists between two markup schemata, to only take into account the parts of the grammar that have been used in a given subset of its language. Statistics for this purpose are gathered in combination with validation when documents are entered and are stored along with them in the repository. This modified subtyping relation is used to determine compatibility with the current database when a schema is upgraded.</p>
   </richtext>
  </abstract>
  <address>Bergen, Norway</address>
  <publisher type="university">University of Bergen</publisher>
  <title>Efficiently Locating Schema Incompatibilities in an Extensible Markup Language</title>
  <annotation>
   <richtext>
    <p>Keywords: <keywordref type="topic-xmlschema" weight="0.8"/>; </p>
   </richtext>
  </annotation>
  <identifier type="uri" resourceType="application/pdf">www.ub.uib.no/elpub/2003/h/413001/Hovedoppgave.pdf</identifier>
  <howpublished>Ph.D. Thesis</howpublished>
 </reference>


Conclusions E. Wilde: XQuery 1.0 and XPath 2.0 Data Model (XDM)

(28) Questions



2008-10-21 XML Foundations [./]
Fall 2008 — INFO 242 (CCN 42572)