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

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

From: Gregg Kellogg <gregg@greggkellogg.net>
Date: Tue, 2 Dec 2014 09:17:15 -0800
Cc: public-linked-json@w3.org
Message-Id: <1ABCF072-307C-4C5F-9642-BE44C8BBB35A@greggkellogg.net>
To: Jauco Noordzij <jauco.noordzij@gmail.com>
> On Dec 2, 2014, at 12:02 AM, Jauco Noordzij <jauco.noordzij@gmail.com> wrote:
> 
> As I understand it, this workaround can't be used when the keys are used in the toplevel object as is done in https://github.com/tobie/specref <https://github.com/tobie/specref>
> 
> See also my naive try at:
> 
>  http://json-ld.org/playground/index.html#startTab=tab-compacted&json-ld=%7B%22FileAPI%22%3A%7B%22authors%22%3A%5B%22Arun%20Ranganathan%22%2C%22Jonas%20Sicking%22%5D%2C%22date%22%3A%2212%20September%202013%22%2C%22deliveredBy%22%3A%5B%7B%22shortname%22%3A%22webapps%22%2C%22url%22%3A%22http%3A%2F%2Fwww.w3.org%2F2008%2Fwebapps%2F%22%7D%5D%2C%22edDraft%22%3A%22http%3A%2F%2Fdev.w3.org%2F2006%2Fwebapi%2FFileAPI%2F%22%2C%22href%22%3A%22http%3A%2F%2Fwww.w3.org%2FTR%2FFileAPI%2F%22%2C%22id%22%3A%22FileAPI%22%2C%22publisher%22%3A%22W3C%22%2C%22status%22%3A%22LCWD%22%2C%22title%22%3A%22File%20API%22%7D%2C%22rfc2119%22%3A%7B%22authors%22%3A%5B%22S.%20Bradner%22%5D%2C%22date%22%3A%22March%201997%22%2C%22href%22%3A%22http%3A%2F%2Fwww.ietf.org%2Frfc%2Frfc2119.txt%22%2C%22id%22%3A%22rfc2119%22%2C%22publisher%22%3A%22IETF%22%2C%22status%22%3A%22Best%20Current%20Practice%22%2C%22title%22%3A%22Key%20words%20for%20use%20in%20RFCs%20to%20Indicate%20Requirement%20Levels%22%7D%7D&frame=%7B%7D&context=%7B%22%40container%22%3A%22%40index%22%7D <http://json-ld.org/playground/index.html#startTab=tab-compacted&json-ld={"FileAPI":{"authors":["Arun Ranganathan","Jonas Sicking"],"date":"12 September 2013","deliveredBy":[{"shortname":"webapps","url":"http://www.w3.org/2008/webapps/"}],"edDraft":"http://dev.w3.org/2006/webapi/FileAPI/","href":"http://www.w3.org/TR/FileAPI/","id":"FileAPI","publisher":"W3C","status":"LCWD","title":"File API"},"rfc2119":{"authors":["S. Bradner"],"date":"March 1997","href":"http://www.ietf.org/rfc/rfc2119.txt","id":"rfc2119","publisher":"IETF","status":"Best Current Practice","title":"Key words for use in RFCs to Indicate Requirement Levels"}}&frame={}&context={"@container":"@index"}>
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”
}

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”}
}

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 <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 <mailto: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 <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 <http://www.w3.org/TR/json-ld/#data-indexing>
> 
> 
> 


Received on Tuesday, 2 December 2014 17:17:45 UTC

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