W3C home > Mailing lists > Public > public-linked-json@w3.org > December 2014

Re: Limitations on JSON which conforms to JSON-LD spec?

From: Dave Longley <dlongley@digitalbazaar.com>
Date: Wed, 03 Dec 2014 11:01:50 -0500
Message-ID: <547F33EE.6050307@digitalbazaar.com>
To: Gregg Kellogg <gregg@greggkellogg.net>, James M Snell <jasnell@gmail.com>
CC: Jauco Noordzij <jauco.noordzij@gmail.com>, Linked JSON <public-linked-json@w3.org>
On 12/02/2014 06:45 PM, Gregg Kellogg wrote:
>> On Dec 2, 2014, at 9:44 AM, James M Snell <jasnell@gmail.com> wrote:
>>
>> On Tue, Dec 2, 2014 at 9:17 AM, Gregg Kellogg <gregg@greggkellogg.net> wrote:
>> [snip]
>>>
>>> I think I mentioned on another thread that there’s an open issue for this
>>> [1]. @index only works when you have property values which would otherwise
>>> be in an array and you want to use an object to index them.
>>>
>>> The ability to index nodes which would otherwise be in an array would be a
>>> useful extension. There are two use cases I had in mind:
>>>
>>> A top-level “@container”: “@id” in a context would indicate that the keys of
>>> the object containing the @context would be treated as @id values of the
>>> nodes they reference. For example:
>>>
>>> {
>>>  “@context”: {“@container”: “@id”},
>>>  “a”:  {“b”: “c”}
>>> }
>>>
>>> would be the same as
>>>
>>> {
>>>  “@id”: “a”,
>>>  “b”: “c”
>>> }
>>>
>>
>> This is problematic in that the labels would typically not expand into
>> URI's. The index tends to be more of a label (rdfs:label?
>> skos:prefLabel?)
>>
>> {
>>   "rdfs:label": "a",
>>   "b": “c”
> 
> Yes, of course, I was simply sketching out how this might work. Certainly all terms would need to property expand. If there’s interest, we can try to develop these ideas further, They really need discussion with the wider community (Dave? Markus?), as there may be other ideas, and the algorithms will need to be thought out.

I certainly think the ideas are interesting and that we should develop
ways to deal with the current limitations, I just don't have many spare
cycles to put into it at the moment.

> 
> In my copious free time :P I may work on my own implementation of what I describe here.

Heh :). It would be good to have implementations do lead work and figure
out what's best. For instance, with respect to framing, I've done a bit
more experimental work that I described here:

https://github.com/json-ld/json-ld.org/issues/377

> 
> Gregg
> 
>> } 
> 
>>> The second proposal was to create a @reverseindex, which would treat the key
>>> as an index to the properties it contains, effectively making it go away.
>>> For example:
>>>
>>> {
>>>  “@context”: {“properties”: {“@container”: “@reverseindex”}},
>>>  “@id”: “a”,
>>>  “properties”: {
>>>    “b”: “c”
>>>  }
>>> }
>>>
>>> would turn into something like the following:
>>>
>>> {
>>>  “@id”: “a”,
>>>  “b”: {“@value”: “c”, “@reverseindex”: “properties”}
>>> }
>>>
>>
>> Again, the challenge here is that "b" is not defined in a context and
>> would not expand out. Given the input...
>>
>> {
>>  “@context”: {
>>    "properties": {
>>      "@id": "urn:example:properties",
>>      "@container": "@index"
>>    }
>>  },
>>  “@id”: “a”,
>>  “properties”: {
>>    “b”: “c”
>>  }
>> }
>>
>> which becomes...
>>
>> {
>>  "@id": "a",
>>  "properties": [
>>    { "@index": "b", "@value": "c" }
>>  ]
>> }
>>
>> and expands out to
>>
>> <a> <urn:example:properties> [
>>  a rdfs:Literal ;
>>     rdfs:label "b" ;
>>     rdf:value "c" .
>> ] .
>>
>> The nice thing is that it would not require any syntax changes to
>> JSON-LD (The change to support this would be limited to the JSON-LD
>> algorithms).
>>
>> - James
>>
>>> We’re likely a ways from a formal update to JSON-LD, but the community could
>>> decide on informal extensions such as this through the CG. Of course,
>>> there’s quite a bit of work involved in hashing these out and getting
>>> reasonable spec text and tests to adequately define them.
>>>
>>> Gregg
>>>
>>> [1] https://github.com/json-ld/json-ld.org/issues/246
>>>
>>> regards,
>>>     Jauco
>>>
>>> On Tue, Dec 2, 2014 at 12:57 AM, ☮ elf Pavlik ☮
>>> <perpetual-tripper@wwelves.org> wrote:
>>>>
>>>> On 12/02/2014 12:17 AM, Nicholas Bollweg wrote:
>>>>> As we have seen a number of times here on the list, objects made from an
>>>>> unknowably large set of of keys are hard to do anything compelling
>>>>> with... see package.json//dependencies/,
>>>>> ipython.ipynb//cells/output/data/.
>>>> I think I understand. What in plain JSON people may tend to structure as
>>>> object with keys and values. In JSON-LD people would use array of
>>>> objects instead.
>>>>
>>>> I've send emails lately here about it: "using object keys in JSON-LD"
>>>> http://lists.w3.org/Archives/Public/public-linked-json/2014Oct/0004.html
>>>>
>>>> To my understanding, JSON-LD Data Indexing (which Markus pointed me to
>>>> on thread above), provides a useful construct for those cases.
>>>> http://www.w3.org/TR/json-ld/#data-indexing
>>>>
>>>
>>>
>>>
> 
> 


-- 
Dave Longley
CTO
Digital Bazaar, Inc.
Received on Wednesday, 3 December 2014 16:02:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:43 UTC