JSONiq follows the W3C standard regarding sequence occurrence indicators. The following explanations, provided as an informal summary for convenience, are non-normative.
A sequence is an ordered list of items.
All sequences match the sequence type js:item*.
A sequence type is made of an item type followed by an occurrence indicator:
* stands for a sequence of any length (zero or more)
+ stands for a non-empty sequence (one or more)
? stands for an empty or a singleton sequence (zero or one)
The absence of indicator stands for a singleton sequence (one).
Examples:
string matches any singleton sequence containing a string.
item+ matches any non-empty sequence.
object? matches the empty sequence and any sequence containing one object.
JSONiq defines the syntax () for the empty sequence, rather than empty-sequence().
Figure 4. SequenceType