http://www.zorba-xquery.com/modules/store/data-structures/unordered-map ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map";

This module defines a set of functions for working with maps. A map is identified by a QName and can be created using the map:create function and deleted using the map:delete function, respectively. However, its actual lifetime depends on the particular store implementation. The key of a particular entry in the map can consist out of a set of atomic values (called attributes). The actual type of each attribute can be determined when the map is created. The value can be an arbitrary sequence of items.

Author:

Matthias Brantner

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
ann http://www.zorba-xquery.com/annotations
err http://www.w3.org/2005/xqt-errors
map http://www.zorba-xquery.com/modules/store/data-structures/unordered-map
ver http://www.zorba-xquery.com/options/versioning
zerr http://www.zorba-xquery.com/errors
Function Summary
External available-maps ( ) as xs:QName* external
The function returns a sequence of QNames of the maps that are available.
Sequential Variadic External create ( $name as xs:QName, $key-type as xs:QName ) as empty-sequence() external
Create a map with a given name and a set of types for each key attribute.
Sequential External delete ( $name as xs:QName ) as empty-sequence() external
Destroys the map with the given name.
Variadic External get ( $name as xs:QName, $key as xs:anyAtomicType? ) as item()* external
Returns the value of the entry with the given key from the map.
Sequential Variadic External insert ( $name as xs:QName, $value as item()*, $key as xs:anyAtomicType? ) as empty-sequence() external
Inserts a new entry into the map with the given name.
External keys ( $name as xs:QName ) as node()* external
Returns the keys of all entries of a map.
Sequential Variadic External remove ( $name as xs:QName, $key as xs:anyAtomicType? ) as empty-sequence() external
Removes an entry identified by the given key from the map.
External size ( $name as xs:QName ) as xs:integer external
The number of entries in a map.
Functions
External available-maps back to 'Function Summary'
declare function map:available-maps (
 ) as xs:QName* external

The function returns a sequence of QNames of the maps that are available. The sequence will be empty if there are no maps.

Returns:

Sequential Variadic External create back to 'Function Summary'
declare %ann:variadic %ann:sequential function map:create (
            $name as xs:QName, 
            $key-type as xs:QName 
 ) as empty-sequence() external

Create a map with a given name and a set of types for each key attribute. Note that the function is variadic and might take an arbitrary amount of types for the key attributes. Also note that the function is sequential and immediately creates the map in the store.

Parameters:
Returns:
Errors:

Sequential External delete back to 'Function Summary'
declare %ann:sequential function map:delete (
            $name as xs:QName 
 ) as empty-sequence() external

Destroys the map with the given name.

Parameters:
Returns:
Errors:

Variadic External get back to 'Function Summary'
declare %ann:variadic function map:get (
            $name as xs:QName, 
            $key as xs:anyAtomicType? 
 ) as item()* external

Returns the value of the entry with the given key from the map.

Parameters:
Returns:
Errors:
See:

Sequential Variadic External insert back to 'Function Summary'
declare %ann:variadic %ann:sequential function map:insert (
            $name as xs:QName, 
            $value as item()*, 
            $key as xs:anyAtomicType? 
 ) as empty-sequence() external

Inserts a new entry into the map with the given name. Note that the function is variadic and might take an arbitrary amount of key attributes. If an entry with the given key already exists in the map, the value sequences of the existing entry and the sequence passed using $value argument are concatenated.

Parameters:
Returns:
Errors:
See:

External keys back to 'Function Summary'
declare function map:keys (
            $name as xs:QName 
 ) as node()* external

Returns the keys of all entries of a map. The keys are returned as sequence of nodes of the form:

 <key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map">
   <attribute value="key1_value"/>
   <attribute value="key2_value"/>
   <attribute value="key3_value"/>
 </key>
 
The following condition always holds: map:size($name) eq fn:count(map:keys($name))

Parameters:
Returns:
Errors:

Sequential Variadic External remove back to 'Function Summary'
declare %ann:variadic %ann:sequential function map:remove (
            $name as xs:QName, 
            $key as xs:anyAtomicType? 
 ) as empty-sequence() external

Removes an entry identified by the given key from the map.

Parameters:
Returns:
Errors:
See:

External size back to 'Function Summary'
declare function map:size (
            $name as xs:QName 
 ) as xs:integer external

The number of entries in a map. The following condition always holds: map:size($name) eq fn:count(map:keys($name))

Parameters:
Returns:
Errors:

blog comments powered by Disqus