<s>
JSONiq	B-General_Concept
is	O
a	O
query	B-Language
and	O
functional	B-Language
programming	I-Language
language	I-Language
that	O
is	O
designed	O
to	O
declaratively	O
query	B-Language
and	O
transform	O
collections	O
of	O
hierarchical	O
and	O
heterogeneous	O
data	O
in	O
format	O
of	O
JSON	B-General_Concept
,	O
XML	B-Protocol
,	O
as	O
well	O
as	O
unstructured	O
,	O
textual	O
data	O
.	O
</s>
<s>
JSONiq	B-General_Concept
is	O
an	O
open	O
specification	O
published	O
under	O
the	O
Creative	O
Commons	O
Attribution-ShareAlike	O
3.0	O
license	O
.	O
</s>
<s>
It	O
is	O
based	O
on	O
the	O
XQuery	B-Language
language	O
,	O
with	O
which	O
it	O
shares	O
the	O
same	O
core	O
expressions	O
and	O
operations	O
on	O
atomic	O
types	O
.	O
</s>
<s>
JSONiq	B-General_Concept
comes	O
in	O
two	O
syntactical	O
flavors	O
,	O
which	O
both	O
support	O
JSON	B-General_Concept
and	O
XML	B-Protocol
natively	O
.	O
</s>
<s>
The	O
JSONiq	B-General_Concept
syntax	O
(	O
a	O
superset	O
of	O
JSON	B-General_Concept
)	O
extended	O
with	O
XML	B-Protocol
support	O
through	O
a	O
compatible	O
subset	O
of	O
XQuery	B-Language
.	O
</s>
<s>
The	O
XQuery	B-Language
syntax	O
(	O
native	O
XML	B-Protocol
support	O
)	O
extended	O
with	O
JSON	B-General_Concept
support	O
through	O
a	O
compatible	O
subset	O
(	O
the	O
JSONiq	B-General_Concept
extension	O
to	O
XQuery	B-Language
)	O
of	O
the	O
above	O
JSONiq	B-General_Concept
syntax	O
.	O
</s>
<s>
JSONiq	B-General_Concept
primarily	O
provides	O
means	O
to	O
extract	O
and	O
transform	O
data	O
from	O
JSON	B-General_Concept
documents	O
or	O
any	O
data	O
source	O
that	O
can	O
be	O
viewed	O
as	O
JSON	B-General_Concept
(	O
e.g.	O
</s>
<s>
relational	B-Application
databases	I-Application
or	O
web	O
services	O
)	O
.	O
</s>
<s>
The	O
major	O
expression	O
for	O
performing	O
such	O
operations	O
is	O
the	O
SQL-like	O
“	O
FLWOR	B-Language
expression	O
”	O
that	O
comes	O
from	O
XQuery	B-Language
.	O
</s>
<s>
A	O
FLWOR	B-Language
expression	O
is	O
constructed	O
from	O
the	O
five	O
clauses	O
after	O
which	O
it	O
is	O
named	O
:	O
FOR	O
,	O
LET	O
,	O
WHERE	O
,	O
ORDER	O
BY	O
,	O
RETURN	O
.	O
</s>
<s>
The	O
language	O
also	O
provides	O
syntax	O
for	O
constructing	O
new	O
JSON	B-General_Concept
documents	O
where	O
either	O
the	O
field	O
names	O
and	O
values	O
are	O
known	O
in	O
advance	O
or	O
can	O
be	O
computed	O
dynamically	O
.	O
</s>
<s>
The	O
JSONiq	B-General_Concept
language	O
(	O
not	O
the	O
extension	O
to	O
XQuery	B-Language
)	O
is	O
a	O
superset	O
of	O
JSON	B-General_Concept
.	O
</s>
<s>
That	O
is	O
,	O
each	O
JSON	B-General_Concept
document	O
is	O
a	O
valid	O
JSONiq	B-General_Concept
program	O
.	O
</s>
<s>
Additionally	O
,	O
the	O
language	O
also	O
supports	O
a	O
navigational	O
syntax	O
for	O
extracting	O
field	O
names	O
and	O
values	O
out	O
of	O
JSON	B-General_Concept
objects	O
as	O
well	O
as	O
values	O
out	O
of	O
JSON	B-General_Concept
arrays	O
.	O
</s>
<s>
JSONiq	B-General_Concept
does	O
not	O
include	O
features	O
for	O
updating	O
JSON	B-General_Concept
or	O
XML	B-Protocol
documents	I-Protocol
,	O
it	O
does	O
not	O
have	O
full	O
text	O
search	O
capabilities	O
,	O
and	O
has	O
no	O
statements	O
.	O
</s>
<s>
JSONiq	B-General_Concept
is	O
a	O
programming	O
language	O
that	O
can	O
express	O
arbitrary	O
JSON	B-General_Concept
to	O
JSON	B-General_Concept
or	O
XML	B-Protocol
to	O
XML	B-Protocol
transformations	O
.	O
</s>
<s>
It	O
also	O
allows	O
for	O
transformations	O
between	O
JSON	B-General_Concept
and	O
XML	B-Protocol
.	O
</s>
<s>
The	O
language	O
is	O
based	O
on	O
the	O
JSONiq	B-General_Concept
Data	O
Model	O
(	O
JDM	O
)	O
which	O
is	O
an	O
extension	O
of	O
the	O
XQuery	B-Application
and	I-Application
XPath	I-Application
Data	I-Application
Model	I-Application
(	O
XDM	O
)	O
.	O
</s>
<s>
The	O
JDM	O
uses	O
a	O
tree-structured	O
model	O
of	O
the	O
information	O
content	O
of	O
a	O
JSON	B-General_Concept
or	O
XML	B-Protocol
document	I-Protocol
.	O
</s>
<s>
It	O
contains	O
JSON	B-General_Concept
objects	O
,	O
JSON	B-General_Concept
arrays	O
,	O
all	O
kinds	O
of	O
XML	B-Protocol
nodes	O
,	O
as	O
well	O
as	O
atomic	O
values	O
such	O
as	O
integers	O
,	O
strings	O
,	O
or	O
boolean	O
all	O
being	O
defined	O
in	O
XML	B-Protocol
Schema	O
.	O
</s>
<s>
The	O
items	O
in	O
a	O
sequence	O
can	O
be	O
JSON	B-General_Concept
objects	O
,	O
JSON	B-General_Concept
arrays	O
,	O
XML	B-Protocol
nodes	O
,	O
or	O
atomic	O
values	O
.	O
</s>
<s>
The	O
sample	O
JSONiq	B-General_Concept
code	O
below	O
computes	O
the	O
area	O
code	O
and	O
the	O
number	O
of	O
all	O
people	O
older	O
than	O
20	O
from	O
a	O
collection	O
of	O
JSON	B-General_Concept
person	O
objects	O
(	O
see	O
the	O
JSON	B-General_Concept
article	O
for	O
an	O
example	O
object	O
)	O
.	O
</s>
<s>
All	O
JSONiq	B-General_Concept
constructs	O
are	O
expressions	O
and	O
can	O
also	O
be	O
contained	O
in	O
the	O
body	O
of	O
a	O
function	O
.	O
</s>
<s>
The	O
next	O
query	B-Language
transforms	O
parts	O
of	O
each	O
person	O
object	O
into	O
an	O
XML	B-Protocol
element	O
using	O
the	O
XQuery	B-Language
syntax	O
(	O
JSONiq	B-General_Concept
extension	O
to	O
XQuery	B-Language
)	O
.	O
</s>
<s>
Below	O
are	O
a	O
few	O
examples	O
of	O
how	O
and	O
where	O
JSONiq	B-General_Concept
can	O
be	O
used	O
:	O
</s>
<s>
Generating	O
summary	O
reports	O
on	O
data	O
stored	O
in	O
a	O
JSON	B-General_Concept
document	O
store	O
.	O
</s>
<s>
Selecting	O
and	O
transforming	O
JSON	B-General_Concept
data	O
to	O
XHTML	O
to	O
be	O
published	O
on	O
the	O
Web	O
.	O
</s>
<s>
JSON	B-General_Concept
document	O
store	O
,	O
XML	B-Protocol
database	O
,	O
relational	B-Application
database	I-Application
,	O
and	O
web	O
service	O
)	O
and	O
offer	O
it	O
in	O
a	O
web	O
service	O
.	O
</s>
<s>
Transforming	O
collections	O
of	O
JSON	B-General_Concept
objects	O
into	O
a	O
different	O
schema	O
.	O
</s>
<s>
There	O
are	O
two	O
syntaxes	O
of	O
JSONiq	B-General_Concept
,	O
which	O
users	O
can	O
use	O
on	O
whether	O
they	O
are	O
focusing	O
on	O
JSON	B-General_Concept
or	O
XML	B-Protocol
.	O
</s>
<s>
The	O
pure	O
JSONiq	B-General_Concept
syntax	O
is	O
a	O
superset	O
of	O
JSON	B-General_Concept
.	O
</s>
<s>
It	O
is	O
not	O
strictly	O
speaking	O
a	O
superset	O
of	O
XQuery	B-Language
even	O
though	O
all	O
its	O
expressions	O
and	O
semantics	O
are	O
available	O
.	O
</s>
<s>
The	O
following	O
aspects	O
of	O
the	O
JSONiq	B-General_Concept
syntax	O
are	O
not	O
XQuery	B-Language
conformant	O
:	O
</s>
<s>
JSON	B-General_Concept
,	O
backslash-based	O
escaping	O
in	O
string	B-Language
literals	I-Language
.	O
</s>
<s>
The	O
JSONiq	B-General_Concept
extension	O
to	O
XQuery	B-Language
is	O
a	O
superset	O
of	O
XQuery	B-Language
but	O
not	O
a	O
superset	O
of	O
JSON	B-General_Concept
.	O
</s>
<s>
It	O
is	O
fully	O
conformant	O
and	O
backwards	O
compatible	O
with	O
XQuery	B-Language
3.0	O
candidate	O
recommendation	O
.	O
</s>
<s>
The	O
following	O
aspects	O
of	O
JSONiq	B-General_Concept
are	O
not	O
supported	O
in	O
the	O
XQuery	B-Language
syntax	O
.	O
</s>
<s>
XML	B-Protocol
,	O
ampersand-based	O
escaping	O
of	O
string	B-Language
literals	I-Language
.	O
</s>
