W3C

XQuery 3.0 Requirements

W3C Working Group Note 08 April 2014

This version:
http://www.w3.org/TR/2014/NOTE-xquery-30-requirements-20140408/
Latest version:
http://www.w3.org/TR/xquery-30-requirements/
Previous versions:
http://www.w3.org/TR/2013/WD-xquery-30-requirements-20130108/ http://www.w3.org/TR/2010/WD-xquery-30-requirements-20100916/,
Editors:
Jonathan Robie, EMC Corporation
Daniel Engovatov, BEA Systems <dengovatov@bea.com>

Abstract

This document specifies goals and requirements for XML Query (XQuery) 3.0.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This is a Working Group Note as described in the Process Document. It was developed by the W3C XML Query Working Group, which is part of the XML Activity.

These Requirements identify extensions to the XQuery 1.0 Recommendation, published 23 January 2007, that have been requested by WG participants and by reviewers who do not participate in the W3C activities. The XML Query WG has reviewed these requirements and accepted them to the degree reflected in this document.

No substantive changes have been made to this specification since its previous publication as a Working Draft.

Please report errors in this document using W3C's public Bugzilla system (instructions can be found at http://www.w3.org/XML/2005/04/qt-bugzilla). If access to that system is not feasible, you may send your comments to the W3C XSLT/XPath/XQuery public comments mailing list, public-qt-comments@w3.org. It will be very helpful if you include the string “[XQuery30Req]” in the subject line of your report, whether made in Bugzilla or in email. Please use multiple Bugzilla entries (or, if necessary, multiple email messages) if you have more than one comment to make. Archives of the comments and responses are available at http://lists.w3.org/Archives/Public/public-qt-comments/.

Publication as a Working Group Note does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Table of Contents

1 Goals
2 Requirements
    2.1 Terminology
    2.2 General Requirements
        2.2.1 Backward compatibility
        2.2.2 Extension compatibility
    2.3 XML Query Functionality
        2.3.1 Value-based grouping
        2.3.2 Error processing and recovery
        2.3.3 Numeric formatting
        2.3.4 Date formatting
        2.3.5 Default values for external variables
        2.3.6 Non-deterministic external functions
        2.3.7 Positional grouping
        2.3.8 Windowing
        2.3.9 Output numbering
        2.3.10 Dynamic creation of namespace bindings
        2.3.11 Declaration of serialization parameters
        2.3.12 Node references
        2.3.13 Outer for
        2.3.14 Type declaration for context item
        2.3.15 Support for new data types
        2.3.16 Higher order functions
        2.3.17 Conditional constructors
        2.3.18 Validation
        2.3.20 Module composition restrictions
        2.3.21 Invocation of external functionality
        2.3.22 Static typing extensions
3 References
    3.1 Normative
    3.2 Non-normative


1 Goals

The goal of XML Query 3.0 is to extend XML Query 1.0 with additional functionality in response to requests from users and implementors.

Satisfying these goals may require changes to the set of seven documents that have progressed to Recommendation together (Data Model, Functions and Operators, Serialization, XPath 2.0, XQuery 1.0, XQueryX, and XSLT 2.0).

2 Requirements

2.1 Terminology

The following keywords are used throughout the document to specify the extent to which an item is a requirement for the work of the XML Query Working Group:

MUST

The item is an absolute requirement.

SHOULD

There may exist valid reasons not to treat this item as a requirement, but the full implications should be understood and the case carefully weighed before discarding this item.

MAY

An item deserves attention, but further study is needed to determine whether the item should be treated as a requirement.

When the words MUST, SHOULD, or MAY are used in this technical sense [IETF RFC 2119], they occur as a hyperlink to these definitions. These words will also be used with their conventional English meaning, in which case there is no hyperlink. For instance, the phrase "the full implications should be understood" uses the word "should" in its conventional English sense, and therefore occurs without the hyperlink.

Each requirement also includes a status section, indicating its current situation in the XQuery/XPath/XSLT family of specifications. Three status levels are used:

"Green" status

green status This indicates that the requirement, according to its original formulation, has been completely met. Optional clarifying text may follow.

"Yellow" status

yellow status This indicates that the requirement has been partially met according to its original formulation. When this happens, explanatory text is provided to better clarify the current scope of the requirement.

"Red" status

red status This indicates that the requirement, according to its original formulation, has not been met. If this is the case, explanatory text is provided.

2.2 General Requirements

