- From: John Walker <john.walker@semaku.com>
- Date: Sat, 22 Nov 2014 17:34:04 +0100
- To: François-Paul Servant <francoispaulservant@gmail.com>
- Cc: Niklas Lindström <lindstream@gmail.com>, "public-linked-json@w3.org" <public-linked-json@w3.org>
- Message-Id: <A2AF233B-1BF9-4141-B609-8B05D8A1E37F@semaku.com>
How about an array of objects? Regards, John On 22 Nov 2014, at 17:24, François-Paul Servant <francoispaulservant@gmail.com> wrote: > Niklas, Andy, > > thank you very much for your answers. Less disappointed? well, as Andy puts it: "there isn't really a choice point here" ;-) > > Thanks! > > (still thinking: what's the best way to write the data about a resource s - s,p,o triples, plus short description of the objects, eg. their labels - with an ordering of the prop-value pairs that depend on the objects, not the predicates) > > Best Regards, > > fps > > > Le 22 nov. 2014 à 15:28, Niklas Lindström <lindstream@gmail.com> a écrit : > >> This is because JSON itself does not, in practice, support multiple keys with the same name. Specifically, the RFC [1] says "the names within an object SHOULD be unique", but implementations commonly throw away all but the last value (see e.g. [2] and [3]). This implementation behavior makes it basically impossible for JSON-LD parsers relying on an underlying JSON parser from detecting and warning about it, unless the underlying parser has support for that. >> >> To overcome this mismatch between the JSON and RDF data models, JSON-LD handles arrays of values as sets of predicate, value pairs, and instead has a special construct, @list, to explicitly provide a way of representing closed, ordered RDF collections. You can also control this in compact form by using the @container feature with the @set and @list keywords. See the JSON-LD Syntax [4] for the details. >> >> I hope this makes you less disappointed. :) >> >> Cheers, >> Niklas >> >> [1]: http://www.ietf.org/rfc/rfc4627.txt >> [2]: http://stackoverflow.com/questions/21832701/does-json-syntax-allow-duplicate-keys-in-an-object >> [3]: http://stackoverflow.com/questions/5306741/do-json-keys-need-to-be-unique >> [4]: http://www.w3.org/TR/json-ld/#sets-and-lists >> >> >> On Sat, Nov 22, 2014 at 2:55 PM, François-Paul Servant <francoispaulservant@gmail.com> wrote: >> As I am a bit disappointed by the fact that keys in JSON-LD objects must be unique, I've tried to understand why it is so (as keys are properties, I didn't expect such a restriction - I know that we can use an array for multi-valued properties, but I would have expected that repeating a key would just have added more values - more triples to the graph). I've not been able to find an explanation (I tried searching this list without result, but I may have missed it). Could someone point me to some explanation / discussion on the topic? (it seems to me that I would be less disappointed if I understood why things are the way they are) >> >> BTW, If you pass some JSON-LD that does not respect this rule to the playground (OK, not JSON-LD, then), you don't get any error or warning message (it seems that the latest value is used in the result) >> >> Best, >> >> fps >> >> >> >
Received on Saturday, 22 November 2014 16:34:37 UTC