# 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
