Changes

Jump to navigation Jump to search
962 bytes added ,  13:03, 6 May 2019
=Expressions=
 
{{Mark|Introduced with Version 9.1:}} ternary if, elvis operator, if without else
Some of the extensions that have been added to BaseX may also be made available in other XQuery processors in the near future.
==Regular Expressions==
 
{{Mark|Introduced with Version 9.1:}}
In analogy with Saxon, you can specify the flag {{Code|j}} to revert to Java’s default regex parser. For example, this allows you to use the word boundary option {{Code|\b}}, which has not been included in the XQuery grammar for regular expressions:
=Serialization=
* <code>basex</code> is used as the default serialization method: nodes are serialized as XML, atomic values are serialized as string, and items of binary type are output in their native byte representation. Function items (including maps and arrays) are output just like with the [[XQuery 3.1#Adaptive Serialization|adaptive]] method.
* With {{Code|csv}}, you can output XML nodes as CSV data (see the [[CSV Module]] for more details).
* With {{Code|json}}, items are output as JSON as described in the [https://www.w3.org/TR/xslt-xquery-serialization-31/#json-output official specification]. However, if If the root node is of type {{Code|element(json)}}, items are serialized as described for the {{Code|direct}} format in the [[JSON Module]].
For more information and some additional BaseX-specific parameters, see the article on [[Serialization]].
This pragma can be helpful when debugging your code.
 
{{Mark|Introduced with Version 9.1:}}
In analogy with option declarations and function annotations, [[Transactions#XQuery_Locks|XQuery Locks]] can also set via pragmas:
==XQuery Locks==
 
{{Mark|Introduced with Version 9.1:}}
In analogy with option declarations and pragmas, [[Transactions#XQuery_Locks|XQuery Locks]] can also set via annotations:
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.
 
=Namespaces=
 
In XQuery, some namespaces are statically bound to prefixes. The following query requires no additional namespaces declarations in the query prolog:
 
<pre class="brush:xquery">
<xml:abc xmlns:prefix='uri' local:fn='x'/>,
fn:exists(1)
</pre>
 
In BaseX, various other namespaces are predefined. Apart from the namespaces that are listed on the [[Module Library]] page, the following namespaces are statically bound:
 
{| class="wikitable sortable"
|-
! Description
! Prefix
! Namespace URI
|-
| [[#Annotations|BaseX Annotations]], [[#Pragmas|Pragmas]], …
| <code>basex</code>
| <code><nowiki>http://basex.org</nowiki></code>
|-
| [[RESTXQ#Input Options|RESTXQ: Input Options]]
| <code>input</code>
| <code><nowiki>http://basex.org/modules/input</nowiki></code>
|-
| [[Repository#EXPath_Packaging|EXPath Packages]]
| <code>pkg</code>
| <code><nowiki>http://expath.org/ns/pkg</nowiki></code>
|-
| [[XQuery Errors]]
| <code>err</code>
| <code><nowiki>http://www.w3.org/2005/xqt-errors</nowiki></code>
|-
| [[Serialization]]
| <code>output</code>
| <code><nowiki>http://www.w3.org/2010/xslt-xquery-serialization</nowiki></code>
|}
=Suffixes=
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu