Add graphrag-neo4j module: structured-output entity and relation extraction into a typed Neo4j graph with a vector index, multi-hop retrieval by span linking and variable-length Cypher paths, compared with plain vector RAG over the same 35 chunks and 9 questions (complete evidence 7/9 vs 5/9 at k=8); Testcontainers on neo4j:2026.10.1 and 5.26. The extraction step is a rule-based stand-in, not a language model.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CifR2BE7PBvRy5hT8TS9oz
This commit is contained in:
2026-10-26 02:03:40 +00:00
co-authored by Claude Sonnet 5.5
parent 279be7eb9f
commit 108fc44542
66 changed files with 1997 additions and 0 deletions
@@ -0,0 +1,23 @@
# Questions whose shape is known: the Cypher is the retrieval (hand-written, parameterised, run on the real graph)
--- Q7 Which services stop working if the Orders Database goes down? ---
MATCH (db:Entity {name: $name})<-[:DEPENDS_ON*1..5]-(s:Entity)
RETURN DISTINCT s.name AS service ORDER BY service
-> Checkout Service
-> Ledger Service
-> Payments Gateway
--- Q6 Who leads the teams that own the services the Checkout Service depends on? ---
MATCH (c:Entity {name: $name})-[:DEPENDS_ON]->(d:Entity)-[:OWNED_BY]->(team:Entity)-[:LED_BY]->(lead:Entity)
RETURN d.name AS dependency, team.name AS team, lead.name AS lead ORDER BY dependency
-> Inventory Service / Fulfilment Team / Tomasz Nowak
-> Payments Gateway / Payments Team / Priya Raman
--- Q8 entity linking and the traversal in ONE statement: the vector index finds the seed, MATCH walks from it ---
CALL db.index.vector.queryNodes('entity_name_embedding', 1, $vector) YIELD node AS c, score
MATCH (c)-[:DEPENDS_ON]->(d:Entity)<-[:AFFECTED]-(i:Entity)
RETURN c.name AS seed, score, d.name AS dependency, i.name AS incident ORDER BY incident
$vector = embedding of the span "Checkout Service"
-> seed Checkout Service (1.00): INC-2057 affected Inventory Service
-> seed Checkout Service (1.00): INC-2060 affected Payments Gateway