Skip to content

Pin the canonical context IRI and move to the stable namespace - #8

Merged
jgoodyear merged 1 commit into
mainfrom
canonical-context-iri
Oct 11, 2026
Merged

jgoodyear merged 1 commit into
mainfrom
canonical-context-iri

Conversation

@ANierbeck

Copy link
Copy Markdown
Contributor

What

Pins the canonical context IRI for 0.0.1 and moves the term namespace to the stable https://sourcelume.apache.org/ns#. Follows the dev-list discussion "Canonical IRI for the Sourcelume JSON-LD context, and pinning it" (11 Oct).

  • Context IRI: records reference https://sourcelume.apache.org/context/0.0.1/sourcelume.jsonld and nothing else. The JSON Schema enforces this with const, so inline @context objects and other hosts are rejected.
  • Namespace: sl: moves from /ns/0.0.1# to /ns# in the context and the SHACL shapes. The context URL stays versioned, so the term IRIs are the same in every spec version.
  • Validator: tools/validate.py resolves the canonical context from the bundled copy instead of fetching it, so validation stays offline.

Not in this PR

  • Hosting the context at the canonical URL (sourcelume-site, infra).
  • Digest pinning. Deferred until Attest, as proposed on the list.
  • Vocabulary changes raised in review (contentCreated ranges, license validity, origin IRI, action vocabulary, dct vs. schema mapping). Those come as a separate discussion before the 0.0.1 vote.

Verification

  • uv run python -m unittest discover -s tests: 6 tests pass, including new negative tests for inline and foreign context IRIs and a check that the schema constant equals validate.CANONICAL_CONTEXT_IRI.
  • Checked that a record with the canonical context expands to https://sourcelume.apache.org/ns#ProvenanceRecord.
  • uv run python tools/validate.py runs clean (no examples on main yet).

Note for the registry

The registry CI checks out this repo's main. Its validator constant (ShaclRecordValidator.PROVENANCE_RECORD_CLASS) and its context check need the same change once this is merged.

Apache-ai: Yes
Generated-by: pi (claude-haiku-5-5)
Reviewed-by: anierbeck

Records may only reference the canonical context IRI
https://sourcelume.apache.org/context/0.0.1/sourcelume.jsonld. The JSON
Schema rejects inline @context objects and other IRIs, so the meaning of
a record is fixed by the published context.

The term namespace moves from /ns/0.0.1# to the stable /ns#; the context
URL stays versioned. tools/validate.py resolves the canonical context
from the bundled copy instead of fetching it.

Apache-ai: Yes
Generated-by: pi (claude-haiku-5-5)
Reviewed-by: anierbeck
@jgoodyear
jgoodyear merged commit c52b6e5 into main Oct 11, 2026
2 checks passed
@jgoodyear
jgoodyear deleted the canonical-context-iri branch October 11, 2026 16:32
jgoodyear pushed a commit that referenced this pull request Oct 11, 2026
* Add optional contentCreatedEnd for content created over a period

contentCreated could only hold one point in time and told authors to
use the start of a period, which dropped the end. contentCreatedEnd is
an optional companion: contentCreated stays the start of the period, so
existing records remain valid.

The SHACL shapes reject an end that lies before the start. The same
shapes were checked with pyshacl and with Jena SHACL, which the
registry uses.

Apache-ai: Yes
Generated-by: pi (claude-haiku-5-5)
Reviewed-by: anierbeck

* Require @context and assert the record type survives expansion

Review findings on the canonical context change:

- @context is now a required property. The const only applies when the
  key is present, and tools/validate.py injects the local context, so a
  record without @context used to pass the command line check although
  other JSON-LD processors cannot expand it.
- The valid-record test asserts that the expanded graph contains
  rdf:type sl:ProvenanceRecord. Without a focus node the SHACL shapes
  pass vacuously; the assertion fails if the namespace and the shapes
  drift apart.
- The context section no longer claims the file is already served at the
  canonical address; the release process publishes it.

Apache-ai: Yes
Generated-by: pi (claude-sonnet-5-5)
Reviewed-by: anierbeck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants