-
Notifications
You must be signed in to change notification settings - Fork 2
Knowledge Graph Pipeline
type: concept up: "Wiki-LLM-Pattern" tags: [kg, sparql, retrieval]
The frontmatter and body cross-references in the wiki feed an optional knowledge-graph pipeline that exposes the wiki as a SPARQL-queryable graph.
scripts/kg/build-graph.sh walks the wiki, extracts frontmatter and body links, converts them to RDF triples, and loads them into a local Fuseki endpoint at http://localhost:3030/wiki/sparql.
- Frontmatter typed edges (
extends:,supports:,criticizes:,source:,up:,related:) become typed predicates. - Body cross-references (
[text](Page-Name)) becomementionsedges. - Pages without frontmatter are included as
untypednodes; no data is lost.
The typing comes from Typed-Edges-and-Frontmatter; the operations come from Three-Operations.
Use the KG for topology questions:
- "Which pages cite finding X?"
- "What concepts does this experiment depend on, transitively?"
- "Find all pages tagged Y that
criticizes:a parent of Z."
Use direct file reads for content questions: "What does page X actually say?"
The right pattern: use the KG to discover where to look, then use file tools to read what the chosen pages say. Reserve grep for non-wiki code or content searches that span many files.
Run ./scripts/kg/build-graph.sh after each ingest, or periodically. The script is idempotent.
The KG pipeline is shipped under scripts/kg/. Derived projects that do not want it can delete the directory. instantiate.sh strips the corresponding subsection from CLAUDE.md when scripts/kg/ is absent, so the generated documentation stays consistent.
Without the typed-edge contracts, the KG collapses to a directed graph of mentions between pages. That is useful but flat. With typed edges, the same query can ask not just "which pages connect to X" but "which pages support a claim that X". Edge typing is what turns the KG from a navigation aid into a reasoning substrate.