Combining @id with @vocab / combining @graph with @included / JSON API compatibility

Hello

Considering the JSON-LD below, which combines @graph, @included and @vocab,
I have 3 questions :

1. No rdf:type triple is produced with https://exemple.eu/entity_1 as
subject. I intended the "id" attribute to be found in the context, as I
marked the "id" key with "@type = @vocab". This works correctly with the
type key.
I understand this is because JSON-LD mandates @id to be IRIs or blank node
identifiers. But why wouldn't it be possible to find the corresponding IRI
in the @context ?
I would like to do that so that the key is the same when I refer to
"entity_1" in the "refers_to" key and when I describe "entity_1" in the
"included" section.

2. When combining @graph with @included, the triples from the @graph are
put in an anonymous graph instead of the default graph. Triples from
the @included section are put in the default graph (if I workaround the
first issue by using an explicit IRI). I find that counter intuitive. The
spec reads "*When a JSON-LD document's top-level structure is a map that
contains no other keys than @graph and optionally @context (...), @graph is
considered to express the otherwise implicit default graph*", but I suggest
to change it to "*...contains no other keys than @graph and @included...*"

Maybe there is another way to have the data+included structure at the
top-most level while maintaining a single default graph ?

3. This is done in an attempt to mimic the JSON API (jsonapi.org) structure
while keeping JSON-LD compatibility. Do you know of other attempts to do
so, or is there some kind of default "JSONAPI to JSON-LD" @context or
something similar ?

Thanks !
Thomas


```
{
  "@context": {

    "id": {
      "@id": "@id",
      "@type":"@vocab"
    },

    "type": {
      "@id": "rdf:type",
      "@type": "@vocab"
    },

    "refers_to": {
      "@id": "https://exemple.eu/ontology#refers_to",
      "@type": "@vocab"
    },

    "data": "@graph",
    "included": "@included",

    "entity_1": "https://exemple.eu/entity_1",

    "Test" : "https://exemple.eu/ontology#Test"
  },


  "data": [
    {
      "id": "https://exemple.eu",
      "type": "Test",
      "refers_to": "entity_1"
    }
  ],

  "included" : [
    {
      "id": "entity_1",
      "type": "Test"
    }
  ]
}
```

-- 

*Thomas Francart* -* SPARNA*
Web de *données* | Architecture de l'*information* | Accès aux
*connaissances*
blog : blog.sparna.fr, site : sparna.fr, linkedin :
fr.linkedin.com/in/thomasfrancart
tel :  +33 (0)6.71.11.25.97, skype : francartthomas

Received on Tuesday, 17 January 2023 17:04:28 UTC