Skip to content

KG: consistent knowledge-graph schema + consistency validation #386

Description

@nadernik

Goal

Generate a consistent BBQS knowledge graph and validate that no part contradicts another. Consistency ≠ completeness — missing per-project detail is out of scope for now. OWL = schema logic; SHACL = validation.

Decisions

  • Source of truth: kg/bbqs.linkml.yaml (LinkML → gen-owl OWL + gen-shacl SHACL). Now v0.3 (keep-list cherry-picked from KG schema: SOSA device alignment, OOPS pitfall fixes, device-usage modeling #397; title/DANDI kept, device/SOSA deferred).
  • Node spine: exporter over Supabase resources (resources.id = IRI, resource_type = rdf:type).
  • Project is the one node — "Grant" is only NIH terminology (DB resource_type stays grant; exporter joins grants ⋈ projects).
  • Validation engine: SHACL-first (pyshacl), OWL reasoner (robot/HermiT) second.
  • Alignments: schema.org + PROV-O + NCBITaxon + Bioschemas/Croissant + reserved neuro hooks (NBO/UBERON/OBI/CogAtlas).

Phase status

  • 0 — Foundations & decisions
  • 1 — Schema authored — kg/bbqs.linkml.yaml v0.3, DB-grounded, Marr stubbed
  • 2 — Consistency invariants — 13-row catalogue; RED/GREEN fixtures; schema↔DB drift guard
  • 3 — Exporter (A) — resources spine → TTL; grants⋈projects; reified ProjectRole; species_aliases resolver; held_by bug fixed (resolves via resources.id, guarded by HeldByResolvesShape)
  • 4 — Generate OWL + boilerplate SHACL (B) — bbqs.owl.ttl (3,165 triples) + bbqs.shapes.gen.ttl (22 NodeShapes)
  • 5 — Backfill migration (C) — extend resource_type + add resource_id (species/devices/working-groups/funding/events/orgs/pubs) ← next
  • 6 — Full-access export + OWL reasoning — light up shapes Move the AG-Grid column #5/SS-7: Design concepts of NeuroMCP #12; robot/HermiT; also owl:disjointWith (didn't emit via gen-owl)
  • 7 — CI gate (D) Turn BBQS-KG into a class object programatically. #401 related to this to streamline CI gate
  • 8 — Publish /schema + retire old surfaces (E) — in progress: /schema admin-gated + WIP banner done; tree regen + retire of old /schema + /data-model pending
  • 9 — Spec artifacts in ../bbqs-agent/specs/ (F)

Consistency status (live)

5 SHACL contradiction shapes + the held_by referential shape + the enum-parity guard are enforced. On the anon export the real graph validates to 9 dangling study_species (#7); role-token (#4) and mechanism (#9) conform. Full catalogue + per-invariant status in kg/README.md.

Related

PR #397 (@Sulstice) reviewed → keep-list cherry-picked to dev (092e5a2); PR closed as superseded. Device-usage + SOSA to return as a focused PR.

Open modeling questions

Tool vs software boundary; Event source (new table vs Announcement subtype). (Algorithm resolved — promoted to its own resource_type.)

Activity

  1. added theissue type on Sep 22, 2026
  2. 10 remaining items

  3. added a commit that references this issue on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions