json-ld-api icon indicating copy to clipboard operation
json-ld-api copied to clipboard

Which context should be used to get the term definition in compaction algorithm step 6?

Open kal opened this issue 5 years ago • 4 comments

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?

kal avatar Jul 01 '20 17:07 kal

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.

gkellogg avatar Jul 01 '20 20:07 gkellogg

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.

timothee-haudebourg avatar Nov 06 '20 21:11 timothee-haudebourg

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.

gkellogg avatar Nov 07 '20 00:11 gkellogg

Summary:

Update step 6 of the Compaction Algorithm to check the type-scoped context instead of the active context.

  1. If the term definition for active property in type-scoped context has a local context:

gkellogg avatar Oct 16 '22 21:10 gkellogg