Python SHACL Validator
A Python validator for SHACL.
This is a pure Python module which allows for the validation of RDF graphs against Shapes Constraint Language (SHACL) graphs. This module uses the rdflib Python library for working with RDF and is dependent on the OWL-RL Python module for OWL2 RL Profile-based expansion of data graphs.
This module is developed to adhere to the SHACL Recommendation:
For basic use of this module, you can just call the
validate function of the
pyshacl module like this:
from pyshacl import validate r = validate(target_graph, shacl_graph, inference='rdfs', abort_on_error=False) conforms, results_graph, results_text = r
target_graphis an rdflib
Graphobject, the graph to be validated
shacl_graphis an rdflib
Graphobject, the graph containing the SHACL shapes to validate with, or None if the SHACL shapes are included in the target_graph.
inferenceis a Python string value to indicate whether or not to perform OWL inferencing expansion of the
target_graphbefore validation. Options are 'rdfs', 'owlrl', 'both', or 'none'. The default is 'none'.
abort_on_erroris a Python
boolvalue to indicate whether or not the program should abort after encountering a validation error or to continue. Default is to continue. on return:
PySHACL is a Python3 library. For best compatibility Python v3.5 or greater. This library does not support Python 2.7.x or below.
A features matrix is kept in the FEATURES file.
A comprehensive changelog is kept in the CHANGELOG file.
This project includes a script to measure the difference in performance of validating the same source graph that has been inferenced using each of the four different inferencing options. Run it on your computer to see how fast the validator operates for you.
This repository is licensed under Apache License, Version 2.0. See the LICENSE deed for details.
See the CONTRIBUTORS file.
CSIRO Land & Water, Environmental Informatics Group
Brisbane, Qld, Australia
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyshacl-0.8.3-py2.py3-none-any.whl (38.4 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size pyshacl-0.8.3.tar.gz (24.7 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for pyshacl-0.8.3-py2.py3-none-any.whl