w3c / json-ld-syntax

JSON-LD 1.1 Specification
https://w3c.github.io/json-ld-syntax/
Other
111 stars 22 forks source link

relative #375

Closed pfps closed 3 years ago

pfps commented 3 years ago

In https://www.w3.org/TR/json-ld11/#iris there is the statement:

In JSON-LD, IRIs may be represented as an IRI reference, which can be relative.

But isn't status a relative IRI reference according to https://datatracker.ietf.org/doc/html/rfc3987#section-1.3? And so shouldn't it be expandable to an IRI?

So why is there no status triple in Example 11 of https://www.w3.org/TR/json-ld11?

gkellogg commented 3 years ago

Vocabulary-relative elements, such as properties, have rules for expansion. Unlike a document-relative property (e.g, @id) properties have no default base IRI, so in the case of Example 11, "status" can not be turned into an absolute IRI, and is discarded (see relative IRI reference). Section 3.2 IRIs also goes into this.

It's not uncommon for context to define an @vocab to define the vocabulary base, which will cause all things interpreted as vocabulary relative, which are not defined terms, to have that vocabulary base prepended. Using "@vocab": "" effectively allows the default vocabulary to be the same as the document base (see section 4.1.4).

pfps commented 3 years ago

It seems to me that according to https://datatracker.ietf.org/doc/html/rfc3986, which is used in https://datatracker.ietf.org/doc/html/rfc3987#section-6.5, relative IRIs are resolved using the base URI, which always exists for a document as one of the ways of determining it is from the location of the document. So "status", as a relative IRI reference, can always be turned into an (absolute) IRI.

dlongley commented 3 years ago

status is not a relative IRI reference in example 11. It is a JSON key that does not possess a colon. In order for a JSON key to be mapped to an IRI, it must either possess a colon (it is an absolute IRI or a CURIE) or it must have a term definition or an @vocab defined in the JSON-LD context. None of these is true in example 11.

pfps commented 3 years ago

So keys are mapped differently from values? That's weird.