Sync db-server SHACL validation from deployment repo#333
Merged
Conversation
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).
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.
Replays the last 3 commits from
case-study-record-manager-deployment'sconfigs/db-server/into this repo's vendored copy atdeploy/shared/db-server/, keeping the two in sync.Changes
[Add]SHACL validation of import data before deploy — generic, advisory validation pass inrepo-init.sh: any data folder may carry ashapes/subfolder whose*.shapes.ttlfiles are validated (warn-only) against all*.ttlfiles under the parent before deployment. Addsvalidate-shacl.sh(pyshacl wrapper, run inside the db-server container) and installsrdflib+pyshaclvia pip in theDockerfile.[Add]form-template SHACL shape — first*.shapes.ttlunderforms/shapes/, enforcing the form-template triple pattern (form:form-templatetyped, withrdfs:labelandrdfs:comment).[Fix]skip form files without exactly oneform:form-template— drop thesedpipe that masked the helper script's non-zero exit; renameget-rdf-subject-by-type.py→get-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.