Product SiteDocumentation Site

Revision History

Revision History
Revision 1-4Fri Aug 7 2015Ghislain Fourny
Add ?: syntax.
Revision 1-3Tue Aug 13 2013Ghislain Fourny
Added more examples for library functions.
Completed signature of keys() and size() with return types.
Simplified code in libjn:remove-keys() and libjn:project().
Moved all fixes for JSON vs. JDM lexical representation mismatch to the serialization layer.
Revision 1-2Thu Aug 8 2013Ghislain Fourny
Fixed the signatures of jn:keys() and jn:members() to accept parameters of type item()*. They were forgotten in the last update. Updated the description accordingly and updating examples with more general sequences.
Fixed some typos.
Fixed semantics of libjn:project() to make it consistent with the other functions.
Added libjn:remove-keys() which does the contrary of libjn:project(), i.e., removes the given keys from all input objects.
Revision 1-1Mon Jul 22 2013Ghislain Fourny
Reintroduced the parameter cast in object lookup (to a string) or array lookup (to an integer) following feedback. The general semantics of object/array lookup with unary dynamic function calls (implicit iteration on mixed sequences, empty sequence in case of mismatch) is mostly untouched, but was significantly reformulated.
Introduced object key listing and array unboxing with 0-ary dynamic function call syntax: $o() (=jn:keys($o)) $a() (=jn:members($a)). It works on mixed sequences in the same way as object and array lookup.
Removed the function jn:is-null() because it is redundant with the "eq" and "instance of" operators which support null.
Removed the function jn:object() and introduced the equivalent {| |} syntax (like in the JSONiq core).
Relaxed the functions libjn:descendant-objects, libjn:descendant-pairs, libjn:values, libjn:flatten, libjn:project to accept any sequence of items. The behavior on mixed sequences is consistent with object and array lookup. Also introduced new function libjn:descendant-arrays and relaxed jn:size to accept the empty sequence..
Fixed roundtrippability of decimals and doubles in jn:encode-for-roundtrip (decimals without dot were roundtripped to integers, etc).
Fixed corner cases in JSON number serialization (trailing zeros, absence of digits, leading +, which are allowed in the JDM but not in the JSON syntax).
Revision 0.4.45Mon May 27 2013Ghislain Fourny
Relaxed object and array selection to work on any mixed sequences. In case of mismatch (i.e., (i) integer on object or atomic, or (ii) string on array or atomic), an empty sequence is now returned. No more cast is done.
Revision 0.4.44Thu May 8 2013Ghislain Fourny
Correcting various typos, errors and formatting errors, mostly in the examples (no change in semantics).
Revision 0.4.43Thu Apr 4 2013Ghislain Fourny
The product was renamed to "JSONiq Extension to XQuery".
The semantics of arithmetics was modified to raise an error in case of a null operand.
The semantics of value comparison was modified to be compatible with null operands (null eq null, and null lt any other atomic item).
Revision 0.4.42Thu Sep 27 2012Ghislain Fourny
The hybrid output method now serializes XML nodes that are found inside objects or arrays to JSON strings.
Revision 0.4.41Tue Sep 25 2012Ghislain Fourny
Extended fn:string to raise an error for JSON items. Added JNTY0024.
Made definition of roundtripping functions more precise (for the case where there is a top-level item which is a JSON native value).
Revision 0.4.40Mon Sep 24 2012Ghislain Fourny
Renamed JNTY0020 and added JNTY0023.
Changed default of encode-for-roundtrip to omit XML declaration.
Corrected signature of roundtripping functions to allow for full recursion.
Revision 0.4.39Fri Sep 14 2012Ghislain Fourny
Qualified names are now treated specially in jn:encode-for-roundtrip and jn:decode-from-roundtrip.
Revision 0.4.38Thu Sep 13 2012Ghislain Fourny
Further specified error handling for key (atomization error, cast error) in pair constructor.
Fixed appending expression syntax to be in sync with insert syntax.
Object and array selectors are now atomized and cast to xs:string and xs:integer respectively.
The alternate object insertion syntax supports several pairs.
Revision 0.4.37Tue Sep 11 2012Ghislain Fourny
Fixed error code of jerr:JNSE0022.
Moved libjn:members to jn:members (builtin).
Corrected example query for jn:encode-for-roundtrip and excluded NaN/infinite from native JSON mapping.
Revision 0.4.36Mon Sep 10 2012Ghislain Fourny
Changed error code to err:XPTY0004 if a key in a pair constructor cannot be atomized and cast to a string.
Further specified error-handling for jn:parse-json. Changed default to accepting multiple items.
Simplified semantics for null in comparison/arithmetics. Introduced jn:is-null().
Introduced a lightweight syntax for inserting a single pair into an object (optional curly braces).
Default output method is now JSON-XML-hybrid (also for fn:trace).
Made changes to sequence normalization orthogonal to the output method used. Introduced error codes.
Revision 0.4.35Fri Sep 07 2012Ghislain Fourny
The json insert syntax was simplified and relaxed.
Revision 0.4.34Thu Sep 06 2012Ghislain Fourny
Relaxed condition that an expression computing a value (in a pair constructor, an insert expression or a replace expression) must return a single item. If no item, null is used instead, if more than one item, an array is built to wrap the items. Errors jerr:JNTY0002 and jerr:JNUP0017 disappear.
jn:parse-json-sequence was merged with jn:parse-json (using an object to transmit parameters).
jn:encode-for-roundtrip and jn:decode-from-roundtrip also now use an object to transmit parameters.
A semantics is now specified for arithmetic operations involving null (null is returned). The semantics of value and general comparison involving nulls was updated.
Revision 0.4.33Tue Sep 04 2012Ghislain Fourny
Corrected typos. Capitalized JSON and XML in hybrid output method.
Introduced jn:parse-json-sequence to support roundtripping sequences.
Revision 0.4.32Mon Sep 03 2012Ghislain Fourny
Split the serialization roundtripping facility into a much simpler specification of the JSON output method and two functions in the builtin module. Only one serialization parameter (specifying whether multiple items are allowed is left).
jerr:JNSE0013 disappears.
Revision 0.4.31Fri Aug 31 2012Ghislain Fourny
Sequences beginning with an object or array now have an effective boolean value, which is true.
jsoniq-boolean-and-null-literals is set to "yes" by default.
Revision 0.4.30Thu Aug 30 2012Ghislain Fourny
Significantly rewrote the serialization section to take feedback received into account: (i) some serialization parameters were renamed (ii) If jsoniq-roundtrip-extensions is set to no, then non-JSON atomic values are automatically serialized to the JSON literal that makes the most sense (iii) the json-xml-hybrid output method was introduced, mostly meant as a default output method for an engine for convenience.
Revision 0.4.29Tue Aug 28 2012Ghislain Fourny
Added function jn:null.
Specified semantics for casting to/from jn:null.
Specified semantics for value and general comparisons involving JSON nulls.
Revision 0.4.28Wed Aug 15 2012Ghislain Fourny
Added namespace for library functions.
Revision 0.4.27Mon Aug 13 2012Ghislain Fourny
Renamed libjn:accumulator-object-union as libjn:accumulate. Corrected some typos in library function code. Completed paragraph on implementation.
Revision 0.4.26Fri Aug 10 2012Ghislain Fourny
Corrected and moved a dynamic object construction example to lib:object().
Revision 0.4.25Wed Aug 8 2012Ghislain Fourny
Added a chapter about the implementation in Zorba.
Revision 0.4.24Tue Aug 7 2012Ghislain Fourny
Fixed array update grammar rules.
Revision 0.4.23Thu Jul 31 2012Ghislain Fourny
Changed JNDY0018 to JNTY0018.
Added more details on JSONiq string support.
Revision 0.4.22Thu Jul 24 2012Ghislain Fourny
Objects and arrays are no longer matching any function types.
Updated type hierarchy picture.
Revision 0-21Thu Jul 24 2012Ghislain Fourny
Corrected typos (jn:null, object constructor grammar in grammar section, residual {| |}s).
Added update features in the introductive list.
Revision 0-20Thu Jun 21 2012Ghislain Fourny
Added an error code checking for single item for insert/replace expressions.
Corrected typos.
Changed JNTY0007 to JNUP0007 and JNTY0008 to JNUP0008.
Revision 0-19Thu Jun 11 2012Ghislain Fourny
Added error code if the selector cannot be resolved when creating an update primitive.
Updated JSONiq value serialization examples to the right double lexical value of infinity.
Revision 0-18Thu May 24 2012Ghislain Fourny
Pairs are no longer exposed as items. There are now just singleton objects (but the word pair is still used in this spec for a string/value pair);
Update primitives are decoupled from a new update syntax;
Object and array selectors return values;
Dynamic invocation on sequence of functions/arrays/objects;
Minimalistic builtin functions. Still, some functions defined for convenience (relational algebra projection, intersection, ...);
Atomization and EBV raise errors or objects and arrays;
There are only one serialization method: json with three new serialization parameters;
Boolean and null literals can be activated with an option;
Multiple items can be serialized according to serialization parameter settings.
Revision 0-17Thu Dec 22 2011Jonathan Robie
Eliminated Array Pairs.
Renamed "member accessors" => "member selectors"
Changed semantics of the empty member selector, which now returns all Objects at the top level or below.
Changed signature of json:delete() to always require the Array or Object as a parameter. Pairs no longer point to the Array or Object that contain them.
Changed namespaces used in the document. Functions and errors have separate namespaces. Functions used to implement operators and JDM accessors are abstract, and have a prefix that is not bound to a namespace.
Removed isnull() function - compare to null insteadl
Removed whitespace requirement for ":" in PairConstructor, require the operands of a PairConstructor to be AdditiveExprs.
Specified that object lookup uses the codepoint collation.
Revision 0-16Tue Oct 11 2011Jonathan Robie
Eliminated typed-value() and string-value() accessors for Pair.
Redefined atomization to use unboxing; defined type value and string value in terms of unboxing.
Changed signatures of many functions to make them more precise.
Fixed "tuesday" query - result is now "day": "Monday".
Introduced "structured items" base class for nodes and JSON Items.
Added StructuredItemTest.
Removed string arguments from JSONPairTest, JSONObjectPairTest, JSONArrayPairTest.
Specified update primitives.
Made signatures of update primitives more precise.
Stated that NaN and Infinity are instances of xs:double.
Clarified order of results for () on Arrays.
Changed "unordered" to implementation-defined order.
Minor editorial changes.
Revision 0-15Thu Sep 22 2011Jonathan Robie
Pairs now have typed-values again. No other JSONiq Item does.
Unboxing pairs is now part of atomization.
In the XQ-- subset of JSONiq, atomizing a Pair is defined as unboxing it. The remaining steps of atomization are irrelevant, because XML values do not occur.
Unboxing pairs is also done for the value expression of Array Constructors and Object Constructors. These do not atomize.
The content expressions of element constructors unbox Pairs and flatten arrays. (In other content expressions, atomization is done, so explicit unboxing is not needed.)
Removed dangling references to context items in two function descriptions.
Changed erroneous KindTest to ItemType in several sentences.
Added a footnote clarifying that the identity of JSON Item is used only in PULs.
Changed name of json() to json-doc()
Changed signature of json-doc(), parse-json() to return json-item()?
Put public functions in the json namespace.
Stated that string serialization uses JSON escape conventions.
Stated that serialization of XML as string content uses serialization parameters and standard serialization.
Revision 0-14Mon Sep 19 2011Jonathan Robie
JSONiq Items no longer have typed values.
Atomization is now defined only for Pairs, which are now unboxed before atomization, then treated as any other value.
In content sequences, Pairs are unboxed, Arrays are flattened, and Objects still raise errors.
Extra-grammatical constraint added: whitespace must occur before and after a ":".
Explicitly stated that a standalone Pair raises an error when serializing.
If a Pair occurs in the value expression of a Pair Constructor, it is unboxed.
Defined the flatten() function to flatten arrays recursively.
Defined serialization for json:null.
Revision 0-13Fri Sep 2 2011Jonathan Robie
Refers to XQ++ and XQ-- grammars on the JSONiq site.
Tutorial is now a separate document.
Data Model appendix is now part of the main text.
Member accessors are defined independently of dynamic function invocation.
Arrays have a typed value again.
Added type hierarchy diagram.
JSON Item tests are ItemTests, no longer KindTests.
Renamed node types and item tests for consistency, changing terminology in the text to match.
Added item tests for all JSON Item types.
Added isnull() function.
Moved updates out of an appendix and into the main text.
Revision 0-12Mon Aug 22 2011Jonathan Robie
Neither Object nor Array have typed values now.
Coined the term "member accessors".
New section calls out semantics of Pair.
Filled in type signatures of functions, added size().
Added Group By queries to Sample Queries.
Moved Satellites query to Sample Queries.
General reorganization, editorial changes.
Revision 0-11Fri Aug 12 2011Jonathan Robie
Added updating functions, revised update example to use them.
Revision 0-10Wed Aug 10 2011Jonathan Robie
New representation of objects, arrays, pairs in the data model. No longer nodes or function items.
Changed representation of nulls.
Navigation primitives now return pairs, not values.
Revision 0-09Tue Aug 9 2011Jonathan Robie
Significantly changed data model. Pairs now serve as the container for values, in both Arrays and Objects. PULs will now need to be defined for pairs, objects, or arrays, not at the level of a single value.
Changed to new path syntax.
Revision 0-07Fri Jul 15 2011Jonathan Robie
Removed special case positional filters for arrays.
Removed special case conversion of sequences to arrays in object values.
Removed extraneous constraint for objects in insert before / after.
Revision 0-06Thu Jul 14 2011Jonathan Robie
Added status section to emphasize that we are in very early stages.
Changed positioning in the introduction.
Added an update example.
Added an appendix listing changes needed for the XQuery Update Facility.
Added navigation primitives; defined navigation functions in terms of these primitives.
Revision 0-05Wed Jul 06 2011Jonathan Robie
Serialization now uses JSONiq values, with a type and a serialized string, for things that JSON can not represent directly.
Changed the verb used in an example.
Revision 0-04Tue Jul 05 2011Jonathan Robie
Revised author list.
Added explicit JDM representation of nulls.
Changed definition of 'value()' - it now returns the empty sequence rather than a type error for nodes that have no value, and the set of nodes for which it is defined has changed.
Added return type to times-ten() function, showed function call.
Removed superfluous space from svg example.
Changed definition of serialization.
Fixed stock holdings example.
Items are now copied into arrays or objects, rather than using references to nodes in existing hierarchies.
Revision 0-03Mon Jun 27 2011Jonathan Robie
Removed references to XQ--, XQ++, which are not yet well specified.
Finished simple value nodes for XQuery atomic values.
Reworked typed value of nodes, added examples and further explanation to "Combining XML and JSON".
General reorganization and rewriting of introduction.
Added "JSON views in middleware" example.
Added "JSON Arrays to HTML Tables" example.
Added "Transforming to SVG" example.
Added KindTests, with an example.
Added section on combining XML, JSON.
Added extended example to show ramifications of atomization.
Added superficial, hand-wavy section on serialization. Needs discussion / fleshing out.
Reorganized section on navigating JSON objects and arrays.
Revision 0-02Fri Jun 24 2011Jonathan Robie
Clarified datatypes used for numeric types.
Fixed typo in JSONPair grammar.
Added text and an example to clarify use of child axis for JSON Pair Nodes.
Added value() for pair nodes.
Added json() function, similar to XQuery's doc() function.
Added parse-json() function, similar to XQuery's parse-xml() function.
Started a section on combining XML and JSON. Not done yet.
Defined atomization for simple value nodes.
Revision 0-01Thu Jun 23 2011Jonathan Robie
Specified filter expressions for Array nodes.
Added XDM mapping, in an appendix.
Clarified typed-value, string-value for arrays and objects.
NameTest no longer matches Pair Nodes. The differences between JSON names and XML names caused problems because (1) the characters allowed in a NameTest and a JSON string differ, and (2) an unprefixed name in a Nametest is in the default namespace, all JSON strings are in no namespace.
Array constructors now allow empty arrays; Object constructors now allow empty objects.
Made JSONPair available as a primary expression.
Added Stellarium example to introduction.
Incorporated navigation functions based on this week's feedback.
Revision 0-00Fri Jun 17 2011Jonathan Robie
Imported spec into publican.