WD-xquery-sx-10-requirements-20070323 19.2 KB

<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en"><head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>XQuery Scripting Extension 1.0 Requirements</title><style type="text/css">
code           { font-family: monospace; }

div.constraint,
div.issue,
div.note,
div.notice     { margin-left: 2em; }

ol.enumar      { list-style-type: decimal; }
ol.enumla      { list-style-type: lower-alpha; }
ol.enumlr      { list-style-type: lower-roman; }
ol.enumua      { list-style-type: upper-alpha; }
ol.enumur      { list-style-type: upper-roman; }


div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
                  margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
                    margin: 4px}
</style><link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD.css"></head><body><div class="head"><p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72"></a></p>
<h1><a name="title" id="title"></a>XQuery Scripting Extension 1.0 Requirements</h1>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Working Draft 23 March 2007</h2><dl><dt>This version:</dt><dd>
			<a href="http://www.w3.org/TR/2007/WD-xquery-sx-10-requirements-20070323">http://www.w3.org/TR/2007/WD-xquery-sx-10-requirements-20070323</a>
		</dd><dt>Latest version:</dt><dd>
      <a href="http://www.w3.org/TR/xquery-sx-10-requirements">http://www.w3.org/TR/xquery-sx-10-requirements</a>
		</dd><dt>Editors:</dt><dd>Daniel Engovatov, BEA <a href="mailto:dengovatov@bea.com">&lt;dengovatov@bea.com&gt;</a></dd><dd>Daniela Florescu, Oracle Corporation <a href="mailto:dana.florescu@oracle.com">&lt;dana.florescu@oracle.com&gt;</a></dd><dd>Giorgio Ghelli, Pisa University <a href="mailto:ghelli@di.unipi.it">&lt;ghelli@di.unipi.it&gt;</a></dd></dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a>&nbsp;&copy;&nbsp;2007&nbsp;<a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>&reg;</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p></div><hr><div>
