Skip to content

Sync db-server SHACL validation from deployment repo#333

Merged
blcham merged 3 commits into
mainfrom
dev/db-server-shacl-validation
Jun 24, 2026
Merged

Sync db-server SHACL validation from deployment repo#333
blcham merged 3 commits into
mainfrom
dev/db-server-shacl-validation

Conversation

@blcham

@blcham blcham commented Jun 24, 2026

Copy link
Copy Markdown

Replays the last 3 commits from case-study-record-manager-deployment's configs/db-server/ into this repo's vendored copy at deploy/shared/db-server/, keeping the two in sync.

Changes

  • [Add] SHACL validation of import data before deploy — generic, advisory validation pass in repo-init.sh: any data folder may carry a shapes/ subfolder whose *.shapes.ttl files are validated (warn-only) against all *.ttl files under the parent before deployment. Adds validate-shacl.sh (pyshacl wrapper, run inside the db-server container) and installs rdflib + pyshacl via pip in the Dockerfile.
  • [Add] form-template SHACL shape — first *.shapes.ttl under forms/shapes/, enforcing the form-template triple pattern (form:form-template typed, with rdfs:label and rdfs:comment).
  • [Fix] skip form files without exactly one form:form-template — drop the sed pipe that masked the helper script's non-zero exit; rename get-rdf-subject-by-type.pyget-rdf-subject-iri-by-type.py (now prints a bare IRI) so its error propagates and the deploy loop skips bad files via || continue.

The three pre-existing files touched were byte-identical to the source's pre-commit base, so the patches applied with no conflicts; the resulting files are byte-identical to the source HEAD.

blcham added 3 commits June 24, 2026 16:35
Add a generic, advisory SHACL validation pass to the db-server init:
any data folder may contain a shapes/ subfolder whose *.shapes.ttl files
are validated (warn-only) against all *.ttl files recursively in the
parent folder before deployment to GraphDB.

- repo-init.sh: validate_shapes_folder() + pre-deploy scan over shapes/ dirs
- validate-shacl.sh: pyshacl wrapper run inside the db-server container
- Dockerfile: install rdflib + pyshacl via pip
First *.shapes.ttl under forms/shapes/, enforcing the triple-level
form-template pattern (form:form-template typed, with rdfs:label and
rdfs:comment). Picked up automatically by the SHACL validation pass.
The form-deploy loop piped get-rdf-subject-by-type.py into sed, which
masked the script's non-zero exit (none/multiple templates), leaving an
empty context and deploying the file into the default graph. Drop the
pipe: the script now prints a bare IRI and its error propagates, so the
loop skips such files via '|| continue'.

Rename get-rdf-subject-by-type.py -> get-rdf-subject-iri-by-type.py to
make the bare-IRI return value explicit (also noted in its usage text).
@blcham
blcham merged commit 2429577 into main Jun 24, 2026
2 checks passed
@blcham
blcham deleted the dev/db-server-shacl-validation branch June 24, 2026 14:39
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