~juan457/+junk/zorba

« back to all changes in this revision

Viewing changes to modules/org/jsoniq/www/functions.xq

  • Committer: Markos Zaharioudakis
  • Date: 2012-07-11 15:38:39 UTC
  • mfrom: (10924 zorba)
  • mto: This revision was merged to the branch mainline in revision 10932.
  • Revision ID: markos_za@yahoo.com-20120711153839-0mkh15cg2ubknchd
work in progress

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 : This module depends on having the JSONiq feature enabled in Zorba,
30
30
 : i.e., Zorba must be compiled with ZORBA_WITH_JSON.
31
31
 :
32
 
 : @author Markos Zaharioudakis, Matthias Brantner
 
32
 : @author Markos Zaharioudakis, Matthias Brantner, Ghislain Fourny
33
33
 :)
34
34
module namespace jn = "http://www.jsoniq.org/functions";
35
35
 
55
55
 
56
56
 
57
57
(:~
58
 
 : Returns the names used in the Pairs of the object. 
 
58
 : Returns the names used in the object. 
59
59
 : The names will be returned in an implementation-defined order
60
60
 :
61
61
 : @param $o A JSON Object.
65
65
 
66
66
 
67
67
(:~
68
 
 : Returns the values of the pairs within a given JSON object.
69
 
 :
70
 
 : @param $o A JSON Object.
71
 
 : @return the value of each pair within the given object.
72
 
 :)
73
 
declare function jn:values($o as object()) as item()* external;
74
 
 
75
 
 
76
 
(:~
77
68
 : Returns the value of a JSON Pair with a given name within a given JSON object.
78
69
 : If no such pair exists in the object, returns the empty sequence.
79
70
 :
81
72
 : @param $name The name of the pair whose value is to be retrieved
82
73
 : @return the value of specified pair within the given object, or the empty sequence.
83
74
 :)
 
75
(: obsolete - use $o($name) instead :)
84
76
declare function jn:value($o as object(), $name as xs:string) as item()? external;
85
77
 
86
78
 
87
79
(:~
 
80
 : Returns the size of a JSON Array. The size of an Array is
 
81
 : the number of members contained within it.
 
82
 :
 
83
 : @param $j A JSON Array.
 
84
 : @return The number of items in $j.
 
85
 :)
 
86
declare function jn:size($j as array()) as xs:integer external;
 
87
 
 
88
 
 
89
(:~
 
90
 : Returns the member of an Array at the specified position (starting from 1).
 
91
 : If the position is out of bounds of the array, returns the empty sequence.
 
92
 :
 
93
 : @param $a A JSON Array.
 
94
 : @param $p The position in the array.
 
95
 : @return The member at the specified position, or empty sequence.
 
96
 :)
 
97
(: obsolete - use $a($p) instead :)
 
98
declare function jn:member($a as array(), $p as xs:integer) as item()? external;
 
99
 
 
100
 
 
101
(:~
88
102
 : Creates an object from the specified pairs of another given object. 
89
103
 : Specifically, for each name in $names, if the object $o has a pair with
90
104
 : that name, then a copy of that pair is included in the new object.
96
110
declare function jn:project($o as object(), $names as xs:string*) as object() external;
97
111
 
98
112
(:~
99
 
 : Returns the size of a JSON Object or JSON Array. The size of an Object
100
 
 : is the number of Pairs contained within it; the size of an Array is
101
 
 : the number of members contained within it.
102
 
 :
103
 
 : @param $j A JSON Object or JSON Array.
104
 
 : @return The number of items in $j.
105
 
 : @error jn:JUDY0060 if $j is a JSON Pair.
106
 
 :)
107
 
declare function jn:size($j as json-item()) as xs:integer external;
108
 
 
109
 
 
110
 
(:~
111
 
 : Returns the member of an Array at the specified position (starting from 1).
112
 
 : If the position is out of bounds of the array, returns the empty sequence.
113
 
 :
114
 
 : @param $a A JSON Array.
115
 
 : @param $p The position in the array.
116
 
 : @return The member at the specified position, or empty sequence.
117
 
 :)
118
 
declare function jn:member($o as array(), $p as xs:integer) as item()? external;
119
 
 
120
 
 
121
 
(:~
122
113
 : Returns the members of an Array.
123
114
 :
124
115
 : @param $a A JSON Array.