Compaction fails when using compact index keys as container keys
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 106
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
In the JSON-LD 1.1 Compaction algorithm, step 12.8.9.6.1 currently reads "Reinitialize container key by IRI compacting index key". This does not always work, since the index key may already be compacted at this point.
In fact, compaction test 0112 ("Compact property index using Compact IRI index") fails here if implemented verbatim, since IRI Compaction step 9 detects an IRI confused with prefix error on the index key ex:name as defined in the context.
To fix this, a condition can be added to step 12.8.9.6.1, to only compact the index key if it is not already compacted; along the lines of: "Reinitialize container key to the value of index key. If the container key expands to itself, reinitialize it by IRI compacting index key." (Note that this is similar to the check in step 12.8.9.8.4.)
(For context, note also that step 20.2 of the Create Term Definition algorithm says "Initialize index to the value associated with the @index entry", which means its exact value, not its expansion. It even elaborates on that with "If the result of IRI expanding that value is not an IRI, an invalid term definition has been detected and processing is aborted.". Compaction tests 0113 and 0114 also rely on this exact behavior.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the JSON-LD 1.1 Compaction algorithm at step 12.8.9.6.1 and compare the similar check in step 12.8.9.8.4. Run compaction test 0112, then review tests 0113 and 0114 to ensure exact @index behavior remains intact. Done means the compacted index key no longer triggers an IRI confused-with-prefix error.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100