kglab ontology audit

Toy scenario

A recorded audit of an earlier tunnel graph. This run lifts the saved D3 snapshot into RDF, reconciles it with the earlier ontology file, checks edge provenance with SHACL, applies OWL-RL inference and queries the result. The outputs below belong to that snapshot; they do not audit the current explorer. The supplied confidence scores and provenance checks concern the model's records, not the engineering truth of its assertions.

1 · LiftD3 nodes/links → RDF, each edge a first-class assertion with edge-type, confidence, source
2 · Reconcileuse reviewed identity pairs; agreement scores: 0.9 for both representations, 0.6 for D3 only
3 · ValidateSHACL shapes enforce the provenance rule — raw lift fails, repaired graph passes
4 · InferOWL-RL closure lands everything in the Digital Construction Ontology upper classes
5 · QuerySPARQL → DataFrame: census, single-representation edges, dependency chains, agreement
6 · Measurekglab → NetworkX: betweenness picks out the graph's brokers

1–2 · Lift & reconcile

Only the explicit identity mappings, reviewed against source identifiers, types, roles and relationships, produce owl:sameAs. A shared label alone does not establish identity. An edge present in both mapped representations receives the score 0.9; other lifted edges receive 0.6. These scores describe cross-representation agreement, not independent evidence, calibrated confidence or engineering truth: both representations belong to the same example.

3 · SHACL validation: fail first, then conform

Two shapes (see shapes.ttl): every edge assertion needs an edge-type, a confidence in [0,1] and a source; plan-critical edges (dependsOn, precedes) additionally need a use statement and an update trigger — the contingent-edge discipline from the portfolio AGENTS.md.

Run 1 — raw lift:


  

Run 2 — after the repair pass added use statements and update triggers to plan-critical edges:

This is the point of the spike: an undocumented dependency is now a validation error, not a hope that reviewers notice.

4 · OWL-RL closure

Census by the snapshot’s legacy upper-ontology class — inference materialised the rdfs:subClassOf bridge from the lifted D3 groups into the Digital Construction Ontology:

5 · SPARQL → DataFrame

Plan-critical edges present in one representation (score < 0.7)

Dependencies found only in the saved D3 representation under the reviewed mapping — candidates for checking coverage, not a ranking of engineering reliability:

Transitive dependency chain

Everything SegmentInstallation depends on, via the property path st:dependsOn+ (one line of SPARQL; no hand-rolled BFS):

Representation-agreement summary

6 · Graph measure

The merged graph projected into NetworkX; betweenness centrality names the brokers everything routes through:

Reproduce

The embedded results are a rerun over the saved historical sources using the reviewed mapping. Use Python 3.12.14 and the recorded package lock: python3 -m venv .venv-kglab, then .venv-kglab/bin/python -m pip install -r apps/kglab-ontology-audit/pipeline/requirements.txt, then .venv-kglab/bin/python apps/kglab-ontology-audit/pipeline/kglab_spike.py. The script regenerates results.json, solway_merged.ttl and this page. Environment of the embedded run: .

The earlier run recorded Python 3.10.12 and kglab 0.6.6, but no complete dependency lock. The recipe above reproduces this rerun; it does not reconstruct that earlier environment. Source hashes in the identity map require another identity review if either input changes.

Foray: FORAY-KGLAB-ONTOLOGY-AUDIT · sources: Original D3 source at the recorded revision (also retained as the downloadable snapshot), not_yet_used/tunnel-ontology-visualizer.ttl.txt (ontology layer) · results embedded at build time by pipeline/kglab_spike.py.