Description
As I understand, there are three ways to locally redefine a term:
- with a scoped context in the term definition of a property,
- with an embedded context in a node object,
- with a scoped context in the term definition of a type.
If I read the expansion algorithm correctly, they are processed in that order, the latter ones potentially overriding the former ones.
So, in the following example, the embedded context overrides the property's scoped context.
{
"@context": {
"foo": {
"@id": "ex:foo",
"@context": {
"name": "rdfs:label"
}
}
},
"foo": {
"@context": {
"name": "schema:name"
},
"name": "this is schema:name"
}
}
So, in the following example, the type's scoped context overrides the property's scoped context.
{
"@context": {
"foo": {
"@id": "ex:foo",
"@context": {
"name": "rdfs:label"
}
},
"Person": {
"@id": "foaf:Person",
"@context": {
"name": "foaf:name"
}
}
},
"foo": {
"@type": "Person",
"name": "this is foaf:name"
}
}
And in the following, the type's scoped context overrides the embedded context.
{
"@context": {
"foo": {
"@id": "ex:foo"
},
"Person": {
"@id": "foaf:Person",
"@context": {
"name": "foaf:name"
}
}
},
"foo": {
"@context": {
"name": "schema:name"
},
"@type": "Person",
"name": "this is foaf:name, while it should(?) be schema:name"
}
}
and I find that latter example quite counter-intuitive, opposite to the general convention that "local overrides global".
If 1) my interpretation above is correct, and 2) we agree that the local embedded context should override any scoped context (including those of the types), I think that the solution would simply be to invert the order of steps 6 and 7 in the expansion algorithm. But I'l like a second opinion ;-)
PS: edited as suggested by @davidlehn ; "@type": "Person"
was indeed missing from the last example