xqDoc Home

Module URI

https://www.oeaw.ac.at/acdh/util/util

Module Description

This module provides the utility functions used at the ACDH-CH when writing BaseX Software.
This modules raise errors in this namespace https://www.oeaw.ac.at/acdh/util/error
TODO:

Variables

 

Imported Modules

 

Namesapces

 

Function Summary

 

Function Detail

_:basic-auth-decode

Decodes the user name and password passed in Basic Auth.

 
_:basic-auth-decode-test
 
_:db-name

Get the db name containing a particular node.
BaseX' db:name causes global read lock.

 
_:dehydrate

Reduce a result of an XQuery to references of DB nodes.

 
_:eval

Executes a reading query as separate job so without any locks in the calling XQuery.
Shortcut for eval with $dontCheckQuery = false().

 
_:eval

Executes any query as separate job so without any locks in the calling XQuery.
For potentially dangerous queries $dontCheckQuery has to be true()
Details are implemented in start-eval-job.

 
_:eval-test
 
_:evals

Executes queries as separate jobs without locks in the calling XQuery.
Uses jobs:eval() with caching to execute batches of $queries truely independently of the
calling XQuery including locks and indexes if the optimizer recognizes the databases in the
probably much shorter (sub)query.
Tries to create meaningful names and base-uris for each query in $queries.
Uses a small random delay to not start all queries at once.
Logs if execution needs more than 100ms.
The main use of this function is to query a set of similar databases with pre created
XQueries that contain any database name as string literal.
This is easy to achieve with the XQuery 3.1 String constructors.

 
_:evals

Executes one query and binds a sequence of $batch-size items in sequence $sequencKey of $bindings per job.
For example with seqenceKey := 'aKey':
map { 'aKey': (<a/>,<b/>)}
If $batch-size is one two jobs are executed with <a/> and <b/> bound respectively,
if $batch-size is two one job is executed with (<a/>,<b/>) bound
and so on.

 
_:get-base-uri-public

Use the X-Forwarded-Request-Uri custom request header to get the correct base URI as seen by the reverse proxy

 
_:get-base-uri-public-test
 
_:get-batch-size

Set the batch size to 1/3 of all possible parallel jobs

 
_:get-public-scheme-and-hostname

Try to get the correct scheme and hostname as seen by the reverse proxy

 
_:get-public-scheme-and-hostname-test
 
_:get-results-or-errors

Get results or errors for a sequence of job IDs.
Gets all results of a sequence of jobs.
If there were errors raised they are encoded and also returned.

 
_:get-xml-file-or-default

Return doc($fn) or if it cannot be resolves doc($default) without any locks in the calling query.

 
_:get-xml-file-or-default

Return doc($fn) or if it cannot be resolves doc($default) without any locks in the calling query.
If there is a way to know when $fn is definitly not there this can be passed in $fn-is-valid.

 
_:hydrate

Fetch the real XML data from databases according to $dryed references.

 
_:hydrate

Fetch the real XML data from databases according to $dryed references.

 
_:query-is-sane

Implementation detail: Check whether this XQuery uses updating or other functions that can be destructive.

 
_:start-eval-job

Implementation detail: Executes a query as separate job.
Uses jobs:eval() with caching to execute $query truely independently of the calling XQuery
including locks and indexes if the optimizer recognizes the databases in the
probably much shorter (sub)query.
Tries to create meaningful names and base-uris for $query.

 
_:throw-on-error-in-returns

Raises an error if there were any reported in the encoded results passed to this function.
Gets all results of a sequence of jobs.
If there were errors raised they are encoded and also returned.

 
_:zzz-unit-test-after
 
_:zzz-unit-test-before
 
 
Created by xqDoc version 1.1 on 2021-03-09T18:47:45.048+01:00