w3c / w3c/json-ld-api

Under what situations would base_url in the context processing algorithm be invalid?

Open
#573 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Editorial editorial:class 2 ErratumRaised spec:editorial
Dominant language
HTML
Stars
106
Forks
40
PR merge metrics
No merged PRs in 30d

Description

In 5.2.1 of the context processing algorithm it says:

Initialize context to the result of resolving context against base URL. If base URL is not a valid IRI, then context MUST be a valid IRI, otherwise a loading document failed error has been detected and processing is aborted.

But in the description of section 4.1.2 it says the following:

The required inputs are an active context, a local context, and a base URL used when resolving relative context URLs

Implementations seem to diverge in how they handle this with Rust's json-ld treating it as optional, the java titanium just ignores that it might not be a "valid" IRI, as does the ocaml RDF implementation.

Because this is a sub-algorithm for other algorithms (though it isn't treated as such per se) there don't seem to be any tests rooted in the inputs or expected outputs for this algorithm, but looking at where it does get called:

Set active context to the result of the Context Processing algorithm, passing active context, the value of the active property's local context as local context, base URL from the term definition for active property in active context, and true for override protected.

This is for the situation where the term definition is an expanded term definition containing a local context that must be a valid context definition. That does allow your base to be null but it is difficult to tell at a glance whether this would come up in practice during the processing.

So it seems like one of the following must be true:

  1. The description is incorrect and base_url is an optional (or at least nullable) attribute, but it cannot be "invalid."
  2. Some other piece is incorrect/incomplete and we expect invalid IRIs to come from somewhere, but don't say what they might look like. I guess a variation on this would be something like "despite being named base_url we should treat the value of base_url as being potentially not a URL, IRI, or anything else in the genre."
  3. The algorithm is incorrect and we never expect to see an invalid IRI at this stage of processing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing section 5.2.1 of the context processing algorithm with section 4.1.2 and the call from algorithm 6. Review the linked Rust, Titanium, and OCaml implementations and determine whether base_url can be null or invalid in practice. Done means resolving the specification wording and identifying any needed algorithm or test changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.