Changes

Jump to navigation Jump to search
430 bytes removed ,  09:45, 30 November 2017
no edit summary
This article is part of the [[XQuery|XQuery Portal]].It summarizes provides a summary of the most interesting important features of the[http://www.w3.org/TR/xquery-30/ XQuery 3.0] Recommendations.XQuery 3.0 is fully supported by BaseXRecommendation.
=Enhanced FLWOR Expressions=
Most clauses of FLWOR expressions can now be specified in an arbitrary order: additional {{Code|let}} and {{Code|for}} clauses can be put after a {{Code|where}} clause, and multiple {{Code|where}}, {{Code|order by}} and {{Code|group by}} statements can be used. This means that many nested loops can now be rewritten to a single FLWOR expression.
'''Example:'''
</pre>
In contrast to the relational GROUP BY statement, the XQuery counterpartconcatenates the values of all non-grouping variables that belong to a specific group.In the context of our example, all nodes in <code>//people/person</code> that belong to the <code>preferred</code> partition are concatenated in <code class="brush:xquery">$ppl</code> after grouping has finished.You can see this effect by changing the return statement to:
<pre class="brush:xquery">
==count==
A new The {{Code|count}} clause enhances the FLWOR expression with a variable that enumerates the iterated tuples.
<pre class="brush:xquery">
</pre>
A map operator is defined to be part of a path expression, which may now mix path and map operators. In contrast to the path operatorexpressions, the results of the map operator will not be made duplicate-free and returned in document order.
=Try/Catch=
=Expanded QNames=
A ''QName'' can now be directly prefixed with the letter "Q" and a namespace URI in the [http://www.jclark.com/xml/xmlns.htm Clark Notation].
'''Examples:'''
* <code><nowiki>Q{http://www.w3.org/2005/xpath-functions/math}pi()</nowiki></code> returns the number π
* <code>Q{java:java.io.FileOutputStream}new("output.txt")</code> creates a new Java file output stream
 
The syntax differed in older versions of the XQuery 3.0 specification, in which the prefixed namespace URI was quoted:
 
* <code><nowiki>"http://www.w3.org/2005/xpath-functions/math":pi()</nowiki></code>
* <code>"java:java.io.FileOutputStream":new("output")</code>
=Namespace Constructors=
New namespaces can now be created via so-called 'Computed Namespace Constructors'.
<pre class="brush:xquery">
=External Variables=
Default values can now be attached to external variable declarations. This way, an expression can also be evaluated if its external variables have not been bound to a new value.
<pre class="brush:xquery">
=Serialization=
[[Serialization|Serialization ]]parameters can now be defined in within XQuery expressions. Parameters are placed in the query prolog and need to be specified as option declarations, using the <code>output</code> prefix.
'''Example:'''
=Context Item=
The context item can now be specified in the prolog of an XQuery expression:
'''Example:'''
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu