http://jsoniq.org/function-library ZC

Module Description
Before using any of the functions below please remember to import the module namespace:
import module namespace libjn = "http://jsoniq.org/function-library";

This module provides the functions defined by the JSONiq specification, chapter 8 (Function Library). JSONiq extends the XQuery specification to also deal with JSON data natively. See http://jsoniq.org/ for details. This module depends on having the JSONiq feature enabled in Zorba, i.e., Zorba must be compiled with ZORBA_WITH_JSON.

Author:

Ghislain Fourny

XQuery version and encoding for this module:

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

Zorba version for this module:

The latest version of this module is 1.0. For more information about module versioning in Zorba please check out this resource.

Module Resources
Module Dependencies

Imported modules:

Namespaces
jn http://jsoniq.org/functions
libjn http://jsoniq.org/function-library
ver http://www.zorba-xquery.com/options/versioning
Function Summary
accumulate ( $o as object()* ) as object()
This function dynamically builds an object, like jn:object, except that it does not throw an error upon pair collision.
descendant-objects ( $i as json-item() ) as object()*
This function returns all Objects contained within a JSON item, regardless of depth.
descendant-pairs ( $o as object() ) as object()*
This function returns all pairs contained within an object, recursively.
flatten ( $a as array() ) as item()*
Recursively "flatten" a JSON Array, by replacing any arrays with their members.
intersect ( $o as object()* ) as object()
This function returns the intersection of two objects, and aggregates values corresponding to the same name into an array.
members ( $o as array() ) as item()*
Returns the members of an Array.
project ( $o as object(), $names as xs:string* ) as object()
Creates an object from the specified pairs of another given object.
values ( $i as object() ) as item()*
This functions returns all values in an Object.
Functions
accumulate back to 'Function Summary'
declare function libjn:accumulate (
            $o as object()*
) as object()

This function dynamically builds an object, like jn:object, except that it does not throw an error upon pair collision. Instead, it aggregates them into an array.

Parameters:
Returns:

descendant-objects back to 'Function Summary'
declare function libjn:descendant-objects (
            $i as json-item()
) as object()*

This function returns all Objects contained within a JSON item, regardless of depth.

Parameters:
Returns:

descendant-pairs back to 'Function Summary'
declare function libjn:descendant-pairs (
            $o as object()
) as object()*

This function returns all pairs contained within an object, recursively.

Parameters:
Returns:

flatten back to 'Function Summary'
declare function libjn:flatten (
            $a as array()
) as item()*

Recursively "flatten" a JSON Array, by replacing any arrays with their members. Equivalent to define function jn:flatten($arg as array()) { for $value in jn:values($arg) return if ($value instance of array()) then jn:flatten($value) else $value };

Parameters:
Returns:

intersect back to 'Function Summary'
declare function libjn:intersect (
            $o as object()*
) as object()

This function returns the intersection of two objects, and aggregates values corresponding to the same name into an array.

Parameters:
Returns:

members back to 'Function Summary'
declare function libjn:members (
            $o as array()
) as item()*

Returns the members of an Array.

Parameters:
Returns:

project back to 'Function Summary'
declare function libjn:project (
            $o as object(),
            $names as xs:string*
) as object()

Creates an object from the specified pairs of another given object. Specifically, for each name in $names, if the object $o has a pair with that name, then a copy of that pair is included in the new object.

Parameters:
Returns:

values back to 'Function Summary'
declare function libjn:values (
            $i as object()
) as item()*

This functions returns all values in an Object.

Parameters:
Returns: