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";. castexpressions (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
askeyword (type declarations) typeswitchexpressionsinstance ofexpressionstreatexpressionscastableexpressionsvalidateexpressions- 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/catchexpressions- pragma expressions
- the
windowFLWOR clause - inline functions
%private/%publicannotations- 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:
- Functions automatically receive the current dynamic context as their last argument, so they can read the current item, position, and size.
- Arguments of functions, aggregates and castables are
atomized by default. Set
skipAtomization: trueon anXQueryFnto receive them as-is.