Closed lambdakris closed 2 years ago
@context
is the cornerstone of JSON-LD: it dictates how all other attributes in the JSON document must be interpreted (and ultimately converted into RDF triples). Its role is prescriptive.
@type
is just one special attribute, which translates to rdf:type
. Its role is purely descriptive in that respect.
Now, things actually get a little more complicated in JSON-LD 1.1 with type-scoped contexts [1]: the top-level context can contain a directive saying "if @type
has this value, then apply locally these additional context rules". It may look like @type
is acting like a context in this situation, but this is actually driven by the top-level context, not by @type
itself. I hope this helps.
@pchampin thank you so much for this explanation! The part about type scoped contexts is exactly what had thrown me off initially and your explanation addresses it precisely.
@lambdakris One more clarification:
translates to
rdf:type
That pertains to nodes (subjects).
But @type
when applied to values (objects) means a datatype (eg xsd:integer
).
Hi, I have a question about the difference between context and type. Now, I obviously see the numerous structural differences, but what I'm wondering is, what does a context mean that a type doesn't mean, and when would you use a type instead of a context (and sub-contexts)? Or asked a different way, what does using a context get you that using a type doesn't and vice versa?