json-ld/json-ld.org — Issue #58: Specify what's the active context in compaction
Author: lanthaler
Created: 2012-01-13 15:31:27+00:00
State: open
Labels: spec-bug, spec-design

Originally raised in issue #57:

What's more interesting to me is what the active context is if there are multiple contexts within the document and the optional context parameter in the API wasn't used. That's not specified at all. Looking at the playground the algorithm just seems to take the top-level @context definition. If such a context is not available since, e.g., an array is used at the top-level (containing objects that contain a top-level @context) the whole compaction fails. Worse yet, the whole document gets expanded.

An example to test would be:

[
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"name": "Markus Lanthaler",
"homepage": "http://www.markus-lanthaler.com/"
},
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/homepage",
"@type": "@id"
},
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
"name": "Manu Sporny",
"homepage": "http://manu.sporny.org/"
}
]