1

Is it possbile to compact iris in @id via the context? I didn't found a solution for that, without using @base.

    {
      "@context":  {
        "MaxMustermann": "http://example.org/MaxMustermann",
        "name": "https://schema.org/name"
      },
      "@id": "MaxMustermann",
      "name": "Max Mustermann"
    }

best regards

frm
  • 35
  • 4

1 Answers1

0

You could write your @id as a compact IRI using a notation consisting of a prefix and a suffix. Prefixes are defined inside your @context. Have a look at this input:

{
  "@context": {
    "ex": "http://example.org/",
    "foaf": "http://xmlns.com/foaf/0.1/"
  },
  "@type": "foaf:Person",
  "@id":"ex:MaxMustermann"
}

This translates to this expanded definition:

[
  {
    "@id": "http://example.org/MaxMustermann",
    "@type": [
      "http://xmlns.com/foaf/0.1/Person"
    ]
  }
]

You can also view this example on the JSON-LD playground. As you can see, the prefix ex is used to abbreviate the namespace of the @id IRI. Same goes for @type where the prefix foaf is used. Is this what you're looking for?

Aljosha Koecher
  • 443
  • 6
  • 17