Python SHACL Validator
Project description
pySHACL
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:
Holger Knublauch; Dimitris Kontokostas. Shapes Constraint Language (SHACL). 20 July 2017. W3C Recommendation. URL: https://www.w3.org/TR/shacl/ ED: https://w3c.github.io/data-shapes/shacl/
Use
For basic use, of this module, you can just call the validate
function of the pyshacl
module like this:
from pyshacl import validate
validate(target_graph, shacl_graph, inference='rdfs', abort_on_error=False)
where:
target_graph
is an rdflibGraph
object, the graph to be validatedshacl_graph
is an rdflibGraph
object, the graph containing the SHACL shapes to validate with, or None if the SHACL shapes are included in the target_graph.inference
is a Python string value to indicate whether or not to perform OWL inferencing expansion of thetarget_graph
before validation. Options are 'rdfs', 'owlrl', 'both', or 'none'. The default is 'none'.abort_on_error
is a Pythonbool
value to indicate whether or not the program should abort after encountering a validation error or to continue. Default is to continue. on return:- a
tuple
containing:conforms
abool
, indicating whether or not thetarget_graph
conforms to theshacl_graph
results_graph
an rdflibGraph
object built according to the SHACL specification's Validation Report semantics
Features
A features matrix is kept in the FEATURES file.
Changelog
A comprehensive changelog is kept in the CHANGELOG file.
Benchmarks
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.
License
This repository is licensed under Apache License, Version 2.0. See the LICENSE deed for details.
Contributors
See the CONTRIBUTORS file
Contacts
Project Lead:
Nicholas Car
Senior Experimental Scientist
CSIRO Land & Water, Environmental Informatics Group
Brisbane, Qld, Australia
nicholas.car@csiro.au
http://orcid.org/0000-0002-8742-7730
Lead Developer:
Ashley Sommer
Software Engineer
CSIRO Land & Water, Environmental Informatics Group
Brisbane, Qld, Australia
Ashley.Sommer@csiro.au
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyshacl-0.8.2.tar.gz
.
File metadata
- Download URL: pyshacl-0.8.2.tar.gz
- Upload date:
- Size: 37.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af3af8b027d2d1f9084c7b2c0f6d62485dcdc2bc8074b0d98277d38836134f86 |
|
MD5 | ad4bf0e5f9ae08ba89331a55c8d5a860 |
|
BLAKE2b-256 | d7c3e19ad26789c91f0fe480b96d745ad8215040b6d6d3d881860fb21399345c |
File details
Details for the file pyshacl-0.8.2-py3-none-any.whl
.
File metadata
- Download URL: pyshacl-0.8.2-py3-none-any.whl
- Upload date:
- Size: 38.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a117d231d8d7b6943208dbd01730428cf9fb5c1c033cfddbecfbf3a45383d5a1 |
|
MD5 | 4cf3a61e972831b155e389ad2db4a28f |
|
BLAKE2b-256 | f8e86eae23296f8dea05cd79b481ae4d46c0cc84c017440ca0e9663f5b499eaa |