MHPKG: carry the 2026-09-15 Termboard draft into the schema, with a delta check #62 - #63
Merged
Merged
Conversation
Adds the aggregated inventory analysis, greenhouse gas emission values and shares, a technology dimension and temporal resolution, each on an OEO or MHPO term. Where neither has one, it becomes TERM REQUEST 6 (convoy planning) and 7 (what a share is a share of). Two rules the generated shapes can no longer carry, because they depend on the container rather than the class, move to a second hand-written file, mhpkg_context.shacl.ttl: a target-scenario value is for 2024 or later, and a plan has exactly one target scenario. Negative-control cases 8-10 assert them and the per-class unit ranges. The example value IRI is now the one mint_slice.py mints; the committed one could not be reproduced from any tuple the IRI policy describes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
termboard_delta.py reads a Termboard JSON export and the committed termboard_mapping.yaml and reports unmapped, removed and dangling names, drawn relations the schema cannot express, and untyped relations with no named counterpart. It compares and never converts: every schema change stays a human decision recorded in the mapping. The JSON export is used because the OWL export is not valid RDF/XML. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Also retracts the provisional-name warning from the root README, the one copy the earlier retraction missed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Summary of the discussion
#62: the new Termboard draft (8922125, 2026-09-15) added parts the LinkML schema did not know, and there was no repeatable way to see the delta between a Termboard export and the schema.
Approach agreed with the maintainer: compare, don't convert. The tool diffs the Termboard JSON export against the schema through a committed mapping file. Every schema change stays a human decision, and the mapping records it. The JSON export is used because the OWL export is not valid RDF/XML (details below).
The loop now
Documented in
mhpkg/model/README.md.What the tool reports
related toedges with no named counterpartterm_request,deferredandopenentries are listed as known and do not fail. Run against the unchanged schema, the 2026-09-15 export produced 13 findings: 3 missing classes, 2 enums, 3 enum values, 2 slots and 3 out-of-range edges. That list was the work for this PR. The tool was also checked with a deliberately broken export and mapping, and every check fired.Schema changes (2026-09-15 draft)
AggregatedInventoryAnalysismhpo:MHPO_00020005GreenhouseGasEmissionValueoeo:OEO_00340065FractionValueoeo:OEO_00140127covers_technology,TechnologyEnumoeo:OEO_00390101; asserted subclasses ofOEO_00020308has_temporal_resolution,TemporalResolutionEnumoeo:OEO_00000516,oeo:OEO_00020161MassUnitEnum.metric_tonoeo:OEO_00010137FractionUnitEnum.percentobo:UO_0000187open— the IRI already is the identity (MH-02, #61)deferred— the draft gives it no contentGreenhouseGasEmissionValuevscarbon dioxide equivalent quantity value(OEO_00140083). The class follows the Termboard name. If every MHPKG emission figure is in tCO2eq, the narrower class may be the better one.mhpkg_context.shacl.ttl.tartget scenario indicators, delete an unnamed self-edge onfinal energy consumption value, and drop therelated toedges that duplicate a typed one.Findings along the way
owl:Restrictionsits insiderdfs:subClassOf rdf:parseType="Resource", and rdflib rejects it.gen-shaclconstrains per class, so "a target-scenario value is ≥ 2024" and "exactly one target scenario" (lost whenhas_partbecamesh:orover two classes) now live in a second hand-written shapes file. Removing that file makes exactly the four expected negative cases fail. This is input for MH-07: hand-written companions are a category, not a single exception.TechnologyEnumneeds no reasoner. OEO's heat generation technologies are asserted subclasses, unlike energy carriers.value/a878a3a1-…was not whatmint_slice.pymints, and no tuple variant reproduced it. It is replaced with the mintedvalue/78153046-….kassel_valid.ttlrecommendedpyshacl -s … -s …, the trapvalidate.pyexists to avoid (only the last-sis used). It now points atvalidate.py.mhpkga provisional name; the earlier retraction missed that copy.Verification (local)
validate.py: valid example CONFORMS; negative control 20 violations, 20 accounted for (cases 1–10 plus 4 documented cascades)check_generated.py: generated SHACL matches the schema (494 triples, isomorphic)termboard_delta.py --check: exit 0, 9 known and recorded holesuv lock --check: OK.mkdocs build --strict: OK. No dependency changes.Not included: the MHPO pin has moved (
34776b6→ae9e4d3, +18/−4 terms), but none of the new terms is needed here. The delta check is not wired into CI; that belongs with MH-12.Type of change (CHANGELOG.md)
Added
mhpkg/model/termboard_delta.py,termboard_mapping.yaml,README.md: the Termboard → schema delta checkmhpkg/schema/: the 2026-09-15 draft (three classes, two slots, four enums, term requests 6–7),mhpkg_context.shacl.ttl, negative-control cases 8–10Updated
has_scenario_year_valuefloor 2024 → 1990; the example value IRI is now reproducible; the stale provisional-name warning in the root README is removedRemoved
Workflow checklist
Automation
Closes #62
PR-Assignee
Reviewer
🤖 Generated with Claude Code