Skip to content

Add SHACL shapes per entity type and CI validation workflow - #4

Merged
namedgraph merged 2 commits into
masterfrom
shacl-validation
Jul 17, 2026
Merged

Add SHACL shapes per entity type and CI validation workflow#4
namedgraph merged 2 commits into
masterfrom
shacl-validation

Conversation

@namedgraph

Copy link
Copy Markdown
Member

Summary

  • etl/shapes/<domain>.ttl — SHACL shapes for all 11 entity classes, parallel to the vocabulary choices in etl/ONTOLOGY-NOTES.md: skos:ConceptScheme/skos:Concept (taxonomies), cv:AdminUnit/dct:Location (admin-units), rov:RegisteredOrganization (legal-entities), foaf:Person/org:Membership/time:Interval/time:Instant/org:OrganizationalUnit/org:FormalOrganization (seimas). Shapes describe what the mappings guarantee on current data; URI patterns match path suffixes only, so make BASE=… outputs still validate.
  • etl/lib/shacl.sh — wrapper that flattens TriG to the union of its named graphs (riot --merge; Jena shacl silently ignores named graphs) and gates on the --text report (Jena shacl always exits 0, even on violations).
  • etl/lib/validate.sh — auto-selects etl/shapes/<domain>.ttl by output directory, so SHACL runs as part of the existing validate stage on every make (including the gitignored bulk settlements/streets files).
  • .github/workflows/shacl-validation.yml — validates all committed datasets/current/**/*.trig on push/PR with the same scripts (cached Apache Jena 5.6.0, sha512-verified download, no fail-fast, per-file error annotations). Overlay files (alignments.trig, photos.trig) get SHACL only — their graphs intentionally lack the dct:title/foaf:primaryTopic invariants.

Test plan

  • riot --validate on all four shapes files
  • All 17 committed + 2 bulk gitignored TriG files conform locally
  • Negative test: fixture with skos:notation removed → violation report + exit 1
  • validate.sh chains SHACL and still prints the valid: line
  • CI loop replicated locally in bash → exit 0
  • Workflow run green on this PR

🤖 Generated with Claude Code

namedgraph and others added 2 commits July 17, 2026 10:14
Shapes in etl/shapes/<domain>.ttl (parallel to the vocab choices in
ONTOLOGY-NOTES.md) formalize property/datatype/cardinality constraints
for all 11 entity classes. etl/lib/shacl.sh flattens TriG to the union
of its graphs (Jena shacl ignores named graphs) and gates on the --text
report (shacl always exits 0). validate.sh auto-selects the shapes file
by output dir, so shapes run on every make; the GitHub Actions workflow
runs the same scripts on committed datasets on push/PR.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CLI behavior the SHACL wrapper depends on is unchanged (verified:
riot --merge, exact "Conforms" text, exit 0 on violations). Jena 6
requires Java 21+ (jars are class-file 65) — CI already uses temurin 21;
docs updated. Full validation suite re-run green on 6.1.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@namedgraph
namedgraph merged commit 11d0cb1 into master Jul 17, 2026
3 checks passed
@namedgraph
namedgraph deleted the shacl-validation branch July 17, 2026 07:28
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.

1 participant