XQuery 1.0 and XPath 2.0 Data Model (XDM)

XML Foundations (INFO 242)

Erik Wilde, UC Berkeley School of Information
2007-10-11
Creative Commons License

This work is licensed under a CC
Attribution 3.0 Unported License

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 XSDL, which results in an complex and powerful collection of built-in datatypes and operations on these datatypes.

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]

XPath 1.0 Sets

XPath 2.0 Sequences

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]

General Comparisons

= != < <= > >=

Value Comparisons

eq ne lt le gt ge

Node Comparisons

is << >>

Some Surprises

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]

XSDL Everywhere

XSDL Type Hierarchy

xsd-type-hierarchy.gif

XDM Type Hierarchy

xdm-type-hierarchy.png

Simplified XDM Type Hierarchy

xdm-type-hierarchy-simplified.jpg

Atomic Types

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]

Testing Sequence Cardinality

Set Operations on Sequences

Manipulating Sequences (I)

Manipulating Sequences (II)

Aggregating Sequences

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]

Type Casting

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]

Advanced Selections

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>

Questions