http://www.zorba-xquery.com/modules/store/static/indexes/dml ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace idml = "http://www.zorba-xquery.com/modules/store/static/indexes/dml";

This module defines a set of functions to probe and refresh indexes which are declared in the prolog of a module.

This module is part of Zorba's XQuery Data Definition Facility. All the indexes managed by this module have to be pre-declared in the prolog of a library module. Please refer to the general documentation for more information and examples.

Author:

Zorba Team

XQuery version and encoding for this module:

xquery version "3.0" encoding "utf-8";

Zorba version for this module:

The latest version of this module is 2.0. For more information about module versioning in Zorba please check out this resource.

Module Resources
Related Documentation

For more details please also see:

Namespaces
an http://www.zorba-xquery.com/annotations
idml http://www.zorba-xquery.com/modules/store/static/indexes/dml
ver http://www.zorba-xquery.com/options/versioning
zerr http://www.zorba-xquery.com/errors
Function Summary
External keys ( $name as xs:QName ) as node()*
The keys function returns a sequence of all keys contained in the index with the given name.
External probe-index-point-general ( $name as xs:QName, $key as xs:anyAtomicType* ) as node()*
The probe-index-point-general function retrieves from an index the domain nodes associated by general equality with a given search sequence .
Variadic External probe-index-point-value ( $name as xs:QName, $key_i as xs:anyAtomicType? ) as node()*
The probe-index-point-value function retrieves from an index the domain nodes associated by value equality with a given search tuple.
Variadic External probe-index-point-value-skip ( $name as xs:QName, $skip as xs:integer, $key_i as xs:anyAtomicType? ) as node()*
The probe-index-point-value-skip function is an extension of the probe-index-point-value function.
External probe-index-range-general ( $name as xs:QName, $lowerBound as xs:anyAtomicType*, $upperBound as xs:anyAtomicType*, $haveLowerBound as xs:boolean, $haveUpperBound as xs:boolean, $lowerBoundIncluded as xs:boolean, $upperBoundIncluded as xs:boolean ) as node()*
The probe-index-range-general function retrieves the domain nodes associated by general order-comparison (operators <=, <, >=, >) with one or two search sequences.
Variadic External probe-index-range-value ( $name as xs:QName, $lowerBound-i as xs:anyAtomicType?, $upperBound-i as xs:anyAtomicType?, $haveLowerBound-i as xs:boolean, $haveUpperBound-i as xs:boolean, $lowerBoundIncluded-i as xs:boolean, $upperBoundIncluded-i as xs:boolean ) as node()*
The probe-index-range-value function retrieves the domain nodes associated by value order-comparison (operators le, lt, ge, gt) with a given search box.
Variadic External probe-index-range-value-skip ( $name as xs:QName, $skip as xs:integer, $lowerBound-i as xs:anyAtomicType?, $upperBound-i as xs:anyAtomicType?, $haveLowerBound-i as xs:boolean, $haveUpperBound-i as xs:boolean, $lowerBoundIncluded-i as xs:boolean, $upperBoundIncluded-i as xs:boolean ) as node()*
The probe-index-range-value-skip function is an extension of the probe-index-range-value function.
Updating External refresh-index ( $name as xs:QName ) as
The refresh-index function is an updating function which updates the index with the given name.
Functions
External keys back to 'Function Summary'
declare function idml:keys (
            $name as xs:QName
) as node()*

The keys function returns a sequence of all keys contained in the index with the given name. Each element has the following structure:

   <key xmlns="http://www.zorba-xquery.com/modules/store/static/indexes/dml">
     <attribute value="key1_value"/>
     <attribute value="key2_value"/>
     <attribute value="key3_value"/>
   </key>
   

Parameters:
Returns:
Errors:

External probe-index-point-general back to 'Function Summary'
declare function idml:probe-index-point-general (
            $name as xs:QName,
            $key as xs:anyAtomicType*
) as node()*

The probe-index-point-general function retrieves from an index the domain nodes associated by general equality with a given search sequence . The search sequence consists of an arbitrary number of search keys, where each search key is an atomic item. The function is supported by general indexes only. Its result is either an error or the set of domain nodes for which the following xquery expression returns true:

 $keys = $node/keyExpr
 
where keyExpr is the expression specified in the keyspec of the index (remember that for general indexes, there can be only one keyspec).

Parameters:
Returns:
Errors:

Variadic External probe-index-point-value back to 'Function Summary'
declare function idml:probe-index-point-value (
            $name as xs:QName,
            $key_i as xs:anyAtomicType?
) as node()*

The probe-index-point-value function retrieves from an index the domain nodes associated by value equality with a given search tuple. The search tuple consists of a number of search keys, where each search key is either an atomic item or the empty sequence. The number of search keys given must be equal to the number of keys declared for the index. Since the number of keys differs from one index to another, this function is variadic.

The result of the function is either an error or the set of domain nodes for which the following xquery expression returns true:

 $key1 eq $node/keyExpr1 and ... and $keyM eq $node/keyExprM
 
where keyExpri is the expression specified in the i-th keyspec of the index.

Parameters:
Returns:
Errors:

Variadic External probe-index-point-value-skip back to 'Function Summary'
declare function idml:probe-index-point-value-skip (
            $name as xs:QName,
            $skip as xs:integer,
            $key_i as xs:anyAtomicType?
) as node()*

The probe-index-point-value-skip function is an extension of the probe-index-point-value function. Additionally, it allows to skip index items.

Parameters:
Returns:
Errors:

External probe-index-range-general back to 'Function Summary'
declare function idml:probe-index-range-general (
            $name as xs:QName,
            $lowerBound as xs:anyAtomicType*,
            $upperBound as xs:anyAtomicType*,
            $haveLowerBound as xs:boolean,
            $haveUpperBound as xs:boolean,
            $lowerBoundIncluded as xs:boolean,
            $upperBoundIncluded as xs:boolean
) as node()*

The probe-index-range-general function retrieves the domain nodes associated by general order-comparison (operators <=, <, >=, >) with one or two search sequences. Each search sequence consists of an arbitrary number of search keys, where each search key is an atomic item. This method is supported by general range indexes only. Its result is either an error or the set of domain nodes for which the following xquery expression returns true:

 if ($haveLowerBound and $haveUpperBound) then
   $lowerBoundKeys lop $node/keyExpr and $node/keyExpr uop $upperBoundKeys
 else if ($haveLowerBound) then
   $lowerBoundKeys lop $node/keyExpr
 else if ($haveUpperBound) then
   $node/keyExpr uop $upperBoundKeys
 else
   fn:true()
 

where keyExpr is the expression specified in the keyspec of the index, lop is either the <= or the < operator depending on whether $lowerBoundsIncluded is true or false, and uop is either the <= or the < operator depending on whether $upperBoundsIncluded is true or false

.

Parameters:
Returns:
Errors:

Variadic External probe-index-range-value back to 'Function Summary'
declare function idml:probe-index-range-value (
            $name as xs:QName,
            $lowerBound-i as xs:anyAtomicType?,
            $upperBound-i as xs:anyAtomicType?,
            $haveLowerBound-i as xs:boolean,
            $haveUpperBound-i as xs:boolean,
            $lowerBoundIncluded-i as xs:boolean,
            $upperBoundIncluded-i as xs:boolean
) as node()*

The probe-index-range-value function retrieves the domain nodes associated by value order-comparison (operators le, lt, ge, gt) with a given search box. The search box is specified as a number M of rangespecs , where each rangespec consists of six values. The number M must be greater than 0 and less than or equal to the number N of keyspecs found in the index declaration. If M is less than N, then the "missing" rangespecs are assumed to have the following value: [(), (), false, false, false, false]. As a result, we can assume that M is equal to N (Remember that for general indexes, there can be only one IndexKeySpec, and as a result, for general indexes, M = N = 1). Since the number of keys differs from one index to another, this function is variadic.

The ith rangespec corresponds to the ith keyspec, and specifies a search condition on the key values that are produced by evaluating that keyspec for every domain node. Specifically, we define the ith rangespec result as the set of domain nodes for which the following xquery expression returns true:

 if ($haveLowerBound-i and $haveUpperBound-i) then
   $lowerBound-i lop $node/keyExpr-i and $node/keyExpr-i uop $upperBound-i
 else if ($haveLowerBound-i) then
   $lowerBound-i lop $node/keyExpr-i
 else if ($haveUpperBound-i) then
   $node/keyExpr-i uop $upperBound-i
 else
   fn:true()

where keyExpr-i is the expression specified by the ith keyspec of the index, lop is either the le or the lt operator depending on whether $lowerBoundsIncluded-i is true or false, and uop is either the le or the lt operator depending on whether $upperBoundsIncluded-i is true or false.

The result of the probe-index-range-value function is either an error, or the intersection of all the rangespec results.

Parameters:
Returns:
Errors:

Variadic External probe-index-range-value-skip back to 'Function Summary'
declare function idml:probe-index-range-value-skip (
            $name as xs:QName,
            $skip as xs:integer,
            $lowerBound-i as xs:anyAtomicType?,
            $upperBound-i as xs:anyAtomicType?,
            $haveLowerBound-i as xs:boolean,
            $haveUpperBound-i as xs:boolean,
            $lowerBoundIncluded-i as xs:boolean,
            $upperBoundIncluded-i as xs:boolean
) as node()*

The probe-index-range-value-skip function is an extension of the probe-index-range-value function. Additionally, it allows to skip index items.

Parameters:
Returns:
Errors:

Updating External refresh-index back to 'Function Summary'
declare function idml:refresh-index (
            $name as xs:QName
) as 

The refresh-index function is an updating function which updates the index with the given name. Note that if the maintenance property of the index is automatic, this function is a NOP.

Parameters:
Returns:
Errors: