Skip to content

Let @vocab take precedence over compact IRIs in compaction #235

Closed
@niklasl

Description

@niklasl

If a @vocab mapping is given, compaction should use that to avoid creating a compact IRI for a term. The purpose of compaction is to make the results as simple and usable as possible, and consumption of JSON with CURIE terms is problematic and undesirable. I propose that @vocab is considered prior to making a compact IRI.

That means moving the content of step 6 before step 3 in 8.3 IRI Compaction of the Processing Algorithms. And to rewrite the initial text of that section to something like:

"If no term was found that could be used to compact the IRI, then an attempt is made to construct one based on the active context's vocabulary mapping, if there is one. If no such term can be constructed, then an attempt is made to find a compact IRI. If there is no appropriate compact IRI, the IRI is transformed to a relative IRI using the document's base IRI. Finally, if the IRI or keyword still could not be compacted, it is returned as is."

That would ensure that this data:

{
  "@type": "http://schema.org/Document",
  "http://schema.org/name": "Something"
}

when compacted with this context:

{
  "@context": {
    "schema": "http://schema.org/",
    "@vocab": "http://schema.org/"
  }
}

results in:

  {
    "@type": "Document",
    "name": "Something"
  }

(Of course, we must ensure that this has no unexpected consequences. It doesn't seem so, but the change should be verified with an implementation against the test suite.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions