Open pawe3kaleta opened 3 years ago
Meanwhile, I figured out it's possible to achieve expected results using JSON-LD 1.1 feature about scoped contexts. But I'm still wondering if the issue can be solved using JSON-LD 1.0.
{
"@context": {
"@vocab": "http://schema.org/",
"gender": {
"@id": "gender",
"@type": "@vocab"
},
"ex": "http://example.org/",
"code": {
"@id": "ex:code",
"@type": "@vocab",
"@context": {
"@vocab": "http://example.org/"
}
}
},
"gender": "Male",
"code": "ABC"
}
I have JSON object containing the attributes using multiple controlled vocabularies. And I'm struggling how to describe it properly using JSON-LD context.
I'm trying to apply Best Practice #8: Things not strings in the following example:
(Open in JSON-LD Playground)
I would expect the following after expanding:
but actually I get:
It seems that the property name is resolved correctly using @vocab from the context containing the property mapping. But the property value is resolved incorrectly i.e. it's resolved using @vocab from the last context regardless of the property mapping declaration.
Ideally I would like to declare @vocab at the property level (which is forbidden as for now) to instruct a JSON-LD processor, which vocabulary, should be used while expanding e.g.
(Open in JSON-LD Playground)