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

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