Update shacl.yaml #431
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
| name: shacl validation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| #on: | |
| # workflow_run: | |
| # workflows: [MAKE] | |
| # branches: [main] | |
| # types: | |
| # - completed | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| ref: main | |
| path: main | |
| - name: Validate against SHACL shapes | |
| run: | | |
| pip install pyshacl | |
| curl -L -o robot.jar "https://github.com/ontodev/robot/releases/latest/download/robot.jar" | |
| #java -jar robot.jar --version | |
| # merge the current EDIT version and all components into one ontology file | |
| java -jar robot.jar merge --catalog main/src/ontology/catalog-v001.xml --input main/src/ontology/pmdco-edit.owl --output merged-pmdco.ttl | |
| for DIR in main/patterns/*/ | |
| do | |
| if [[ "$DIR" != "main/patterns/unused/" ]]; then | |
| if [[ "$DIR" != "main/patterns/autoshape/" ]]; then | |
| echo "processing: $DIR" | |
| SHAPEFILE="${DIR}shape.ttl" | |
| DATAFILE="${DIR}shape-data.ttl" | |
| echo "testing shape" | |
| java -jar robot.jar merge --collapse-import-closure false --input merged-pmdco.ttl --input "$DATAFILE" reason --reasoner hermit --output shape-data-reasoned.ttl | |
| python3 -m pyshacl -s "$SHAPEFILE" shape-data-reasoned.ttl | |
| echo "testing autoshapes" | |
| # test with autoshapes | |
| python3 -m pyshacl -s main/patterns/autoshape/auto-shapes-open.ttl shape-data-reasoned.ttl | |
| echo "testing missing IRIs 1" | |
| # test that all classes in the a-box are present in PMDco ontology | |
| java -jar robot.jar export --input "$DATAFILE" --header "IRI" --include "classes properties" --export ids.txt | |
| echo "testing missing IRIs 2" | |
| tail -n +2 ids.txt > ids2.txt | |
| echo "testing missing IRIs 3" | |
| grep -Fof ids2.txt merged-pmdco.ttl | sort -u | grep -Fvf - ids2.txt > missing.txt | |
| echo "testing missing IRIs 4" | |
| cat missing.txt | |
| echo "testing missing IRIs 5" | |
| if [ -s missing.txt ]; then | |
| echo "testing missing IRIs 6" | |
| echo "Found the listed IRIs in the a-box, but they are not in PMDco:" | |
| exit 1 | |
| fi | |
| fi | |
| fi | |
| done |