http://zorba.io/modules/store/static/integrity-constraints/ddl

Description

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

import module namespace icddl = "http://zorba.io/modules/store/static/integrity-constraints/ddl";
This module defines a set of functions to manage integrity constraints that are declared in the prolog of a module. For example, it provides functions to activate or deactivate integrity constraints.

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

icddlhttp://zorba.io/modules/store/static/integrity-constraints/ddl
verhttp://zorba.io/options/versioning
zerrhttp://zorba.io/errors

Function Summary

activate($name as xs:QName) external

Activates an integrity constraint in the dynamic context.

activated-integrity-constraints() as xs:QName* external

Gets the integrity constraints that are activated, if any.

deactivate($name as xs:QName) external

Deactivates the integrity constraint.

is-activated-integrity-constraint($name as xs:QName) as xs:boolean external

Gets whether an integrity constraints is activated.

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

Gets whether an integrity constraint is declared in the prolog of the static context.

declared-integrity-constraints() as xs:QName* external

Gets the sequence of QNames representing the integrity constraints that have been declared in the prolog of the static context.

Functions

activate#1

declare updating function icddl:activate(
    $name as xs:QName
) as item()* external

Activates an integrity constraint in the dynamic context.

Parameters

  • $name

    The name of the integrity constraint to activate.

Errors

  • zerr:ZDDY0031

    if the integrity constraint does not exist in the static context.

activated-integrity-constraints#0

declare function icddl:activated-integrity-constraints() as xs:QName* external

Gets the integrity constraints that are activated, if any.

Returns

  • xs:QName*

    A sequence of QNames, one for each activated integrity constraint, or an empty sequence if none.

deactivate#1

declare updating function icddl:deactivate(
    $name as xs:QName
) as item()* external

Deactivates the integrity constraint.

Parameters

  • $name

    The name of the integrity constraint to deactivate.

Errors

  • zerr:ZDDY0032

    if the integrity constraint was not declared in the the static context.

  • zerr:ZDDY0032

    if the integrity constraints is not activated.

is-activated-integrity-constraint#1

declare function icddl:is-activated-integrity-constraint(
    $name as xs:QName
) as xs:boolean external

Gets whether an integrity constraints is activated.

Parameters

  • $name

    The name of the constraint to check.

Returns

  • xs:boolean

    true if the integrity constraint is activated; false otherwise.

is-declared-integrity-constraint#1

declare function icddl:is-declared-integrity-constraint(
    $name as xs:QName
) as xs:boolean external

Gets whether an integrity constraint is declared in the prolog of the static context.

Parameters

  • $name

    The name of the constraint to check.

Returns

  • xs:boolean

    true if the constraint is declared; false otherwise.

declared-integrity-constraints#0

declare function icddl:declared-integrity-constraints() as xs:QName* external

Gets the sequence of QNames representing the integrity constraints that have been declared in the prolog of the static context.

Returns

  • xs:QName*

    A sequence of QNames, one for each created integrity constraints, or an emtpy sequence if none.