Conversation
Generate the JSON-LD context, JSON Schema, SHACL shapes and a merged LinkML schema from src/schema.yaml (version 0.2.0) into schema/versions/<version>/, with versions/manifest.json mapping each version to its source tree, generator versions, file digests, entry points and examples. 0.1.0 is the base Claim at ab39066 (#87). The context is corrected to give the same RDF as the Turtle output (type-scoped terms, enum meanings); SHACL is serialized canonically. check-schema-artifacts validates every version's examples offline with both published validators, checks digests and staleness, and with BASE checks that published versions are unchanged; CI runs it against the base branch. The examples and gen-rdf's playground JSON-LD now use the published artifacts, and gen-rdf checks its JSON-LD against the Turtle. Add c06-mvp-claim-domain-invalid.jsonld, which fails only the C06 practices constraint. Declare the geo: and sdgs: prefixes, without which the Turtle output had unexpanded geo: IRIs and SDG values as strings.
blushi
added this pull request to stack #88
October 5, 2026 15:30
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #74 (WP1-07). Stacked on #90 (base
feat/73-attestation-evidence-c06).It generates the published artifacts from the composed schema, which needs #90's schemas and its shared
QuantityValue(two classes no longer share the class IRIqudt:QuantityValue).Implements ADR: ADR 0001 — "Standards boundaries already established" at
0cfe1c52(#56, Proposed): claims use the schema-generated JSON-LD context from this repository, under a pinned context. This PR publishes that context per schema version, and its check verifies the RDF examples and conversion against a pinned schema revision, which the ADR lists under "Consequences and acceptance".Differences from ADR (if any) and why: the published context is generated (
gen-jsonld-context --xsd-anyuri-as-iri) and then corrected, because the generated context does not give the same RDF as LinkML's Turtle output (see Known limitations). The corrections are made byschema-artifacts.py, and every example and playground fixture is checked against its Turtle.Usage, the versioning rule and the generator limitations are documented in
schema/README.md, "Published schema artifacts".Changes
schema/versions/<version>/, new. Generated fromsrc/schema.yamland its imports, for the version it declares (version: 0.2.0):context.jsonld: the JSON-LD context, corrected;json-schema.json:gen-json-schema --include-range-class-descendants, the optionslinkml-validateuses. The entry point for a class is#/$defs/<class>;shacl.ttl:gen-shacl, unchanged except that it is serialized canonically so that regeneration gives the same bytes;linkml.yaml: the schema with every import merged, includinglinkml:types, so that generation and validation need no import lookups;examples/: the JSON-LD examples with that version's context.schema/versions/manifest.json, new. For each version it records:source: the git tree hash ofschema/src, the blob hash of each module (which pins the imported base and shared modules), and the commit where known;generators: thelinkmlandlinkml-runtimeversions;files: each file's path and SHA-256;entryPoints:Claimand each concrete subclass, with its class IRI, JSON Schema location and SHACL shape;examples: each example's entry point, whether it is valid, and, if not, the only slots it may violate.The tree hash is what
git rev-parse <commit>:schema/srcprints. It survives a squash merge, and both recorded hashes match git's.Two versions.
0.1.0is the base Claim of #85 as upgraded by #87 (commitab39066, treef4c11af), with one entry point (Claim) and two examples. feat(schema): refactor Claim.yaml into the reusable base Claim #85's own head (8d817c7) was not used: itswasRevisionOfhas rangeResource, so its own SHACL rejects its revision example ("Value does not have class rfs:Resource"), and build(schema): upgrade LinkML to 1.11.1 #87 fixed that.0.2.0is this stack (treec9c0f57), with nine entry points and eleven examples.scripts/schema-artifacts.py, new.generatewrites the artifacts,bundlecopies the examples and writes the manifest entry, andcheckvalidates the bundle.--source,--versionand--commitgenerate an older version from an archive of its commit.Makefile. New targets:gen-context,gen-json-schemaandgen-shacl, for one artifact at a time;gen-schema-artifacts, which builds the artifacts, then the examples, then the bundle;check-schema-artifacts [BASE=<ref>], whichallnow includes.check-schema-artifactsblocks network access, then checks:src/is the recorded source and that regenerating gives the same bytes;BASE, that every version published in that ref is unchanged.CI (
sparql-playground.yaml) runs the check. On a pull request it fetches the base branch and passes it asBASE.scripts/claim-examples.py.json-schema.json, instead oflinkml-validate, and the publishedshacl.ttl.@typewherever LinkML inlines an object, including classes without an identifier.linkml-validateon all 20 invalid examples and all 68 playground fixtures.playgroundmode writes each fixture's JSON-LD and checks it against the fixture's Turtle.scripts/gen-rdf.sh.linkml-convert's own context wrote everyuriorcurievalue as anxsd:anyURIliteral.data/playground, even whenDATA_DIRis overridden.c06-mvp-claim-domain-invalid.jsonld, new, generated fromc06-mvp-claim.INVALID-unknown-practice.yaml.c06-mvp-claim.jsonldwith one practice,CONTINUOUS_TILLAGE, that is not anActivityTypeterm. Its base Claim fields are those of the valid example.C06SiteClaim, and the check asserts that every violation is onpractices.src/schema.yamlandsrc/SDG.yaml: two prefix fixes, needed for the JSON-LD and Turtle to agree. Both bugs are already onmain.geo:was not declared in the root schema, so the Turtle output had IRIs such as<geo:asWKT>and<geo:Feature>in every project dataset.update-graphpushed those to the graph store.sdgs:(https://sdgs.un.org/goals/) was not declared, so LinkML dropped the SDG enum's meanings, which are written as full IRIs, andsupportsSDGwas a string. It is not namedsdg: LinkML's generated Python would name that namespaceSDGand clash with the enum.Examples. All ten JSON-LD examples now carry the composed context, so each grows from about 6 KB to about 33 KB.
Docs.
schema/README.mdgets the new section.docs/claim-base.mdanddocs/attestation-and-evidence.mdnow describe the published validators and list the domain-invalid example.#74 checklist
gen-context,gen-json-schema,gen-shacl,gen-schema-artifactstargetsschema/src/schema.yamland its imports as a wholesourceandgenerators; READMEschema/README.mdc06-mvp-claim.jsonldthrough the composed schema, with imported and inherited constraintsC06SiteClaim, closed shapes including the base Claim'sc06-mvp-claim-domain-invalid.jsonld; entry point documented; imported definitions included for offline validationlinkml.yamlmerges every import; the check blocks network accessschema/versions/manifest.json0.1.0;check-schema-artifacts BASE=<ref>, run in CI against the base branchschema/versions/. They are not served on the docs siteValidation
Run locally with the pinned toolchain (
requirements.txt: linkml 1.11.1, pyshacl 0.40.1, Python 3.10), on the tree committed asaa130d2:make -C schema lintmake -C schema check-claim-examplesmake -C schema gen-rdfmake -C schema check-schema-artifactspracticesonly), entry points and digestsmake -C schema gen-docFailure cases, tested with temporary inputs:
0.1.0fails with "must not change: declare a new version";src/without regenerating fails;@contextwith the network blocked raises an error instead of fetching.Not run:
update-graph(needs a graph store) and the site build.Known limitations and open points
gen-shacldrops a class-levelany_of. A slot-levelany_ofover enums gets no meaning mapping in the context, so SHACL rejects valid values, andlinkml-convertfails on it;decimalslot fails SHACL, while a string passes;sh:classwithout the class hierarchy;uriorcurieslot cannot be narrowed to an enum;gen-shacl's output order varies between runs.ImpactType'sUNKNOWN), a value without one expands against@vocab(rfs:) in JSON-LD, while the Turtle output has a string. No fixture uses it.src/after a version is published needs a new version, including a description-only change, because the source is identified by its tree hash. Upgrading LinkML also changes the artifacts, so it needs a new version too.0.1.0's commitab39066will be orphaned when build(schema): upgrade LinkML to 1.11.1 #87 is squash-merged; GitHub keeps it under build(schema): upgrade LinkML to 1.11.1 #87's pull ref, and the tree hash identifies the source either way.0.2.0records no commit, because its merge commit does not exist yet.main, and whether the bundle should also be served on the docs site.