Description
This issue has been spotted in w3c/wot-thing-description#988. I can't yet decide if it is an implementation bug (which appears in both the playground and the Ruby distiller) or a problem in the API spec.
It is caused during compaction, when the @index
property of a term definition using a compact IRI. Not only does it not roundtrip, but it fails with an "IRI confused with prefix" error.
Minimal example (see in playground) :
{
"@context": {
"ex": "http://example.org/ns/",
"prop": {
"@id": "ex:prop",
"@container": "@index",
"@index": "ex:name"
}
},
"prop": {
"foo": { "@id": "ex:foo"},
"bar": { "@id": "ex:bar"}
}
}
Note that expansion works fine. Replacing "@index": "ex:name"
with "@index": "http://example.org/ns/name"
in the compaction context solves the problem.
What is embarassing is that the example from the spec suffers from the same problem: it expands correctly, but fails to compact back, with the same error (see in playground).