Description
This is a proposal @niklasl made in response to the proposal to support "@container": "@language"
(#133):
@container
is already a mechanism for letting the two currently defined container keywords,@set
and@list
, interpret a given array in their own specific way. We can extend the behaviour of@container
to let all of@language
,@id
,@type
and regular terms treat an object as a map, in their own, specific ways.
To keep the discussion focused, let's concentrate on "@container": "@id"
in this issue (and call it a subject map) and create separate ones for @type
and regular terms if required.
Here's an example of using @container
with @id
(one without aliasing @graph
as Niklas did):
{
"@context": {
"ex": "http://example.com/",
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": { "@id": "http://xmlns.com/foaf/0.1/homepage", "@type": "@id" },
"knows": { "@id": "http://xmlns.com/foaf/0.1/knows", "@container": "@id" }
},
"@id": "ex:Markus",
"name": "Markus",
"homepage": "http://www.markus-lanthaler.com/",
"knows": {
"ex:Niklas": {
****** what would happen if a different @id would be defined here? *****
"name": "Niklas",
"homepage": "http://neverspace.net/"
}
}
}
This would be expanded to:
[
{
"@id": "http://example.com/Markus",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Markus" } ],
"http://xmlns.com/foaf/0.1/homepage": [ { "@id": "http://www.markus-lanthaler.com/" } ],
"http://xmlns.com/foaf/0.1/knows": [ {
"@id": "http://example.com/Niklas",
"http://xmlns.com/foaf/0.1/name": [ { "@value": "Niklas" } ],
"http://xmlns.com/foaf/0.1/homepage": [ { "@id": "http://neverspace.net/" } ]
} ]
}
]
A couple of questions:
- what should happen if a different IRI is assigned to an object in a subject map
- should properties of subject maps be interpreted as relative IRIs as fallback, i.e., the same way as values of
@id
Gregg originally proposed to use something he called "folding" for this and #133:
{
"@context": {
"en": {"@id": null", "@language": "en", "@fold": true},
"de": {"@id": null", "@language": "de", "@fold": true},
"queenie": {"@id": null", "@fold": true}
},
"queenie": {
"@id": "http://buckingham.uk/queenie",
"label": {
"en": { "@value": "The Queen" },
"de": { "@value": "Die Königin"}
}
}
}