w3c / w3c/json-ld-syntax

Cannot use `@reverse` combined with `"@container": "@id"`

Open
#496 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
139
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Hello,

I am trying to use the @reverse keyword in combination with an @id index, but I keep getting a syntax error.

Given this part of graph data:

"@id": "http://example.org/my-shapes-graph#",
"@type": "owl:Ontology",
"classes": {
  "ex:SomeClass": {}
    # ...

I want it to render triples like this:

ex:SomeClass rdfs:member <http://example.org/my-shapes-graph#> .
# ...

So, in other words, I want classes to be a reverse of rdfs:member and its node be an index by identifier.

I would have expected the followg part of context to accomplish that:

"@context": {
  "classes": {
      "@reverse": "rdfs:member",
      "@container": "@id"
}

However, using several JSON-LD parsers I'm getting (like):

SyntaxError: @reverse is only compatible with @index and @set containers

Why is this the case? I cannot find or gather an explanation of this in the spec, and I would like to understand whether this is mathematically impossible in some way I'm missing, or just not currently implemented, or maybe just user error and already achievable.

Thanks,
Bart

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

Start by reading the JSON-LD 1.1 specification's rules for @reverse and @container, then compare the reported @reverse plus @id example with the allowed @index and @set containers. Done means documenting why the combination is rejected and whether the specification should clarify or change that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.