json-ld-api icon indicating copy to clipboard operation
json-ld-api copied to clipboard

Unify document loading in Context Processing?

Open helins opened this issue 1 year ago • 4 comments

The Context Processing Algorithm deals with dereferencing remote documents at 2 occasions: 5.2 and 5.6. Both look very similar to the point where I do not understand why there are seemingly differences:

  • 5.2.1 details how resolving the context string against base URL might fail ; 5.6.3 does not mention anything about failure when resolving the value of @import against base URL
  • 5.2.4 is very explicit about not dereferencing a URL that has already been dereferenced ; 5.6.4 goes straight into dereferencing without any further consideration

helins avatar Dec 11 '23 19:12 helins

5.6.5 says what to do if loading the document fails; this would include cases where the URL is invalid.

5.2.4 is explicit about not dereferencing again, due to potential recursion loops. I don't think that the @import case had the same concern (@dlongley may recall), but implementations are generally encouraged to cache the result of retrieving external documents, which could be considered an expected optimization.

gkellogg avatar Dec 11 '23 20:12 gkellogg

Thanks @gkellogg. I guess not but would it make sense at all to also replicate 5.2.3 in 6, WRT to remote contexts?

helins avatar Dec 12 '23 21:12 helins

5.6.5 says what to do if loading the document fails; this would include cases where the URL is invalid.

True, but that's a different error. 5.2.1 tells you what to do if the base URL is invalid, and therefore resolving the context URL against it is not possible. 5.6.3 does not tell you what to do in this situation... @helins has a point, we should probably render both steps more homogeneous.

implementations are generally encouraged to cache the result of retrieving external documents, which could be considered an expected optimization.

I agree, but again, the fact that it is explicitly mentioned in one part, and not in another, may confuse implementers (as demonstrated by this issue).

pchampin avatar Jul 10 '24 15:07 pchampin

Discussed on [today's call](https://json-ld.org/minutes/2024-07-10/#52)
https://github.com/w3c/json-ld-api/issues/584 -> Issue 584 Unify document loading in Context Processing? (by helins) [spec:editorial] [ErratumRaised]
Gregg Kellogg: Perhaps a chance to DRY up the text.
Pierre-Antoine Champin: I'm hesitant to extract the common functionality, so maybe just go for consistency so as not to disrupt the flow of the document.

gkellogg avatar Jul 10 '24 17:07 gkellogg