Skip to main content

Validate and review extracted compliance rules with mandatory human expert oversight.

Project description

kg-validator

Install from PyPI: pip install ski-kg-validator (publishing starts with the first release after June 2026).

Status: v3.0 — first production-target release.

Validate v3 Knowledge Graphs against SKI Framework specification v3.0 §3 (schema) and §3.6 (cross-cutting validation passes). Phase 1 (compilation) tool.

What it does

  • Schema validation. Parses a v3 KG JSON file into the typed-node Pydantic models. Unknown obligation types, unknown edge types, unknown risk tiers, missing required fields, and extra unknown keys are all rejected at load time.
  • Cross-cutting validation (§3.6). Detects duplicate node IDs, dangling edges, edges pointing at the wrong target node type, rules without any obligation, and orphan obligations.

What it no longer does (v2 retired in PR 10e)

  • The v2 flat-rule-list format is gone. v3 typed obligations are the only currency.
  • Interactive review, detect-conflicts, detect-duplicates, and HTML report subcommands were retired with the v2 path — they worked on the flat-rule shape and have no v3 equivalent. v3 conflict and duplicate detection happen at the typed-obligation level inside the validation passes and surface as issues in the output JSON.
  • The ConfidenceLevel enum is gone. The extractor now carries an ExtractionQuality value (separate concept; see kg-extractor).

Installation

pip install -e tools/kg-validator

Quick start

# Validate a v3 KG and print the issue summary:
kg-validator validate --input examples/energy/knowledge-graphs/kg-energy-v3-demo.json

# Validate and persist the full issue report:
kg-validator validate \
  --input kg-energy-v3.json \
  --output validation-report.json

# Show usage examples:
kg-validator examples

# Show version:
kg-validator version

The validate command exits with code 0 on a clean KG, code 2 on a schema-level Pydantic validation failure, and code 3 on any CRITICAL or HIGH severity §3.6 issue.

Architecture

kg_validator/
├── __init__.py    public API: KnowledgeGraphV3, V3Validator, load_v3_kg, models
├── loader.py      KnowledgeGraphV3 container + load_v3_kg(path) entry point
├── models.py      typed Pydantic models per spec v3.0 §3 (nodes, edges, enums)
├── validator.py   V3Validator runs the §3.6 cross-cutting passes
└── cli.py         click-based CLI (`validate`, `examples`, `version`)

Conformance

The examples/energy/knowledge-graphs/kg-energy-v3-demo.json sample KG must load cleanly and produce zero validation issues. This is exercised by tests/test_v3_validator.py and by the CI durability suite.

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

ski_kg_validator-3.0.3.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

ski_kg_validator-3.0.3-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file ski_kg_validator-3.0.3.tar.gz.

File metadata

  • Download URL: ski_kg_validator-3.0.3.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ski_kg_validator-3.0.3.tar.gz
Algorithm Hash digest
SHA256 483512475ab00a87dbc67806d860a0dd0a742ec851023433ce6c885913469e55
MD5 e81c4e52d9512a4eb5cc357abdf0b37a
BLAKE2b-256 402453c917c0ee9b89c20a442a41c96c2791f44952f65035e05054d4ba400495

See more details on using hashes here.

Provenance

The following attestation bundles were made for ski_kg_validator-3.0.3.tar.gz:

Publisher: release.yml on kpifinity/ski-framework

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

File details

Details for the file ski_kg_validator-3.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ski_kg_validator-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 29a57af7d2ca239120b27bb0df4b006ec3054a810326e85d238c0f07f96fa162
MD5 8f6c89d7754a8cb175fbaf74e15aa218
BLAKE2b-256 d4bf365c447817293643271dcedacc947db9409b4a41254f1506a25a3665a87f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ski_kg_validator-3.0.3-py3-none-any.whl:

Publisher: release.yml on kpifinity/ski-framework

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