W3C home > Mailing lists > Public > public-socialweb@w3.org > October 2014

RE: using object keys in JSON-LD

From: Markus Lanthaler <markus.lanthaler@gmx.net>
Date: Mon, 6 Oct 2014 12:43:56 +0200
To: <public-socialweb@w3.org>, "'Linked JSON'" <public-linked-json@w3.org>
Message-ID: <05a001cfe152$6efaece0$4cf0c6a0$@gmx.net>
Hi Pavlik,

On 4 Okt 2014 at 13:50, ☮ elf Pavlik ☮ wrote:
> ActivityStreams defines (unless it recently changed) UrlTemplate and
> ParametersObject in https://github.com/jasnell/w3c-socialwg-
> activitystreams/blob/54deeb6d6aa742ffe4e1d6c6e09cb84cdf3123b4/activitystr
> eams2- actions.html#L1035
> where we can see that as:parameters takes *an object* (not sure about an
> array of objects here...)

Let's discuss as specific example from the document you reference above:

    "review": { 
       "objectType": "UrlTemplate", 
       "template": "http://example.org/notes/{noteid}", 
       "parameters": { 
         "noteid": { 
           "type": "nonNegativeInteger", 
           "totalDigits": 5 

> I can't yet clearly explain possible issues with using object keys this
> way. To my understanding in JSON-LD object keys always map to
> *predicates* which limits them to IRIs (no blank nodes or literal values
> unless serializing Generalized RDF) which can make difference here.

In JSON-LD "object keys", as you call them, don't always have to map to predicates. In the example above, "noteid" *probably* shows such a use case. It represents/describes the variable "noteid" in the URL template. Hydra makes this a bit more explicit (hydra:variable) but you can also handle the AS way of doing it with JSON-LD, but it won't result in meaningful RDF. The trick is to use a feature called "Data Indexing" [1]. Simply speaking, it allows you to add index data in a similar way as language maps do but with the difference that the index has no meaning at all. It is simply a string token that would be lost when converting to RDF. It survives all JSON-LD transformations (expansion/compaction etc.) though.

Does this answer your question?


[1] http://www.w3.org/TR/json-ld/#data-indexing

Markus Lanthaler
Received on Monday, 6 October 2014 10:44:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:26:13 UTC