- From: Gregg Kellogg <gregg@greggkellogg.net>
- Date: Sun, 24 Jun 2012 18:10:08 -0400
- To: Gavin Carothers <gavin@carothers.name>
- CC: Manu Sporny <msporny@digitalbazaar.com>, "public-rdf-wg@w3.org" <public-rdf-wg@w3.org>, Françoise Conil <fconil@liris.cnrs.fr>
On Jun 24, 2012, at 6:01 AM, Gavin Carothers wrote: > On Sat, Jun 23, 2012 at 12:47 PM, Manu Sporny <msporny@digitalbazaar.com> wrote: >> On 06/19/2012 12:51 PM, Pierre-Antoine Champin wrote: >>> ... >> >>> S3.1.1 one-pass parsing sounds good, but how can I know in advance >>> that the JSON-LD I get will respect the good practices that allow me >>> to do so? As those good practices are SHOULDs and not MUSTs, I will >>> never know for sure if I can use a one-pass processor or if it will >>> fail. So I would recommend to add a parameter to the content-type >>> (annex C) to indicate whether the JSON-LD guarantees that @context's >>> and @id's are in first positions, so that I can chose the most >>> appropriate parser. >> >> I don't think we should tell folks that there are two types of JSON-LD >> processors. Maybe the terminology needs to be changed because all >> parsing is one-pass... it just can't happen until the @context is known. >> We could re-name this to "efficient memory footprint processing", as >> that's what it really is. It's a bit heavy-handed to say that input MUST >> be ordered in a certain way. I think we'd rather let this be a social >> contract between Web Services and clients of those services. That is, if >> the Web Service wants to use a "efficient memory footprint" processor, >> it can reject any input that doesn't have @context listed as the first key. > > I'm confused how this works with JSON. "An object is an unordered set > of name/value pairs", there isn't really a way to say that @context > comes first is there? I mean in all the examples it does, but those > are produced by hand. Nothing in JSON provides for any ordering of > name/value pairs. Gavin's correct, although a specific character stream may have an order, the JSON model [1] says that keys without objects are not ordered: [[[ An object is an unordered set of name/value pairs. ]]] When possible, it is a good idea to perform lexicographical ordering of keys, which leads to @context, @id, and @type coming out in order prior to keys that begin with an alphanumeric character, but implementations can't count on this. In effect, this means that to implement a streaming parser, the processing of keys and values in an object needs to be deferred until an @context is seen. This certainly makes doing a streaming processor more difficult, and potentially to have little advantage over an in-memory processor. Gregg [1] http://www.json.org/ >> ... >> >> -- manu >> >> -- >> Manu Sporny (skype: msporny, twitter: manusporny) >> Founder/CEO - Digital Bazaar, Inc. >> blog: PaySwarm Website for Developers Launched >> http://digitalbazaar.com/2012/02/22/new-payswarm-alpha/ >> >
Received on Sunday, 24 June 2012 22:11:06 UTC