<h2><a name="abstract" id="abstract"></a>Abstract</h2><p>This document specifies goals and requirements for the XQuery Scripting Extension.</p></div><div>
<h2><a name="status" id="status"></a>Status of this Document</h2><p>
				<em>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
        <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em>
			</p><p>This is the <a href="http://www.w3.org/2004/02/Process-20040205/tr.html#first-wd">First
      Public Working Draft</a> 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.</p><p>This document has been produced by the
      <a href="http://www.w3.org/XML/Query/">XML Query Working Group</a>
      (part of the <a href="http://www.w3.org/XML/Activity">XML Activity</a>),
      following the procedures set out in the
      <a href="http://www.w3.org/2004/02/Process-20040205/tr.html">W3C Process Document</a>.
      The XML Query Working Group feels that the contents of this
      Working Draft are relatively stable, and therefore encourages feedback on this version.</p><p>These Requirements identify extensions to the
      <a href="http://www.w3.org/TR/xquery/">XQuery 1.0 Recommendation</a> published 23 January 2007
      to make it functional as a scripting language. 
      That capability has been requested by WG participants and
      has been encouraged by members of the larger community
      who do not participate in the W3C activities. 
      The XML Query WG has reviewed these requirements and has
      reached a high level of agreement (but not necessarily unanimity) on
      the desirability of each of them.</p><p>Public comments on this document and its open issues are invited.
      Comments on this document should be made in W3C's
      <a href="http://www.w3.org/Bugs/Public/">public Bugzilla system</a>
      (instructions can be found at
      <a href="http://www.w3.org/XML/2005/04/qt-bugzilla">http://www.w3.org/XML/2005/04/qt-bugzilla</a>). 
      When entering comments, select the Product named "XPath / XQuery / XSLT",
      the Component named "XQuery Scripting Extensions 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,
      <a href="mailto:public-qt-comments@w3.org">public-qt-comments@w3.org</a>.
      It will be very helpful if you include the string [ScriptReq]
      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
      <a href="http://lists.w3.org/Archives/Public/public-qt-comments/">http://lists.w3.org/Archives/Public/public-qt-comments/</a>.</p><p>This document was produced by a group operating under the
      <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. 
      W3C maintains a
      <a href="http://www.w3.org/2004/01/pp-impl/18797/status#disclosures">public list
      of any patent disclosures</a> 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
      <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a>
      must disclose the information in accordance with
      <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6
      of the W3C Patent Policy</a>. </p></div><div class="toc">
<h2><a name="contents" id="contents"></a>Table of Contents</h2><p class="toc">1 <a href="#goals">Goals</a><br>
2 <a href="#usage-scenarios">Usage Scenarios</a><br>
3 <a href="#requirements">Requirements</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;3.1 <a href="#terminology">Terminology</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;3.2 <a href="#general-requiremens">General Requirements</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;3.3 <a href="#relationship-to-xquery">Relationship to XQuery</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;3.4 <a href="#functionalities">Functionalities</a><br>
</p>
<h3><a name="appendices" id="appendices"></a>Appendix</h3><p class="toc">A <a href="#references">References</a><br>
</p></div><hr><div class="body"><div class="div1">
<h2><a name="goals" id="goals"></a>1 Goals</h2><p>This document describes the requirements for the XQuery Scripting
Extensions.
XQuery <a href="#xquery">[XQuery 1.0]</a>
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 <a href="#xquery">XQuery</a>
capabilities with some imperative
features, such as the ability to explicitly manage internal
states. The same issue stands for <a href="#xquery">XQuery</a>
enriched with the <a href="#updatef">[XQuery Update Facility]</a>
(hereafter,
				<a href="#terminology-XQU">XQuery With Updates</a>).

The scripting extension is intended to overcome this problem, and allow
programmers to write such applications without relying on embedding
				<a href="#xquery">XQuery</a> into an external language.</p></div><div class="div1">
<h2><a name="usage-scenarios" id="usage-scenarios"></a>2 Usage Scenarios</h2><p>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.</p><p>While <a href="#xquery">XQuery</a> 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 <a href="#xquery">XQuery</a> to write some complex
applications that belong to the following usage scenarios.</p><dl><dt class="label">Applications that perform complex manipulations on
	  persistent XML data</dt><dd><p>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.</p></dd><dt class="label">Complex XML to XML transformations</dt><dd><p>Writing code that performs complex XML to XML transformations.</p></dd><dt class="label">Implementation of web services</dt><dd><p>Writing code that implements a web service, with the
	    ability to access and modify persistent XML data.</p></dd><dt class="label">Processing RSS feeds</dt><dd><p>Writing code that generates or aggregates RSS feeds.</p></dd><dt class="label">Web service message composition and orchestration</dt><dd><p>Writing code that orchestrates web services.</p></dd><dt class="label">XML application integration</dt><dd><p>Writing scripting code that calls both
							<a href="#terminology-XQU">XQuery
							With
							Updates</a> and external
	    functions, which may manipulate state and perform
							<a href="#side-effects">side-effects</a>.</p></dd><dt class="label">XML data cleaning or normalization</dt><dd><p>Writing code that performs data cleaning
          operations.</p></dd><dt class="label">XML data integration</dt><dd><p>Writing code that accesses multiple data sources with
            the ability of reflecting updates from the integrated data
            to the data sources.</p></dd><dt class="label">XML data verification</dt><dd><p>Expressing complex constraints on XML data.</p></dd></dl></div><div class="div1">
<h2><a name="requirements" id="requirements"></a>3 Requirements</h2><div class="div2">
<h3><a name="terminology" id="terminology"></a>3.1 Terminology</h3><p>In this specification the words
					
					<a href="#RFC2119">must</a>,
					<a href="#RFC2119">must not</a>,
					<a href="#RFC2119">should</a>,
					<a href="#RFC2119">should not</a>,
					<a href="#RFC2119">may</a>
					and
					<a href="#RFC2119">recommended</a>, when 
are to be interpreted as described in <a href="#RFC2119">[RFC 2119]</a>.
When these words
					
are used in this technical sense, they occur as a hyperlink to <a href="#RFC2119">[RFC 2119]</a>. These words will also be used with their conventional English
meaning, in which case there is no hyperlink.</p><dl><dt class="label"><a name="terminology-XQU" id="terminology-XQU"></a>XQuery With Updates</dt><dd><p>This term identifies
								<a href="#xquery">XQuery</a>
								extended with the
								<a href="#updatef">[XQuery Update Facility]</a>.</p></dd><dt class="label"><a name="side-effects" id="side-effects"></a>Side-effects</dt><dd><p>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.</p></dd></dl></div><div class="div2">
<h3><a name="general-requiremens" id="general-requiremens"></a>3.2 General Requirements</h3><dl><dt class="label">Compatibility with other extensions</dt><dd><p>The XQuery Scripting Extension
								<a href="#RFC2119">must
								not</a>
								preclude the use of the 
                 other XQuery extensions developed by the Working Group.</p></dd><dt class="label">Protocol Independence</dt><dd><p>The XQuery Scripting Extension
								<a href="#RFC2119">must</a>
								be defined independently
            of any protocols with which it is used.</p></dd><dt class="label">Language Syntax</dt><dd><p>The XQuery Scripting Extension <a href="#RFC2119">must</a> have
                more than one syntax binding. One syntax <a href="#RFC2119">must</a> 
				be convenient for humans to
                read and write. One syntax <a href="#RFC2119">must</a>
                be expressed in XML in a way that reflects the underlying structure
                of the operations.</p></dd><dt class="label">Static Type Checking</dt><dd><p>The XQuery Scripting Extension
								<a href="#RFC2119">should</a>
								provide an optional
            static type checking feature.</p></dd><dt class="label">Ease of programming</dt><dd><p>The XQuery Scripting Extension
								<a href="#RFC2119">may</a>
								include syntactic
            constructs to facilitate common programming tasks.</p></dd></dl></div><div class="div2">
<h3><a name="relationship-to-xquery" id="relationship-to-xquery"></a>3.3 Relationship to <a href="#xquery">XQuery</a></h3><dl><dt class="label">Based on Data Model</dt><dd><p>The XQuery Scripting Extension <a href="#RFC2119">must</a>
                be defined on the <a href="#datamodel">[XQuery 1.0 and XPath 2.0 Data Model]</a>.</p></dd><dt class="label">Based on <a href="#xquery">XQuery</a></dt><dd><p>The XQuery Scripting Extension <a href="#RFC2119">must</a> be based on <a href="#xquery">XQuery</a>. The Scripting Extension may constrain the evaluation order more than <a href="#xquery">XQuery</a> evaluation model, but the evaluation of an expression that belongs to the syntax of <a href="#xquery">XQuery</a> <a href="#RFC2119">must</a> result in a value, or in an error, that is one of those allowed by
								<a href="#xquery">XQuery</a>
								semantics.</p></dd><dt class="label">Based on <a href="#terminology-XQU">XQuery With Updates</a></dt><dd><p>The XQuery Scripting Extension
								<a href="#RFC2119">should</a> be based on
								<a href="#terminology-XQU">XQuery With Updates</a>.
If it is based on <a href="#terminology-XQU">XQuery With Updates</a>,
it may constrain the evaluation order in ways that are not required by  
								<a href="#terminology-XQU">XQuery With Updates</a> evaluation model. However, 
								 if both 
								<a href="#terminology-XQU">XQuery With Updates</a>
								and the XQuery Scripting Extension specify a result value for a given expression, 
								they <a href="#RFC2119">must</a> specify the same result value. 
                              </p></dd><dt class="label">Optimization</dt><dd><p>The XQuery Scripting Extension <a href="#RFC2119">should</a> 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.</p></dd></dl></div><div class="div2">
<h3><a name="functionalities" id="functionalities"></a>3.4 Functionalities</h3><dl><dt class="label">Controlling the order of evaluation of functions
and expressions that have <a href="#side-effects">side-effects</a></dt><dd><p>It <a href="#RFC2119">must</a> be possible for the
programmer to control the evaluation order of expressions and function
calls that perform <a href="#side-effects">side-effects</a>.</p></dd><dt class="label">Preserving state during computation</dt><dd><p>It <a href="#RFC2119">must</a> be possible to write code where pieces of data are bound to
variables which are passed to further stages of the computation, and it
								<a href="#RFC2119">must</a> be possible to modify the value associated to such variables.</p></dd><dt class="label">Returning values from expressions that have <a href="#side-effects">side-effects</a></dt><dd><p>It <a href="#RFC2119">must</a> be possible to write code that has <a href="#side-effects">side-effects</a> and returns a value.</p></dd><dt class="label">Ability to see <a href="#side-effects">side-effects</a> during computation</dt><dd><p>It <a href="#RFC2119">must</a> 
be possible for an expression to observe some <a href="#side-effects">side-effects</a> caused by other expressions.</p></dd><dt class="label">Error handling</dt><dd><p>It <a href="#RFC2119">must</a> be possible to control
error propagation and to perform 
alternative actions when the evaluation of an expression raises an error.</p></dd><dt class="label">Controlling the scope of snapshot, isolation, atomicity</dt><dd><p>The extension <a href="#RFC2119">may</a> provide the
ability to control the scope of snapshots.
The extension <a href="#RFC2119">may</a> provide the
ability to identify pieces of code whose execution should be isolated
from the outer environment. It
								<a href="#RFC2119">may</a> be possible
to indicate that some pieces of code must be executed atomically, with
respect to failures.</p></dd></dl></div></div></div><div class="back"><div class="div1">
<h2><a name="references" id="references"></a>A References</h2><dl><dt class="label"><a name="RFC2119" id="RFC2119"></a>RFC 2119</dt><dd>S. Bradner.
					<em>Key Words for use in
					RFCs to Indicate Requirement
					Levels.</em> IETF RFC 2119. 
          See <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>.</dd><dt class="label"><a name="datamodel" id="datamodel"></a>XQuery 1.0 and XPath 2.0 Data Model</dt><dd>World Wide Web
          Consortium. <em>XQuery 1.0 and XPath 2.0 Data Model</em>. 
          W3C Recommendation, 23 January 2007. 
          See <a href="http://www.w3.org/TR/xpath-datamodel/">http://www.w3.org/TR/xpath-datamodel/</a>.</dd><dt class="label"><a name="xquery" id="xquery"></a>XQuery 1.0</dt><dd>World Wide Web Consortium. <em>XQuery
          1.0</em>. 
          W3C Recommendation, 23 January 2007. 
          See <a href="http://www.w3.org/TR/xquery/">http://www.w3.org/TR/xquery/</a>.</dd><dt class="label"><a name="updatef" id="updatef"></a>XQuery Update Facility</dt><dd>World Wide Web Consortium. 
				<em>XQuery Update Facility</em>. W3C Working Draft, 11 July 2006. 
				See <a href="http://www.w3.org/TR/xqupdate/">http://www.w3.org/TR/xqupdate/</a>.</dd></dl></div></div></body></html>