2.2.1 Backward compatibility

XQuery 3.0 MUST be backward compatible.

Every valid XQuery 1.0 expression MUST be valid in XQuery 3.0 and it MUST evaluate to the same result.

green status Status: this requirement has been met.

2.2.2 Extension compatibility

XQuery 3.0 MUST be compatible with XQuery 1.0 extensions developed by the XML Query Working Group, including XQuery Update Facility and XQuery 1.0 and XPath 2.0 Full-Text.

green status Status: this requirement has been met.

2.3 XML Query Functionality

2.3.1 Value-based grouping

XQuery 3.0 MUST include a language facility to specify value-based grouping.

green status Status: this requirement has been met.

2.3.2 Error processing and recovery

XQuery 3.0 MUST provide a mechanism to process errors raised by an expression and to return an alternative value.

This MAY be implemented by introducing a try-catch expression.

green status Status: this requirement has been met.

2.3.3 Numeric formatting

XQuery 3.0 MUST include additional library functions or an equivalent mechanism to perform formatting of numeric values.

It SHOULD be similar to the functionality provided in XSLT 2.0, such as by function format-number().

green status Status: this requirement has been met.

2.3.4 Date formatting

XQuery 3.0 MUST include additional library functions or an equivalent mechanism to perform formatting of date and time values.

It SHOULD be similar to the functionality provided in XSLT 2.0, such as by functions format-date(), format-time(), format-dateTime().

green status Status: this requirement has been met.

2.3.5 Default values for external variables

XQuery 3.0 MUST have a mechanism to specify default values for external variables.

green status Status: this requirement has been met.

2.3.6 Non-deterministic external functions

XQuery 3.0 MUST provide a way to denote that an external function is non-deterministic.

red status Status: this requirement has not been met.

2.3.7 Positional grouping

XQuery 3.0 SHOULD provide a facility for positional grouping of items in a sequence according to specified partitioning conditions.

green status Status: this requirement has been met.

2.3.8 Windowing

XQuery 3.0 SHOULD provide a way to iterate over a sequence by several values at a time.

green status Status: this requirement has been met.

2.3.9 Output numbering

XQuery 3.0 SHOULD provide a mechanism to associate ordinal numbers with the items returned by a FLWOR expression.

green status Status: this requirement has been met.

2.3.10 Dynamic creation of namespace bindings

XQuery 3.0 SHOULD allow dynamic creation of namespace bindings.

green status Status: this requirement has been met.

2.3.11 Declaration of serialization parameters

XQuery 3.0 SHOULD have a mechanism to specify serialization parameters in the query prolog.

green status Status: this requirement has been met.

2.3.12 Node references

XQuery 3.0 SHOULD support creation of a reference to an existing node having the following properties:

a) the reference could be included in a constructed element

b) the reference can be dereferenced, returning the original node with the original node id.

red status Status: this requirement has not been met.

2.3.13 Outer for

XQuery 3.0 SHOULD provide additional mechanisms to specify joins between sequences. A possible approach would be to add an "outer-for" clause to the FLWOR expression to specify variable binding which is guaranteed to be bound to an empty sequence if there are no other bindings generated.

green status Status: this requirement has been met.

2.3.14 Type declaration for context item

XQuery 3.0 SHOULD allow explicit type declaration for the context item.

green status Status: this requirement has been met.

2.3.15 Support for new data types

XQuery 3.0 SHOULD support new data types introduced in XML Schema 1.1.

green status Status: this requirement has been met.

2.3.16 Higher order functions

XQuery 3.0 MAY provide an ability to pass a function as an argument to another function and to invoke a function that has been passed as an argument.

green status Status: this requirement has been met. (The proposal is not yet integrated into our internal Working Draft.)

XQuery 3.0 MAY also provide the ability to define anonymous functions e.g., lambda expressions.

green status Status: this requirement has been met. (The proposal is not yet integrated into our internal Working Draft.)

2.3.17 Conditional constructors

XQuery 3.0 MAY add a language extension to the node constructors to specify, in a compact notation, that a node should be constructed only if its typed value would not be an empty sequence or if it would satisfy some other condition.

green status Status: this requirement is already met by XQuery 1.0, there is no need to introduce new syntax. Either of the following solutions works:

if ($mentor) then attribute mentor { $mentor } else ()
(attribute mentor { $mentor })[$mentor]

2.3.18 Validation

XQuery 3.0 MAY provide a mechanism to validate an element or document node with respect to a global named type

green status Status: this requirement has been met.

or against non-global element declarations or types.

red status Status: this requirement has not been met.

XQuery 3.0 MAY provide a mechanism to validate an element or document node against a named schema without importing the schema.

red status Status: this requirement has not been met.

2.3.20 Module composition restrictions

XQuery 3.0 MAY relax the restrictions on the module import feature relating to forward references and circular imports.

green status Status: this requirement has been met.

2.3.21 Invocation of external functionality

XQuery 3.0 MAY provide a normative way to invoke external functions and modules that are not implemented in XQuery, such as functions defined as web services or XSLT functions and templates.

red status Status: this requirement has not been met.

2.3.22 Static typing extensions

XQuery 3.0 MAY extend static typing rules.

red status Status: this requirement has not been met. Static typing is no longer a normative part of XQuery 3.0.

3 References

3.1 Normative

XQuery 3.0: An XML Query Language
XQuery 3.0: An XML Query Language, Jonathan Robie, Don Chamberlin, Michael Dyck, John Snelson, Editors. World Wide Web Consortium, 08 April 2014. This version is http://www.w3.org/TR/2014/REC-xquery-30-20140408/. The latest version is available at http://www.w3.org/TR/xquery-30/.
XQuery and XPath Data Model (XDM) 3.0
XQuery and XPath Data Model (XDM) 3.0, Norman Walsh, Anders Berglund, John Snelson, Editors. World Wide Web Consortium, 08 April 2014. This version is http://www.w3.org/TR/2014/REC-xpath-datamodel-30-20140408/. The latest version is available at http://www.w3.org/TR/xpath-datamodel-30/.
XSL Transformations (XSLT) Version 3.0
XSL Transformations (XSLT) Version 3.0, Michael Kay, Editor. World Wide Web Consortium, 12 December 2013. This version is http://www.w3.org/TR/2013/WD-xslt-30-20131212/. The latest version is available at http://www.w3.org/TR/xslt-30/.
XQuery Update Facility 3.0 Requirements and Use Cases
XQuery Update Facility 3.0 Requirements and Use Cases, Andrew Coleman, Editor. World Wide Web Consortium, 13 December 2011. This version is http://www.w3.org/TR/2012/WD-xquery-update-30-requirements-use-cases-20120327/. The latest version is available at http://www.w3.org/TR/xquery-update-30-requirements-use-cases/.
XQuery and XPath Full Text 3.0 Requirements and Use Cases
XQuery and XPath Full Text 3.0 Requirements and Use Cases, Pat Case, Editor. World Wide Web Consortium, 27 March 2012. This version is http://www.w3.org/TR/2012/WD-xpath-full-text-30-requirements-use-cases-20120327/. The latest version is available at http://www.w3.org/TR/xpath-full-text-30-requirements-use-cases/.
XQuery 1.0
XQuery 1.0: An XML Query Language, W3C Recommendation, 23 January 2007 and references therein.
XSLT 2.0
XSL Transformations (XSLT) Version 2.0, W3C Recommendation, 23 January 2007 and references therein.
XDM
XQuery 1.0 and XPath 2.0 Data Model (XDM), W3C Recommendation, 23 January 2007
XQuery 1.0 requirements
XML Query (XQuery) Requirements, W3C Working Draft 3 June 2005

3.2 Non-normative

The following references are some of the works considered by the WG in deriving its requirements.

XML
Extensible Markup Language (XML) 1.0 (Fourth Edition). W3C Recommendation, 29 September 2006.
XML Schema Part 0
XML Schema Part 0: Primer Second Edition, W3C Recommendation 28 October 2004.
XML Schema Part 1
XML Schema Part 1: Structures Second Edition, W3C Recommendation 28 October 2004.
XML Schema Part 2
XML Schema Part 2: Datatypes Second Edition, W3C Recommendation 28 October 2004.
XML Schema 1.1 requirements
Requirements for XML Schema 1.1, W3C Working Draft, 2003.
Kay06
"Positional Grouping in XQuery", Kay, M.H. XIME-P International workshop proceedings, 2006
Colby05
"Extending XQuery for Analytics", Beyer K., Chamberlin D. et al. SIGMOD 2005
Borkar04
"Extending XQuery for Grouping, Duplicate Elimination, and Outer Joins.", Borkar V. and Carey M. XML 2004, Idealliance