semlayer
The Semlayer validation client — validate your RDF instance data (ABox) against a
pinned ontology (owner/repo@version), its SHACL shapes, and its full dependency
closure, pulled from the Semlayer registry. Runs in your
environment — your data never leaves your network.
Status: functional (v0.1.0). Self-contained + contextual validation, registry bundle fetch, token auth, and
semlayer login(device flow) all work end-to-end. Designed in Semlayer'sCLIENT.md. Not yet published to PyPI.
Why
Semlayer hosts the TBox (versioned ontologies + author SHACL shapes). This client is the quality gate: check that new instance data conforms to a pinned schema before it hits your production triple store or an LLM/RAG pipeline. CI-native, engine = pySHACL (full SHACL Core + SPARQL + Advanced Features).
Install (once published)
pip install semlayerio # CLI + SDK — installs the `semlayer` command
pip install "semlayerio[aws]" # + AWS SigV4 signing for Amazon Neptune
(The PyPI distribution is named semlayerio — semlayer was already taken
by an unrelated project — but the installed command is still semlayer.)
Usage
# self-contained: validate a payload as a closed graph
semlayer validate --schema acme/health-model@v1.2.0 --data ./incoming.ttl
# contextual: resolve references against a target store (GraphDB/Fuseki/…)
semlayer validate --schema acme/health-model@v1.2.0 --data ./incoming.ttl \
--target-endpoint https://graphdb.internal/repositories/prod --target-auth basic \
--context-depth 2 --inference none --format json
# contextual against Amazon Neptune (IAM auth → SigV4)
semlayer validate --schema acme/health-model@v1.2.0 --data ./incoming.ttl \
--target-endpoint https://…neptune.amazonaws.com:8182/sparql \
--target-auth sigv4 --aws-region eu-west-1
# authenticate for local dev (OAuth device flow)
semlayer login
Auth: all programmatic pulls need a Semlayer token — --token, SEMLAYER_API_TOKEN, or
semlayer login (device flow). Exit codes: 0 conforms · 1 non-conforming · 2 error.
Layout
| Module | Responsibility |
|---|---|
cli.py |
semlayer command (validate, login) |
client.py |
SemlayerClient SDK — fetch pinned schema + shapes + closure, validate |
registry.py |
Semlayer registry API client (token auth) |
validation.py |
Orchestration: assemble graph, run pySHACL, report-scope (design §5) |
context.py |
Contextual mode: bounded context fetch from the target endpoint (§5, §5.1) |
report.py |
Report formats: text / json / jsonld (§8.1) |
auth.py |
Token storage + semlayer login device flow (§9.3) |
models.py |
Core types (SchemaRef, ValidationReport, Violation) |
Develop
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev,aws]"
pytest && ruff check . && mypy src
License: MIT.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file semlayerio-0.1.0.tar.gz.
File metadata
- Download URL: semlayerio-0.1.0.tar.gz
- Upload date:
- Size: 20.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fea52871ac63c9e1d2b2622baeb2a27edff9207ec57d775c7e0ccd14e9690faa
|
|
| MD5 |
7205f66aa6b0168552010fbbda330476
|
|
| BLAKE2b-256 |
58de2aaa5710ba412c0ae3c9cd4bec4e744bc6d8199f9649b06a7c8891dba0c4
|
File details
Details for the file semlayerio-0.1.0-py3-none-any.whl.
File metadata
- Download URL: semlayerio-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c28b7c9b3c3aa839e9e96f225a405f1dfea3888c025d4651c4544f73fc2b7834
|
|
| MD5 |
f71540250c6ec4e06da9641e016d3ba0
|
|
| BLAKE2b-256 |
005bb5419d532551f8a50ab7086680f94958ee58e2f0e68cbddcee8f7421e3b5
|