Skip to main content

Python wrapper around TopQuadrant SHACL processor

Project description

PyPI - Status

Py(thon)T(op)Q(uadrant)SHA(pe)C(onstraint)L(anguage)

Python wrapper around TopQuadrant's SHACL implementation in Java.

Why?

Motivation: This was developed as part of BIM2RDF where TopQuadrant was used to execute SHACL. Python's PySHACL was too slow. Nonetheless, it's useful to be able to integrate it with Python.

Optional Features

can be installed as pytqshacl[java,cli].

  • Java: is installed on first use. Note this changes your system. The installation location will be printed.
  • CLI: will just wrap the topquadrant invocation with managed configuraion.

Usage

Install pytqshacl with your Python package manager. The features are optional pytqshacl[cli,java].

CLI

Get help with pytqshacl --help.

Example usage:

pytqshacl\test on  master [!⇡] via  v3.11.9 
❯ pytqshacl validate -d data.ttl -s shapes.ttl -o None
ERRORS: process did not exit with 0

@prefix dash:    <http://datashapes.org/dash#> .     
@prefix graphql: <http://datashapes.org/graphql#> .  
@prefix owl:     <http://www.w3.org/2002/07/owl#> .  
@prefix rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:    <http://www.w3.org/2000/01/rdf-schema#> .
@prefix schema:  <http://schema.org/> .
@prefix sh:      <http://www.w3.org/ns/shacl#> .     
@prefix swa:     <http://topbraid.org/swa#> .        
@prefix tosh:    <http://topbraid.org/tosh#> .       
@prefix xsd:     <http://www.w3.org/2001/XMLSchema#> .

[ rdf:type     sh:ValidationReport ;
  sh:conforms  false ;
  sh:result    [ rdf:type                      sh:ValidationResult ;
                 sh:focusNode                  <https://example.com/John-Doe> ;
                 sh:resultMessage              "Property may only have 1 value, but found 2" ;
                 sh:resultPath                 schema:name ;
                 sh:resultSeverity             sh:Violation ;
                 sh:sourceConstraintComponent  sh:MaxCountConstraintComponent ;
                 sh:sourceShape                []    
               ]
] .

Lib

Check the arguments from validate and infer from the imports from pytqshacl import validate, infer.

Configuration

The environment variable, PYTQSHACL_PREFER_SYSJAVA, can be set to 'false' if the package is installed with the 'java' feature to prefer finding a java executable in the system PATH environment variable.

Dev Philosphy

This point of this code is just to provide access to use TopQuadrant's SHACL from Python. Therefore,

  • No features: It should just wrap the TopQuadrant SHACL executable.
  • No dependencies

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytqshacl-140.tar.gz (15.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytqshacl-140-py2.py3-none-any.whl (15.6 MB view details)

Uploaded Python 2Python 3

File details

Details for the file pytqshacl-140.tar.gz.

File metadata

  • Download URL: pytqshacl-140.tar.gz
  • Upload date:
  • Size: 15.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pytqshacl-140.tar.gz
Algorithm Hash digest
SHA256 b6849b622d2e0082ee42296cc8ee5f0cea6d2290e557017e2cf5f8ef0f6665f7
MD5 814894a4fa7e562e7f342e7c01ad10d6
BLAKE2b-256 02e3351f6730c2d620225ab342d82303a9785b631d7828a004595e86ccca331c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytqshacl-140.tar.gz:

Publisher: python-publish.yml on pnnl/pytqshacl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytqshacl-140-py2.py3-none-any.whl.

File metadata

  • Download URL: pytqshacl-140-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.6 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pytqshacl-140-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9af70c436dd37cacae8c0c9187a01860e05bc0c50514730930a8502c36f15fb7
MD5 f96aecc6fba20dfffe660a7f54f35b55
BLAKE2b-256 31dc0208e41b3944b5b0dc19c6aa29e0924a6fc56f44a3db165801497d6828a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytqshacl-140-py2.py3-none-any.whl:

Publisher: python-publish.yml on pnnl/pytqshacl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page