Skip to content

Compaction fails when using compact index keys as container keys #674

@niklasl

Description

@niklasl

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions