This PR adds a python script that can be used to run SHACL validations against the live metadata within the ops folder. This can eventually be used to perform CI checks before we merge code into master.
This is a zero-dependency python3 script. The python script orchestrates which SHACL files need to be run against which data files. The python script calls the Apache Jena CLI tool to actually validate the SHACL files against data inputs.
Once Apache Jena and python3 are installed, you just run this:
❯ ./shacl_validate.py
shapes=shacl/credit-classes/C01-verified-carbon-standard-class.ttl on data=ops/C01/credit-class-metadata/C01-verified-carbon-standard-credit-class.jsonld.. CONFORMS
shapes=shacl/projects/C01-verified-carbon-standard-project.ttl on data=ops/C01/project-metadata/C01-ProjectId934-metadata.jsonld.. CONFORMS
shapes=shacl/projects/C01-verified-carbon-standard-project.ttl on data=ops/C01/project-metadata/C01-ProjectId612-metadata.jsonld.. CONFORMS
shapes=shacl/credit-batches/C01-verified-carbon-standard-batch.ttl on data=ops/C01/credit-batch-metadata/C01-20150101-20151231-005.jsonld.. CONFORMS
shapes=shacl/credit-batches/C01-verified-carbon-standard-batch.ttl on data=ops/C01/credit-batch-metadata/C01-20150101-20151231-007.jsonld.. CONFORMS
shapes=shacl/credit-batches/C01-verified-carbon-standard-batch.ttl on data=ops/C01/credit-batch-metadata/C01-20190101-20191231-001.jsonld.. CONFORMS
shapes=shacl/credit-batches/C01-verified-carbon-standard-batch.ttl on data=ops/C01/credit-batch-metadata/C01-20150101-20151231-003.jsonld.. CONFORMS
shapes=shacl/credit-batches/C01-verified-carbon-standard-batch.ttl on data=ops/C01/credit-batch-metadata/C01-20190101-20191231-006.jsonld.. CONFORMS
shapes=shacl/credit-batches/C01-verified-carbon-standard-batch.ttl on data=ops/C01/credit-batch-metadata/C01-20150101-20151231-004.jsonld.. CONFORMS
shapes=shacl/credit-batches/C01-verified-carbon-standard-batch.ttl on data=ops/C01/credit-batch-metadata/C01-20150101-20151231-008.jsonld.. CONFORMS
shapes=shacl/credit-batches/C01-verified-carbon-standard-batch.ttl on data=ops/C01/credit-batch-metadata/C01-20190101-20191231-002.jsonld.. CONFORMS
If a SHACL file does not validate against a given data file for some reason, an error message will be reported:
This is a definite improve to our dev experience here! 🎉
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
[ ] provided a link to the relevant issue or specification
[ ] reviewed "Files changed" and left comments if necessary
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
[ ] confirmed all author checklist items have been addressed
Description
This PR adds a python script that can be used to run SHACL validations against the live metadata within the ops folder. This can eventually be used to perform CI checks before we merge code into master.
This is a zero-dependency python3 script. The python script orchestrates which SHACL files need to be run against which data files. The python script calls the Apache Jena CLI tool to actually validate the SHACL files against data inputs.
Once Apache Jena and python3 are installed, you just run this:
If a SHACL file does not validate against a given data file for some reason, an error message will be reported:
If the validation script succeeds it exits with code 0, if it fails it exits with code 1. So this can nicely be utilized as a CI check (https://docs.github.com/en/actions/creating-actions/setting-exit-codes-for-actions).
This is a definite improve to our dev experience here! 🎉
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.
I have...
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.
I have...