Figure 4. AtomicOrUnionType
Atomic types are organized in a tree hierarchy.
JSONiq defines the following build-in types that have a direct relation with JSON:
string: the value space is all strings made of Unicode characters.
All string literals build an atomic which matches string.
integer: the value space is that of all mathematical integral numbers (N), with an infinite range. This is a subtype of decimal, so that all integers also match the item type decimal.
All integer literals build an atomic which matches integer.
decimal: the value space is that of all mathematical decimal numbers (D), with an infinite range.
All decimal literals build an atomic which matches decimal.
double: the value space is that of all IEEE double-precision 64-bit floating point numbers.
All double literals build an atomic which matches double.
boolean: the value space contains the booleans true and false.
All boolean literals build an atomic which matches boolean.
null: the value space is a singleton and only contains null.
All null literals build an atomic which matches null.
atomic: all atomic types.
All literals build an atomic which matches atomic.
JSONiq also supports further atomic types, which were borrowed from XML Schema.
These datatypes are already used as a set of atomic datatypes by the other two semi-structured data formats of the Web: XML and RDF, as well as by the corresponding query languages: XQuery and SPARQL, so it is natural for a complete JSON data model to reuse them.
Further number types: long, int, short, byte, float.
Date or time types: date, dateTime, dateTimeStamp, gDay, gMonth, gMonthDay, gYear, gYearMonth, time.
Duration types: duration, dayTimeDuration, yearMonthDuration.
Binary types: base64Binary, hexBinary.
An URI type: anyURI.