W3C

XQuery Scripting Extension 1.0 Requirements

W3C Working Group Note 20 June 2017

This version:
https://www.w3.org/TR/2017/NOTE-xquery-sx-10-requirements-20170620/
Latest version:
https://www.w3.org/TR/xquery-sx-10-requirements/
Previous version:
https://www.w3.org/TR/2007/WD-xquery-sx-10-requirements-20070323/
Editors:
Daniel Engovatov, BEA <dengovatov@bea.com>
Daniela Florescu, Oracle Corporation <dana.florescu@oracle.com>
Giorgio Ghelli, Pisa University <ghelli@di.unipi.it>

Abstract

This document specifies goals and requirements for the XQuery Scripting Extension.

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 https://www.w3.org/TR/.

This document is governed by the 1 March 2017 W3C Process Document.

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.

This Working Group Note has been published in order to document the work that the XML Query Working Group has done in the area of providing an imperative extension to XQuery. The WG was unable to achieve consensus on several significant aspects of this technology and determined to terminate work on the project in mid-2014.

Please report errors in this document using W3C's public Bugzilla system (instructions can be found at https://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 “[SXReq]” 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 https://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.


1 Goals

This document describes the requirements for the XQuery Scripting Extensions. XQuery [XQuery 1.0] is a functional language that is Turing-complete and well suited to write code that ranges from simple queries to complete applications. However, some categories of applications are more easily implemented by combining XQuery capabilities with some imperative features, such as the ability to explicitly manage internal states. The same issue stands for XQuery enriched with the [XQuery Update Facility 1.0] (hereafter, XQuery With Updates). The scripting extension is intended to overcome this problem, and allow programmers to write such applications without relying on embedding XQuery into an external language.

2 Usage Scenarios

The following usage scenarios describe ways in which the XQuery Scripting Extension may be used in various environments, and represent a wide range of activities and needs that illustrate the problem space to be addressed. They are intended to be used as design cases during the development of the XQuery Scripting Extension, and should be reviewed when critical decisions are made. These usage scenarios should also prove useful in helping non-members of the XML Query Working Group understand the intent and goals of the project.

While XQuery is very well suited to perform the main tasks of XML exploration and transformation that are common to most of these cases, some limited extensions would make it easier to use XQuery to write some complex applications that belong to the following usage scenarios.

2.1 Applications that perform complex manipulations on persistent XML data

Writing applications that modify persistent data, stored in files or in databases. Such applications may need to operate on data in stages, and may need to verify that the modified data meet some constraints.

2.2 Complex XML to XML transformations

Writing code that performs complex XML to XML transformations.

2.3 Implementation of web services

Writing code that implements a web service, with the ability to access and modify persistent XML data.

2.4 Processing RSS feeds

Writing code that generates or aggregates RSS feeds.

2.5 Web service message composition and orchestration

Writing code that orchestrates web services.

2.6 XML application integration

Writing scripting code that calls both XQuery With Updates and external functions, which may manipulate state and perform side-effects.

2.7 XML data cleaning or normalization

Writing code that performs data cleaning operations.

2.8 XML data integration

Writing code that accesses multiple data sources with the ability of reflecting updates from the integrated data to the data sources.

2.9 XML data verification

Expressing complex constraints on XML data.

3 Requirements

3.1 Terminology

In this specification the words must, must not, should, should not, may and recommended, when are to be interpreted as described in [RFC 2119]. When these words are used in this technical sense, they occur as a hyperlink to [RFC 2119]. These words will also be used with their conventional English meaning, in which case there is no hyperlink.

XQuery With Updates

This term identifies XQuery extended with the [XQuery Update Facility 1.0].

Side-effects

We say that an expression has side-effects if its evaluation may affect the external environment or may affect the result of the subsequent evaluation of another expression.

3.2 General Requirements

3.2.1 Compatibility with other extensions

The XQuery Scripting Extension must not preclude the use of the other XQuery extensions developed by the Working Group.

3.2.2 Protocol Independence

The XQuery Scripting Extension must be defined independently of any protocols with which it is used.

3.2.3 Language Syntax

The XQuery Scripting Extension must have more than one syntax binding. One syntax must be convenient for humans to read and write. One syntax must be expressed in XML in a way that reflects the underlying structure of the operations.

3.2.4 Static Type Checking

The XQuery Scripting Extension should provide an optional static type checking feature.

3.2.5 Ease of programming

The XQuery Scripting Extension may include syntactic constructs to facilitate common programming tasks.

3.3 Relationship to XQuery

3.3.1 Based on Data Model

The XQuery Scripting Extension must be defined on the [XQuery 1.0 and XPath 2.0 Data Model].

3.3.2 Based on XQuery

The XQuery Scripting Extension must be based on XQuery. The Scripting Extension may constrain the evaluation order more than XQuery evaluation model, but the evaluation of an expression that belongs to the syntax of XQuery must result in a value, or in an error, that is one of those allowed by XQuery semantics.

3.3.3 Based on XQuery With Updates

The XQuery Scripting Extension should be based on XQuery With Updates. If it is based on XQuery With Updates, it may constrain the evaluation order in ways that are not required by XQuery With Updates evaluation model. However, if both XQuery With Updates and the XQuery Scripting Extension specify a result value for a given expression, they must specify the same result value.

3.3.4 Optimization

The XQuery Scripting Extension should be designed in such a way that the ability of a processor to optimize queries or parts of a query that make no use of the extension is not compromised.

3.4 Functionalities

3.4.1 Controlling the order of evaluation of functions and expressions that have side-effects

It must be possible for the programmer to control the evaluation order of expressions and function calls that perform side-effects.

3.4.2 Preserving state during computation

It must be possible to write code where pieces of data are bound to variables which are passed to further stages of the computation, and it must be possible to modify the value associated to such variables.

3.4.3 Returning values from expressions that have side-effects

It must be possible to write code that has side-effects and returns a value.

3.4.4 Ability to see side-effects during computation

It must be possible for an expression to observe some side-effects caused by other expressions.

3.4.5 Error handling

It must be possible to control error propagation and to perform alternative actions when the evaluation of an expression raises an error.

3.4.6 Controlling the scope of snapshot, isolation, atomicity

The extension may provide the ability to control the scope of snapshots. The extension may provide the ability to identify pieces of code whose execution should be isolated from the outer environment. It may be possible to indicate that some pieces of code must be executed atomically, with respect to failures.

A References

RFC 2119
S. Bradner. Key Words for use in RFCs to Indicate Requirement Levels. IETF RFC 2119. See http://www.ietf.org/rfc/rfc2119.txt.
XQuery 1.0 and XPath 2.0 Data Model
World Wide Web Consortium. XQuery 1.0 and XPath 2.0 Data Model. W3C Recommendation, 23 January 2007. See http://www.w3.org/TR/xpath-datamodel/.
XQuery 1.0
World Wide Web Consortium. XQuery 1.0. W3C Recommendation, 23 January 2007. See http://www.w3.org/TR/xquery/.
XQuery Update Facility 1.0
World Wide Web Consortium. XQuery Update Facility1.0 . W3C Candidate Recommendation, 14 March 2008. See http://www.w3.org/TR/xquery-update-10/.