Skip to main content

XQuery Dialect & Restrictions

DortDB's XQuery is a subset of XQuery 3.0 (which itself is a superset of XPath). It focuses on the data-selection and transformation core: path expressions, FLWOR, and sequence operations.

Supported​

  • XPath path expressions and predicates over DOM/XML trees.
  • FLWOR expressions (for / let / where / order by / return).
  • Sequences and sequence-valued functions (aggregation via sum, etc.).
  • The static/dynamic context: current item (. or $fs:dot), position (fn:position() / $fs:position), and size (fn:last() / $fs:last).
  • Namespace declarations, e.g. declare namespace foo = "http://example.org";.
  • cast expressions (the only typing construct that is supported).

XQuery contributes its own plan operators (such as tree navigation) that extend the shared algebra; see the language mapping.

Not implemented, and not planned​

DortDB's XQuery deliberately omits the type system. The following are not available and are not planned:

  • the as keyword (type declarations)
  • typeswitch expressions
  • instance of expressions
  • treat expressions
  • castable expressions
  • validate expressions
  • function types other than function(*)
  • named function references with arity (fnname#arity)

Not implemented, possibly later​

These may be added in the future but are not available today:

  • try / catch expressions
  • pragma expressions
  • the window FLWOR clause
  • inline functions
  • %private / %public annotations
  • module prolog features beyond namespace definitions

Standard library​

Only a subset of the XQuery/XPath standard-library functions is implemented, so some functions you know from full XQuery engines may be missing. Missing functions can be supplied as extensions.

Two XQuery specifics apply to any function you add: