← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-1049508 into lp:zorba

 

Chris Hillery has proposed merging lp:~zorba-coders/zorba/bug-1049508 into lp:zorba.

Commit message:
Change all namespaces from http://www.jsoniq.org/ to http://jsoniq.org, to match specification.

Requested reviews:
  Chris Hillery (ceejatec)
Related bugs:
  Bug #1049508 in Zorba: "use "http://jsoniq.org"; namespaces"
  https://bugs.launchpad.net/zorba/+bug/1049508

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1049508/+merge/126266
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-1049508/+merge/126266
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-09-24 21:28:44 +0000
+++ ChangeLog	2012-09-25 15:07:26 +0000
@@ -8,7 +8,7 @@
   * Allow prolog variables to be referenced before they are declared (XQuery 3.0 feature)
   * xml:parse (fragment parsing) now allows for a DOCTYPE declaration at the
     beginning of the XML document (requested in bug #1016606).
-  * New module http://www.jsoniq.org/modules/function-library with handy JSONiq
+  * New module http://jsoniq.org/modules/function-library with handy JSONiq
     functions. jn:object is also supported.
   * jn:parse-json can parse multiple top-level JSON items. Also, there is jn:parse-json#2 that
     takes options to parameterize the parsing process (see bug #1047547)
@@ -68,7 +68,7 @@
 
 New Features:
   * Include first-class support for JSON data by implementing the JSONiq spec
-  - see http://www.jsoniq.org/ for more information. This feature is enabled by default.
+  - see http://jsoniq.org/ for more information. This feature is enabled by default.
   * Implemented the new EQName syntax (use Q{namespace}local instead of "namespace":local)
   * New function Item::isSeekable for streamable content (xs:string and xs:base64Binary)
   * Implemented the latest W3C specification for the group by clause (backwards incompatible)

=== modified file 'doc/zorba/JSONforXQuery.html'
--- doc/zorba/JSONforXQuery.html	2012-09-17 00:36:37 +0000
+++ doc/zorba/JSONforXQuery.html	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-<html><head><title>JSON for XQuery</title><style type="text/css">@import url('https://themes.googleusercontent.com/fonts/css?kit=lhDjYqiy3mZ0x6ROQEUoUw');ol{margin:0;padding:0}.c9{padding-left:0pt;text-align:justify;margin-left:36pt}.c7{list-style-type:disc;margin:0;padding:0}.c19{max-width:468pt;background-color:#ffffff;padding:72pt 72pt 72pt 72pt}.c20{color:inherit;text-decoration:inherit}.c11{text-indent:-13pt;margin-left:77pt}.c2{font-size:36pt;font-weight:bold}.c21{color:#1155cc;text-decoration:underline}.c16{font-weight:bold}.c3{color:#38761d}.c15{text-indent:120pt}.c22{color:#4a86e8}.c17{text-align:center}.c13{margin-left:49.5pt}.c6{text-align:right}.c10{text-indent:156pt}.c0{font-family:"Consolas"}.c12{text-indent:144pt}.c14{text-align:justify}.c8{text-indent:139.5pt}.c5{margin-left:144pt}.c18{font-style:italic}.c4{height:11pt}.c1{direction:ltr}.title{padding-top:24pt;line-height:1.15;text-align:center;color:#4a86e8;font-size:36pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}.subtitle{padding-top:18pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:24pt;font-family:"Georgia";padding-bottom:4pt}li{color:#000000;font-size:11pt;font-family:"Arial"}p{color:#000000;font-size:11pt;margin:0;font-family:"Arial"}h1{padding-top:24pt;line-height:1.15;text-align:left;color:#4a86e8;font-size:24pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}h2{padding-top:18pt;line-height:1.15;text-align:left;color:#ff9900;font-size:18pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h3{padding-top:14pt;line-height:1.15;text-align:left;color:#000000;font-size:14pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h4{padding-top:12pt;line-height:1.15;text-align:left;color:#000000;font-size:12pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h5{padding-top:11pt;line-height:1.15;text-align:left;color:#000000;font-size:11pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h6{padding-top:10pt;line-height:1.15;text-align:left;color:#000000;font-size:10pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}</style></head><body class="c19"><p class="c17 c1"><span class="c2">JSONiq for XQuery users</span></p><p class="c4 c1 c15"><span></span></p><hr><p class="c1 c17"><span>This tutorial introduces the JSONiq language, which declaratively manipulates JSON data.</span></p><p class="c17 c1"><span>Why don&#39;t you go ahead can try the queries of this document on our online demo interface?</span></p><p class="c17 c1"><span>&nbsp;</span><span class="c21 c16"><a class="c20" href="http://www.zorba-xquery.com/html/jsoniq";>http://www.zorba-xquery.com/html/jsoniq</a></span></p><hr><p class="c4 c1"><span></span></p><h1 class="c1"><a name="h.f453h84m2u1a"></a><span>JSON</span></h1><p class="c14 c1"><span>As explained on </span><span class="c21"><a class="c20" href="http://www.json.org/";>http://www.json.org/</a></span><span>, JSON is a lightweight data-interchange format designed for humans as well as for computers. It supports as values:</span></p><ol class="c7" start="1"><li class="c9 c1"><span>objects (string-to-value map)</span></li><li class="c9 c1"><span>arrays (ordered sequence of values)</span></li><li class="c1 c9"><span>strings</span></li><li class="c9 c1"><span>numbers</span></li><li class="c9 c1"><span>booleans (true, false)</span></li><li class="c9 c1"><span>null</span></li></ol><p class="c4 c1"><span></span></p><p class="c1"><span>JSONiq extends XQuery to query and update JSON data, like XML data.</span></p><h1 class="c1"><a name="h.qtfakecy3fr7"></a><span>Elevator Pitch</span></h1><p class="c14 c1"><span>Here is an appetizer before we start the tutorial from scratch.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">let $stores :=</span></p><p class="c1"><span class="c0">[</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c1"><span class="c0">]</span></p><p class="c1"><span class="c0">let $sales := [</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c1"><span class="c0">]</span></p><p class="c1"><span class="c0">let $join :=</span></p><p class="c1"><span class="c0">&nbsp; for $store in jn:members($stores), $sale in jn:members($sales)</span></p><p class="c1"><span class="c0">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c1"><span class="c0">&nbsp; return {</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c1"><span class="c0">&nbsp; }</span></p><p class="c1"><span class="c0">return [$join]</span></p><p class="c5 c1"><span class="c3 c0">[ </span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c5 c1"><span class="c3 c0">&nbsp;]</span></p><p class="c4 c1"><span></span></p><h1 class="c1"><a name="h.yugk1mszt0re"></a><span>And here you go</span></h1><h2 class="c1"><a name="h.39rm37noeh9g"></a><span>JSONiq types</span></h2><p class="c1"><span>JSONiq maps JSON types to the XQuery data model. Numbers are xs:integer, xs:decimal or xs:double, strings are xs:string, true and false are xs:boolean and null is the unique value of a new atomic type jn:null.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>By default, in JSONiq, for convenience, true, false and null are recognized as literals instead of the classical XQuery path expression semantics (i.e., they would otherwise navigate to XML elements named &quot;true&quot;, &quot;false&quot; or &quot;null&quot;). However, this can be deactivated to use the path expression semantics.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>JSONiq also introduces new items: objects and arrays. Objects are sets of key/value pairs. Arrays have members which are values. Values are objects, arrays, XML nodes, functions or atomic items. Note that, in particular, Arrays can nest, unlike sequences.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>The new item types for objects and arrays are object() and array(). json-item() is a supertype of both. structured-item() is a supertype for json-item() and node().</span></p><h2 class="c1"><a name="h.j0wg8654ivtw"></a><span>JSON Constructors</span></h2><p class="c1"><span>JSONiq introduces JSON constructors, in a similar way to XML constructors.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>You can put any expression in a array. The items in the sequence produced by the expression will become members of the array:</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">[ 1 to 10 ]</span></p><p class="c6 c1"><span class="c3 c0">[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</span></p><p class="c6 c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>Or you can dynamically compute an object:</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">{</span></p><p class="c1"><span class="c0">&nbsp; &quot;Greeting&quot; : let $d := &quot;Mister Spock&quot;</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return concat(&quot;Hello, &quot;, $d),</span></p><p class="c1"><span class="c0">&nbsp; &quot;Farewell&quot; : string-join((&quot;Live&quot;, &quot;long&quot;, &quot;and&quot;, &quot;prosper&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot; &quot;)</span></p><p class="c1"><span class="c0">}</span></p><p class="c4 c1"><span class="c3 c0"></span></p><p class="c6 c1"><span class="c3 c0">{ &quot;Greeting&quot; : &quot;Hello, Mister Spock&quot;, &quot;Farewell&quot; : &quot;Live long and prosper&quot; }</span></p><p class="c4 c1"><span class="c3"></span></p><p class="c1"><span>You can also dynamically generate singleton objects:</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c1"><span class="c0">{ concat(&quot;Square of &quot;, 2) : 2 * 2 }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;Square of 2&quot; : 4 }</span></p><p class="c6 c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>and then use the {| |} construct to wrap several of them in a bigger object:</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c1"><span class="c0">{|</span></p><p class="c1"><span class="c0">&nbsp; for $i in 1 to 10</span></p><p class="c1"><span class="c0">&nbsp; return { concat(&quot;Square of &quot;, $i) : $i * $i }</span></p><p class="c1"><span class="c0">|}</span></p><p class="c5 c1"><span class="c3 c0">{</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 1&quot; : 1,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 2&quot; : 4,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 3&quot; : 9,</span></p><p class="c1 c5"><span class="c3 c0">&quot;Square of 4&quot; : 16,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 5&quot; : 25,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 6&quot; : 36,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 7&quot; : 49,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 8&quot; : 64,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 9&quot; : 81,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 10&quot; : 100</span></p><p class="c5 c1"><span class="c3 c0">}</span></p><p class="c4 c1"><span></span></p><h2 class="c1"><a name="h.qe57mgdf5ql"></a><span>JSON as a subset of JSONiq</span></h2><p class="c14 c1"><span>As a rule of thumb, a well-formed JSON document is a JSONiq expression as well. This means that you can copy-and-paste a JSON document into a query. The following are JSONiq queries that are &quot;idempotent&quot; (they just output themselves):</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c1 c4"><span class="c3 c0"></span></p><p class="c1"><span class="c0">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c6 c1"><span class="c3 c0">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c1"><span class="c0">{</span></p><p class="c1"><span class="c0">&nbsp; &quot;operations&quot; : [</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot;] },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; { &quot;unary&quot; : [&quot;not&quot;] }</span></p><p class="c1"><span class="c0">&nbsp; ],</span></p><p class="c1"><span class="c0">&nbsp; &quot;bits&quot; : [</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; 0, 1</span></p><p class="c1"><span class="c0">&nbsp; ]</span></p><p class="c1"><span class="c0">}</span></p><p class="c12 c1"><span class="c0 c3">{</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; &quot;operations&quot; : [</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot; ] },</span></p><p class="c1 c12"><span class="c3 c0">&nbsp; &nbsp; { &quot;unary&quot; : [ &quot;not&quot; ] }</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; ],</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; &quot;bits&quot; : [</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; &nbsp; 0, 1</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; ]</span></p><p class="c12 c1"><span class="c3 c0">}</span></p><p class="c6 c4 c1"><span class="c3 c0"></span></p><p class="c14 c1"><span>This works with objects, arrays (even nested), strings, numbers, booleans, null. </span><span class="c18">The exceptions to this rule (but we are working on it!) are that:</span></p><p class="c14 c1"><span class="c18">(i) empty objects are not recognized</span></p><p class="c14 c1"><span class="c18">(ii) characters escaped with the \ in JSON strings are not recognized, XML character references are recognized instead.</span></p><p class="c4 c1"><span class="c0 c18"></span></p><p class="c14 c1"><span>It also works the other way round: if your query outputs an object or an array, you can directly use it as a JSON document.</span></p><p class="c6 c4 c1"><span class="c3 c0"></span></p><h1 class="c1"><a name="h.dewn8sw3husv"></a><span>JSON Navigation</span></h1><p class="c14 c1"><span>Up to now, you learnt how to compose expressions so as to do some computations and to build objects and arrays. It also works the other way round: if you have some JSON data, you can access it and navigate.</span></p><p class="c10 c4 c1"><span></span></p><p class="c14 c1"><span>All you need to know is: JSONiq views</span></p><ol class="c7" start="1"><li class="c9 c1"><span>an array as an ordered list of values,</span></li><li class="c9 c1"><span>an object as a set of name/value pairs</span></li></ol><h2 class="c14 c1"><a name="h.zcnazhl6374z"></a><span>Objects</span></h2><p class="c14 c1"><span>You can use an object as if it were a function and pass the call an argument of type xs:string. It will return the value associated thereto:</span></p><p class="c10 c4 c1"><span></span></p><p class="c1"><span class="c0">let $person := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;first name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;age&quot; : 13,</span></p><p class="c1"><span class="c0">&nbsp;&quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">return $person(&quot;first name&quot;)</span></p><p class="c6 c10 c1"><span class="c3 c0">&quot;Sarah&quot;</span></p><p class="c10 c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>You can also ask for all keys in an object:</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">let $person := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;age&quot; : 13,</span></p><p class="c1"><span class="c0">&nbsp;&quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">return { &quot;keys&quot; : [ jn:keys($person)] }</span></p><p class="c10 c4 c1"><span class="c0"></span></p><p class="c6 c1 c11"><span class="c3 c0">{ &quot;keys&quot; : [ &quot;name&quot;, &quot;age&quot;, &quot;gender&quot;, &quot;friends&quot; ] }</span></p><h2 class="c1"><a name="h.30wafxvenhgy"></a><span>Arrays</span></h2><p class="c14 c1"><span>You can use an array as if it were a function and pass the call an argument of type xs:integer. It will return the entry at that position:</span></p><p class="c10 c4 c1"><span></span></p><p class="c1"><span class="c0">let $friends := [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">return $friends(2)</span></p><p class="c6 c10 c1"><span class="c3 c0">Mary</span></p><p class="c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>It is also possible to get the size of an array:</span></p><p class="c4 c1 c10"><span></span></p><p class="c1"><span class="c0">let $person := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;age&quot; : 13,</span></p><p class="c1"><span class="c0">&nbsp;&quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">return { &quot;how many friends&quot; : jn:size($person(&quot;friends&quot;)) }</span></p><p class="c10 c4 c1"><span class="c0"></span></p><p class="c6 c10 c1"><span class="c3 c0">{ &quot;how many friends&quot; : 3 }</span></p><p class="c10 c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>For convenience, there is a function that returns all elements in an array, as a sequence:</span></p><p class="c10 c4 c1"><span></span></p><p class="c1"><span class="c0">let $person := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;age&quot; : 13,</span></p><p class="c1"><span class="c0">&nbsp;&quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">return jn:members($person(&quot;friends&quot;))</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c6 c10 c1"><span class="c3 c0">Jim Mary Jennifer</span></p><h1 class="c1"><a name="h.eb0bxle2oykl"></a><span>Relational Algebra</span></h1><p class="c14 c1"><span>Remember SQL&#39;s SELECT FROM WHERE statements? JSONiq inherits selection, projection and join capability from XQuery FLWOR expressions. In order to traverse an array, jn:members() converts it into a sequence which can then be iterated over by a FLWOR expression.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">let $stores :=</span></p><p class="c1"><span class="c0">[</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c1"><span class="c0">]</span></p><p class="c1"><span class="c0">let $sales := [</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c1"><span class="c0">]</span></p><p class="c1"><span class="c0">let $join :=</span></p><p class="c1"><span class="c0">&nbsp; for $store in jn:members($stores), $sale in jn:members($sales)</span></p><p class="c1"><span class="c0">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c1"><span class="c0">&nbsp; return {</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c1"><span class="c0">&nbsp; }</span></p><p class="c1"><span class="c0">return [$join]</span></p><p class="c8 c1"><span class="c3 c0">[ </span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c1 c8"><span class="c3 c0">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c8 c1"><span class="c3 c0">&nbsp;]</span></p><h1 class="c1"><a name="h.oii6pvliilhi"></a><span>Access external data</span></h1><p class="c1"><span>Our implementation supports collections of (and indices on) JSON objects or arrays:</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">dml:collection(&quot;my:data&quot;)</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;Your&quot; }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;Collection&quot; }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;of&quot; }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;JSON&quot; }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;objects&quot; }</span></p><p class="c4 c1 c6"><span class="c3 c0"></span></p><p class="c1"><span>It is also possible to get JSON content with an HTTP request, or by parsing it from a string. The EXPath http-client module (described in the Zorba documentation) &nbsp;allows you to make HTTP requests, and the jn:parse-json() function allows you to use the body as an object or an array.</span></p><p class="c4 c1"><span class="c3 c0"></span></p><h1 class="c1"><a name="h.fopcxnkoydgt"></a><span>JSON and XML</span></h1><p class="c14 c1"><span>You can use XML and JSON in the same program. An XML node can be a value in an object or array, however, arrays and object may not be children of an XML node - but you can extract atomic values or XML nodes inside objects and arrays to insert them in a new XML node.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">let $data := {</span></p><p class="c1"><span class="c0">&nbsp; &quot;color&quot; : &quot;blue&quot;,</span></p><p class="c1"><span class="c0">&nbsp; &quot;closed&quot; : true,</span></p><p class="c1"><span class="c0">&nbsp; &quot;points&quot; : [[10,10], [20,10], [20,20], [10,20]]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">let $stroke := attribute stroke { $data(&quot;color&quot;) }</span></p><p class="c1"><span class="c0">let $points := attribute points { jn:flatten($data(&quot;points&quot;)) }</span></p><p class="c1"><span class="c0">return</span></p><p class="c1"><span class="c0">&nbsp; if ($data(&quot;closed&quot;)) then</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &lt;svg&gt;&lt;polygon&gt;{ $stroke, $points }&lt;/polygon&gt;&lt;/svg&gt;</span></p><p class="c1"><span class="c0">&nbsp; else</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &lt;svg&gt;&lt;polyline&gt;{ $stroke, $points }&lt;/polyline&gt;&lt;/svg&gt;</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c13 c6 c1"><span class="c3 c0">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span></p><p class="c6 c1 c13"><span class="c3 c0">&lt;svg&gt;&lt;polygon stroke=&quot;blue&quot; points=&quot;10 10 20 10 20 20 10 20&quot;/&gt;&lt;/svg&gt;</span></p><p class="c4 c1"><span></span></p><h1 class="c1"><a name="h.bm3buqmzhtko"></a><span>I want more</span></h1><p class="c1 c14"><span>JSONiq supports JSON updates by extending the XQuery Update Facility specification, so you can declaratively update your JSON data. JSONiq provides new expressions that produce update primitives on JSON items. The list of updates that is eventually output by your program is then applied to your JSON data.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">copy $people := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;John&quot; : { &quot;status&quot; : &quot;single&quot; },</span></p><p class="c1"><span class="c0">&nbsp;&quot;Mary&quot; : { &quot;status&quot; : &quot;single&quot; } }</span></p><p class="c1"><span class="c0">modify (replace json value of $people(&quot;John&quot;)(&quot;status&quot;) with &quot;married&quot;,</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; replace json value of $people(&quot;Mary&quot;)(&quot;status&quot;) with &quot;married&quot;)</span></p><p class="c1"><span class="c0">return $people</span></p><p class="c10 c4 c1"><span class="c0"></span></p><p class="c6 c1"><span class="c3 c0">{ &quot;John&quot; : { &quot;status&quot; : &quot;married&quot; }, &quot;Mary&quot; : { &quot;status&quot; : &quot;married&quot; } }</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>JSONiq works with the XQuery 3.0 standard (switch, typeswitch and try-catch expressions, universal/existential quantifiers, path expressions, filtering expressions, functors, mappings, grouping, windowing will work). The Zorba implementation is also compatible with the proprietary Zorba scripting.</span></p><p class="c4 c1"><span></span></p><p class="c14 c1"><span>The complete JSONiq specification is available on </span><span class="c21"><a class="c20" href="http://www.jsoniq.org/";>http://www.jsoniq.org/</a></span></p><p class="c4 c1"><span></span></p></body></html>
\ No newline at end of file
+<html><head><title>JSON for XQuery</title><style type="text/css">@import url('https://themes.googleusercontent.com/fonts/css?kit=lhDjYqiy3mZ0x6ROQEUoUw');ol{margin:0;padding:0}.c9{padding-left:0pt;text-align:justify;margin-left:36pt}.c7{list-style-type:disc;margin:0;padding:0}.c19{max-width:468pt;background-color:#ffffff;padding:72pt 72pt 72pt 72pt}.c20{color:inherit;text-decoration:inherit}.c11{text-indent:-13pt;margin-left:77pt}.c2{font-size:36pt;font-weight:bold}.c21{color:#1155cc;text-decoration:underline}.c16{font-weight:bold}.c3{color:#38761d}.c15{text-indent:120pt}.c22{color:#4a86e8}.c17{text-align:center}.c13{margin-left:49.5pt}.c6{text-align:right}.c10{text-indent:156pt}.c0{font-family:"Consolas"}.c12{text-indent:144pt}.c14{text-align:justify}.c8{text-indent:139.5pt}.c5{margin-left:144pt}.c18{font-style:italic}.c4{height:11pt}.c1{direction:ltr}.title{padding-top:24pt;line-height:1.15;text-align:center;color:#4a86e8;font-size:36pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}.subtitle{padding-top:18pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:24pt;font-family:"Georgia";padding-bottom:4pt}li{color:#000000;font-size:11pt;font-family:"Arial"}p{color:#000000;font-size:11pt;margin:0;font-family:"Arial"}h1{padding-top:24pt;line-height:1.15;text-align:left;color:#4a86e8;font-size:24pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}h2{padding-top:18pt;line-height:1.15;text-align:left;color:#ff9900;font-size:18pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h3{padding-top:14pt;line-height:1.15;text-align:left;color:#000000;font-size:14pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h4{padding-top:12pt;line-height:1.15;text-align:left;color:#000000;font-size:12pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h5{padding-top:11pt;line-height:1.15;text-align:left;color:#000000;font-size:11pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h6{padding-top:10pt;line-height:1.15;text-align:left;color:#000000;font-size:10pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}</style></head><body class="c19"><p class="c17 c1"><span class="c2">JSONiq for XQuery users</span></p><p class="c4 c1 c15"><span></span></p><hr><p class="c1 c17"><span>This tutorial introduces the JSONiq language, which declaratively manipulates JSON data.</span></p><p class="c17 c1"><span>Why don&#39;t you go ahead can try the queries of this document on our online demo interface?</span></p><p class="c17 c1"><span>&nbsp;</span><span class="c21 c16"><a class="c20" href="http://www.zorba-xquery.com/html/jsoniq";>http://www.zorba-xquery.com/html/jsoniq</a></span></p><hr><p class="c4 c1"><span></span></p><h1 class="c1"><a name="h.f453h84m2u1a"></a><span>JSON</span></h1><p class="c14 c1"><span>As explained on </span><span class="c21"><a class="c20" href="http://www.json.org/";>http://www.json.org/</a></span><span>, JSON is a lightweight data-interchange format designed for humans as well as for computers. It supports as values:</span></p><ol class="c7" start="1"><li class="c9 c1"><span>objects (string-to-value map)</span></li><li class="c9 c1"><span>arrays (ordered sequence of values)</span></li><li class="c1 c9"><span>strings</span></li><li class="c9 c1"><span>numbers</span></li><li class="c9 c1"><span>booleans (true, false)</span></li><li class="c9 c1"><span>null</span></li></ol><p class="c4 c1"><span></span></p><p class="c1"><span>JSONiq extends XQuery to query and update JSON data, like XML data.</span></p><h1 class="c1"><a name="h.qtfakecy3fr7"></a><span>Elevator Pitch</span></h1><p class="c14 c1"><span>Here is an appetizer before we start the tutorial from scratch.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">let $stores :=</span></p><p class="c1"><span class="c0">[</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c1"><span class="c0">]</span></p><p class="c1"><span class="c0">let $sales := [</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c1"><span class="c0">]</span></p><p class="c1"><span class="c0">let $join :=</span></p><p class="c1"><span class="c0">&nbsp; for $store in jn:members($stores), $sale in jn:members($sales)</span></p><p class="c1"><span class="c0">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c1"><span class="c0">&nbsp; return {</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c1"><span class="c0">&nbsp; }</span></p><p class="c1"><span class="c0">return [$join]</span></p><p class="c5 c1"><span class="c3 c0">[ </span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c5 c1"><span class="c3 c0">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c5 c1"><span class="c3 c0">&nbsp;]</span></p><p class="c4 c1"><span></span></p><h1 class="c1"><a name="h.yugk1mszt0re"></a><span>And here you go</span></h1><h2 class="c1"><a name="h.39rm37noeh9g"></a><span>JSONiq types</span></h2><p class="c1"><span>JSONiq maps JSON types to the XQuery data model. Numbers are xs:integer, xs:decimal or xs:double, strings are xs:string, true and false are xs:boolean and null is the unique value of a new atomic type jn:null.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>By default, in JSONiq, for convenience, true, false and null are recognized as literals instead of the classical XQuery path expression semantics (i.e., they would otherwise navigate to XML elements named &quot;true&quot;, &quot;false&quot; or &quot;null&quot;). However, this can be deactivated to use the path expression semantics.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>JSONiq also introduces new items: objects and arrays. Objects are sets of key/value pairs. Arrays have members which are values. Values are objects, arrays, XML nodes, functions or atomic items. Note that, in particular, Arrays can nest, unlike sequences.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>The new item types for objects and arrays are object() and array(). json-item() is a supertype of both. structured-item() is a supertype for json-item() and node().</span></p><h2 class="c1"><a name="h.j0wg8654ivtw"></a><span>JSON Constructors</span></h2><p class="c1"><span>JSONiq introduces JSON constructors, in a similar way to XML constructors.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>You can put any expression in a array. The items in the sequence produced by the expression will become members of the array:</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">[ 1 to 10 ]</span></p><p class="c6 c1"><span class="c3 c0">[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</span></p><p class="c6 c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>Or you can dynamically compute an object:</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">{</span></p><p class="c1"><span class="c0">&nbsp; &quot;Greeting&quot; : let $d := &quot;Mister Spock&quot;</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return concat(&quot;Hello, &quot;, $d),</span></p><p class="c1"><span class="c0">&nbsp; &quot;Farewell&quot; : string-join((&quot;Live&quot;, &quot;long&quot;, &quot;and&quot;, &quot;prosper&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot; &quot;)</span></p><p class="c1"><span class="c0">}</span></p><p class="c4 c1"><span class="c3 c0"></span></p><p class="c6 c1"><span class="c3 c0">{ &quot;Greeting&quot; : &quot;Hello, Mister Spock&quot;, &quot;Farewell&quot; : &quot;Live long and prosper&quot; }</span></p><p class="c4 c1"><span class="c3"></span></p><p class="c1"><span>You can also dynamically generate singleton objects:</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c1"><span class="c0">{ concat(&quot;Square of &quot;, 2) : 2 * 2 }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;Square of 2&quot; : 4 }</span></p><p class="c6 c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>and then use the {| |} construct to wrap several of them in a bigger object:</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c1"><span class="c0">{|</span></p><p class="c1"><span class="c0">&nbsp; for $i in 1 to 10</span></p><p class="c1"><span class="c0">&nbsp; return { concat(&quot;Square of &quot;, $i) : $i * $i }</span></p><p class="c1"><span class="c0">|}</span></p><p class="c5 c1"><span class="c3 c0">{</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 1&quot; : 1,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 2&quot; : 4,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 3&quot; : 9,</span></p><p class="c1 c5"><span class="c3 c0">&quot;Square of 4&quot; : 16,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 5&quot; : 25,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 6&quot; : 36,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 7&quot; : 49,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 8&quot; : 64,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 9&quot; : 81,</span></p><p class="c5 c1"><span class="c3 c0">&quot;Square of 10&quot; : 100</span></p><p class="c5 c1"><span class="c3 c0">}</span></p><p class="c4 c1"><span></span></p><h2 class="c1"><a name="h.qe57mgdf5ql"></a><span>JSON as a subset of JSONiq</span></h2><p class="c14 c1"><span>As a rule of thumb, a well-formed JSON document is a JSONiq expression as well. This means that you can copy-and-paste a JSON document into a query. The following are JSONiq queries that are &quot;idempotent&quot; (they just output themselves):</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c1 c4"><span class="c3 c0"></span></p><p class="c1"><span class="c0">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c6 c1"><span class="c3 c0">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c1"><span class="c0">{</span></p><p class="c1"><span class="c0">&nbsp; &quot;operations&quot; : [</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot;] },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; { &quot;unary&quot; : [&quot;not&quot;] }</span></p><p class="c1"><span class="c0">&nbsp; ],</span></p><p class="c1"><span class="c0">&nbsp; &quot;bits&quot; : [</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; 0, 1</span></p><p class="c1"><span class="c0">&nbsp; ]</span></p><p class="c1"><span class="c0">}</span></p><p class="c12 c1"><span class="c0 c3">{</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; &quot;operations&quot; : [</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot; ] },</span></p><p class="c1 c12"><span class="c3 c0">&nbsp; &nbsp; { &quot;unary&quot; : [ &quot;not&quot; ] }</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; ],</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; &quot;bits&quot; : [</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; &nbsp; 0, 1</span></p><p class="c12 c1"><span class="c3 c0">&nbsp; ]</span></p><p class="c12 c1"><span class="c3 c0">}</span></p><p class="c6 c4 c1"><span class="c3 c0"></span></p><p class="c14 c1"><span>This works with objects, arrays (even nested), strings, numbers, booleans, null. </span><span class="c18">The exceptions to this rule (but we are working on it!) are that:</span></p><p class="c14 c1"><span class="c18">(i) empty objects are not recognized</span></p><p class="c14 c1"><span class="c18">(ii) characters escaped with the \ in JSON strings are not recognized, XML character references are recognized instead.</span></p><p class="c4 c1"><span class="c0 c18"></span></p><p class="c14 c1"><span>It also works the other way round: if your query outputs an object or an array, you can directly use it as a JSON document.</span></p><p class="c6 c4 c1"><span class="c3 c0"></span></p><h1 class="c1"><a name="h.dewn8sw3husv"></a><span>JSON Navigation</span></h1><p class="c14 c1"><span>Up to now, you learnt how to compose expressions so as to do some computations and to build objects and arrays. It also works the other way round: if you have some JSON data, you can access it and navigate.</span></p><p class="c10 c4 c1"><span></span></p><p class="c14 c1"><span>All you need to know is: JSONiq views</span></p><ol class="c7" start="1"><li class="c9 c1"><span>an array as an ordered list of values,</span></li><li class="c9 c1"><span>an object as a set of name/value pairs</span></li></ol><h2 class="c14 c1"><a name="h.zcnazhl6374z"></a><span>Objects</span></h2><p class="c14 c1"><span>You can use an object as if it were a function and pass the call an argument of type xs:string. It will return the value associated thereto:</span></p><p class="c10 c4 c1"><span></span></p><p class="c1"><span class="c0">let $person := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;first name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;age&quot; : 13,</span></p><p class="c1"><span class="c0">&nbsp;&quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">return $person(&quot;first name&quot;)</span></p><p class="c6 c10 c1"><span class="c3 c0">&quot;Sarah&quot;</span></p><p class="c10 c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>You can also ask for all keys in an object:</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">let $person := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;age&quot; : 13,</span></p><p class="c1"><span class="c0">&nbsp;&quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">return { &quot;keys&quot; : [ jn:keys($person)] }</span></p><p class="c10 c4 c1"><span class="c0"></span></p><p class="c6 c1 c11"><span class="c3 c0">{ &quot;keys&quot; : [ &quot;name&quot;, &quot;age&quot;, &quot;gender&quot;, &quot;friends&quot; ] }</span></p><h2 class="c1"><a name="h.30wafxvenhgy"></a><span>Arrays</span></h2><p class="c14 c1"><span>You can use an array as if it were a function and pass the call an argument of type xs:integer. It will return the entry at that position:</span></p><p class="c10 c4 c1"><span></span></p><p class="c1"><span class="c0">let $friends := [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">return $friends(2)</span></p><p class="c6 c10 c1"><span class="c3 c0">Mary</span></p><p class="c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>It is also possible to get the size of an array:</span></p><p class="c4 c1 c10"><span></span></p><p class="c1"><span class="c0">let $person := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;age&quot; : 13,</span></p><p class="c1"><span class="c0">&nbsp;&quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">return { &quot;how many friends&quot; : jn:size($person(&quot;friends&quot;)) }</span></p><p class="c10 c4 c1"><span class="c0"></span></p><p class="c6 c10 c1"><span class="c3 c0">{ &quot;how many friends&quot; : 3 }</span></p><p class="c10 c4 c1"><span class="c3 c0"></span></p><p class="c1"><span>For convenience, there is a function that returns all elements in an array, as a sequence:</span></p><p class="c10 c4 c1"><span></span></p><p class="c1"><span class="c0">let $person := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;age&quot; : 13,</span></p><p class="c1"><span class="c0">&nbsp;&quot;gender&quot; : &quot;female&quot;,</span></p><p class="c1"><span class="c0">&nbsp;&quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">return jn:members($person(&quot;friends&quot;))</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c6 c10 c1"><span class="c3 c0">Jim Mary Jennifer</span></p><h1 class="c1"><a name="h.eb0bxle2oykl"></a><span>Relational Algebra</span></h1><p class="c14 c1"><span>Remember SQL&#39;s SELECT FROM WHERE statements? JSONiq inherits selection, projection and join capability from XQuery FLWOR expressions. In order to traverse an array, jn:members() converts it into a sequence which can then be iterated over by a FLWOR expression.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">let $stores :=</span></p><p class="c1"><span class="c0">[</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c1"><span class="c0">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c1"><span class="c0">]</span></p><p class="c1"><span class="c0">let $sales := [</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c1"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c1"><span class="c0">]</span></p><p class="c1"><span class="c0">let $join :=</span></p><p class="c1"><span class="c0">&nbsp; for $store in jn:members($stores), $sale in jn:members($sales)</span></p><p class="c1"><span class="c0">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c1"><span class="c0">&nbsp; return {</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c1"><span class="c0">&nbsp; }</span></p><p class="c1"><span class="c0">return [$join]</span></p><p class="c8 c1"><span class="c3 c0">[ </span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c1 c8"><span class="c3 c0">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c8 c1"><span class="c3 c0">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c8 c1"><span class="c3 c0">&nbsp;]</span></p><h1 class="c1"><a name="h.oii6pvliilhi"></a><span>Access external data</span></h1><p class="c1"><span>Our implementation supports collections of (and indices on) JSON objects or arrays:</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">dml:collection(&quot;my:data&quot;)</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;Your&quot; }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;Collection&quot; }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;of&quot; }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;JSON&quot; }</span></p><p class="c6 c1"><span class="c3 c0">{ &quot;foo&quot; : &quot;objects&quot; }</span></p><p class="c4 c1 c6"><span class="c3 c0"></span></p><p class="c1"><span>It is also possible to get JSON content with an HTTP request, or by parsing it from a string. The EXPath http-client module (described in the Zorba documentation) &nbsp;allows you to make HTTP requests, and the jn:parse-json() function allows you to use the body as an object or an array.</span></p><p class="c4 c1"><span class="c3 c0"></span></p><h1 class="c1"><a name="h.fopcxnkoydgt"></a><span>JSON and XML</span></h1><p class="c14 c1"><span>You can use XML and JSON in the same program. An XML node can be a value in an object or array, however, arrays and object may not be children of an XML node - but you can extract atomic values or XML nodes inside objects and arrays to insert them in a new XML node.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">let $data := {</span></p><p class="c1"><span class="c0">&nbsp; &quot;color&quot; : &quot;blue&quot;,</span></p><p class="c1"><span class="c0">&nbsp; &quot;closed&quot; : true,</span></p><p class="c1"><span class="c0">&nbsp; &quot;points&quot; : [[10,10], [20,10], [20,20], [10,20]]</span></p><p class="c1"><span class="c0">}</span></p><p class="c1"><span class="c0">let $stroke := attribute stroke { $data(&quot;color&quot;) }</span></p><p class="c1"><span class="c0">let $points := attribute points { jn:flatten($data(&quot;points&quot;)) }</span></p><p class="c1"><span class="c0">return</span></p><p class="c1"><span class="c0">&nbsp; if ($data(&quot;closed&quot;)) then</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &lt;svg&gt;&lt;polygon&gt;{ $stroke, $points }&lt;/polygon&gt;&lt;/svg&gt;</span></p><p class="c1"><span class="c0">&nbsp; else</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &lt;svg&gt;&lt;polyline&gt;{ $stroke, $points }&lt;/polyline&gt;&lt;/svg&gt;</span></p><p class="c4 c1"><span class="c0"></span></p><p class="c13 c6 c1"><span class="c3 c0">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span></p><p class="c6 c1 c13"><span class="c3 c0">&lt;svg&gt;&lt;polygon stroke=&quot;blue&quot; points=&quot;10 10 20 10 20 20 10 20&quot;/&gt;&lt;/svg&gt;</span></p><p class="c4 c1"><span></span></p><h1 class="c1"><a name="h.bm3buqmzhtko"></a><span>I want more</span></h1><p class="c1 c14"><span>JSONiq supports JSON updates by extending the XQuery Update Facility specification, so you can declaratively update your JSON data. JSONiq provides new expressions that produce update primitives on JSON items. The list of updates that is eventually output by your program is then applied to your JSON data.</span></p><p class="c4 c1"><span></span></p><p class="c1"><span class="c0">copy $people := {</span></p><p class="c1"><span class="c0">&nbsp;&quot;John&quot; : { &quot;status&quot; : &quot;single&quot; },</span></p><p class="c1"><span class="c0">&nbsp;&quot;Mary&quot; : { &quot;status&quot; : &quot;single&quot; } }</span></p><p class="c1"><span class="c0">modify (replace json value of $people(&quot;John&quot;)(&quot;status&quot;) with &quot;married&quot;,</span></p><p class="c1"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; replace json value of $people(&quot;Mary&quot;)(&quot;status&quot;) with &quot;married&quot;)</span></p><p class="c1"><span class="c0">return $people</span></p><p class="c10 c4 c1"><span class="c0"></span></p><p class="c6 c1"><span class="c3 c0">{ &quot;John&quot; : { &quot;status&quot; : &quot;married&quot; }, &quot;Mary&quot; : { &quot;status&quot; : &quot;married&quot; } }</span></p><p class="c4 c1"><span></span></p><p class="c1"><span>JSONiq works with the XQuery 3.0 standard (switch, typeswitch and try-catch expressions, universal/existential quantifiers, path expressions, filtering expressions, functors, mappings, grouping, windowing will work). The Zorba implementation is also compatible with the proprietary Zorba scripting.</span></p><p class="c4 c1"><span></span></p><p class="c14 c1"><span>The complete JSONiq specification is available on </span><span class="c21"><a class="c20" href="http://jsoniq.org/";>http://jsoniq.org/</a></span></p><p class="c4 c1"><span></span></p></body></html>
\ No newline at end of file

=== modified file 'doc/zorba/XQueryforJSON.html'
--- doc/zorba/XQueryforJSON.html	2012-09-17 00:36:37 +0000
+++ doc/zorba/XQueryforJSON.html	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-<html><head><title>XQuery for JSON</title><style type="text/css">@import url('https://themes.googleusercontent.com/fonts/css?kit=lhDjYqiy3mZ0x6ROQEUoUw');ol{margin:0;padding:0}.c1{height:11pt;text-align:right;direction:ltr}.c3{color:#1155cc;text-decoration:underline;font-weight:bold}.c15{list-style-type:disc;margin:0;padding:0}.c16{max-width:468pt;background-color:#ffffff;padding:72pt 72pt 72pt 72pt}.c7{color:#ff0000;font-style:italic}.c19{text-indent:-13.5pt;margin-left:76.5pt}.c2{direction:ltr;margin-left:144pt}.c13{color:inherit;text-decoration:inherit}.c14{padding-left:0pt;margin-left:36pt}.c20{color:#1155cc;text-decoration:underline}.c17{color:#4a86e8}.c6{text-align:center}.c0{font-family:"Consolas"}.c10{font-style:italic}.c4{direction:ltr}.c9{text-align:justify}.c11{text-align:right}.c5{color:#38761d}.c18{color:#ff9900}.c12{font-weight:bold}.c8{height:11pt}.title{padding-top:24pt;line-height:1.15;text-align:center;color:#4a86e8;font-size:36pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}.subtitle{padding-top:18pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:24pt;font-family:"Georgia";padding-bottom:4pt}li{color:#000000;font-size:11pt;font-family:"Arial"}p{color:#000000;font-size:11pt;margin:0;font-family:"Arial"}h1{padding-top:24pt;line-height:1.15;text-align:left;color:#4a86e8;font-size:24pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}h2{padding-top:18pt;line-height:1.15;text-align:left;color:#ff9900;font-size:18pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h3{padding-top:14pt;line-height:1.15;text-align:left;color:#000000;font-size:14pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h4{padding-top:12pt;line-height:1.15;text-align:left;color:#000000;font-size:12pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h5{padding-top:11pt;line-height:1.15;text-align:left;color:#000000;font-size:11pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h6{padding-top:10pt;line-height:1.15;text-align:left;color:#000000;font-size:10pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}</style></head><body class="c16"><p class="c4 title"><a name="h.ngvhp3svo6iy"></a><span>JSONiq for JSON users</span></p><hr><p class="c6 c4"><span>This tutorial introduces the JSONiq language, which declaratively manipulates JSON data.</span></p><p class="c6 c4"><span>Why don&#39;t you go ahead can try the queries of this document on our online demo interface?</span></p><p class="c4 c6"><span>&nbsp;</span><span class="c3"><a class="c13" href="http://www.zorba-xquery.com/html/jsoniq";>http://www.zorba-xquery.com/html/jsoniq</a></span></p><hr><p class="c4 c8"><span></span></p><h1 class="c4"><a name="h.f453h84m2u1a"></a><span>JSON</span></h1><p class="c4 c9"><span>As explained on the official Web site </span><span class="c20"><a class="c13" href="http://www.json.org/";>http://www.json.org/</a></span><span>, JSON is a lightweight data-interchange format designed for humans as well as for computers. It supports as values:</span></p><ol class="c15" start="1"><li class="c14 c4 c9"><span>objects (string-to-value maps)</span></li><li class="c4 c9 c14"><span>arrays (ordered sequences of values)</span></li><li class="c14 c4 c9"><span>strings</span></li><li class="c14 c4 c9"><span>numbers</span></li><li class="c14 c4 c9"><span>booleans (true, false)</span></li><li class="c14 c4 c9"><span>null</span></li></ol><p class="c4 c8"><span></span></p><p class="c4"><span>JSONiq provides declarative querying and updating capabilities on JSON data.</span></p><h1 class="c4"><a name="h.qtfakecy3fr7"></a><span>Elevator Pitch</span></h1><p class="c4 c9"><span>JSONiq is based on XQuery, which is a W3C standard (like XML and HTML). XQuery is a very powerful declarative language that originally manipulates XML data, but it turns out that it is also a very good fit for manipulating JSON natively.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span>JSONiq, since it extends XQuery, is a very powerful general-purpose declarative programming language. Our experience is that, for the same task, you will probably write about 80% less code compared to imperative languages like JavaScript, Python or Ruby. Additionally, you get the benefits of strong type checking without actually having to write type declarations.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span>Here is an appetizer before we start the tutorial from scratch.</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $stores :=</span></p><p class="c4"><span class="c0">[</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c4"><span class="c0">]</span></p><p class="c4"><span class="c0">let $sales := [</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c4"><span class="c0">]</span></p><p class="c4"><span class="c0">let $join :=</span></p><p class="c4"><span class="c0">&nbsp; for $store in jn:members($stores), $sale in jn:members($sales)</span></p><p class="c4"><span class="c0">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c4"><span class="c0">&nbsp; return {</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c4"><span class="c0">&nbsp; }</span></p><p class="c4"><span class="c0">return [$join]</span></p><p class="c2"><span class="c0 c5">[ </span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c2"><span class="c0 c5">&nbsp;]</span></p><p class="c4 c8"><span></span></p><h1 class="c4"><a name="h.yugk1mszt0re"></a><span>And here you go</span></h1><h2 class="c4"><a name="h.4uvhbej4btrt"></a><span>Actually</span><span>, you already knew some JSONiq</span></h2><p class="c4 c9"><span>The first thing you need to know is that, as a rule of thumb, a well-formed JSON document is a JSONiq expression as well.</span></p><p class="c4 c8"><span></span></p><p class="c4 c9"><span>This means that, most of the time, you can copy-and-paste a JSON document into a query. The following are JSONiq queries that are &quot;idempotent&quot; (they just output themselves):</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4"><span class="c0">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c4 c11"><span class="c0 c5">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">{</span></p><p class="c4"><span class="c0">&nbsp; &quot;operations&quot; : [</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot;] },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; { &quot;unary&quot; : [&quot;not&quot;] }</span></p><p class="c4"><span class="c0">&nbsp; ],</span></p><p class="c4"><span class="c0">&nbsp; &quot;bits&quot; : [</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; 0, 1</span></p><p class="c4"><span class="c0">&nbsp; ]</span></p><p class="c4"><span class="c0">}</span></p><p class="c2"><span class="c0 c5">{</span></p><p class="c2"><span class="c0 c5">&nbsp; &quot;operations&quot; : [</span></p><p class="c2"><span class="c0 c5">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot; ] },</span></p><p class="c2"><span class="c0 c5">&nbsp; &nbsp; { &quot;unary&quot; : [ &quot;not&quot; ] }</span></p><p class="c2"><span class="c0 c5">&nbsp; ],</span></p><p class="c2"><span class="c0 c5">&nbsp; &quot;bits&quot; : [</span></p><p class="c2"><span class="c0 c5">&nbsp; &nbsp; 0, 1</span></p><p class="c2"><span class="c0 c5">&nbsp; ]</span></p><p class="c2"><span class="c0 c5">}</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">[ { &quot;Question&quot; : &quot;Ultimate&quot; }, [&quot;Life&quot;, &quot;the universe&quot;, &quot;and everything&quot;] ]</span></p><p class="c1"><span class="c0"></span></p><p class="c4 c11"><span class="c0 c5">[ { &quot;Question&quot; : &quot;Ultimate&quot; }, [ &quot;Life&quot;, &quot;the universe&quot;, &quot;and everything&quot; ] ]</span></p><p class="c1"><span class="c0"></span></p><p class="c4"><span>This works with objects, arrays (even nested), strings, numbers, booleans, null. </span><span class="c10">The exceptions to this rule (but we are working on it!) are that:</span></p><p class="c4 c9"><span class="c10">(i) empty objects are not recognized and must be written {| |}.</span></p><p class="c4 c9"><span class="c10">(ii) characters escaped with the \ in JSON strings are not recognized (XQuery uses another means of escaping characters).</span></p><p class="c4 c8"><span class="c0 c7"></span></p><p class="c4 c9"><span>It also works the other way round: if your query outputs an object or an array, you can use it as a JSON document.</span></p><p class="c4 c8"><span></span></p><p class="c4 c9"><span>JSONiq is a declarative language. This means that you only need to say </span><span class="c10">what</span><span>&nbsp;you want - the compiler will take care of the </span><span class="c10">how</span><span>. In the above queries, you are basically saying: I want to output this JSON content, and here it is.</span></p><h1 class="c4"><a name="h.1gal1zhyffu4"></a><span>JSONiq basics</span></h1><h2 class="c4"><a name="h.ncbxtez2z3rn"></a><span>The real JSONiq Hello, World!</span></h2><p class="c4"><span>Wondering what a hello world program looks like in JSONiq? Here it is:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">&quot;Hello, World!&quot;</span></p><p class="c4 c11"><span class="c0 c5">Hello, World!</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4"><span>Not surprisingly, it outputs the string &quot;Hello, World!&quot;.</span></p><h2 class="c4"><a name="h.ifcjheuaxoqc"></a><span>Numbers and arithmetic operations</span></h2><p class="c4 c9"><span>Okay, so, now, you might be thinking: &quot;What is the use of this language if it just outputs what I put in?&quot; Of course, JSONiq can more than that. And still in a declarative way. Here is how it works with numbers:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">2 + 2</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span>will output:</span></p><p class="c4 c11"><span class="c0 c5">4</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>whereas</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">(38 + 2) div 2 + 11 * 2</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span>will output</span></p><p class="c4 c11"><span class="c0 c5">42</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4 c9"><span>(mind the division operator which is the &quot;div&quot; keyword. The slash operator has different semantics).</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>Like JSON, JSONiq works with decimals and doubles:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">6.022e23 * 42</span></p><p class="c4 c11"><span class="c0 c5">2.52924E25</span></p><h2 class="c4"><a name="h.jmbc6c1fqqwx"></a><span>Logical operations</span></h2><p class="c4 c9"><span>JSONiq supports boolean operations.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4"><span class="c0">true and false</span></p><p class="c4 c11"><span class="c0 c5">false</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">(true or false) and (false or true)</span></p><p class="c4 c11"><span class="c0 c5">true</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>The unary not is a function (yes, JSONiq has functions):</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">not(true)</span></p><p class="c4 c11"><span class="c0 c5">false</span></p><h2 class="c4"><a name="h.iq1ixg5ywx0r"></a><span>Strings</span></h2><p class="c4"><span>JSONiq is capable of manipulating strings as well, using functions:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">concat(&quot;Hello &quot;, &quot;Captain &quot;, &quot;Kirk&quot;)</span></p><p class="c4 c11"><span class="c0 c5">Hello Captain Kirk</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">substring(&quot;Mister Spock&quot;, 8, 5)</span></p><p class="c4 c11"><span class="c0 c5">Spock</span></p><p class="c1"><span class="c5"></span></p><p class="c4 c9"><span>JSONiq comes up with a rich string function library out of the box, inherited from its base language. These functions are listed </span><span class="c20"><a class="c13" href="http://www.w3.org/TR/xpath-functions-30/#string-functions";>here</a></span><span>&nbsp;(actually, you will find many more for numbers, etc.)</span></p><h2 class="c4"><a name="h.rv6w8p4wenfa"></a><span>Sequences</span></h2><p class="c4"><span>Until now, we have only been working with single values (an object, an array, a number, a string, a boolean). JSONiq supports sequences of values. You can build a sequence using commas:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)</span></p><p class="c4 c11"><span class="c5">1 2 3 4 5 6 7 8 9 10</span></p><p class="c4 c8"><span class="c5"></span></p><p class="c4"><span class="c0">1, </span><span class="c0">true</span><span class="c0">, 4.2e1, &quot;Life&quot;</span></p><p class="c4 c11"><span class="c0 c5">1 true 42 Life</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span>The &quot;to&quot; operator is very convenient, too:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">(1 to 100)</span></p><p class="c4 c11"><span class="c5">1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20</span></p><p class="c4 c11"><span class="c5">21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40</span></p><p class="c4 c11"><span class="c5">41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60</span></p><p class="c4 c11"><span class="c5">61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80</span></p><p class="c4 c11"><span class="c5">81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>Some functions even work on sequences:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">sum(1 to 100)</span></p><p class="c4 c11"><span class="c0 c5">5050</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">string-join((&quot;These&quot;, &quot;are&quot;, &quot;some&quot;, &quot;words&quot;), &quot;-&quot;)</span></p><p class="c4 c11"><span class="c0 c5">These-are-some-words</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">count(10 to 20)</span></p><p class="c4 c11"><span class="c0 c5">11</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4"><span class="c0">avg(1 to 100)</span></p><p class="c4 c11"><span class="c0 c5">50.5</span></p><p class="c4 c8"><span class="c5"></span></p><p class="c4"><span>Unlike arrays, sequences are flat. The sequence (3) is identical to the integer 3, and (1, (2, 3)) is identical to (1, 2, 3).</span></p><h1 class="c4"><a name="h.7x2r8sj1zjwe"></a><span>A bit more in depth</span></h1><h2 class="c4"><a name="h.b6c9zq9um8cu"></a><span>Variables</span></h2><p class="c4"><span>You can bind a sequence of values to a (dollar-prefixed) variable, like so:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $x := &quot;Bearing 3 1 4 Mark 5. &quot;</span></p><p class="c4"><span class="c0">return concat($x, &quot;Engage!&quot;)</span></p><p class="c4 c11"><span class="c0 c5">Bearing 3 1 4 Mark 5. Engage!</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c1"><span class="c0"></span></p><p class="c4"><span class="c0">let $x := (&quot;Kirk&quot;, &quot;Picard&quot;, &quot;Sisko&quot;)</span></p><p class="c4"><span class="c0">return string-join($x, &quot; and &quot;)</span></p><p class="c4 c11"><span class="c0 c5">Kirk and Picard and Sisko</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4"><span>You can bind as many variables as you want:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $x := 1</span></p><p class="c4"><span class="c0">let $y := $x * 2</span></p><p class="c4"><span class="c0">let $z := $y + $x</span></p><p class="c4"><span class="c0">return ($x, $y, $z)</span></p><p class="c4 c11"><span class="c0 c5">1 2 3</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>and even reuse the same name to hide formerly declared variables:</span></p><p class="c4"><span class="c0">let $x := 1</span></p><p class="c4"><span class="c0">let $x := $x + 2</span></p><p class="c4"><span class="c0">let $x := $x + 3</span></p><p class="c4"><span class="c0">return $x</span></p><p class="c4 c11"><span class="c0 c5">6</span></p><h2 class="c4"><a name="h.92ak2udyfghp"></a><span>Iteration</span></h2><p class="c4 c9"><span>In a way very similar to let, you can iterate over a sequence of values with the &quot;for&quot; keyword. Instead of binding the entire sequence of the variable, it will bind each value of the sequence in turn to this variable.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span class="c0">for $i in 1 to 10</span></p><p class="c4 c9"><span class="c0">return $i * 2</span></p><p class="c4 c11"><span class="c0 c5">2 4 6 8 10 12 14 16 18 20</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>More interestingly, you can combine fors and lets like so:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">let $sequence := 1 to 10</span></p><p class="c4"><span class="c0">for $value in $sequence</span></p><p class="c4"><span class="c0">let $square := $value * 2</span></p><p class="c4"><span class="c0">return $square</span></p><p class="c4 c11"><span class="c0 c5">2 4 6 8 10 12 14 16 18 20</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>and even filter out some values:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">let $sequence := 1 to 10</span></p><p class="c4"><span class="c0">for $value in $sequence</span></p><p class="c4"><span class="c0">let $square := $value * 2</span></p><p class="c4"><span class="c0">where $square &lt; 10</span></p><p class="c4"><span class="c0">return $square</span></p><p class="c4 c11"><span class="c0 c5">2 4 6 8</span></p><h2 class="c4"><a name="h.5fcoouj7073u"></a><span>Note that you can only iterate over sequences, not arrays. To iterate over an array, you can obtain the sequence of its values with jn:members([1, 2, 3]).</span></h2><h2 class="c4"><a name="h.zdhx60a5duyu"></a><span>Conditions</span></h2><p class="c4"><span>You can make the output depend on a condition with an if-then-else construct:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">for $x in 1 to 10</span></p><p class="c4"><span class="c0">return if ($x &lt; 5) then $x</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else -$x</span></p><p class="c4 c11"><span class="c0 c5">1 2 3 4 -5 -6 -7 -8 -9 -10</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>Note that the else clause is required - however, it can be the empty sequence () which is often when you need if only the then clause is relevant to you.</span></p><h2 class="c4"><a name="h.ccs6lkxiixw4"></a><span>Composability of Expressions</span></h2><p class="c4"><span>Now that you know of a couple of elementary JSONiq expressions, you can combine them in more elaborate expressions. For example, you can put any sequence of values in an array:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">[ 1 to 10 ]</span></p><p class="c4 c11"><span class="c0 c5">[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>Or you can dynamically compute the value of object pairs (or their key):</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">{</span></p><p class="c4"><span class="c0">&nbsp; &quot;Greeting&quot; : (let $d := &quot;Mister Spock&quot;</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return concat(&quot;Hello, &quot;, $d)),</span></p><p class="c4"><span class="c0">&nbsp; &quot;Farewell&quot; : string-join((&quot;Live&quot;, &quot;long&quot;, &quot;and&quot;, &quot;prosper&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot; &quot;)</span></p><p class="c4"><span class="c0">}</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4 c11"><span class="c0 c5">{ &quot;Greeting&quot; : &quot;Hello, Mister Spock&quot;, &quot;Farewell&quot; : &quot;Live long and prosper&quot; }</span></p><p class="c4 c8"><span class="c5"></span></p><p class="c4"><span>You can dynamically generate object singletons (with a single pair):</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">{ concat(&quot;Integer &quot;, 2) : 2 * 2 }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;Integer 2&quot; : 4 }</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>and then merge lots of them into a new object with the {| |} notation:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">{|</span></p><p class="c4"><span class="c0">&nbsp; for $i in 1 to 10</span></p><p class="c4"><span class="c0">&nbsp; return { concat(&quot;Square of &quot;, $i) : $i * $i }</span></p><p class="c4"><span class="c0">|}</span></p><p class="c2"><span class="c0 c5">{</span></p><p class="c2"><span class="c0 c5">&quot;Square of 1&quot; : 1,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 2&quot; : 4,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 3&quot; : 9,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 4&quot; : 16,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 5&quot; : 25,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 6&quot; : 36,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 7&quot; : 49,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 8&quot; : 64,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 9&quot; : 81,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 10&quot; : 100</span></p><p class="c2"><span class="c0 c5">}</span></p><h1 class="c4"><a name="h.mjv7kyjurri2"></a><span>JSON Navigation</span></h1><p class="c4 c9"><span>Up to now, you have learnt how to compose expressions so as to do some computations and to build objects and arrays. It also works the other way round: if you have some JSON data, you can access it and navigate.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span>All you need to know is: JSONiq views</span></p><ol class="c15" start="1"><li class="c14 c4 c9"><span>an array as an ordered list of values,</span></li><li class="c14 c4 c9"><span>an object as a set of name/value pairs</span></li></ol><h2 class="c4 c9"><a name="h.xosiyb17dh24"></a><span>Objects</span></h2><p class="c4 c9"><span>You can use an object as if it were a function and pass the call an argument of type xs:string. It will return the value associated thereto:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">let $person := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;first name&quot; : &quot;Sarah&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;age&quot; : 13,</span></p><p class="c4"><span class="c0">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">}</span></p><p class="c4"><span class="c0">return $person(&quot;first name&quot;)</span></p><p class="c4 c11"><span class="c0 c5">&quot;Sarah&quot;</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>You can also ask for all keys in an object:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $person := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;age&quot; : 13,</span></p><p class="c4"><span class="c0">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">}</span></p><p class="c4"><span class="c0">return { &quot;keys&quot; : [ jn:keys($person)] }</span></p><p class="c1 c19"><span class="c0 c5"></span></p><p class="c4 c11 c19"><span class="c0 c5">{ &quot;keys&quot; : [ &quot;name&quot;, &quot;age&quot;, &quot;gender&quot;, &quot;friends&quot; ] }</span></p><h2 class="c4"><a name="h.mrf42gizl3y6"></a><span>Arrays</span></h2><p class="c4 c9"><span>You can use an array as if it were a function and pass the call an argument of type xs:integer. It will return the entry at that position:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">let $friends := [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">return $friends(2)</span></p><p class="c4 c11"><span class="c0 c5">Mary</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>It is also possible to get the size of an array:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $person := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;age&quot; : 13,</span></p><p class="c4"><span class="c0">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">}</span></p><p class="c4"><span class="c0">return { &quot;how many friends&quot; : jn:size($person(&quot;friends&quot;)) }</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4 c11"><span class="c0 c5">{ &quot;how many friends&quot; : 3 }</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>For convenience, there is a function that returns all elements in an array, as a sequence:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $person := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;age&quot; : 13,</span></p><p class="c4"><span class="c0">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">}</span></p><p class="c4"><span class="c0">return jn:members($person(&quot;friends&quot;))</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4 c11"><span class="c0 c5">Jim Mary Jennifer</span></p><p class="c1"><span class="c5"></span></p><h1 class="c4"><a name="h.eb0bxle2oykl"></a><span>Relational Algebra</span></h1><p class="c4 c9"><span>Do you r</span><span>emember SQL&#39;s SELECT FROM WHERE statements? JSONiq inherits selection, projection and join capability from XQuery, too.</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $stores :=</span></p><p class="c4"><span class="c0">[</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c4"><span class="c0">]</span></p><p class="c4"><span class="c0">let $sales := [</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c4"><span class="c0">]</span></p><p class="c4"><span class="c0">let $join :=</span></p><p class="c4"><span class="c0">&nbsp; for $store in jn:members($stores), $sale in jn:members($sales)</span></p><p class="c4"><span class="c0">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c4"><span class="c0">&nbsp; return {</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c4"><span class="c0">&nbsp; }</span></p><p class="c4"><span class="c0">return [$join]</span></p><p class="c2"><span class="c0 c5">[ </span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c2"><span class="c0 c5">&nbsp;]</span></p><h1 class="c4"><a name="h.oii6pvliilhi"></a><span>Access external data</span></h1><p class="c4"><span>Our implementation supports collections of (and indices on) JSON objects or arrays:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">dml:collection(&quot;my:data&quot;)</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;Your&quot; }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;Collection&quot; }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;of&quot; }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;JSON&quot; }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;objects&quot; }</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>It is also possible to get JSON content with an HTTP request, or by parsing it from a string. The EXPath http-client module (described in the Zorba documentation) &nbsp;allows you to make HTTP requests, and the jn:parse-json() function allows you to use the body as an object or an array.</span></p><h1 class="c4"><a name="h.bm3buqmzhtko"></a><span>I want more</span></h1><p class="c4 c9"><span>JSONiq supports JSON updates. You can declaratively update your JSON data. JSONiq provides updating expressions. The list of updates that is eventually output by your program is then applied to your JSON data.</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">copy $people := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;John&quot; : { &quot;status&quot; : &quot;single&quot; },</span></p><p class="c4"><span class="c0">&nbsp; &quot;Mary&quot; : { &quot;status&quot; : &quot;single&quot; } }</span></p><p class="c4"><span class="c0">modify (replace json value of $people(&quot;John&quot;)(&quot;status&quot;) with &quot;married&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; replace json value of $people(&quot;Mary&quot;)(&quot;status&quot;) with &quot;married&quot;)</span></p><p class="c4"><span class="c0">return $people</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4 c11"><span class="c0 c5">{ &quot;John&quot; : { &quot;status&quot; : &quot;married&quot; }, &quot;Mary&quot; : { &quot;status&quot; : &quot;married&quot; } }</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4 c9"><span>Other updates are insertion into an object or an array, replacement of a value in an object or an array, deletion in an object or an array, renaming an object pair, appending to an array. This is documented on jsoniq.org.</span></p><h2 class="c4"><a name="h.5itcphr8262b"></a><span>Even more</span></h2><p class="c4"><span>JSONiq can do way more that what is presented here. Here are a couple of highlights:</span></p><p class="c4 c9"><span>- JSONiq is a strongly typed language, but is smart enough to not bother you with types when unnecessary. It potentially supports static typing as well to detect errors before you even execute your program.</span></p><p class="c4"><span>- You can define your own functions and modules.</span></p><p class="c4"><span>- JSONiq provides you with loads of available modules shipped with Zorba.</span></p><p class="c4 c9"><span>- JSONiq has tons of further features such as switch, typeswitch and try-catch expressions, universal/existential quantifiers, path expressions, filtering expressions, functors, mappings, grouping, windowing.</span></p><h2 class="c4"><a name="h.j7oh3cyhem38"></a><span>More is not enough</span></h2><p class="c4 c9"><span>- JSONiq supports XML. Yes: you can manipulate JSON and XML with the same language! JSONiq is actually a superset of XQuery, a W3C standard, and extends its data model to support JSON.</span></p><p class="c4 c9"><span>- JSONiq supports scripting. If you need to write a full-fledged, side-effecting Web application, scripting is for you.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span>The complete JSONiq specification is available on </span><span class="c20"><a class="c13" href="http://www.jsoniq.org/";>http://www.jsoniq.org/</a></span></p></body></html>
\ No newline at end of file
+<html><head><title>XQuery for JSON</title><style type="text/css">@import url('https://themes.googleusercontent.com/fonts/css?kit=lhDjYqiy3mZ0x6ROQEUoUw');ol{margin:0;padding:0}.c1{height:11pt;text-align:right;direction:ltr}.c3{color:#1155cc;text-decoration:underline;font-weight:bold}.c15{list-style-type:disc;margin:0;padding:0}.c16{max-width:468pt;background-color:#ffffff;padding:72pt 72pt 72pt 72pt}.c7{color:#ff0000;font-style:italic}.c19{text-indent:-13.5pt;margin-left:76.5pt}.c2{direction:ltr;margin-left:144pt}.c13{color:inherit;text-decoration:inherit}.c14{padding-left:0pt;margin-left:36pt}.c20{color:#1155cc;text-decoration:underline}.c17{color:#4a86e8}.c6{text-align:center}.c0{font-family:"Consolas"}.c10{font-style:italic}.c4{direction:ltr}.c9{text-align:justify}.c11{text-align:right}.c5{color:#38761d}.c18{color:#ff9900}.c12{font-weight:bold}.c8{height:11pt}.title{padding-top:24pt;line-height:1.15;text-align:center;color:#4a86e8;font-size:36pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}.subtitle{padding-top:18pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:24pt;font-family:"Georgia";padding-bottom:4pt}li{color:#000000;font-size:11pt;font-family:"Arial"}p{color:#000000;font-size:11pt;margin:0;font-family:"Arial"}h1{padding-top:24pt;line-height:1.15;text-align:left;color:#4a86e8;font-size:24pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}h2{padding-top:18pt;line-height:1.15;text-align:left;color:#ff9900;font-size:18pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h3{padding-top:14pt;line-height:1.15;text-align:left;color:#000000;font-size:14pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h4{padding-top:12pt;line-height:1.15;text-align:left;color:#000000;font-size:12pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h5{padding-top:11pt;line-height:1.15;text-align:left;color:#000000;font-size:11pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h6{padding-top:10pt;line-height:1.15;text-align:left;color:#000000;font-size:10pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}</style></head><body class="c16"><p class="c4 title"><a name="h.ngvhp3svo6iy"></a><span>JSONiq for JSON users</span></p><hr><p class="c6 c4"><span>This tutorial introduces the JSONiq language, which declaratively manipulates JSON data.</span></p><p class="c6 c4"><span>Why don&#39;t you go ahead can try the queries of this document on our online demo interface?</span></p><p class="c4 c6"><span>&nbsp;</span><span class="c3"><a class="c13" href="http://www.zorba-xquery.com/html/jsoniq";>http://www.zorba-xquery.com/html/jsoniq</a></span></p><hr><p class="c4 c8"><span></span></p><h1 class="c4"><a name="h.f453h84m2u1a"></a><span>JSON</span></h1><p class="c4 c9"><span>As explained on the official Web site </span><span class="c20"><a class="c13" href="http://www.json.org/";>http://www.json.org/</a></span><span>, JSON is a lightweight data-interchange format designed for humans as well as for computers. It supports as values:</span></p><ol class="c15" start="1"><li class="c14 c4 c9"><span>objects (string-to-value maps)</span></li><li class="c4 c9 c14"><span>arrays (ordered sequences of values)</span></li><li class="c14 c4 c9"><span>strings</span></li><li class="c14 c4 c9"><span>numbers</span></li><li class="c14 c4 c9"><span>booleans (true, false)</span></li><li class="c14 c4 c9"><span>null</span></li></ol><p class="c4 c8"><span></span></p><p class="c4"><span>JSONiq provides declarative querying and updating capabilities on JSON data.</span></p><h1 class="c4"><a name="h.qtfakecy3fr7"></a><span>Elevator Pitch</span></h1><p class="c4 c9"><span>JSONiq is based on XQuery, which is a W3C standard (like XML and HTML). XQuery is a very powerful declarative language that originally manipulates XML data, but it turns out that it is also a very good fit for manipulating JSON natively.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span>JSONiq, since it extends XQuery, is a very powerful general-purpose declarative programming language. Our experience is that, for the same task, you will probably write about 80% less code compared to imperative languages like JavaScript, Python or Ruby. Additionally, you get the benefits of strong type checking without actually having to write type declarations.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span>Here is an appetizer before we start the tutorial from scratch.</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $stores :=</span></p><p class="c4"><span class="c0">[</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c4"><span class="c0">]</span></p><p class="c4"><span class="c0">let $sales := [</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c4"><span class="c0">]</span></p><p class="c4"><span class="c0">let $join :=</span></p><p class="c4"><span class="c0">&nbsp; for $store in jn:members($stores), $sale in jn:members($sales)</span></p><p class="c4"><span class="c0">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c4"><span class="c0">&nbsp; return {</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c4"><span class="c0">&nbsp; }</span></p><p class="c4"><span class="c0">return [$join]</span></p><p class="c2"><span class="c0 c5">[ </span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c2"><span class="c0 c5">&nbsp; { &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c2"><span class="c0 c5">&nbsp;]</span></p><p class="c4 c8"><span></span></p><h1 class="c4"><a name="h.yugk1mszt0re"></a><span>And here you go</span></h1><h2 class="c4"><a name="h.4uvhbej4btrt"></a><span>Actually</span><span>, you already knew some JSONiq</span></h2><p class="c4 c9"><span>The first thing you need to know is that, as a rule of thumb, a well-formed JSON document is a JSONiq expression as well.</span></p><p class="c4 c8"><span></span></p><p class="c4 c9"><span>This means that, most of the time, you can copy-and-paste a JSON document into a query. The following are JSONiq queries that are &quot;idempotent&quot; (they just output themselves):</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;pi&quot; : 3.14, &quot;sq2&quot; : 1.4 }</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4"><span class="c0">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c4 c11"><span class="c0 c5">[ 2, 3, 5, 7, 11, 13 ]</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">{</span></p><p class="c4"><span class="c0">&nbsp; &quot;operations&quot; : [</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot;] },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; { &quot;unary&quot; : [&quot;not&quot;] }</span></p><p class="c4"><span class="c0">&nbsp; ],</span></p><p class="c4"><span class="c0">&nbsp; &quot;bits&quot; : [</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; 0, 1</span></p><p class="c4"><span class="c0">&nbsp; ]</span></p><p class="c4"><span class="c0">}</span></p><p class="c2"><span class="c0 c5">{</span></p><p class="c2"><span class="c0 c5">&nbsp; &quot;operations&quot; : [</span></p><p class="c2"><span class="c0 c5">&nbsp; &nbsp; { &quot;binary&quot; : [ &quot;and&quot;, &quot;or&quot; ] },</span></p><p class="c2"><span class="c0 c5">&nbsp; &nbsp; { &quot;unary&quot; : [ &quot;not&quot; ] }</span></p><p class="c2"><span class="c0 c5">&nbsp; ],</span></p><p class="c2"><span class="c0 c5">&nbsp; &quot;bits&quot; : [</span></p><p class="c2"><span class="c0 c5">&nbsp; &nbsp; 0, 1</span></p><p class="c2"><span class="c0 c5">&nbsp; ]</span></p><p class="c2"><span class="c0 c5">}</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">[ { &quot;Question&quot; : &quot;Ultimate&quot; }, [&quot;Life&quot;, &quot;the universe&quot;, &quot;and everything&quot;] ]</span></p><p class="c1"><span class="c0"></span></p><p class="c4 c11"><span class="c0 c5">[ { &quot;Question&quot; : &quot;Ultimate&quot; }, [ &quot;Life&quot;, &quot;the universe&quot;, &quot;and everything&quot; ] ]</span></p><p class="c1"><span class="c0"></span></p><p class="c4"><span>This works with objects, arrays (even nested), strings, numbers, booleans, null. </span><span class="c10">The exceptions to this rule (but we are working on it!) are that:</span></p><p class="c4 c9"><span class="c10">(i) empty objects are not recognized and must be written {| |}.</span></p><p class="c4 c9"><span class="c10">(ii) characters escaped with the \ in JSON strings are not recognized (XQuery uses another means of escaping characters).</span></p><p class="c4 c8"><span class="c0 c7"></span></p><p class="c4 c9"><span>It also works the other way round: if your query outputs an object or an array, you can use it as a JSON document.</span></p><p class="c4 c8"><span></span></p><p class="c4 c9"><span>JSONiq is a declarative language. This means that you only need to say </span><span class="c10">what</span><span>&nbsp;you want - the compiler will take care of the </span><span class="c10">how</span><span>. In the above queries, you are basically saying: I want to output this JSON content, and here it is.</span></p><h1 class="c4"><a name="h.1gal1zhyffu4"></a><span>JSONiq basics</span></h1><h2 class="c4"><a name="h.ncbxtez2z3rn"></a><span>The real JSONiq Hello, World!</span></h2><p class="c4"><span>Wondering what a hello world program looks like in JSONiq? Here it is:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">&quot;Hello, World!&quot;</span></p><p class="c4 c11"><span class="c0 c5">Hello, World!</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4"><span>Not surprisingly, it outputs the string &quot;Hello, World!&quot;.</span></p><h2 class="c4"><a name="h.ifcjheuaxoqc"></a><span>Numbers and arithmetic operations</span></h2><p class="c4 c9"><span>Okay, so, now, you might be thinking: &quot;What is the use of this language if it just outputs what I put in?&quot; Of course, JSONiq can more than that. And still in a declarative way. Here is how it works with numbers:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">2 + 2</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span>will output:</span></p><p class="c4 c11"><span class="c0 c5">4</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>whereas</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">(38 + 2) div 2 + 11 * 2</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span>will output</span></p><p class="c4 c11"><span class="c0 c5">42</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4 c9"><span>(mind the division operator which is the &quot;div&quot; keyword. The slash operator has different semantics).</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>Like JSON, JSONiq works with decimals and doubles:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">6.022e23 * 42</span></p><p class="c4 c11"><span class="c0 c5">2.52924E25</span></p><h2 class="c4"><a name="h.jmbc6c1fqqwx"></a><span>Logical operations</span></h2><p class="c4 c9"><span>JSONiq supports boolean operations.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4"><span class="c0">true and false</span></p><p class="c4 c11"><span class="c0 c5">false</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">(true or false) and (false or true)</span></p><p class="c4 c11"><span class="c0 c5">true</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>The unary not is a function (yes, JSONiq has functions):</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">not(true)</span></p><p class="c4 c11"><span class="c0 c5">false</span></p><h2 class="c4"><a name="h.iq1ixg5ywx0r"></a><span>Strings</span></h2><p class="c4"><span>JSONiq is capable of manipulating strings as well, using functions:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">concat(&quot;Hello &quot;, &quot;Captain &quot;, &quot;Kirk&quot;)</span></p><p class="c4 c11"><span class="c0 c5">Hello Captain Kirk</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">substring(&quot;Mister Spock&quot;, 8, 5)</span></p><p class="c4 c11"><span class="c0 c5">Spock</span></p><p class="c1"><span class="c5"></span></p><p class="c4 c9"><span>JSONiq comes up with a rich string function library out of the box, inherited from its base language. These functions are listed </span><span class="c20"><a class="c13" href="http://www.w3.org/TR/xpath-functions-30/#string-functions";>here</a></span><span>&nbsp;(actually, you will find many more for numbers, etc.)</span></p><h2 class="c4"><a name="h.rv6w8p4wenfa"></a><span>Sequences</span></h2><p class="c4"><span>Until now, we have only been working with single values (an object, an array, a number, a string, a boolean). JSONiq supports sequences of values. You can build a sequence using commas:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)</span></p><p class="c4 c11"><span class="c5">1 2 3 4 5 6 7 8 9 10</span></p><p class="c4 c8"><span class="c5"></span></p><p class="c4"><span class="c0">1, </span><span class="c0">true</span><span class="c0">, 4.2e1, &quot;Life&quot;</span></p><p class="c4 c11"><span class="c0 c5">1 true 42 Life</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span>The &quot;to&quot; operator is very convenient, too:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">(1 to 100)</span></p><p class="c4 c11"><span class="c5">1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20</span></p><p class="c4 c11"><span class="c5">21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40</span></p><p class="c4 c11"><span class="c5">41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60</span></p><p class="c4 c11"><span class="c5">61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80</span></p><p class="c4 c11"><span class="c5">81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>Some functions even work on sequences:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">sum(1 to 100)</span></p><p class="c4 c11"><span class="c0 c5">5050</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">string-join((&quot;These&quot;, &quot;are&quot;, &quot;some&quot;, &quot;words&quot;), &quot;-&quot;)</span></p><p class="c4 c11"><span class="c0 c5">These-are-some-words</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span class="c0">count(10 to 20)</span></p><p class="c4 c11"><span class="c0 c5">11</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4"><span class="c0">avg(1 to 100)</span></p><p class="c4 c11"><span class="c0 c5">50.5</span></p><p class="c4 c8"><span class="c5"></span></p><p class="c4"><span>Unlike arrays, sequences are flat. The sequence (3) is identical to the integer 3, and (1, (2, 3)) is identical to (1, 2, 3).</span></p><h1 class="c4"><a name="h.7x2r8sj1zjwe"></a><span>A bit more in depth</span></h1><h2 class="c4"><a name="h.b6c9zq9um8cu"></a><span>Variables</span></h2><p class="c4"><span>You can bind a sequence of values to a (dollar-prefixed) variable, like so:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $x := &quot;Bearing 3 1 4 Mark 5. &quot;</span></p><p class="c4"><span class="c0">return concat($x, &quot;Engage!&quot;)</span></p><p class="c4 c11"><span class="c0 c5">Bearing 3 1 4 Mark 5. Engage!</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c1"><span class="c0"></span></p><p class="c4"><span class="c0">let $x := (&quot;Kirk&quot;, &quot;Picard&quot;, &quot;Sisko&quot;)</span></p><p class="c4"><span class="c0">return string-join($x, &quot; and &quot;)</span></p><p class="c4 c11"><span class="c0 c5">Kirk and Picard and Sisko</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4"><span>You can bind as many variables as you want:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $x := 1</span></p><p class="c4"><span class="c0">let $y := $x * 2</span></p><p class="c4"><span class="c0">let $z := $y + $x</span></p><p class="c4"><span class="c0">return ($x, $y, $z)</span></p><p class="c4 c11"><span class="c0 c5">1 2 3</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>and even reuse the same name to hide formerly declared variables:</span></p><p class="c4"><span class="c0">let $x := 1</span></p><p class="c4"><span class="c0">let $x := $x + 2</span></p><p class="c4"><span class="c0">let $x := $x + 3</span></p><p class="c4"><span class="c0">return $x</span></p><p class="c4 c11"><span class="c0 c5">6</span></p><h2 class="c4"><a name="h.92ak2udyfghp"></a><span>Iteration</span></h2><p class="c4 c9"><span>In a way very similar to let, you can iterate over a sequence of values with the &quot;for&quot; keyword. Instead of binding the entire sequence of the variable, it will bind each value of the sequence in turn to this variable.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span class="c0">for $i in 1 to 10</span></p><p class="c4 c9"><span class="c0">return $i * 2</span></p><p class="c4 c11"><span class="c0 c5">2 4 6 8 10 12 14 16 18 20</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>More interestingly, you can combine fors and lets like so:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">let $sequence := 1 to 10</span></p><p class="c4"><span class="c0">for $value in $sequence</span></p><p class="c4"><span class="c0">let $square := $value * 2</span></p><p class="c4"><span class="c0">return $square</span></p><p class="c4 c11"><span class="c0 c5">2 4 6 8 10 12 14 16 18 20</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>and even filter out some values:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">let $sequence := 1 to 10</span></p><p class="c4"><span class="c0">for $value in $sequence</span></p><p class="c4"><span class="c0">let $square := $value * 2</span></p><p class="c4"><span class="c0">where $square &lt; 10</span></p><p class="c4"><span class="c0">return $square</span></p><p class="c4 c11"><span class="c0 c5">2 4 6 8</span></p><h2 class="c4"><a name="h.5fcoouj7073u"></a><span>Note that you can only iterate over sequences, not arrays. To iterate over an array, you can obtain the sequence of its values with jn:members([1, 2, 3]).</span></h2><h2 class="c4"><a name="h.zdhx60a5duyu"></a><span>Conditions</span></h2><p class="c4"><span>You can make the output depend on a condition with an if-then-else construct:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">for $x in 1 to 10</span></p><p class="c4"><span class="c0">return if ($x &lt; 5) then $x</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else -$x</span></p><p class="c4 c11"><span class="c0 c5">1 2 3 4 -5 -6 -7 -8 -9 -10</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>Note that the else clause is required - however, it can be the empty sequence () which is often when you need if only the then clause is relevant to you.</span></p><h2 class="c4"><a name="h.ccs6lkxiixw4"></a><span>Composability of Expressions</span></h2><p class="c4"><span>Now that you know of a couple of elementary JSONiq expressions, you can combine them in more elaborate expressions. For example, you can put any sequence of values in an array:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">[ 1 to 10 ]</span></p><p class="c4 c11"><span class="c0 c5">[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>Or you can dynamically compute the value of object pairs (or their key):</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">{</span></p><p class="c4"><span class="c0">&nbsp; &quot;Greeting&quot; : (let $d := &quot;Mister Spock&quot;</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return concat(&quot;Hello, &quot;, $d)),</span></p><p class="c4"><span class="c0">&nbsp; &quot;Farewell&quot; : string-join((&quot;Live&quot;, &quot;long&quot;, &quot;and&quot;, &quot;prosper&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&quot; &quot;)</span></p><p class="c4"><span class="c0">}</span></p><p class="c4 c8"><span class="c0 c5"></span></p><p class="c4 c11"><span class="c0 c5">{ &quot;Greeting&quot; : &quot;Hello, Mister Spock&quot;, &quot;Farewell&quot; : &quot;Live long and prosper&quot; }</span></p><p class="c4 c8"><span class="c5"></span></p><p class="c4"><span>You can dynamically generate object singletons (with a single pair):</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">{ concat(&quot;Integer &quot;, 2) : 2 * 2 }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;Integer 2&quot; : 4 }</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>and then merge lots of them into a new object with the {| |} notation:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">{|</span></p><p class="c4"><span class="c0">&nbsp; for $i in 1 to 10</span></p><p class="c4"><span class="c0">&nbsp; return { concat(&quot;Square of &quot;, $i) : $i * $i }</span></p><p class="c4"><span class="c0">|}</span></p><p class="c2"><span class="c0 c5">{</span></p><p class="c2"><span class="c0 c5">&quot;Square of 1&quot; : 1,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 2&quot; : 4,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 3&quot; : 9,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 4&quot; : 16,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 5&quot; : 25,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 6&quot; : 36,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 7&quot; : 49,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 8&quot; : 64,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 9&quot; : 81,</span></p><p class="c2"><span class="c0 c5">&quot;Square of 10&quot; : 100</span></p><p class="c2"><span class="c0 c5">}</span></p><h1 class="c4"><a name="h.mjv7kyjurri2"></a><span>JSON Navigation</span></h1><p class="c4 c9"><span>Up to now, you have learnt how to compose expressions so as to do some computations and to build objects and arrays. It also works the other way round: if you have some JSON data, you can access it and navigate.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span>All you need to know is: JSONiq views</span></p><ol class="c15" start="1"><li class="c14 c4 c9"><span>an array as an ordered list of values,</span></li><li class="c14 c4 c9"><span>an object as a set of name/value pairs</span></li></ol><h2 class="c4 c9"><a name="h.xosiyb17dh24"></a><span>Objects</span></h2><p class="c4 c9"><span>You can use an object as if it were a function and pass the call an argument of type xs:string. It will return the value associated thereto:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">let $person := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;first name&quot; : &quot;Sarah&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;age&quot; : 13,</span></p><p class="c4"><span class="c0">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">}</span></p><p class="c4"><span class="c0">return $person(&quot;first name&quot;)</span></p><p class="c4 c11"><span class="c0 c5">&quot;Sarah&quot;</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>You can also ask for all keys in an object:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $person := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;age&quot; : 13,</span></p><p class="c4"><span class="c0">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">}</span></p><p class="c4"><span class="c0">return { &quot;keys&quot; : [ jn:keys($person)] }</span></p><p class="c1 c19"><span class="c0 c5"></span></p><p class="c4 c11 c19"><span class="c0 c5">{ &quot;keys&quot; : [ &quot;name&quot;, &quot;age&quot;, &quot;gender&quot;, &quot;friends&quot; ] }</span></p><h2 class="c4"><a name="h.mrf42gizl3y6"></a><span>Arrays</span></h2><p class="c4 c9"><span>You can use an array as if it were a function and pass the call an argument of type xs:integer. It will return the entry at that position:</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4"><span class="c0">let $friends := [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">return $friends(2)</span></p><p class="c4 c11"><span class="c0 c5">Mary</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>It is also possible to get the size of an array:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $person := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;age&quot; : 13,</span></p><p class="c4"><span class="c0">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">}</span></p><p class="c4"><span class="c0">return { &quot;how many friends&quot; : jn:size($person(&quot;friends&quot;)) }</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4 c11"><span class="c0 c5">{ &quot;how many friends&quot; : 3 }</span></p><p class="c4 c8"><span></span></p><p class="c4"><span>For convenience, there is a function that returns all elements in an array, as a sequence:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $person := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;name&quot; : &quot;Sarah&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;age&quot; : 13,</span></p><p class="c4"><span class="c0">&nbsp; &quot;gender&quot; : &quot;female&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &quot;friends&quot; : [ &quot;Jim&quot;, &quot;Mary&quot;, &quot;Jennifer&quot;]</span></p><p class="c4"><span class="c0">}</span></p><p class="c4"><span class="c0">return jn:members($person(&quot;friends&quot;))</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4 c11"><span class="c0 c5">Jim Mary Jennifer</span></p><p class="c1"><span class="c5"></span></p><h1 class="c4"><a name="h.eb0bxle2oykl"></a><span>Relational Algebra</span></h1><p class="c4 c9"><span>Do you r</span><span>emember SQL&#39;s SELECT FROM WHERE statements? JSONiq inherits selection, projection and join capability from XQuery, too.</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">let $stores :=</span></p><p class="c4"><span class="c0">[</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 1, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 2, &quot;state&quot; : &quot;MA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 3, &quot;state&quot; : &quot;CA&quot; },</span></p><p class="c4"><span class="c0">&nbsp; { &quot;store number&quot; : 4, &quot;state&quot; : &quot;CA&quot; }</span></p><p class="c4"><span class="c0">]</span></p><p class="c4"><span class="c0">let $sales := [</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;broiler&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 20 &nbsp;},</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 100 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 50 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;toaster&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 50 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 100 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;blender&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 150 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 1, &quot;quantity&quot; : 500 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;socks&quot;, &quot;store number&quot; : 2, &quot;quantity&quot; : 10 },</span></p><p class="c4"><span class="c0">&nbsp; &nbsp;{ &quot;product&quot; : &quot;shirt&quot;, &quot;store number&quot; : 3, &quot;quantity&quot; : 10 }</span></p><p class="c4"><span class="c0">]</span></p><p class="c4"><span class="c0">let $join :=</span></p><p class="c4"><span class="c0">&nbsp; for $store in jn:members($stores), $sale in jn:members($sales)</span></p><p class="c4"><span class="c0">&nbsp; where $store(&quot;store number&quot;) = $sale(&quot;store number&quot;)</span></p><p class="c4"><span class="c0">&nbsp; return {</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;nb&quot; : $store(&quot;store number&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;state&quot; : $store(&quot;state&quot;),</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &quot;sold&quot; : $sale(&quot;product&quot;)</span></p><p class="c4"><span class="c0">&nbsp; }</span></p><p class="c4"><span class="c0">return [$join]</span></p><p class="c2"><span class="c0 c5">[ </span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;broiler&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 1, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 2, &quot;state&quot; : &quot;MA&quot;, &quot;sold&quot; : &quot;socks&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;toaster&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;blender&quot; },</span></p><p class="c2"><span class="c0 c5">{ &quot;nb&quot; : 3, &quot;state&quot; : &quot;CA&quot;, &quot;sold&quot; : &quot;shirt&quot; }</span></p><p class="c2"><span class="c0 c5">&nbsp;]</span></p><h1 class="c4"><a name="h.oii6pvliilhi"></a><span>Access external data</span></h1><p class="c4"><span>Our implementation supports collections of (and indices on) JSON objects or arrays:</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">dml:collection(&quot;my:data&quot;)</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;Your&quot; }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;Collection&quot; }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;of&quot; }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;JSON&quot; }</span></p><p class="c4 c11"><span class="c0 c5">{ &quot;foo&quot; : &quot;objects&quot; }</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4"><span>It is also possible to get JSON content with an HTTP request, or by parsing it from a string. The EXPath http-client module (described in the Zorba documentation) &nbsp;allows you to make HTTP requests, and the jn:parse-json() function allows you to use the body as an object or an array.</span></p><h1 class="c4"><a name="h.bm3buqmzhtko"></a><span>I want more</span></h1><p class="c4 c9"><span>JSONiq supports JSON updates. You can declaratively update your JSON data. JSONiq provides updating expressions. The list of updates that is eventually output by your program is then applied to your JSON data.</span></p><p class="c4 c8"><span></span></p><p class="c4"><span class="c0">copy $people := {</span></p><p class="c4"><span class="c0">&nbsp; &quot;John&quot; : { &quot;status&quot; : &quot;single&quot; },</span></p><p class="c4"><span class="c0">&nbsp; &quot;Mary&quot; : { &quot;status&quot; : &quot;single&quot; } }</span></p><p class="c4"><span class="c0">modify (replace json value of $people(&quot;John&quot;)(&quot;status&quot;) with &quot;married&quot;,</span></p><p class="c4"><span class="c0">&nbsp; &nbsp; &nbsp; &nbsp; replace json value of $people(&quot;Mary&quot;)(&quot;status&quot;) with &quot;married&quot;)</span></p><p class="c4"><span class="c0">return $people</span></p><p class="c4 c8"><span class="c0"></span></p><p class="c4 c11"><span class="c0 c5">{ &quot;John&quot; : { &quot;status&quot; : &quot;married&quot; }, &quot;Mary&quot; : { &quot;status&quot; : &quot;married&quot; } }</span></p><p class="c1"><span class="c0 c5"></span></p><p class="c4 c9"><span>Other updates are insertion into an object or an array, replacement of a value in an object or an array, deletion in an object or an array, renaming an object pair, appending to an array. This is documented on jsoniq.org.</span></p><h2 class="c4"><a name="h.5itcphr8262b"></a><span>Even more</span></h2><p class="c4"><span>JSONiq can do way more that what is presented here. Here are a couple of highlights:</span></p><p class="c4 c9"><span>- JSONiq is a strongly typed language, but is smart enough to not bother you with types when unnecessary. It potentially supports static typing as well to detect errors before you even execute your program.</span></p><p class="c4"><span>- You can define your own functions and modules.</span></p><p class="c4"><span>- JSONiq provides you with loads of available modules shipped with Zorba.</span></p><p class="c4 c9"><span>- JSONiq has tons of further features such as switch, typeswitch and try-catch expressions, universal/existential quantifiers, path expressions, filtering expressions, functors, mappings, grouping, windowing.</span></p><h2 class="c4"><a name="h.j7oh3cyhem38"></a><span>More is not enough</span></h2><p class="c4 c9"><span>- JSONiq supports XML. Yes: you can manipulate JSON and XML with the same language! JSONiq is actually a superset of XQuery, a W3C standard, and extends its data model to support JSON.</span></p><p class="c4 c9"><span>- JSONiq supports scripting. If you need to write a full-fledged, side-effecting Web application, scripting is for you.</span></p><p class="c4 c9 c8"><span></span></p><p class="c4 c9"><span>The complete JSONiq specification is available on </span><span class="c20"><a class="c13" href="http://jsoniq.org/";>http://jsoniq.org/</a></span></p></body></html>
\ No newline at end of file

=== modified file 'doc/zorba/xqdoc/images/modules.svg'
--- doc/zorba/xqdoc/images/modules.svg	2012-09-17 00:36:37 +0000
+++ doc/zorba/xqdoc/images/modules.svg	2012-09-25 15:07:26 +0000
@@ -1286,7 +1286,7 @@
 </g>
 <!-- 40 -->
 <g id="node115" class="node"><title>40</title>
-<a xlink:href="../www.jsoniq.org_errors.html" xlink:title="(Zorba-core) module uri=http://www.jsoniq.org/errors";>
+<a xlink:href="../jsoniq.org_errors.html" xlink:title="(Zorba-core) module uri=http://jsoniq.org/errors";>
 <ellipse fill="white" stroke="white" cx="5967" cy="-439" rx="31.2965" ry="18"/>
 <text text-anchor="middle" x="5967" y="-435.3" font-family="Times,serif" font-size="14.00" fill="red">errors</text>
 </a>
@@ -1374,7 +1374,7 @@
 </g>
 <!-- 39&#45;&gt;12 -->
 <g id="edge103" class="edge"><title>39-&gt;12</title>
-<a xlink:title="FROM: http://www.jsoniq.org/functions, TO: http://www.zorba-xquery.com/modules/schema";>
+<a xlink:title="FROM: http://jsoniq.org/functions, TO: http://www.zorba-xquery.com/modules/schema";>
 <path fill="none" stroke="black" d="M1744,-267.807C1744,-248.114 1744,-215.583 1744,-192.39"/>
 <polygon fill="black" stroke="black" points="1747.5,-192.161 1744,-182.161 1740.5,-192.161 1747.5,-192.161"/>
 </a>

=== modified file 'doc/zorba/xqdoc/templates/www.functx.com_index.html'
--- doc/zorba/xqdoc/templates/www.functx.com_index.html	2012-09-17 00:36:37 +0000
+++ doc/zorba/xqdoc/templates/www.functx.com_index.html	2012-09-25 15:07:26 +0000
@@ -762,7 +762,7 @@
               <span>error</span>
               <ul>
                 <li>
-                  <a href="www.jsoniq.org_errors.html" title="http://www.jsoniq.org/errors";>errors</a>
+                  <a href="jsoniq.org_errors.html" title="http://jsoniq.org/errors";>errors</a>
                   <sup>
                     <img src="images/ZCsmall.gif" alt="ZC" title="This module is part of Zorba core." />
                   </sup>
@@ -801,10 +801,10 @@
               </ul>
             </li>
             <li>
-              <span>www.jsoniq.org</span>
+              <span>jsoniq.org</span>
               <ul>
                 <li>
-                  <a href="www.jsoniq.org_functions.html" title="http://www.jsoniq.org/functions";>functions</a>
+                  <a href="jsoniq.org_functions.html" title="http://jsoniq.org/functions";>functions</a>
                   <sup>
                     <a href="http://www.w3.org/TR/xquery-30/#dt-external-function"; target="_blank" title="There are external functions (either private or public) declared in this module.">(E)</a>
                   </sup>

=== modified file 'doc/zorba/xqdoc/templates/www.w3.org_2005_xpath-functions.html'
--- doc/zorba/xqdoc/templates/www.w3.org_2005_xpath-functions.html	2012-09-17 00:36:37 +0000
+++ doc/zorba/xqdoc/templates/www.w3.org_2005_xpath-functions.html	2012-09-25 15:07:26 +0000
@@ -762,7 +762,7 @@
               <span>error</span>
               <ul>
                 <li>
-                  <a href="www.jsoniq.org_errors.html" title="http://www.jsoniq.org/errors";>errors</a>
+                  <a href="jsoniq.org_errors.html" title="http://jsoniq.org/errors";>errors</a>
                   <sup>
                     <img src="images/ZCsmall.gif" alt="ZC" title="This module is part of Zorba core." />
                   </sup>
@@ -801,10 +801,10 @@
               </ul>
             </li>
             <li>
-              <span>www.jsoniq.org</span>
+              <span>jsoniq.org</span>
               <ul>
                 <li>
-                  <a href="www.jsoniq.org_functions.html" title="http://www.jsoniq.org/functions";>functions</a>
+                  <a href="jsoniq.org_functions.html" title="http://jsoniq.org/functions";>functions</a>
                   <sup>
                     <a href="http://www.w3.org/TR/xquery-30/#dt-external-function"; target="_blank" title="There are external functions (either private or public) declared in this module.">(E)</a>
                   </sup>

=== modified file 'doc/zorba/xqdoc/templates/www.w3.org_2005_xpath-functions_math.html'
--- doc/zorba/xqdoc/templates/www.w3.org_2005_xpath-functions_math.html	2012-09-17 00:36:37 +0000
+++ doc/zorba/xqdoc/templates/www.w3.org_2005_xpath-functions_math.html	2012-09-25 15:07:26 +0000
@@ -762,7 +762,7 @@
               <span>error</span>
               <ul>
                 <li>
-                  <a href="www.jsoniq.org_errors.html" title="http://www.jsoniq.org/errors";>errors</a>
+                  <a href="jsoniq.org_errors.html" title="http://jsoniq.org/errors";>errors</a>
                   <sup>
                     <img src="images/ZCsmall.gif" alt="ZC" title="This module is part of Zorba core." />
                   </sup>
@@ -801,10 +801,10 @@
               </ul>
             </li>
             <li>
-              <span>www.jsoniq.org</span>
+              <span>jsoniq.org</span>
               <ul>
                 <li>
-                  <a href="www.jsoniq.org_functions.html" title="http://www.jsoniq.org/functions";>functions</a>
+                  <a href="jsoniq.org_functions.html" title="http://jsoniq.org/functions";>functions</a>
                   <sup>
                     <a href="http://www.w3.org/TR/xquery-30/#dt-external-function"; target="_blank" title="There are external functions (either private or public) declared in this module.">(E)</a>
                   </sup>

=== modified file 'modules/org/jsoniq/www/CMakeLists.txt'
--- modules/org/jsoniq/www/CMakeLists.txt	2012-09-17 00:36:37 +0000
+++ modules/org/jsoniq/www/CMakeLists.txt	2012-09-25 15:07:26 +0000
@@ -14,10 +14,10 @@
 
 IF(ZORBA_WITH_JSON)
   DECLARE_ZORBA_MODULE(FILE functions.xq VERSION 1.0
-    URI "http://www.jsoniq.org/functions";)
+    URI "http://jsoniq.org/functions";)
   DECLARE_ZORBA_MODULE(FILE function-library.xq VERSION 1.0
-    URI "http://www.jsoniq.org/function-library";)
+    URI "http://jsoniq.org/function-library";)
   DECLARE_ZORBA_MODULE (FILE pregenerated/errors.xq
-    URI "http://www.jsoniq.org/errors";)
+    URI "http://jsoniq.org/errors";)
 ENDIF(ZORBA_WITH_JSON)
 

=== modified file 'modules/org/jsoniq/www/function-library.xq'
--- modules/org/jsoniq/www/function-library.xq	2012-09-06 23:55:13 +0000
+++ modules/org/jsoniq/www/function-library.xq	2012-09-25 15:07:26 +0000
@@ -22,7 +22,7 @@
  : chapter 8 (Function Library). JSONiq extends
  : the XQuery specification to also deal with JSON data natively. See
  :
- :     http://www.jsoniq.org/
+ :     http://jsoniq.org/
  :
  : for details.
  :
@@ -31,9 +31,9 @@
  :
  : @author Ghislain Fourny
  :)
-module namespace libjn = "http://www.jsoniq.org/function-library";;
+module namespace libjn = "http://jsoniq.org/function-library";;
 
-import module namespace jn = "http://www.jsoniq.org/functions";;
+import module namespace jn = "http://jsoniq.org/functions";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "1.0";

=== modified file 'modules/org/jsoniq/www/functions.xq'
--- modules/org/jsoniq/www/functions.xq	2012-09-21 18:25:49 +0000
+++ modules/org/jsoniq/www/functions.xq	2012-09-25 15:07:26 +0000
@@ -22,7 +22,7 @@
  : sections 1.7 (Functions) and 1.10 (Update Primitives). JSONiq extends
  : the XQuery specification to also deal with JSON data natively. See
  :
- :     http://www.jsoniq.org/
+ :     http://jsoniq.org/
  :
  : for details.
  :
@@ -31,13 +31,13 @@
  :
  : @author Markos Zaharioudakis, Matthias Brantner, Ghislain Fourny
  :)
-module namespace jn = "http://www.jsoniq.org/functions";;
+module namespace jn = "http://jsoniq.org/functions";;
 
 import module namespace schema = "http://www.zorba-xquery.com/modules/schema";;
 
 declare namespace err = "http://www.w3.org/2005/xqt-errors";;
-declare namespace jerr = "http://www.jsoniq.org/errors";;
-declare namespace js = "http://www.jsoniq.org/types";;
+declare namespace jerr = "http://jsoniq.org/errors";;
+declare namespace js = "http://jsoniq.org/types";;
 
 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";;
 declare option ver:module-version "1.0";
@@ -49,7 +49,7 @@
  : Calling this version of the function is equivalent to calling the
  : 2 argument version of the function with the second argument
  :
- :   { "prefix" : "Q{http://www.jsoniq.org/roundtrip}"; }
+ :   { "prefix" : "Q{http://jsoniq.org/roundtrip}"; }
  :
  : @param $items the items to be decoded.
  : @return the decoded items.
@@ -103,7 +103,7 @@
  : 2 argument version of the function with the second argument
  :
  :  {
- :    "prefix" : "Q{http://www.jsoniq.org/roundtrip}";
+ :    "prefix" : "Q{http://jsoniq.org/roundtrip}";
  :    "serialization-parameters" : <serialization-parameters xmlns="http://www.w3.org/2010/xslt-xquery-serialization"/>
  :  }
  :

=== modified file 'modules/org/jsoniq/www/pregenerated/errors.xq'
--- modules/org/jsoniq/www/pregenerated/errors.xq	2012-09-20 19:24:53 +0000
+++ modules/org/jsoniq/www/pregenerated/errors.xq	2012-09-25 15:07:26 +0000
@@ -20,7 +20,7 @@
   :)
  (:~
  : This module contains one declaration of a variable for each
- : error of the http://www.jsoniq.org/errors namespace.
+ : error of the http://jsoniq.org/errors namespace.
  : The variables serves as documentation for the errors but can also
  : be used in the code. For example, one useful scenario is to compare
  : an error caught in the catch clause of a try-catch expression with one of
@@ -33,9 +33,9 @@
 
 xquery version '1.0';
 
-module namespace jerr = 'http://www.jsoniq.org/errors';
+module namespace jerr = 'http://jsoniq.org/errors';
 
-declare variable $jerr:NS := 'http://www.jsoniq.org/errors';
+declare variable $jerr:NS := 'http://jsoniq.org/errors';
 
 (:~
  :It is a type error if the right-hand-side expression of a pair constructor does not return exactly one item.

=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2012-09-19 18:18:02 +0000
+++ src/context/static_context.cpp	2012-09-25 15:07:26 +0000
@@ -398,11 +398,11 @@
 
 const char*
 static_context::JSONIQ_DM_NS =
-"http://www.jsoniq.org/types";;
+"http://jsoniq.org/types";;
 
 const char*
 static_context::JSONIQ_FN_NS =
-"http://www.jsoniq.org/functions";;
+"http://jsoniq.org/functions";;
 
 #endif
 

=== modified file 'src/diagnostics/diagnostic_list_xq.xq'
--- src/diagnostics/diagnostic_list_xq.xq	2012-09-17 00:36:37 +0000
+++ src/diagnostics/diagnostic_list_xq.xq	2012-09-25 15:07:26 +0000
@@ -76,7 +76,7 @@
   if ($namespace = "err")
     then "http://www.w3.org/2005/xqt-errors";
   else if ($namespace = "jerr")
-    then "http://www.jsoniq.org/errors";
+    then "http://jsoniq.org/errors";
   else if ($namespace = "zerr")
     then "http://www.zorba-xquery.com/errors";
   else if ($namespace = "zwarn")

=== modified file 'src/functions/func_jsoniq_functions_impl.cpp'
--- src/functions/func_jsoniq_functions_impl.cpp	2012-09-17 00:36:37 +0000
+++ src/functions/func_jsoniq_functions_impl.cpp	2012-09-25 15:07:26 +0000
@@ -175,7 +175,7 @@
 void populate_context_jsoniq_functions_impl(static_context* sctx)
 {
   DECL(sctx, jn_object,
-       (createQName("http://www.jsoniq.org/functions";, "", "object"),
+       (createQName("http://jsoniq.org/functions";, "", "object"),
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_STAR,
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE));
 }

=== modified file 'src/functions/pregenerated/func_jsoniq_functions.cpp'
--- src/functions/pregenerated/func_jsoniq_functions.cpp	2012-09-21 19:01:00 +0000
+++ src/functions/pregenerated/func_jsoniq_functions.cpp	2012-09-25 15:07:26 +0000
@@ -261,7 +261,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_decode_from_roundtrip,
-        (createQName("http://www.jsoniq.org/functions","","decode-from-roundtrip";), 
+        (createQName("http://jsoniq.org/functions","","decode-from-roundtrip";), 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR, 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR),
         FunctionConsts::FN_JSONIQ_DECODE_FROM_ROUNDTRIP_1);
@@ -277,7 +277,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_decode_from_roundtrip,
-        (createQName("http://www.jsoniq.org/functions","","decode-from-roundtrip";), 
+        (createQName("http://jsoniq.org/functions","","decode-from-roundtrip";), 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR, 
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR),
@@ -294,7 +294,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_encode_for_roundtrip,
-        (createQName("http://www.jsoniq.org/functions","","encode-for-roundtrip";), 
+        (createQName("http://jsoniq.org/functions","","encode-for-roundtrip";), 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR, 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR),
         FunctionConsts::FN_JSONIQ_ENCODE_FOR_ROUNDTRIP_1);
@@ -310,7 +310,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_encode_for_roundtrip,
-        (createQName("http://www.jsoniq.org/functions","","encode-for-roundtrip";), 
+        (createQName("http://jsoniq.org/functions","","encode-for-roundtrip";), 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR, 
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR),
@@ -327,7 +327,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_parse_json,
-        (createQName("http://www.jsoniq.org/functions","","parse-json";), 
+        (createQName("http://jsoniq.org/functions","","parse-json";), 
         GENV_TYPESYSTEM.STRING_TYPE_QUESTION, 
         GENV_TYPESYSTEM.JSON_ITEM_TYPE_STAR),
         FunctionConsts::FN_JSONIQ_PARSE_JSON_1);
@@ -343,7 +343,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_parse_json,
-        (createQName("http://www.jsoniq.org/functions","","parse-json";), 
+        (createQName("http://jsoniq.org/functions","","parse-json";), 
         GENV_TYPESYSTEM.STRING_TYPE_QUESTION, 
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, 
         GENV_TYPESYSTEM.JSON_ITEM_TYPE_STAR),
@@ -360,7 +360,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_keys,
-        (createQName("http://www.jsoniq.org/functions","","keys";), 
+        (createQName("http://jsoniq.org/functions","","keys";), 
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_STAR),
         FunctionConsts::FN_JSONIQ_KEYS_1);
@@ -376,7 +376,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_value,
-        (createQName("http://www.jsoniq.org/functions","","value";), 
+        (createQName("http://jsoniq.org/functions","","value";), 
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_ONE, 
         GENV_TYPESYSTEM.ITEM_TYPE_QUESTION),
@@ -393,7 +393,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_project,
-        (createQName("http://www.jsoniq.org/functions","","project";), 
+        (createQName("http://jsoniq.org/functions","","project";), 
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, 
         GENV_TYPESYSTEM.STRING_TYPE_STAR, 
         GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE),
@@ -410,7 +410,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_size,
-        (createQName("http://www.jsoniq.org/functions","","size";), 
+        (createQName("http://jsoniq.org/functions","","size";), 
         GENV_TYPESYSTEM.JSON_ARRAY_TYPE_ONE, 
         GENV_TYPESYSTEM.INTEGER_TYPE_ONE),
         FunctionConsts::FN_JSONIQ_SIZE_1);
@@ -426,7 +426,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_member,
-        (createQName("http://www.jsoniq.org/functions","","member";), 
+        (createQName("http://jsoniq.org/functions","","member";), 
         GENV_TYPESYSTEM.JSON_ARRAY_TYPE_ONE, 
         GENV_TYPESYSTEM.INTEGER_TYPE_ONE, 
         GENV_TYPESYSTEM.ITEM_TYPE_QUESTION),
@@ -443,7 +443,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_members,
-        (createQName("http://www.jsoniq.org/functions","","members";), 
+        (createQName("http://jsoniq.org/functions","","members";), 
         GENV_TYPESYSTEM.JSON_ARRAY_TYPE_ONE, 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR),
         FunctionConsts::FN_JSONIQ_MEMBERS_1);
@@ -459,7 +459,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_flatten,
-        (createQName("http://www.jsoniq.org/functions","","flatten";), 
+        (createQName("http://jsoniq.org/functions","","flatten";), 
         GENV_TYPESYSTEM.JSON_ARRAY_TYPE_ONE, 
         GENV_TYPESYSTEM.ITEM_TYPE_STAR),
         FunctionConsts::FN_JSONIQ_FLATTEN_1);
@@ -492,7 +492,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_null,
-        (createQName("http://www.jsoniq.org/functions","","null";), 
+        (createQName("http://jsoniq.org/functions","","null";), 
         GENV_TYPESYSTEM.JS_NULL_TYPE_ONE),
         FunctionConsts::FN_JSONIQ_NULL_0);
 
@@ -507,7 +507,7 @@
 
       {
     DECL_WITH_KIND(sctx, fn_jsoniq_is_null,
-        (createQName("http://www.jsoniq.org/functions","","is-null";), 
+        (createQName("http://jsoniq.org/functions","","is-null";), 
         GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_ONE, 
         GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE),
         FunctionConsts::FN_JSONIQ_IS_NULL_1);

=== modified file 'src/runtime/spec/mappings.xml'
--- src/runtime/spec/mappings.xml	2012-09-17 00:36:37 +0000
+++ src/runtime/spec/mappings.xml	2012-09-25 15:07:26 +0000
@@ -32,7 +32,7 @@
                      define="ZORBA_SCHEMA_FN_NS"
                      prefix="fn-zorba-schema"/>
 
-    <zorba:namespace uri="http://www.jsoniq.org/functions";
+    <zorba:namespace uri="http://jsoniq.org/functions";
                      define="JSONIQ_FN_NS"
                      prefix="fn-jsoniq"/>
 

=== modified file 'src/store/naive/store.cpp'
--- src/store/naive/store.cpp	2012-09-17 00:36:37 +0000
+++ src/store/naive/store.cpp	2012-09-25 15:07:26 +0000
@@ -86,7 +86,7 @@
 const char* Store::XS_URI = "http://www.w3.org/2001/XMLSchema";;
 const char* Store::XML_URI = "http://www.w3.org/2001/XML/1998/namespace";;
 const char* Store::ZXSE_URI = "http://www.zorba-xquery.com/zorba/schema-extensions";;
-const char* Store::JS_URI = "http://www.jsoniq.org/types";;
+const char* Store::JS_URI = "http://jsoniq.org/types";;
 
 const ulong Store::XML_URI_LEN = sizeof(Store::XML_URI);
 

=== modified file 'src/zorbamisc/ns_consts.h'
--- src/zorbamisc/ns_consts.h	2012-09-19 18:18:02 +0000
+++ src/zorbamisc/ns_consts.h	2012-09-25 15:07:26 +0000
@@ -41,7 +41,7 @@
 #define XSI_NS                  W3C_NS "2001/XMLSchema-instance"
 
 #ifdef ZORBA_WITH_JSON
-#define JSONIQ_ERR_NS           "http://www.jsoniq.org/errors";
+#define JSONIQ_ERR_NS           "http://jsoniq.org/errors";
 #endif
 
 ///////////////////////////////////////////////////////////////////////////////

=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_01.xml.res	2012-09-13 23:49:28 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_01.xml.res	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-{ "nan" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "NaN" }, "inf" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "INF" }, "date" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:date", "Q{http://jsoniq.org/roundtrip}value"; : "1066-10-14" }, "QName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://www.jsoniq.org/functions}encode-for-roundtrip";, "Q{http://jsoniq.org/roundtrip}prefix"; : "jn" }, "EQName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/roundtrip}value"; } }
+{ "nan" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "NaN" }, "inf" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "INF" }, "date" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:date", "Q{http://jsoniq.org/roundtrip}value"; : "1066-10-14" }, "QName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/functions}encode-for-roundtrip";, "Q{http://jsoniq.org/roundtrip}prefix"; : "jn" }, "EQName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/roundtrip}value"; } }

=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_08.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_08.xml.res	2012-09-21 01:11:35 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/encode_08.xml.res	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-{ "nan" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "NaN" }, "inf" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "INF" } }{ "date" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:date", "Q{http://jsoniq.org/roundtrip}value"; : "1066-10-14" } }{ "QName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://www.jsoniq.org/functions}encode-for-roundtrip";, "Q{http://jsoniq.org/roundtrip}prefix"; : "jn" }, "EQName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/roundtrip}value"; } }
\ No newline at end of file
+{ "nan" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "NaN" }, "inf" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "INF" } }{ "date" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:date", "Q{http://jsoniq.org/roundtrip}value"; : "1066-10-14" } }{ "QName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/functions}encode-for-roundtrip";, "Q{http://jsoniq.org/roundtrip}prefix"; : "jn" }, "EQName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/roundtrip}value"; } }
\ No newline at end of file

=== modified file 'test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_01.xml.res'
--- test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_01.xml.res	2012-09-19 18:44:33 +0000
+++ test/rbkt/ExpQueryResults/zorba/jsoniq/roundtrip/roundtrip_01.xml.res	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-{ "nan" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "NaN" }, "inf" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "INF" }, "date" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:date", "Q{http://jsoniq.org/roundtrip}value"; : "1066-10-14" }, "QName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://www.jsoniq.org/functions}encode-for-roundtrip";, "Q{http://jsoniq.org/roundtrip}prefix"; : "jn" }, "EQName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/roundtrip}value"; } }
+{ "nan" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "NaN" }, "inf" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:double", "Q{http://jsoniq.org/roundtrip}value"; : "INF" }, "date" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:date", "Q{http://jsoniq.org/roundtrip}value"; : "1066-10-14" }, "QName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/functions}encode-for-roundtrip";, "Q{http://jsoniq.org/roundtrip}prefix"; : "jn" }, "EQName" : { "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName", "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/roundtrip}value"; } }

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_append_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_append_01.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_append_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $a :=  [ 1, 2, 3];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_delete_02.spec'
--- test/rbkt/Queries/zorba/jsoniq/arr_delete_02.spec	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_delete_02.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0007
+Error: http://jsoniq.org/errors:JNUP0007

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_delete_03.spec'
--- test/rbkt/Queries/zorba/jsoniq/arr_delete_03.spec	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_delete_03.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0016
+Error: http://jsoniq.org/errors:JNUP0016

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_delete_04.spec'
--- test/rbkt/Queries/zorba/jsoniq/arr_delete_04.spec	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_delete_04.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0016
+Error: http://jsoniq.org/errors:JNUP0016

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_delete_05.spec'
--- test/rbkt/Queries/zorba/jsoniq/arr_delete_05.spec	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_delete_05.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0016
+Error: http://jsoniq.org/errors:JNUP0016

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_delete_08.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_delete_08.xq	2012-06-12 13:38:07 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_delete_08.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 rename json $o(1)[1] as 3;

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_delete_09.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_delete_09.xq	2012-06-11 09:41:04 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_delete_09.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 declare variable $o := [ [ 1, 2] ];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_insert_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_insert_01.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_insert_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $a1 := [ 1, 2, 3 ];
 variable $a2 := [  ];

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_insert_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_insert_02.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_insert_02.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $a1 := [ 1, 4, 5 ];
 variable $a2 := [ 1, 2, 5 ];

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_insert_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_insert_03.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_insert_03.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
-declare namespace jerr = "http://www.jsoniq.org/errors";;
+declare namespace jerr = "http://jsoniq.org/errors";;
 
 variable $a1 := [ 1, 2, 3 ];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_insert_04.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_insert_04.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_insert_04.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
-declare namespace jerr = "http://www.jsoniq.org/errors";;
+declare namespace jerr = "http://jsoniq.org/errors";;
 
 variable $a := [ 3 ];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_insert_05.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_insert_05.xq	2012-09-13 12:09:43 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_insert_05.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
-declare namespace jerr = "http://www.jsoniq.org/errors";;
+declare namespace jerr = "http://jsoniq.org/errors";;
 
 variable $a := [ 3 ];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_insert_06.spec'
--- test/rbkt/Queries/zorba/jsoniq/arr_insert_06.spec	2012-09-13 12:09:43 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_insert_06.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_insert_06.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_insert_06.xq	2012-09-13 12:09:43 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_insert_06.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
-declare namespace jerr = "http://www.jsoniq.org/errors";;
+declare namespace jerr = "http://jsoniq.org/errors";;
 
 variable $a := [ 3 ];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_replace_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_replace_01.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_replace_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 variable $a :=  [ 1, 2, 3];

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_update_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $a :=  [ 1, 2, 3];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec'
--- test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec	2012-07-10 13:03:31 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_update_02.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0009
\ No newline at end of file
+Error: http://jsoniq.org/errors:JNUP0009
\ No newline at end of file

=== modified file 'test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/arr_update_02.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $a :=  [ 1, 2, 3];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/coll_dyn_02.spec'
--- test/rbkt/Queries/zorba/jsoniq/coll_dyn_02.spec	2012-09-15 01:17:21 +0000
+++ test/rbkt/Queries/zorba/jsoniq/coll_dyn_02.spec	2012-09-25 15:07:26 +0000
@@ -1,2 +1,2 @@
 Serialization: method=json
-Error: http://www.jsoniq.org/errors:JNSE0014
+Error: http://jsoniq.org/errors:JNSE0014

=== modified file 'test/rbkt/Queries/zorba/jsoniq/data01.spec'
--- test/rbkt/Queries/zorba/jsoniq/data01.spec	2012-03-13 11:48:34 +0000
+++ test/rbkt/Queries/zorba/jsoniq/data01.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/data02.spec'
--- test/rbkt/Queries/zorba/jsoniq/data02.spec	2012-03-13 11:48:34 +0000
+++ test/rbkt/Queries/zorba/jsoniq/data02.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/data03.spec'
--- test/rbkt/Queries/zorba/jsoniq/data03.spec	2012-03-13 11:48:34 +0000
+++ test/rbkt/Queries/zorba/jsoniq/data03.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/data04.spec'
--- test/rbkt/Queries/zorba/jsoniq/data04.spec	2012-03-13 11:48:34 +0000
+++ test/rbkt/Queries/zorba/jsoniq/data04.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/ebv01.xq'
--- test/rbkt/Queries/zorba/jsoniq/ebv01.xq	2012-02-07 20:19:48 +0000
+++ test/rbkt/Queries/zorba/jsoniq/ebv01.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 fn:boolean(j:null())

=== modified file 'test/rbkt/Queries/zorba/jsoniq/ebv02.xq'
--- test/rbkt/Queries/zorba/jsoniq/ebv02.xq	2012-03-12 17:04:56 +0000
+++ test/rbkt/Queries/zorba/jsoniq/ebv02.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 (: ebv of an array in a pair :)
 let $j := { "foo" : [ 1 to 10 ] }

=== modified file 'test/rbkt/Queries/zorba/jsoniq/ebv03.xq'
--- test/rbkt/Queries/zorba/jsoniq/ebv03.xq	2012-03-12 17:04:56 +0000
+++ test/rbkt/Queries/zorba/jsoniq/ebv03.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 (: ebv of a sequence of an object :)
 let $j := { "foo" : [ 1 to 10 ], "bar" : true }

=== modified file 'test/rbkt/Queries/zorba/jsoniq/flatten_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/flatten_01.xq	2011-12-16 05:12:01 +0000
+++ test/rbkt/Queries/zorba/jsoniq/flatten_01.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 j:flatten(j:parse-json("[1, 2, [ 3 ] ]"))

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jn_accumulate.xq'
--- test/rbkt/Queries/zorba/jsoniq/jn_accumulate.xq	2012-09-15 01:17:21 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jn_accumulate.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace libjn = "http://www.jsoniq.org/function-library";;
+import module namespace libjn = "http://jsoniq.org/function-library";;
 
 declare variable $xdoc :=
 <nodes>

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jn_descendant_objects.xq'
--- test/rbkt/Queries/zorba/jsoniq/jn_descendant_objects.xq	2012-09-06 23:55:13 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jn_descendant_objects.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace libjn = "http://www.jsoniq.org/function-library";;
+import module namespace libjn = "http://jsoniq.org/function-library";;
 
 let $object :=
 {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jn_descendant_pairs.xq'
--- test/rbkt/Queries/zorba/jsoniq/jn_descendant_pairs.xq	2012-09-06 23:55:13 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jn_descendant_pairs.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace libjn = "http://www.jsoniq.org/function-library";;
+import module namespace libjn = "http://jsoniq.org/function-library";;
 
 let $object :=
 {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jn_intersect.xq'
--- test/rbkt/Queries/zorba/jsoniq/jn_intersect.xq	2012-09-06 23:55:13 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jn_intersect.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace libjn = "http://www.jsoniq.org/function-library";;
+import module namespace libjn = "http://jsoniq.org/function-library";;
 
 let $object :=
 {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jn_values.xq'
--- test/rbkt/Queries/zorba/jsoniq/jn_values.xq	2012-09-06 23:55:13 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jn_values.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace libjn = "http://www.jsoniq.org/function-library";;
+import module namespace libjn = "http://jsoniq.org/function-library";;
 
 let $object :=
 {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jndy0003-1.spec'
--- test/rbkt/Queries/zorba/jsoniq/jndy0003-1.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jndy0003-1.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNDY0003
+Error: http://jsoniq.org/errors:JNDY0003

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jndy0003-2.spec'
--- test/rbkt/Queries/zorba/jsoniq/jndy0003-2.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jndy0003-2.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNDY0003
+Error: http://jsoniq.org/errors:JNDY0003

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jndy0018-1.spec'
--- test/rbkt/Queries/zorba/jsoniq/jndy0018-1.spec	2012-07-30 12:23:36 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jndy0018-1.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0018
+Error: http://jsoniq.org/errors:JNTY0018

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jndy0018-2.spec'
--- test/rbkt/Queries/zorba/jsoniq/jndy0018-2.spec	2012-07-30 12:23:36 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jndy0018-2.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0018
+Error: http://jsoniq.org/errors:JNTY0018

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jndy0018-3.spec'
--- test/rbkt/Queries/zorba/jsoniq/jndy0018-3.spec	2012-07-30 12:23:36 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jndy0018-3.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0018
+Error: http://jsoniq.org/errors:JNTY0018

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jndy0018-4.spec'
--- test/rbkt/Queries/zorba/jsoniq/jndy0018-4.spec	2012-07-30 12:23:36 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jndy0018-4.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0018
+Error: http://jsoniq.org/errors:JNTY0018

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0004-1.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0004-1.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0004-1.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0004-2.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0004-2.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0004-2.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0007-1.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0007-1.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0007-1.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0007
+Error: http://jsoniq.org/errors:JNUP0007

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0007-2.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0007-2.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0007-2.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0007
+Error: http://jsoniq.org/errors:JNUP0007

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0007-4.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0007-4.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0007-4.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0007
+Error: http://jsoniq.org/errors:JNUP0007

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0007-5.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0007-5.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0007-5.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0007
+Error: http://jsoniq.org/errors:JNUP0007

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0007-6.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0007-6.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0007-6.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0007
+Error: http://jsoniq.org/errors:JNUP0007

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0007-7.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0007-7.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0007-7.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0007
+Error: http://jsoniq.org/errors:JNUP0007

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0008-1.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0008-1.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0008-1.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0008
+Error: http://jsoniq.org/errors:JNUP0008

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0008-2.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0008-2.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0008-2.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0008
+Error: http://jsoniq.org/errors:JNUP0008

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0008-3.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0008-3.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0008-3.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0008
+Error: http://jsoniq.org/errors:JNUP0008

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0008-4.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0008-4.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0008-4.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0008
+Error: http://jsoniq.org/errors:JNUP0008

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0008-5.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0008-5.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0008-5.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0008
+Error: http://jsoniq.org/errors:JNUP0008

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0008-6.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0008-6.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0008-6.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0008
+Error: http://jsoniq.org/errors:JNUP0008

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0008-7.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0008-7.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0008-7.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0008
+Error: http://jsoniq.org/errors:JNUP0008

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnty0008-8.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnty0008-8.spec	2012-06-21 13:56:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnty0008-8.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0008
+Error: http://jsoniq.org/errors:JNUP0008

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnup0005.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnup0005.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnup0005.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0005
+Error: http://jsoniq.org/errors:JNUP0005

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnup0006.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnup0006.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnup0006.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0006
+Error: http://jsoniq.org/errors:JNUP0006

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnup0009-1.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnup0009-1.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnup0009-1.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0009
+Error: http://jsoniq.org/errors:JNUP0009

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnup0009-2.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnup0009-2.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnup0009-2.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0009
+Error: http://jsoniq.org/errors:JNUP0009

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnup0010.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnup0010.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnup0010.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0010
+Error: http://jsoniq.org/errors:JNUP0010

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnup0011-1.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnup0011-1.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnup0011-1.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0011
+Error: http://jsoniq.org/errors:JNTY0011

=== modified file 'test/rbkt/Queries/zorba/jsoniq/jnup0011-2.spec'
--- test/rbkt/Queries/zorba/jsoniq/jnup0011-2.spec	2012-06-19 14:58:25 +0000
+++ test/rbkt/Queries/zorba/jsoniq/jnup0011-2.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0011
+Error: http://jsoniq.org/errors:JNTY0011

=== modified file 'test/rbkt/Queries/zorba/jsoniq/member_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/member_01.xq	2012-01-10 19:42:22 +0000
+++ test/rbkt/Queries/zorba/jsoniq/member_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $j := j:parse-json('[ "foo", "bar" ]')
 return (empty(j:member($j, 0)), j:member($j, 1), empty(j:member($j, 3)))

=== modified file 'test/rbkt/Queries/zorba/jsoniq/member_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/member_03.xq	2012-02-05 17:39:57 +0000
+++ test/rbkt/Queries/zorba/jsoniq/member_03.xq	2012-09-25 15:07:26 +0000
@@ -1,5 +1,5 @@
 let $stats := [{
-  "domain": "www.jsoniq.org"
+  "domain": "jsoniq.org"
 }]
 for $stat in $stats
 return $stat("domain")

=== modified file 'test/rbkt/Queries/zorba/jsoniq/names_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/names_01.xq	2012-03-23 21:17:48 +0000
+++ test/rbkt/Queries/zorba/jsoniq/names_01.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 j:keys(j:parse-json('{ "foo" : "bar" }'))

=== modified file 'test/rbkt/Queries/zorba/jsoniq/names_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/names_02.xq	2012-03-23 21:17:48 +0000
+++ test/rbkt/Queries/zorba/jsoniq/names_02.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 for $i in j:keys(j:parse-json('{ "foo" : "bar" }'))
 return $i

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_constr_03.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_constr_03.spec	2012-03-13 15:35:20 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_constr_03.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNDY0003
+Error: http://jsoniq.org/errors:JNDY0003

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_constr_05.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_constr_05.spec	2012-03-13 15:35:20 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_constr_05.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNDY0003
+Error: http://jsoniq.org/errors:JNDY0003

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_constr_06.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_constr_06.xq	2012-09-11 15:38:58 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_constr_06.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
 declare namespace err = "http://www.w3.org/2005/xqt-errors";;
-declare namespace jerr = "http://www.jsoniq.org/errors";;
+declare namespace jerr = "http://jsoniq.org/errors";;
 
 try { { { 1 : 1 } : 1 } } catch jerr:JNTY0004 { $err:description }

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_constr_10.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_constr_10.xq	2012-09-11 15:38:58 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_constr_10.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
 declare namespace err = "http://www.w3.org/2005/xqt-errors";;
-declare namespace jerr = "http://www.jsoniq.org/errors";;
+declare namespace jerr = "http://jsoniq.org/errors";;
 
 try { { [ 1 to 3] : 1 } } catch jerr:JNTY0004 { $err:description }

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_01.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_02.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_02.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_03.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_03.spec	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_03.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0007
+Error: http://jsoniq.org/errors:JNUP0007

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_03.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_03.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_05.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_05.spec	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_05.spec	2012-09-25 15:07:26 +0000
@@ -1,2 +1,2 @@
-Error: http://www.jsoniq.org/errors:JNUP0016
+Error: http://jsoniq.org/errors:JNUP0016
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_05.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_05.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_05.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_06.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_06.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_06.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := 
 {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_07.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_07.xq	2012-06-12 13:38:07 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_07.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 delete json $o(1)[2](3)("foo", "bar");

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_08.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_08.xq	2012-06-12 13:38:07 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_08.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 delete json $o(1)["foo"];

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_delete_09.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_delete_09.xq	2012-06-11 09:41:04 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_delete_09.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 declare variable $o := [ { "foo" : "foo", "bar" : "bar" } ];
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_01.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_02.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_02.spec	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_02.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0006
+Error: http://jsoniq.org/errors:JNUP0006

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_02.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_02.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 insert json { "foo" : "blub" } into { "foo" : "bar" }

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_03.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_03.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_04.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_04.spec	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_04.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0005
+Error: http://jsoniq.org/errors:JNUP0005

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_04.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_04.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_04.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_12.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_12.spec	2012-09-13 12:09:43 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_12.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0019
+Error: http://jsoniq.org/errors:JNUP0019

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_15.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_15.spec	2012-09-13 12:09:43 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_15.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNDY0003
+Error: http://jsoniq.org/errors:JNDY0003

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_16.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_16.spec	2012-09-14 13:04:48 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_16.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0005
+Error: http://jsoniq.org/errors:JNUP0005

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_insert_16.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_insert_16.xq	2012-09-14 13:04:48 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_insert_16.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_rename_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_rename_01.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_rename_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_rename_02.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_rename_02.spec	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_rename_02.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0016
+Error: http://jsoniq.org/errors:JNUP0016

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_rename_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_rename_02.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_rename_02.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_rename_03.spec'
--- test/rbkt/Queries/zorba/jsoniq/obj_rename_03.spec	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_rename_03.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNUP0006
+Error: http://jsoniq.org/errors:JNUP0006

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_rename_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_rename_03.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_rename_03.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar", "blub" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_rename_04.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_rename_04.xq	2012-06-12 13:38:07 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_rename_04.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 rename json $o(1)[2](3)("foo", "bar") as 3;

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_rename_05.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_rename_05.xq	2012-06-12 13:38:07 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_rename_05.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 rename json $o(1)["foo"] as 3;

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_rename_06.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_rename_06.xq	2012-06-11 09:41:04 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_rename_06.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : { "foo" : "bar" } };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_replace_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_replace_01.xq	2012-03-20 15:35:18 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_replace_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 variable $a :=  [ 1, 2, 3];

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_replace_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_replace_02.xq	2012-06-12 13:38:07 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_replace_02.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 replace json value of $o(1)[2](3)("foo", "bar") with 3;

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_replace_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_replace_03.xq	2012-06-12 13:38:07 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_replace_03.xq	2012-09-25 15:07:26 +0000
@@ -1,3 +1,3 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 replace json value of $o(1)["foo"] with 3;

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_replace_04.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_replace_04.xq	2012-06-11 09:41:04 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_replace_04.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : { "foo" : "bar " } };
 variable $a :=  [ 1, 2, 3];

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_replace_05.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_replace_05.xq	2012-09-11 15:53:52 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_replace_05.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 variable $a :=  [ 1, 2, 3];

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq	2012-07-10 13:03:31 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_update_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq'
--- test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq	2012-07-10 13:03:31 +0000
+++ test/rbkt/Queries/zorba/jsoniq/obj_update_02.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 variable $o := { "foo" : "bar" };
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/object_03.xq'
--- test/rbkt/Queries/zorba/jsoniq/object_03.xq	2012-09-06 23:55:13 +0000
+++ test/rbkt/Queries/zorba/jsoniq/object_03.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace jn = "http://www.jsoniq.org/functions";;
+import module namespace jn = "http://jsoniq.org/functions";;
 
 let $j := ({ "product" : "broiler", "store number" : 1, "quantity" : 20  },
 { "product" : "toaster", "store number" : 2, "quantity" : 100 },

=== modified file 'test/rbkt/Queries/zorba/jsoniq/pair-constructor-atomize-array.spec'
--- test/rbkt/Queries/zorba/jsoniq/pair-constructor-atomize-array.spec	2012-09-12 08:39:32 +0000
+++ test/rbkt/Queries/zorba/jsoniq/pair-constructor-atomize-array.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/pair-constructor-atomize-object.spec'
--- test/rbkt/Queries/zorba/jsoniq/pair-constructor-atomize-object.spec	2012-09-12 08:39:32 +0000
+++ test/rbkt/Queries/zorba/jsoniq/pair-constructor-atomize-object.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0004
+Error: http://jsoniq.org/errors:JNTY0004

=== modified file 'test/rbkt/Queries/zorba/jsoniq/pair_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/pair_01.xq	2012-03-12 15:43:16 +0000
+++ test/rbkt/Queries/zorba/jsoniq/pair_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $j := j:parse-json('{ "foo": "bar" }')
 return (empty(j:value($j, "bar")), j:value($j, "foo"))

=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-02.spec'
--- test/rbkt/Queries/zorba/jsoniq/parse_json-02.spec	2012-09-10 16:37:03 +0000
+++ test/rbkt/Queries/zorba/jsoniq/parse_json-02.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JSDY0021
+Error: http://jsoniq.org/errors:JSDY0021

=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-03.spec'
--- test/rbkt/Queries/zorba/jsoniq/parse_json-03.spec	2012-09-10 16:37:03 +0000
+++ test/rbkt/Queries/zorba/jsoniq/parse_json-03.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JSDY0021
+Error: http://jsoniq.org/errors:JSDY0021

=== modified file 'test/rbkt/Queries/zorba/jsoniq/parse_json-04.spec'
--- test/rbkt/Queries/zorba/jsoniq/parse_json-04.spec	2012-09-10 16:37:03 +0000
+++ test/rbkt/Queries/zorba/jsoniq/parse_json-04.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JSDY0020
+Error: http://jsoniq.org/errors:JSDY0020

=== modified file 'test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_01.xq	2012-09-14 06:42:05 +0000
+++ test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_01.xq	2012-09-25 15:07:26 +0000
@@ -14,7 +14,7 @@
     },
     "QName" : {
       "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName",
-      "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://www.jsoniq.org/functions}encode-for-roundtrip";,
+      "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/functions}encode-for-roundtrip";,
       "Q{http://jsoniq.org/roundtrip}prefix"; : "jn"
     },
     "EQName" : {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_03.spec'
--- test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_03.spec	2012-09-20 18:20:33 +0000
+++ test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_03.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0023
+Error: http://jsoniq.org/errors:JNTY0023

=== modified file 'test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_05.xq'
--- test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_05.xq	2012-09-21 01:11:35 +0000
+++ test/rbkt/Queries/zorba/jsoniq/roundtrip/decode_05.xq	2012-09-25 15:07:26 +0000
@@ -16,7 +16,7 @@
   }, {
     "QName" : {
       "Q{http://jsoniq.org/roundtrip}type"; : "xs:QName",
-      "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://www.jsoniq.org/functions}encode-for-roundtrip";,
+      "Q{http://jsoniq.org/roundtrip}value"; : "Q{http://jsoniq.org/functions}encode-for-roundtrip";,
       "Q{http://jsoniq.org/roundtrip}prefix"; : "jn"
     },
     "EQName" : {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_05.spec'
--- test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_05.spec	2012-09-20 19:27:58 +0000
+++ test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_05.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0023
+Error: http://jsoniq.org/errors:JNTY0023

=== modified file 'test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_06.spec'
--- test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_06.spec	2012-09-20 19:24:53 +0000
+++ test/rbkt/Queries/zorba/jsoniq/roundtrip/encode_06.spec	2012-09-25 15:07:26 +0000
@@ -1,1 +1,1 @@
-Error: http://www.jsoniq.org/errors:JNTY0023
+Error: http://jsoniq.org/errors:JNTY0023

=== modified file 'test/rbkt/Queries/zorba/jsoniq/serializer-JNSE0022.xq'
--- test/rbkt/Queries/zorba/jsoniq/serializer-JNSE0022.xq	2012-09-10 17:47:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/serializer-JNSE0022.xq	2012-09-25 15:07:26 +0000
@@ -2,7 +2,7 @@
 declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";;
 
 declare namespace err = "http://www.w3.org/2005/xqt-errors";;
-declare namespace jerr = "http://www.jsoniq.org/errors";;
+declare namespace jerr = "http://jsoniq.org/errors";;
 
 let $obj := { "message": "test" }
 return

=== modified file 'test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-1.spec'
--- test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-1.spec	2012-09-15 01:17:21 +0000
+++ test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-1.spec	2012-09-25 15:07:26 +0000
@@ -1,2 +1,2 @@
 Serialization: method=json
-Error: http://www.jsoniq.org/errors:JNSE0014
+Error: http://jsoniq.org/errors:JNSE0014

=== modified file 'test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-2.spec'
--- test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-2.spec	2012-09-15 01:17:21 +0000
+++ test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-2.spec	2012-09-25 15:07:26 +0000
@@ -1,2 +1,2 @@
 Serialization: method=json
-Error: http://www.jsoniq.org/errors:JNSE0014
+Error: http://jsoniq.org/errors:JNSE0014

=== modified file 'test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-3.spec'
--- test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-3.spec	2012-09-15 01:17:21 +0000
+++ test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-3.spec	2012-09-25 15:07:26 +0000
@@ -1,2 +1,2 @@
 Serialization: method=json
-Error: http://www.jsoniq.org/errors:JNSE0014
+Error: http://jsoniq.org/errors:JNSE0014

=== modified file 'test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-4.spec'
--- test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-4.spec	2012-09-15 01:17:21 +0000
+++ test/rbkt/Queries/zorba/jsoniq/serializer-jsoniq-disallow-mixed-4.spec	2012-09-25 15:07:26 +0000
@@ -1,2 +1,2 @@
 Serialization: method=json
-Error: http://www.jsoniq.org/errors:JNSE0014
+Error: http://jsoniq.org/errors:JNSE0014

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case01.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case01.xq	2012-04-11 20:22:52 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case01.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
 import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";;
 import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";;
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 ddl:create(xs:QName("users"));
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case01_2.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case01_2.xq	2012-04-11 20:22:52 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case01_2.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
 import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";;
 import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";;
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 ddl:create(xs:QName("users"));
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case02.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case02.xq	2012-04-11 20:22:52 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case02.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
 import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";;
 import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";;
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 ddl:create(xs:QName("sales"));
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case03.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case03.xq	2012-04-11 20:22:52 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case03.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
 import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";;
 import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";;
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 ddl:create(xs:QName("sales"));
 ddl:create(xs:QName("products"));

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case04.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case04.xq	2012-03-23 21:17:48 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case04.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $satsDoc :=
   {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case06.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case06.xq	2012-03-13 11:48:34 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case06.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 declare variable $input :=
   {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case07.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case07.xq	2012-03-13 00:02:13 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case07.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $j := 
 {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case08.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case08.xq	2012-03-13 11:48:34 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case08.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $j :=
   [

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case09.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case09.xq	2012-03-13 11:48:34 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case09.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $users :=
   [

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case10.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case10.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case10.xq	2012-09-25 15:07:26 +0000
@@ -1,6 +1,6 @@
 import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";;
 import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";;
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 ddl:create(xs:QName("users"));
 

=== modified file 'test/rbkt/Queries/zorba/jsoniq/use_case11.xq'
--- test/rbkt/Queries/zorba/jsoniq/use_case11.xq	2012-04-11 20:22:52 +0000
+++ test/rbkt/Queries/zorba/jsoniq/use_case11.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $feed :=
 {

=== modified file 'test/rbkt/Queries/zorba/jsoniq/value_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/value_01.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/value_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $json := j:parse-json('{ "foo" : "bar" }')
 let $keys := j:keys($json)

=== modified file 'test/rbkt/Queries/zorba/jsoniq/values_01.xq'
--- test/rbkt/Queries/zorba/jsoniq/values_01.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/jsoniq/values_01.xq	2012-09-25 15:07:26 +0000
@@ -1,4 +1,4 @@
-import module namespace j = "http://www.jsoniq.org/functions";;
+import module namespace j = "http://jsoniq.org/functions";;
 
 let $json := j:parse-json('{ "foo" : "bar" }')
 let $keys := j:keys($json)

=== modified file 'test/rbkt/Queries/zorba/serialization/cloudscript/extensions3.spec'
--- test/rbkt/Queries/zorba/serialization/cloudscript/extensions3.spec	2012-09-15 01:17:21 +0000
+++ test/rbkt/Queries/zorba/serialization/cloudscript/extensions3.spec	2012-09-25 15:07:26 +0000
@@ -1,2 +1,2 @@
-Error: http://www.jsoniq.org/errors:JNSE0014
+Error: http://jsoniq.org/errors:JNSE0014
 Serialization: method=json

=== modified file 'test/rbkt/Queries/zorba/serialization/cloudscript/multiple1.spec'
--- test/rbkt/Queries/zorba/serialization/cloudscript/multiple1.spec	2012-09-15 01:17:21 +0000
+++ test/rbkt/Queries/zorba/serialization/cloudscript/multiple1.spec	2012-09-25 15:07:26 +0000
@@ -1,2 +1,2 @@
-Error: http://www.jsoniq.org/errors:JNSE0012
+Error: http://jsoniq.org/errors:JNSE0012
 Serialization: method=json jsoniq-multiple-items=no

=== modified file 'test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq'
--- test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq	2012-09-17 00:36:37 +0000
+++ test/rbkt/Queries/zorba/xqdoc/moduleDocumentation.xq	2012-09-25 15:07:26 +0000
@@ -63,7 +63,7 @@
                 ($moduleUri = "http://www.functx.com/";) or
                 ($moduleUri = "http://www.w3.org/2005/xqt-errors";) or
                 ($moduleUri = "http://www.zorba-xquery.com/errors";) or
-                ($moduleUri = "http://www.jsoniq.org/errors";) or
+                ($moduleUri = "http://jsoniq.org/errors";) or
                 ($moduleUri = "http://www.zorba-xquery.com/warnings";)) then ()
             else(
             local:test-module($xqdoc),


Follow ups