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

Re: when object keys are "data" and not predicates

From: Nicholas Bollweg <nick.bollweg@gmail.com>
Date: Mon, 24 Nov 2014 22:16:21 -0500
Message-ID: <CACejjWzw7c7tZgzs0nP5vaztc8FNxq3X=oMY1naem+woYrHeLw@mail.gmail.com>
To: Peter Amstutz <peter.amstutz@curoverse.com>
Cc: public-linked-json <public-linked-json@w3.org>
Peter:
That's the rub right now. It's too bad, as one of the claims that JSON-LD is

> unambiguously machine-readable without requiring developers to drastically
> change their documents
>
but maps are just too handy, they're all over the place... and JSON-LD
doesn't handle them very well.

I think the challenge is that they are used in so many ways.

I first encountered this when trying to understand the `dependencies` key
in a package.json, like this example sanitized, canonical example (I
wouldn't even try against in-the-wild package.json):
http://registry.npmjs.org/backbone/1.0.0

Now, I could imagine some filigreed RDF that describes this really
accurately, but the developers has been able to tell this story very
concisely: that's a lot to pack into a little map, which is why developers
like it.

I have yet to find a compelling solution, but it's important to keep this
on the radar.

Perhaps there is a way to do it without introducing new @ keywords.
Imagining, for your case, if you're looking for literals:
{
  "@context": {
    "ex": "http://example.com#",
    "components": {
      "@id": "ex:components",
      "@container": {
        "@index": {
          "@id": "ex:name",
          "@type": "xsd:string"
        },
        "@value": {
          "@id": "ex:value",
          "@type": "xsd:int"
        }
      }
    }
  },
  "components": {
    "foo": 1,
    "bar": 2
  }
}

Or for my case: where I am expecting URIs:

{
  "@context": {
    "pkg": "https://www.npmjs.org/doc/files/package.json.html#",
    "reg": "https://registry.npmjs.org/",
    "dependencies": {
      "@id": "pkg:dependencies",
      "@container": {
        "@index": {
          "@id": "@type",
          "@type": "@id",
          "@base": "@reg"
        },
        "@value": {
          "@id": "pkg:version",
          "@type": "@id"
        }
      }
    }
  },
  "dependencies": {
    "underscore": ">=1.4.3"
  }
}

Still leaves much to be desired. I guess I still think preprocessing will
be required for a lot of these more complicated shapes.
Received on Tuesday, 25 November 2014 03:16:49 UTC

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