Hi Benito,
Again thanks for your useful comments. Most typos should be fixed now (in the JSONiq extension to XQuery spec). I commented below, please let me know if I have missed anything.
Many thanks and kind regards,
Ghislain
On roundtripping: I will take it to the team.
> is-null(()) is a type error, Is that intended? Then you cannot even write is-null(null), with disabled literals...
The signature could be changed to is-null(item()?) as xs:boolean?. I will take it to the team.
> And I think it would be nice to have a members-like function that behaves like members for arrays and like the identity function for everything else. Makes it easier to handle formats, where multiple values are stored as {"foo": [1,2,3]} and single values as {"foo": 4} ...
> (i.e like: typeswitch ($x) case array() return members($x) default return $x
I will take it to the team. If you have a more elaborate use case, it could help motivating the introduction of such a function.
> Although, why is jn:members even needed?
> An array could be automatically cast to a sequence, whereever a sequence is needed.
> After all a sequence is already auto converted to an array (when used as property in a serialized object),
> and an array cannot contain a sequence (cf. [1 to 10] ), so it would not cause ambiguity.
This is a good question, and this was discussed, as well as other solutions. Every time, for various reasons (too complicated or unintuitive, singleton sequence singularities, ...) we fell back to the current solution (arrays are items, no auto-unboxing).
> There also quite a few actual errors:
>
> In Chapter 5. Navigation in JSON content
> If the base expression $s is a sequence of objects, or a sequence of arrays, then $sequence($params) is ...
> => That does not seem to allow a mixed sequence of (objects and arrays).
I am not sure this is an error. Are there use cases for an object+array lookup (which would involve casting for either the formers or the latters)? I will take it to the team.
>
>
> In 5.2. Array selectors:
> "thursday"" ]
Fixed.
>
> In 6.1. fn:boolean (aka Effective Boolean Value):
> EBV ( [1], jn:null() )
> => EBV is supposed to be an 1-arity function
Fixed.
>
> In Example 6.9. Retrieving the size of an array
> returns
> => that has the wrong formatting (should not be part of the code)
Fixed.
>
> In 6.10. jn:keys:
> for $key in json:keys($map)
> => that namespace prefix is not defined
Fixed.
>
> In 6.18. Changes to general comparison semantics:
> Example 6.11. Addition
> => that example has nothing to do with addition
Fixed.
>
>
> In 6.13. jn:object:
> return jn:object($object1, $object2)
> => this calls a arity-2 object function, which does not exist
Fixed.
>
>
> In 8.1. libjn:accumulate :
> for $distinct-key := distinct-values($all-keys)
Fixed.
>
> In 8.2. libjn:descendant-objects :
> for $v in libjn:members($i)
> => that should be a jn: function
Fixed.
>
> In 8.3. libjn:descendant-pairs :
> jn:descendant-pairs($o)("first")
> => that should be an libjn: function
Fixed.
> Result: { "first" : 1 }, { "first" : "a" }
> => No, the accessor only returns the value, so the result is "1 a"
Fixed.
>
> In 8.4. libjn:flatten:
> for $value in libjn:values($a)
> => values is not defined for arrays. Should probably be jn:members
Fixed.
>
> In 8.6. libjn:project:
> "First Officer" : "Spock",
> => there should not be a comma
Fixed.
> Result: ()
> => actually returns {}, since it always calls jn:object
Fixed.
--
Dr. Ghislain Fourny
Software Architect
28msec Inc.
http://www.28msec.com
http://twitter.com/28msec