w3c / json-ld-syntax

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

Terminology of "absolute IRI" differs from RFC 3986 / 3987? #288

Closed lo48576 closed 4 years ago

lo48576 commented 4 years ago

In JSON-LD spec, "absolute IRI" is actually same as "IRI" in RFC 3987 (defined by IRI rule), but not "absolute IRI" in RFC 3987 (defined by absolute-IRI rule).

An absolute IRI is defined in [RFC3987] as containing a scheme along with path and optional query and fragment segments.

--- Section 3.2 (IRIs) in JSON-LD-SYNTAX

The absolute form of an IRI containing a scheme along with a path and optional query and fragment segments.

--- Section 1.4 (Terminology) in JSON-LD-SYNTAX

IRI reference: Denotes the common usage of an Internationalized Resource Identifier. An IRI reference may be absolute or relative. However, the "IRI" that results from such a reference only includes absolute IRIs; any relative IRI references are resolved to their absolute form. Note that in [RFC2396] URIs did not include fragment identifiers, but in [RFC3986] fragment identifiers are part of URIs.

Section 1.3 (Definitions) in RFC 3987

Some protocol elements allow only the absolute form of a URI without a fragment identifier. For example, defining a base URI for later use by relative references calls for an absolute-URI syntax rule that does not allow a fragment.

absolute-URI  = scheme ":" hier-part [ "?" query ]

--- Section 4.3 (Absolute URI) in RFC 3986

It seems that RFC 3986 (and also 3987) defines hierarchy of some kinds of URIs / IRIs:

URI reference         (absolute or relative. fragment part is allowed)
|-- URI               (absolute. fragement is allowed)
|   `-- absolute URI  (absolute. fragment is NOT allowed)
`-- relative URI      (relative. fragment is allowed)

Simply saying "URI" (and "IRI") automatically means it is absolute, and it should be called "IRI reference" to include relative IRI. "Absolute IRI" (defined by absolute-IRI rule) seems to be unable to have a fragment. (However, RFC also saying "absolute form" of IRI references, so RFC itself is confusing...)

So, I think "absolute IRI" in JSON-LD spec and "absolute IRI" in RFC differs. The former is defined by IRI rule and called "IRI" in RFC, but the latter is defined by absolute-IRI rule.

Conclusion:

I'm sorry if I am misunderstanding...

pchampin commented 4 years ago

Thanks for pointing that out. Digging a little more into the RFCs, I found the following NOTE (in RFC 3986 §1.2.3):

NOTE: Previous specifications used the terms "partial URI" and "relative URI" to denote a relative reference to a URI. As some readers misunderstood those terms to mean that relative URIs are a subset of URIs rather than a method of referencing URIs, this specification simply refers to them as relative references.

So what the JSON-LD specs calls "absolute IRI" and "relative IRI" should in fact be called "absolute IRI reference" (which is equivalent to "IRI") and "relative IRI reference". According to the RFC "absolute IRI" is more restrictive (no fragment) and "relative IRI" does not exist...

NB: I know that the term "absolute IRI reference" is never used in the RFC, but since "relative IRI reference" is, and we have a mention of "the absolute form [of an IRI reference]", I think we can safely extrapolate that.

I see two options here. I'll post them in different comments so that people express their opinion with the thumbs up/down icons.

pchampin commented 4 years ago

Option 1

We replace, in the terminology section and in the full text of the specs, all occupernces of

We mention in the definition of "absolute IRI reference" that it is equivalent to "IRI" per RFC 3987, but I think it is important in our specs that we keep it explicit that they are absolute. Most people reading "IRI" may wrongly think "it might be absolute or relative".

pchampin commented 4 years ago

Option 2

We bite the bullet and we explain in the terminology section that our use of "absolute IRI" and "relative IRI" is not strictly aligned with RFC 3987, but that we decided to keep it because

gkellogg commented 4 years ago

I think the other option is to just use IRI for absolute IRI, and relative IRI reference for relative IRI. There are some cases where we may use IRI in an inconsistent way, but this better aligns us with best practice.

The Terminology references are directly to the RFCs, and not into our own Terminology section, so we probably can't count on people seeing this when looking up a term, but we do that already for list/array.