Metadata-Version: 2.5
Name: ontogate
Version: 0.1.0
Summary: Validate RDF instance data (ABox) against a pinned ontology, its SHACL shapes, and dependency closure.
Project-URL: Homepage, https://semlayer.io
Project-URL: Documentation, https://semlayer.io/docs
Author: Ontoshire
License-Expression: MIT
License-File: LICENSE
Keywords: knowledge-graph,ontology,owl,rdf,semantic-web,shacl,validation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: pyshacl>=0.26
Requires-Dist: pyyaml>=6.0
Requires-Dist: rdflib>=7.0
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.12
Provides-Extra: aws
Requires-Dist: botocore>=1.34; extra == 'aws'
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: types-pyyaml; extra == 'dev'
Description-Content-Type: text/markdown

# ontogate

**Validate RDF instance data against a pinned ontology and its SHACL shapes.**

Point it at a published ontology (`owner/repo@version`), give it a data file, and it tells
you whether that data conforms — using the ontology's own author-published shapes and its
full dependency closure. Validation runs **in your environment**: the shapes come to your
data, your data never leaves your network.

> **Status:** v0.1.0, functional. Self-contained and contextual validation, registry bundle
> fetch, token auth and `ontogate login` (device flow) all work end to end.

## Why

A registry hosts the *TBox* — versioned ontologies plus the SHACL shapes their authors
published. This client is the *quality gate*: check that new instance data conforms to a
pinned schema **before** it reaches your production triple store or an LLM/RAG pipeline.
CI-native; the engine is **pySHACL** (full SHACL Core + SPARQL + Advanced Features).

Because the schema is pinned to a version, a validation result stays reproducible: the
report records the schema reference, the mode and the inference regime it ran under.

## Install

```bash
pip install ontogate            # CLI + SDK — installs the `ontogate` command
pip install "ontogate[aws]"     # + AWS SigV4 signing for Amazon Neptune

uv tool install ontogate        # or as a standalone tool
```

## Usage

```bash
# self-contained: validate a payload as a closed graph
ontogate validate --schema acme/health-model@v1.2.0 --data ./incoming.ttl

# contextual: resolve references against a target store (GraphDB/Fuseki/…)
ontogate 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)
ontogate 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)
ontogate login
```

Auth: all programmatic pulls need an API token — `--token`, `ONTOGATE_API_TOKEN`, or
`ontogate login` (device flow). Exit codes: `0` conforms · `1` non-conforming · `2` error.

## Layout

| Module | Responsibility |
|---|---|
| `cli.py` | `ontogate` command (`validate`, `login`) |
| `client.py` | `OntogateClient` SDK — fetch pinned schema + shapes + closure, validate |
| `registry.py` | 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 + `ontogate login` device flow (§9.3) |
| `models.py` | Core types (`SchemaRef`, `ValidationReport`, `Violation`) |

## Develop

```bash
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev,aws]"
pytest && ruff check . && mypy src
```

**License:** [MIT](./LICENSE).
