Scoping external JSON-LD context inside objects?

Hello RDF team,

this question is mainly directed towards the JSON-LD guys.

I'm in the situation where I want to create an easy way to convert an
existing JSON model (which I can't edit) to JSON-LD.
Obviously, I'm using an external context document for that, so all one
needs to do to convert their JSON to -LD is to add 1 @context property.

However, there are some duplicate terms in this model, and unfortunately,
they refer to different things.
For example, there is the term "id". When it occurs anywhere in the
document, its property should be http://example.org/id, and its value
should be a UUID (thus, the @type should be a xsd:string). When it occurs
inside an "object" however, it should be the subject of the corresponding
triple.

So let's consider an example:

{
  "id" : "123.456.789",
  "object" : {
                   "id" : "http://example.org/myObject"
   }
}

In N3, this should become something like this:

[] <http://example.org/id> "123.456.789";
   <http://example.org/object> <http://example.org/myObject> .
<http://example.org/myObject> a <http://example.org/Object> .

How do I model this correctly in JSON-LD?

Basically, I would like to put something in my context that resembles this:


{
  "id" : {
      "@id" : "http://example.org/id",
      "@type" : "xsd:string"
    },
  "object" : {
      "@id" : "http://example.org/object",
      "@type" : "@id"
    },
   "object.id" : "@id"
}

Right now all I can see as a solution is to force the developers to add the
following to every object in their JSON:
"@context" : {
  "id" : "@id"
},
Which would be quite a nuisance compared to just specifying 1 external
context...
Am I missing something?

Thanks in advance!

Regards,
Tom
Tom De Nies
Researcher Semantic Web
Ghent University - iMinds
Faculty of Engineering and Architecture
Department of Electronics and Information Systems - Multimedia Lab
Gaston Crommenlaan 8 bus 201, B-9050 Ledeberg-Ghent, Belgium

e: tom.denies@ugent.be

URL:  http://multimedialab.elis.ugent.be

Received on Friday, 30 January 2015 16:37:38 UTC