- All Modules
- All Functions
-
www.w3.org
- 2005
- XDM
- store
- introspection
- reflection
- external
-
xqdoc
-
xqdoc
(E)
-
project_xqdoc
- xqdoc2xhtml
-
xqdoc
(E)
- data processing
- expath.org
- www.functx.com
- Zorba
- debugger
- error
- jsoniq.org
- www.zorba-xquery.com
http://jsoniq.org/function-library
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.
Ghislain Fourny
xquery version "1.0" encoding "utf-8";
The latest version of this module is 1.0. For more information about module versioning in Zorba please check out this resource.
- the XQuery module can be found here.
Imported modules:
jn | http://jsoniq.org/functions |
libjn | http://jsoniq.org/function-library |
ver | http://www.zorba-xquery.com/options/versioning |
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. |
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.
- $o A sequence of objects.
- The accumulated object.
declare function libjn:descendant-objects ( $i as json-item() ) as object()*
This function returns all Objects contained within a JSON item, regardless of depth.
- $i A JSON item.
- Its descendant objects.
declare function libjn:descendant-pairs ( $o as object() ) as object()*
This function returns all pairs contained within an object, recursively.
- $o An object.
- All direct and indirect descendant pairs.
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 };
- $a A JSON Array.
- The flattened version of $a.
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.
- $o A sequence of objects.
- Their insersection.
declare function libjn:members ( $o as array() ) as item()*
Returns the members of an Array.
- $a A JSON Array.
- The members of the specified array.
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.
- $o A JSON Object.
- $names The names of the pairs to copy out of $o and insert into the new object
- The new object.
declare function libjn:values ( $i as object() ) as item()*
This functions returns all values in an Object.
- $i An object.
- Its values.