W3C

XML Query (XQuery) 1.1 Requirements

W3C Working Draft 23 March 2007

This version:
http://www.w3.org/TR/2007/WD-xquery-11-requirements-20070323
Latest version:
http://www.w3.org/TR/xquery-11-requirements
Editor:
Daniel Engovatov, BEA Systems <dengovatov@bea.com>

Abstract

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

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 the First Public Working Draft for review by W3C Members and other interested parties. Publication as a Working Draft 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 has been produced by the XML Query Working Group (part of the XML Activity), following the procedures set out in the W3C Process Document. The XML Query Working Group feels that the contents of this Working Draft are relatively stable, and therefore encourages feedback on this version.

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 extensively and has reached a very high level of agreement (but not necessarily unanimity) on the desirability of each of them.

Public comments on this document and its open issues are invited. Comments on this document should be made in W3C's public Bugzilla system (instructions can be found at http://www.w3.org/XML/2005/04/qt-bugzilla). When entering comments, select the Product named "XPath / XQuery / XSLT", the Component named "XQuery 1.1 Requirements", and the Version named "Working drafts". This repository includes open issues recorded by the XML Query Working Group as well as by members of the public. If access to the Bugzilla system is not feasible, you may send your comments to the W3C XSLT/XPath/XQuery mailing list, public-qt-comments@w3.org. It will be very helpful if you include the string [XQuery11Req] in the subject line of your comment, whether made in Bugzilla or in email. Each Bugzilla entry and email message should contain only one comment. Archives of the comments and responses are available at http://lists.w3.org/Archives/Public/public-qt-comments/.

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.19 Type expressions
        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 1.1 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 eight documents that have progressed to Recommendation together (Data Model, Functions and Operators, Formal Semantics, 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.

2.2 General Requirements

2.2.1 Backward compatibility

XQuery 1.1 MUST be backward compatible.

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

2.2.2 Extension compatibility

XQuery 1.1 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.

2.3 XML Query Functionality

2.3.1 Value-based grouping

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

2.3.2 Error processing and recovery

XQuery 1.1 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.

2.3.3 Numeric formatting

XQuery 1.1 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().

2.3.4 Date formatting

XQuery 1.1 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().

2.3.5 Default values for external variables

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

2.3.6 Non-deterministic external functions

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

2.3.7 Positional grouping

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

2.3.8 Windowing

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

2.3.9 Output numbering

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

2.3.10 Dynamic creation of namespace bindings

XQuery 1.1 SHOULD allow dynamic creation of namespace bindings.

2.3.11 Declaration of serialization parameters

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

2.3.12 Node references

XQuery 1.1 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.

2.3.13 Outer for

XQuery 1.1 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.

2.3.14 Type declaration for context item

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

2.3.15 Support for new data types

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

2.3.16 Higher order functions

XQuery 1.1 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.

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

2.3.17 Conditional constructors

XQuery 1.1 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.

2.3.18 Validation

XQuery 1.1 MAY provide a mechanism to validate an element or document node with respect to a global named type or against non-global element declarations or types.

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

2.3.19 Type expressions

XQuery 1.1 MAY provide a way to compare the type of an expression to the type of another expression without exposing the type itself.

2.3.20 Module composition restrictions

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

2.3.21 Invocation of external functionality

XQuery 1.1 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.

2.3.22 Static typing extensions

XQuery 1.1 MAY extend static typing rules.

3 References

3.1 Normative

XQuery 1.0
XQuery 1.0: An XML Query Language, W3C Recommendation, 23 January 2007 and references therein. (See http://www.w3.org/TR/xquery.)
XSLT 2.0
XSL Transformations (XSLT) Version 2.0, W3C Recommendation, 23 January 2007 and references therein. (See http://www.w3.org/TR/xslt20/.)
XDM
XQuery 1.0 and XPath 2.0 Data Model (XDM), W3C Recommendation, 23 January 2007 (See http://www.w3.org/TR/xpath-datamodel/.)
XQuery 1.0 requirements
XML Query (XQuery) Requirements, W3C Working Draft 3 June 2005 (See http://www.w3.org/TR/xquery-requirements.)
Update Requirements
XQuery Update Facility Requirements, W3C Working Draft, Feb. 2005. (See http://www.w3.org/TR/xquery-update-requirements.)
Full-Text Requirements
XQuery and XPath Full-Text Requirements, W3C Working Draft, May 2003. (See http://www.w3.org/TR/xquery-full-text-requirements.)

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. (See http://www.w3.org/TR/1998/REC-xml-19980210.)
XML Schema Part 0
XML Schema Part 0: Primer Second Edition, W3C Recommendation 28 October 2004. (See http://www.w3.org/TR/xmlschema-0/.)
XML Schema Part 1
XML Schema Part 1: Structures Second Edition, W3C Recommendation 28 October 2004. (See http://www.w3.org/TR/xmlschema-1/.)
XML Schema Part 2
XML Schema Part 2: Datatypes Second Edition, W3C Recommendation 28 October 2004. (See http://www.w3.org/TR/xmlschema-2/.)
XML Schema 1.1 requirements
Requirements for XML Schema 1.1, W3C Working Draft, 2003. (See http://www.w3.org/TR/xmlschema-11-req/.)
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