Changes

Jump to navigation Jump to search
44 bytes added ,  09:59, 18 August 2018
no edit summary
This [[Module Library|XQuery Module]] contains functions for parsing and evaluating XQuery strings and modules at runtime, and to run code in parallel.
=Conventions=
All functions and errors in this module are assigned to the <code><nowiki>http://basex.org/modules/xquery</nowiki></code> namespace, which is statically bound to the {{Code|xquery}} prefix.<br/>
=FunctionsDynamic Evaluation=
==xquery:eval==
|{{Error|update|#Errors}} the expression contains no [[XQuery Update#Updating Expressions|updating expressions]].<br/>{{Error|permission|#Errors}} insufficient permissions for evaluating the query.<br/>{{Error|timeout|#Errors}} query execution exceeded timeout.<br/>{{Error|nested|#Errors}} nested query evaluation is not allowed.<br/>Any other error that may occur while evaluating the query.
|}
 
=XQuery Parsing=
==xquery:parse==
=Parallelized Execution=
Parallel query execution is recommendable if you have various calls that require a lot of time, but that cannot be sped up by rewriting the code. This is e. g. the case if external URLs are called. If you are parallelizing local data reads (such as the access to a database), single-threaded queries will usually be faster, because parallelized access to disk data often results in randomized access patterns, which can hardly will rarely be optimized by the caching strategies of HDHDDs, SSDs, SSD or the operating system.
==xquery:fork-join==
* In the following query, up to four URLs will be requested in parallel:
<pre class='brush:xquery'>
let $funcs xquery:=fork-join(
for $segment in 1 to 4
let $url := 'http://url.com/path/' || $segment
return function() { http:send-request((), $url) }
return xquery:fork-join($funcs)
</pre>
|-
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu