eastdino
eastdino

Reputation: 23

What does mean @id and @type in json-ld context?

What does mean this statement in json-ld context?

{
  "@context": {
      "@version": 1.1,
      "id": "@id",
      "type": "@type"
  }
}

and

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

I do not figure out that expression means what.

Upvotes: 1

Views: 1528

Answers (1)

jschnasse
jschnasse

Reputation: 9548

Json-Ld is designed to be interoperable with rdf. Therefore it introduces certain keywords marked with @. This keywords are needed to create rdf-statements from the json document.

A good starting point to get familar with the underlying concepts is to play around with the Json-Ld Playground. You will find some examples there. You can use the examples to create conversions from one format into another.

Getting rid of the '@'-character

Sometimes the '@'-character can become unhandy, e.g. when working with Javascript. In such situations it is possible to define an alias for an '@'-keyword. Like shown in your context:

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

By defining aliases for '@'-keywords the actual json document is easier to consume by non-rdf applications while it is still possible to process the data as rdf.

Upvotes: 1

Related Questions