http://zorba.io/modules/store/static/indexes/ddl

Description

Before using any of the functions below please remember to import the module namespace:

import module namespace iddl = "http://zorba.io/modules/store/static/indexes/ddl";
This modules defines a set of functions for managing indexes that 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 module. Please refer to the general documentation for more information and examples.

Module code

Here is the actual XQuery module code.

See also

Authors

Nicolae Brinza, Matthias Brantner, David Graf, Till Westmann, Markos Zaharioudakis

Version Declaration

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

Namespaces

iddlhttp://zorba.io/modules/store/static/indexes/ddl
verhttp://zorba.io/options/versioning
zerrhttp://zorba.io/errors

Function Summary

available-indexes() as xs:QName* external

Gets the available indexes.

create($name as xs:QName) external

Creates an index.

declared-indexes() as xs:QName* external

Gets a sequence of QNames representing the indexes that have been declared in the prolog of the static context.

delete($name as xs:QName) external

Deletes an index.

is-available-index($name as xs:QName) as xs:boolean external

Gets whether an index exists.

is-declared-index($name as xs:QName) as xs:boolean external

Gets whether an index has been declared in the prolog of the static context.

Functions

available-indexes#0

declare function iddl:available-indexes() as xs:QName* external

Gets the available indexes.

Returns

  • xs:QName*

    A sequence of QNames, one for each available index, or an empty sequence if none are.

create#1

declare updating function iddl:create(
    $name as xs:QName
) as item()* external

Creates an index.

Parameters

  • $name

    The name of the index to create.

Errors

  • zerr:ZDDY0021

    if $name is not equal to the name of any resource in the statically known indexes.

  • zerr:ZDDY0022

    if an index with $name already exists.

declared-indexes#0

declare function iddl:declared-indexes() as xs:QName* external

Gets a sequence of QNames representing the indexes that have been declared in the prolog of the static context.

Returns

  • xs:QName*

    A sequence of QNames, one for each created collection, or an emtpy sequence.

delete#1

declare updating function iddl:delete(
    $name as xs:QName
) as item()* external

Deletes an index.

Parameters

  • $name

    The name of the index to delete.

Errors

  • zerr:ZDDY0009

    if the index does not exist.

is-available-index#1

declare function iddl:is-available-index(
    $name as xs:QName
) as xs:boolean external

Gets whether an index exists.

Parameters

  • $name

    The name of the index that is being checked.

Returns

  • xs:boolean

    true if the index is available; false otherwise.

is-declared-index#1

declare function iddl:is-declared-index(
    $name as xs:QName
) as xs:boolean external

Gets whether an index has been declared in the prolog of the static context.

Parameters

  • $name

    The name of the index that is being checked.

Returns

  • xs:boolean

    true if the index was declared; false otherwise.