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

View as XML or JSON.

This modules defines a set of functions for managing collections that are declared in the prolog of a module. For example, it provides functions to create, delete, or introspect collections.

This module is part of Zorba's XQuery Data Definition Facility. All the collections 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.

Function Summary

available-collections () as xs:QName* external

Gets the QNames of the collections that have been statically declared and 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.

declared-collections () as xs:QName* external

Gets the collections that have been declared in the prolog of the static context.

delete ($name as xs:QName) external

Deletes a collection.

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

Gets whether a collection is statically declared and available.

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

Gers whether a collection was declared in the prolog of the static context.

Functions

available-collections#0

declare  function cddl:available-collections() as xs:QName* external
Gets the QNames of the collections that have been statically declared and are available, if any.

Parameters

Returns

xs:QName*
A sequence comprising one QName for each statically declared and available collection or an emtpy sequence if no such collections are available.

create#1

declare  function cddl:create($name as xs:QName) external
Creates a collection.

Parameters

name as xs:QName
The of the collection to create.

Returns

An empty XDM instance and a pending update list that, once applied, creates a collection with the given name.

create#2

declare  function cddl:create($name as xs:QName, $content as item()*) external
Creates a collection and adds the given sequence as content to the new collection.

Parameters

name as xs:QName
The name of the collection to create.
content as item()
The sequences of items (nodes or JSON items) to be added to the new collection.

Returns

An empty XDM instance and a pending update list that, once applied, creates a collection with the given name and inserts the given items into it.

declared-collections#0

declare  function cddl:declared-collections() as xs:QName* external
Gets the collections that have been declared in the prolog of the static context.

Parameters

Returns

xs:QName*
A sequence of QNames, one for each collection created in the static context, or an emtpy sequence.

delete#1

declare  function cddl:delete($name as xs:QName) external
Deletes a collection.

Parameters

name as xs:QName
The collection to delete.

Returns

An empty XDM instance and a pending update list that, once applied, deletes the collection with the given name.

is-available-collection#1

declare  function cddl:is-available-collection($name as xs:QName) as xs:boolean external
Gets whether a collection is statically declared and available.

Parameters

name as xs:QName
The name of the collection to check.

Returns

xs:boolean
true if the collection was statically declared and is available; false otherwise.

is-declared-collection#1

declare  function cddl:is-declared-collection($name as xs:QName) as xs:boolean external
Gers whether a collection was declared in the prolog of the static context.

Parameters

name as xs:QName
The name of the collection to check.

Returns

xs:boolean
true if the collection was declared; false otherwise.