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.1.0a2.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.1.0a2-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file ski_kg_validator-3.1.0a2.tar.gz.

File metadata

  • Download URL: ski_kg_validator-3.1.0a2.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.1.0a2.tar.gz
Algorithm Hash digest
SHA256 49e74d4ae0c478f1c516c5d955ebdbff405188fdb529674302a0e0c0f29dd976
MD5 473c1baa04a7b02634772b679ab59f2b
BLAKE2b-256 7e726d8f007e41a59f6ad54739ea6d34870d55745288f8dbb06f868ab675dabf

See more details on using hashes here.

Provenance

The following attestation bundles were made for ski_kg_validator-3.1.0a2.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.1.0a2-py3-none-any.whl.

File metadata

File hashes

Hashes for ski_kg_validator-3.1.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe38dd0b80c9453a73a11f9e536cf7b1eb0ec607ab0deea901e067124bd79199
MD5 886ec4878f82399a480bbfec32202c1e
BLAKE2b-256 eb7f8169663347b0e559bda06b374495a33b291cb0c441e4e570bddab75adf02

See more details on using hashes here.

Provenance

The following attestation bundles were made for ski_kg_validator-3.1.0a2-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