Offline reasoning + validation + artifact publishing pipeline that works locally and in CI, with minimal runtime changes (load precomputed inferred triples). Runtime inference stays rdfs, SHACL remains pyshacl, and offline reasoning is forward-chaining (OWL RL subset via Jena OWL Mini reasoner).
rdfs (current default in pyshacl and existing adapters).owl:sameAs blowups) via rule restrictions and guardrails.ontologies/sea-debt.ttl (including imports if present).ontologies/sea-shapes.v1.shacl (fallback ontologies/sea-shapes.shacl).tools/ir_to_kgs.py (explicit export handled by tools/kg_export_explicit.py).Generated under artifacts/kg/<GIT_SHA>/:
explicit.nq (all explicit triples)inferred.nq (inferred only)merged.nq (explicit + inferred)manifest.json (git SHA, timestamp, inputs, sha256, triple counts, shapes version, ontology version IRI)shacl_report.json (pyshacl report)tools/kg_export_explicit.pytools/kg-reasoner/Dockerfile (Jena 4.10.0, OWL Mini reasoner)tools/kg_validate.py (N-Quads supported)tools/kg_manifest.pytools/kg_drift_check.py (warn-only against baselines/kg/inferred.nq)scripts/reason_materialize.sh and just reason-materializeRun end-to-end pipeline:
1
just reason-materialize
Optional environment overrides:
KG_CTX (default: governance-runtime)KG_IR_PATH (explicit IR path override)KG_ONTOLOGY_PATH (default: ontologies/sea-debt.ttl)KG_SHAPES_PATH (default: ontologies/sea-shapes.v1.shacl)KG_SHAPES_VERSION (default: v1)KG_ARTIFACT_ROOT (default: artifacts/kg)KG_REASONER_IMAGE (default: sea-kg-reasoner:jena-4.10.0)KG_INFERRED_MAX_MULTIPLIER (default: 10)KG_REASONER_ALLOW_SAME_AS (default: false)The Knowledge Graph service loads precomputed artifacts when configured:
KG_ARTIFACT_DIR → load merged.nq from artifact directory (or explicit.nq + inferred.nq)KG_LOAD_MERGED_PATH → load a specific merged.nqStartup logs include triple counts per file and the manifest.json sha256 if present.
just reason-materialize.artifacts/kg/<sha>/ are uploaded.baselines/kg/inferred.nq.LC_ALL=C sort).owl:sameAs statements fail reasoning by default unless explicitly allowed.KG_INFERRED_MAX_MULTIPLIER to prevent runaway growth.