Skip to main content

Python SHACL Compact Syntax Parser

A Python SHACL Compact Syntax parser and serializer based on the specification at https://w3c.github.io/shacl/shacl-compact-syntax/.

All tests defined in github.com/w3c/data-shapes/shacl-compact-syntax/tests are passing.

Browser playground

Play around with the implementation in your browser at https://edmondchuc.github.io/shaclc/.

Quickstart

Installation.

pip install shaclc

Usage.

from shaclc import shaclc_to_graph

shaclc_str = """
BASE <http://example.com/ns>

IMPORTS <http://example.com/person-ontology>

PREFIX ex: <http://example.com/ns#>

shape ex:PersonShape -> ex:Person {
	ex:ssn xsd:string [0..1] pattern="^\\d{3}-\\d{2}-\\d{4}$" .
}
"""

graph = shaclc_to_graph(shaclc_str)

graph.print(format="longturtle")

Output.

BASE <http://example.com/ns>
PREFIX ex: <http://example.com/ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

<>
    a owl:Ontology ;
    owl:imports <http://example.com/person-ontology> ;
.

<#PersonShape>
    a sh:NodeShape ;
    sh:property
        [
            sh:datatype xsd:string ;
            sh:maxCount 1 ;
            sh:path <#ssn> ;
            sh:pattern "^\\d{3}-\\d{2}-\\d{4}$" ;
        ] ;
    sh:targetClass <#Person> ;
.

Metadata

Release files for shaclc 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shaclc 0.1.1
File Size Uploaded Provenance Actions
shaclc-0.1.1.tar.gz 8.4 kB Without provenance Details for shaclc-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shaclc 0.1.1
File Interpreter ABI Platform Actions
shaclc-0.1.1-py3-none-any.whl Python 3 none any Details for shaclc-0.1.1-py3-none-any.whl

Total release size: 17.0 kB

Release files / shaclc-0.1.1.tar.gz

Download URL shaclc-0.1.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
84f0f3813d488dca2c814e3d5748a97653514371d757b251d413635c05e924ae
BLAKE2b-256 checksum
How to use checksums
f40cb89cfb529076ba9b94f7ba0453358bf9fd03def4c38d79f2d438d4b80c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1018-azure

Release files / shaclc-0.1.1-py3-none-any.whl

Download URL shaclc-0.1.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
48240b97097214a63ba99408f02f178cd65a52aac6912a49fc9e2cd6f7bf5314
BLAKE2b-256 checksum
How to use checksums
2f7738862f0a6ed45727e1eca775ec5a2c232dc0d664fa9d8cee3b7797a95314
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1018-azure

Security for shaclc 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page