This project comprises a Python test suite and configuration resources for a Java service, for validating OWL vocabularies and SHACL shapes, according to the SEMIC conventions for semantic data interoperability, as part of the interoperability test bed (ITB).
The use case is geared towards validating an OWL ontology (rather than its instance data) like ePO and/or a SHACL Shapes file (which itself typically validates instance data) to ensure comformance to applicable SEMIC rules.
This service allows you to assess the conformance of an OWL model (ontology) or a SHACL Shapes file with the SEMIC Style Guide. For each guideline in the style guide, a set of rules have been implemented, which assess whether an OWL or SHACL convention is respected. These rules specify constraints on the structure, relationships, and properties within the models. The set of rules employed during validation is documented here.
The content to validate can be provided as a file or a URI reference. Documentation on using the Interoperability Test Bed (ITB) is available here.
- The official UI is available at https://www.itb.ec.europa.eu/shacl/semicstyleguide/upload
- The SOAP API is available at https://www.itb.ec.europa.eu/shacl/soap/semicstyleguide/validation?wsdl
- The REST API (Swagger UI) is available at https://www.itb.ec.europa.eu/shacl/swagger-ui/index.html
Aside from the examples/
folder, which is provided for user convenience, only
the resources/
folder is
specific to
the ITB validator.
The single SEMIC shapes file resources/shapes/semic-shapes.ttl
for ITB is
automatically generated from multiple modular SHACL files (with the extension
.shacl.ttl
) under the toplevel shapes/
folder, which are used by the Python
unit test files in test/
.
Support for aggregating data, running a validation command, and testing a local
ITB validator service instance via Docker are also
provided (see Makefile
, validation_runner.py
and docker-compose.yml
respectively).
The unit testing component is a Python 3.8+ project. You may want to create a local virtual environment to set up and run anything in it:
python -m venv .venv
source .venv/bin/activate
Run deactivate
to exit out of this environment at any time.
Your Python programming IDE of choice should also have a way to select this as the "interpreter runtime".
You may also use any other means to run Python programs, such as a
system-installed interpreter, the pyenv
tool, or the conda
tool (via a
distribution like Anaconda).
Install the prerequisite software/library dependencies via the Python package manager Pip:
pip install -r requirements.txt
You may want/have to run python -m pip install --upgrade
to upgrade Pip
itself, so that you have up-to-date dependency resolution.
Alternatively, a convenience Makefile is provided through which you can
simply run make
(which defaults to running make install
), if you have
the tool.
Run the test suite from the toplevel/root of the project folder:
pytest # or make test
For generating the complete SHACL shapes file aggregated from the individual test shapes, a convenience Make target is provided:
make generate_aggregate_shapes
This generates the SHACL shapes file in output/semic-shacl.ttl
(a version of
which is committed in resources/shapes
).
Alternatively, if you do not have make
, inspect the Makefile and run the
relevant commands yourself.