json-ld-api
json-ld-api copied to clipboard
Unify document loading in Context Processing?
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.1details how resolving thecontextstring againstbase URLmight fail ;5.6.3does not mention anything about failure when resolving the value of@importagainstbase URL5.2.4is very explicit about not dereferencing a URL that has already been dereferenced ;5.6.4goes straight into dereferencing without any further consideration
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.
Thanks @gkellogg. I guess not but would it make sense at all to also replicate 5.2.3 in 6, WRT to remote contexts?
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).