json-ld-api
json-ld-api copied to clipboard
Which context should be used to get the term definition in compaction algorithm step 6?
I was trying to get my implementation of the compaction algorithm to pass test c013 and I think that the spec may be misleading. Step 5 reverts active context if there is a previous context (unless dealing with a value or simple @id reference). Step 6 then looks for a term definition for active property in active context. When following this my code fails test c013 which has a nested property-scoped context inside the type-scoped context. Looking at the code of jsonld.js, it seems that library uses the context passed into the algorithm (called type-scoped context in the algorithm). If I do the same then my code passes and no other tests break (that aren't already broken ;-) - so is the jsonld.js implementation correct?
It seems that step 5 should look up the property-scoped context using type-scoped context and not active context, although it does update the active context.
Perhaps other implementors can comment, as I recall addressing this specifically, but don't see anything in the commit history.
My implementation is also failing on compact#c013, I believe for the same reason. Using type-scoped context allows me to pass this test without breaking previous passing tests.
We have a backlog of updates to do to the spec, but the WG hasn't been active. It's captured as a raised erratum, which will eventually allow us to go fix the spec, and the WG has the ability to re-issue a REC, with the appropriate procedures.
In the meantime, please continue to reach out with issues we encounter.
Summary:
Update step 6 of the Compaction Algorithm to check the type-scoped context instead of the active context.
- If the term definition for active property in type-scoped context has a local context: