Working with JSON-LD, and trying to create a @context that can be external to the main dataset.
I am trying to specify that all elements in a list are of a specified type, something along the lines of this:
{
"@context": {
"ex": "http://example.org/",
"group": "ex:group",
"members": {"@type": "ex:individual", "@id": "ex:member", "@container": "@set"}
},
"@type": "group",
"@id": "ex:mygroup",
"members": [
{"name": "John"},
{"name": "Jeff"},
{"name": "Jane"}
]
}
but, I cannot get the @type to 'stick', the resulting rdf does not state than John is an individual.
If declaring 'inside' the main part, like this:
{
"@context": {
"ex": "http://example.org/",
"group": "ex:group",
"members": {"@type": "ex:individual", "@id": "ex:member", "@container": "@set"}
},
"@type": "group",
"@id": "ex:mygroup",
"members": [
{"name": "John", "@type": "ex:individual"},
{"name": "Jeff", "@type": "ex:individual"},
{"name": "Jane", "@type": "ex:individual"}
]
}
it works, but I would really like to avoid changing the main part of the JSON struct.
The obvious benefit is that I can just tack on a JSON-LD context to an existing interface, for example using a link header.
What am I missing?
Edit: It could be that I am hoping for future functionality as discussed here.