Changes

Jump to navigation Jump to search
No change in size ,  13:38, 20 August 2018
no edit summary
This article is part of the [[XQuery|XQuery Portal]]. It lists extensions and optimizations that are specific to the BaseX XQuery processor.
 
=Suffixes=
 
In BaseX, files with the suffixes {{Code|.xq}}, {{Code|.xqm}}, {{Code|.xqy}}, {{Code|.xql}}, {{Code|.xqu}} and {{Code|.xquery}} are treated as XQuery files. In XQuery, there are main and library modules:
 
* Main modules have an expression as query body. Here is a minimum example:
 
<pre class="brush:xquery">
'Hello World!'
</pre>
 
* Library modules start with a module namespace declaration and have no query body:
 
<pre class="brush:xquery">
module namespace hello = 'http://basex.org/examples/hello';
 
declare function hello:world() {
'Hello World!'
};
</pre>
 
We recommend {{Code|.xq}} as suffix for for main modules, and {{Code|.xqm}} for library modules. However, the actual module type will dynamically be detected when a file is opened and parsed.
=Option Declarations=
Two non-deterministic functions will be bound to <code>$read</code>, and the result of the function call will be bound to <code>$ignored</code>. As the variable is not referenced in the subsequent code, the let clause would usually be discarded by the compiler. In the given query, however, execution will be enforced because of the BaseX-specific {{Code|non-deterministic}} keyword.
 
=Suffixes=
 
In BaseX, files with the suffixes {{Code|.xq}}, {{Code|.xqm}}, {{Code|.xqy}}, {{Code|.xql}}, {{Code|.xqu}} and {{Code|.xquery}} are treated as XQuery files. In XQuery, there are main and library modules:
 
* Main modules have an expression as query body. Here is a minimum example:
 
<pre class="brush:xquery">
'Hello World!'
</pre>
 
* Library modules start with a module namespace declaration and have no query body:
 
<pre class="brush:xquery">
module namespace hello = 'http://basex.org/examples/hello';
 
declare function hello:world() {
'Hello World!'
};
</pre>
 
We recommend {{Code|.xq}} as suffix for for main modules, and {{Code|.xqm}} for library modules. However, the actual module type will dynamically be detected when a file is opened and parsed.
=Miscellaneous=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu