Skip to content

Using @annotation on a @type #24

@niklasl

Description

@niklasl

I cannot find a convenient way to express this:

@base: <http://example.org/abox/> .
@prefix : <http://example.org/tbox#> .

  :bob a :Person {| :accordingTo :alice |} .

as compact JSON-LD-star using the @annotation design along with @type. Am I missing something or is this a limitation of the current design?

If it is, and without resorting to context trickery, I could imagine a new special form like this might do the trick:

{
  "@context": {
    "@base": "http://example.org/abox/",
    "@vocab": "http://example.org/tbox#"
  },
  "@id": "bob",
  "@type": {
    "@type": "Person",
    "@annotation": {
      "accordingTo": {"@id": "alice"}
    }
  }
}

But with that, "@type": {"@type": "Person"} would have to be supported in general, which isn't so nice. I guess a variant could be "@type": {"@value": "Person"}. Alas, both forms might come off a bit like hacks for this purpose. Defining a new keyword, say @symbol, as a companion to @id but resolving against the context, might do it, but with all the drawbacks of yet another new keyword.

(It's possible to work around this limitation and get a "fairly compact" form, e.g. by not using @type and resorting to a plain rdf:type link using a regular non-@vocab-resolved @id value. (Or define a key in the context with a nested context where @base is set to the value of @vocab, albeit that'd resolve differently for e.g. hash-IRI:s as in the example.) But I'm looking for a way to leverage @type as is, resolving to @vocab, to keep the compact form as close to "regular" compact JSON-LD as possible.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions