w3c / w3c/json-ld-syntax

Support multiple IRIs for `@reverse`

Open
#372 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

defer-future-version ms:future-work needs discussion spec:enhancement
Dominant language
HTML
Stars
139
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Hi all,

It would be great to allow multiple property IRIs in the @reverse property. This would allow users to transform JSON-LD to other formats like N-Quads more easily without having to manipulate the output format to add additional triples with the extra properties they want to add.

For example, I have some JSON-LD like this:

{
  "@id": "ex:BEA/code/FREQ",
  "@type": "skos:ConceptScheme",
  "skos:notation": "FREQ",
  "entries": [
    {
      "@id": "ex:BEA/code/FREQ/A",
      "@type": "skos:Concept",
      "skos:prefLabel": "Annually",
      "skos:notation": "A"
    },
    {
      "@id": "ex:BEA/code/FREQ/Q",
      "@type": "skos:Concept",
      "skos:prefLabel": "Quarterly",
      "skos:notation": "Q"
    }
  ]
}

I'd like to have a context entry like this:

    "entries": {"@reverse": ["skos:hasTopConcept", "skos:inScheme"]}

This use-case is based on Example 14 from the RDF Data Cube Specification.

I know that the feature set is frozen for 1.1, I just wanted to put this out there for consideration for the next version.

I guess the trickiest part would be handling the expanded form, which looks like this currently:

{
  "@reverse": {
    "http://www.w3.org/2004/02/skos/core#hasTopConcept": [
        {
          "@id": "ex:BEA/code/FREQ/A",
          "@type": "skos:Concept",
          "skos:prefLabel": "Annually",
          "skos:notation": "A"
        },
    ]
  }
}

We can't have keys that are arrays, so we'd need to restructure it. I'm not sure if it's possible to do that in a backwards-compatible way, which might be a deal-breaker.

Let me know what you think. Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin with issue #372 and the JSON-LD 1.1 specification sections covering @reverse, expanded form, and processing; compare the proposal with RDF Data Cube Example 14. Done means agreeing on a backwards-compatible representation and defining the required processing behavior; the issue names no files or tests.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.