KB-6262

SuperBundle — 02 KG Vocab / Universal Projection / DOT Enrichment (LIVE)

5 min read Revision 1
kgiu-relationv-kg-edges-alldotvocabdieu39liveuniversal-edges2026-05-28

02 — Branch B: KG Vocab + Universal Projection + DOT Enrichment (LIVE)

Goal: move KG beyond the 60-row backfill. Result: PASS — 2 safe additive live commits + vocab-widen dress-rehearsed.

1. LIVE COMMITTED (additive, read-only, reversible)

Method: dress-rehearse in BEGIN..ROLLBACK → COMMIT small → verify in a fresh psql connection (per established durable method).

B1 — v_kg_edges_all projection extended

CREATE OR REPLACE VIEW public.v_kg_edges_all (security_invoker=true)appended assertion_mode + evidence (columns 16–17). NB: CREATE OR REPLACE VIEW can only append at the end — original 15 columns kept in exact order; new columns added last. iu_relation branch projects r.assertion_mode, r.evidence; universal_edges branch projects NULL::text, NULL::jsonb (universal_edges has neither column).

  • Fresh-conn verify: 2259 edges, assertion_mode non-null on 60 (the IU edges), evidence non-null on 0 (evidence not yet populated).

B3 — read-only KG audit DOT

  • fn_iu_kg_edge_audit() STABLE jsonb (provenance/assertion/evidence coverage + by_edge_type breakdown).
  • Catalog row dot_iu_kg_edge_audit (category=read, mutating=false, reversible=true, target=fn_iu_kg_edge_audit). Catalog 52→53.
  • Live output: {total_edges:2259, by_edge_type:{USES:1486, CONTAINS:342, BELONGS_TO:431}, iu_relation_edges:60, iu_relation_provenance_filled:60, iu_relation_assertion_filled:60, iu_relation_evidence_filled:0, universal_edges:2199, universal_edges_provenance_filled:0}.

Rollback (committed-change reversal)

BEGIN;
DROP FUNCTION IF EXISTS public.fn_iu_kg_edge_audit();
DELETE FROM public.dot_iu_command_catalog WHERE command_name='dot_iu_kg_edge_audit';
-- restore prior 15-col view (drop assertion_mode/evidence) via CREATE OR REPLACE VIEW with original def
COMMIT;

(Original 15-col view def archived in this campaign's appendix; restorable verbatim.)

2. Relation vocab — DRESS-REHEARSED, deferred

Current iu_relation_type_chk = 6-value CHECK: contains, derived_from, supersedes, replaced_by, merged_from, split_from (lifecycle/structural). Only contains is used (60 rows).

Dress-rehearsed (BEGIN..ROLLBACK) widening to 13 values = 6 existing + 7 atom-law semantic (identity, belongs_to, depends_on, used_by, transitive, peers, similar):

ALTER TABLE iu_relation DROP CONSTRAINT iu_relation_type_chk;
ALTER TABLE iu_relation ADD CONSTRAINT iu_relation_type_chk CHECK (relation_type = ANY (ARRAY[
  'contains','derived_from','supersedes','replaced_by','merged_from','split_from',
  'identity','belongs_to','depends_on','used_by','transitive','peers','similar']));

Result: applied cleanly in-tx, all 60 existing rows still valid. Deferred commit — the canonical KG relation vocabulary is an information-atom-law decision (8-atom-rules: IDENTITY/BELONGS_TO/CONTAINS/DEPENDS_ON/USED_BY/TRANSITIVE/PEERS/SIMILAR). Recommend atom-law confirm the canonical casing/names before committing the widen. Forbidden: no law enactment, so vocab law stays unenacted here.

3. universal_edges UUID-bridge decision (re-confirmed)

  • universal_edges (2199): integer-keyed (source_id/target_id int), 3 types (USES 1486, CONTAINS, BELONGS_TO), confidence filled (2199), provenance = 0 (NOT backfilled — deliberate; it is not IU-scoped).
  • iu_relation (60): uuid-native, fully Đ39-enriched.
  • Decision: keep separate; bridge via the read-only v_kg_edges_all UNION only. Do NOT migrate IU edges into universal_edges (would create a hidden second SoT) and do NOT key universal_edges by uuid. The view already normalizes both into one read surface (2259) without duplication.
  • universal_edges provenance backfill: not in scope — those edges are integer-keyed catalog/structure edges governed elsewhere; backfilling them is a separate GOV-KG-SYS decision.

4. Vector

iu_core.vector_sync_enabled=false (never_flip) — untouched. Qdrant container present but no write. ✓

5. Net live delta (Branch B)

v_kg_edges_all +2 cols · fn_iu_kg_edge_audit() +1 · catalog 52→53. No row mutation to iu_relation/universal_edges. Gate state all_safe=true throughout.

Back to Knowledge Hub knowledge/dev/reports/architecture/gate-clearing-first-factory-dry-assembly-superbundle-2026-05-28/02-kg-vocab-dot-enrichment.md