On 8 May 2016, at 9:59, Preston Carman wrote:
On Sat, May 7, 2016 at 11:22 AM, Riyafa Abdul Hameed
<[email protected]> wrote:
Hi,
I am attempting to create a doc on the JSONiq data model for
objects[1] (It
might be full of errors because I am doing the calculations
manually).
This is what I have come up on the data model for objects:
The first byte would have the value tag, followed by the id (4 bytes)
of
the object. Then 4 bytes to represent the size of the object. Then
another
four bytes to represent the number of key-value pairs. Next few bytes
represent the offsets of keys which follow (each offset is
represented by 4
bytes). Ids would be assigned to the keys. Next few bytes would be a
sorted
list of ids for keys in alphabetical order. The following bytes would
represent the keys in the object.Each key is a StringPointable
followed by
the id of the key. Each object would have a sequence pointable: the
following bytes would be the number of Items (items are the values
for
keys) in the sequence. The next bytes would be the offset of each
item in
the sequence. The last bytes would be the values for each key
followed by
the respective id of the key.
Hope it makes sense.
My problem is,
I have not provided for the white spaces in the object. What can I
use to
represent the white spaces? I cannot use a text node because object
is not
a node.
The XML data model defines how to utilize white space. I don't believe
JSON has the same idea. I think we can print the JSON object in a
standard fashion and do not need to track white space in the object
definition.
I agree. The only information available in the data model as specified
[1]
are the keys and the values, so whitespace is not a problem. Taking one
step
back, one of the differences between XML and JSON is that
- XML is used to represent human readable documents (often after
transformation), so line breaks, indentation, and other whitespace
are
important while
- JSON is a notation for objects in a programming language.
Cheers,
Till
[1]
http://jsoniq.org/docs/JSONiqExtensionToXQuery/html-single/index.html#idm139680641300880
[1]
https://drive.google.com/open?id=1-wT0pE8rTTNIzuY4iTgvhqkdHmKGek4CgNthXN6mlm0
Thank you.
Yours sincerely,
Riyafa
On 26 April 2016 at 10:29, Preston Carman <[email protected]>
wrote:
We have two students working with us this summer through GSOC to
complete
JSONiq specification for arrays and objects. I think the first step
is to
define the data model used by JSONiq. The definition should be
defined in
our wiki [1] before coding starts this summer. The wiki will allow
the
community to discuss the JSON data model implementation in VXQuery.
I updated the JSONiq wiki to help get the documentation started.
Please
fill in the JSON data model based on the examples seen on our
website
(links on the wiki page).
Post here if you have any questions.
[1] https://cwiki.apache.org/confluence/display/VXQUERY/JSONiq
--
Riyafa Abdul Hameed
Undergraduate, University of Moratuwa
Email: [email protected]
Website: https://riyafa.wordpress.com/ <http://riyafa.wordpress.com/>
<http://facebook.com/riyafa.ahf> <http://lk.linkedin.com/in/riyafa>
<http://twitter.com/Riyafa1>