From 98e56fb7182b7e8e2edc7e67b16f7365a45b3cbf Mon Sep 17 00:00:00 2001 From: "John P. McCrae" Date: Wed, 12 Jun 2024 08:54:53 +0100 Subject: [PATCH 1/3] Add RDF validation to GitHub workflow --- .gitignore | 1 + dmlex-v1.0/specification/Makefile | 11 ++++++++++- .../specification/examples/examples/source/8.rdf | 2 +- .../specification/serializations/RDF/verify_shacl.sh | 7 ------- 4 files changed, 12 insertions(+), 9 deletions(-) delete mode 100644 dmlex-v1.0/specification/serializations/RDF/verify_shacl.sh diff --git a/.gitignore b/.gitignore index e3cd38d4..3c6b63be 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ dmlex-v1.0/specification/dmlex_uml_core_sm.png dmlex-v1.0/specification/dmlex-v1.0-csd02.fo dmlex-v1.0/specification/dmlex-v1.0-csd02.pdf dmlex-v1.0/specification/dmlex-v1.0-csd02.xml +dmlex-v1.0/specification/.venv diff --git a/dmlex-v1.0/specification/Makefile b/dmlex-v1.0/specification/Makefile index ab7de40f..ef4cda96 100644 --- a/dmlex-v1.0/specification/Makefile +++ b/dmlex-v1.0/specification/Makefile @@ -34,7 +34,7 @@ Makefile.dep: dmlex.xml $(SOURCE_XML) makedep.sh echo -n "SOURCE_XML=" > $@ ./makedep.sh >> $@ -.PHONY: clean validate_xml validate_json +.PHONY: clean validate_xml validate_json validate_rdf clean: rm -f dmlex-$(VERSION).html dmlex-$(VERSION).pdf dmlex-$(VERSION).fo dmlex-$(VERSION).xml Makefile.dep dmlex_uml.svg dmlex_uml.pdf dmlex.dot dmlex.dot.content @@ -69,3 +69,12 @@ validate_json: jsondep validate_json.py schemas/JSON/dmlex.schema.json schemas/J exit 4; \ } \ done + +validate_rdf: jsondep schemas/RDF/dmlex.shacl + @for rdfexample in examples/examples/source/*[0-9].rdf; do \ + echo validating "$$rdfexample"; \ + python -m pyshacl -s schemas/RDF/dmlex.shacl -df turtle $$rdfexample -e schemas/RDF/dmlex.ttl -i rdfs \ + || { echo "validation of $$rdfexample failed"; \ + exit 5; \ + } \ + done diff --git a/dmlex-v1.0/specification/examples/examples/source/8.rdf b/dmlex-v1.0/specification/examples/examples/source/8.rdf index 9f785a9b..2c408924 100644 --- a/dmlex-v1.0/specification/examples/examples/source/8.rdf +++ b/dmlex-v1.0/specification/examples/examples/source/8.rdf @@ -13,7 +13,7 @@ ex:doctor-n-1 a dmlex:Sense; dmlex:headwordTranslation [ a dmlex:HeadwordTranslation; dmlex:text "Ă„rztin"; dmlex:listingOrder "2"^^xsd:unsignedInt; - dmlex:langCode "de" + dmlex:langCode "de" ; dmlex:partOfSpeech [ dmlex:tag "n-fem"; dmlex:listingOrder "1"^^xsd:unsignedInt ] ], diff --git a/dmlex-v1.0/specification/serializations/RDF/verify_shacl.sh b/dmlex-v1.0/specification/serializations/RDF/verify_shacl.sh deleted file mode 100644 index ad02975f..00000000 --- a/dmlex-v1.0/specification/serializations/RDF/verify_shacl.sh +++ /dev/null @@ -1,7 +0,0 @@ -# Run in dmlex-v1.0/specification/serializations/RDF/ - -for f in `ls ../../examples/examples/source/*.rdf` -do - echo "Validating $f" - pyshacl -s ontology/dmlex.shacl -df turtle $f -e ontology/dmlex.ttl -i rdfs -done From ca04bacecdde0dc5545ed8d7adf445cd1af6ccb1 Mon Sep 17 00:00:00 2001 From: "John P. McCrae" Date: Wed, 12 Jun 2024 09:03:11 +0100 Subject: [PATCH 2/3] Enable RDF validation --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 233b6ae2..43d4f8a8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,9 +24,9 @@ jobs: - uses: actions/checkout@v2 - name: Install packages for XML and JSON validation run: | - pip install xmlschema jsonschema xmlstarlet + pip install xmlschema jsonschema xmlstarlet pyshacl - name: Validate - run: make validate_xml validate_json + run: make validate_xml validate_json validate_rdf build: needs: validate From 028de39681e64aa56c35b0b8029e13c257b60591 Mon Sep 17 00:00:00 2001 From: "John P. McCrae" Date: Wed, 12 Jun 2024 09:58:14 +0100 Subject: [PATCH 3/3] Make RDF tests run on PR alos --- .github/workflows/pr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index bfe2f0b1..3c6d7759 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -24,9 +24,9 @@ jobs: - uses: actions/checkout@v2 - name: Install packages for XML and JSON validation run: | - pip install xmlschema jsonschema xmlstarlet + pip install xmlschema jsonschema xmlstarlet pyshacl - name: Validate - run: make validate_xml validate_json + run: make validate_xml validate_json validate_rdf build: needs: validate runs-on: ubuntu-latest