http://zorba.io/modules/store/dynamic/collections/ddl

Description

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

import module namespace ddl = "http://zorba.io/modules/store/dynamic/collections/ddl";
This modules defines a set of functions for managing persistent, ordered, and updatable collections.

Please refer to our documentation for more information about the lifecycle management and the manipulation of such collections.

Module code

Here is the actual XQuery module code.

See also

Authors

Matthias Brantner, David Graf, Till Westmann, Markos Zaharioudakis

Version Declaration

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

Namespaces

ddlhttp://zorba.io/modules/store/dynamic/collections/ddl
verhttp://zorba.io/options/versioning
zerrhttp://zorba.io/errors

Function Summary

available-collections() as xs:QName* external

Gets the QNames of the collections that are available, if any.

create($name as xs:QName) external

Creates a collection.

create($name as xs:QName, $content as item()*) external

Creates a collection and adds the given sequence as content to the new collection.

delete($name as xs:QName) external

Deletes the collection having the given name.

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

Gets whether a collection with the given name is available.

Functions

available-collections#0

declare function ddl:available-collections() as xs:QName* external

Gets the QNames of the collections that are available, if any.

Returns

  • xs:QName*

    A sequence comprising one QName for each available collection or an emtpy sequence if no collections are available.

create#1

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

Creates a collection.

Parameters

  • $name

    The name of the collection to create.

Errors

  • zerr:ZDDY0002

    if a collection with $name already exists.

create#2

declare updating function ddl:create(
    $name as xs:QName,
    $content as item()*
) as item()* external

Creates a collection and adds the given sequence as content to the new collection.

Parameters

  • $name

    The name of the collection to create.

  • $content

    The sequence of items (nodes or JSON items) to be added to the new collection.

Errors

  • zerr:ZDDY0002

    if a collection with the given name already exists.

delete#1

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

Deletes the collection having the given name.

Parameters

  • $name

    The name of the collection to delete.

Errors

  • zerr:ZDDY0003

    if the collection identified by $name is not available.

  • zerr:ZDDY0015

    if any of the in-scope variables references an item that belongs to the collection with QName $name.

is-available-collection#1

declare function ddl:is-available-collection(
    $name as xs:QName
) as xs:boolean external

Gets whether a collection with the given name is available.

Parameters

  • $name

    The QName of the collection that is being checked.

Returns

  • xs:boolean

    true if the collection is available and false otherwise.