From 17fc42ccaa11c35e092b5b2d2c46daca958dfaf9 Mon Sep 17 00:00:00 2001 From: KaifAhmad1 Date: Fri, 13 Feb 2026 16:23:18 +0530 Subject: [PATCH] fix: Resolve influence query placeholders in DecisionQuery - Convert query strings to f-strings to properly substitute max_depth parameter - Fix Cypher syntax for variable-length paths from *1..{max_depth} to *1..{max_depth} - Remove max_depth from query parameters since it's now embedded in the query - Ensure proper Neo4j/FalkorDB compatibility for influence analysis queries - Prevent runtime query failures in analyze_decision_influence method --- semantica/context/decision_query.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/semantica/context/decision_query.py b/semantica/context/decision_query.py index bef653e6..20a208d2 100644 --- a/semantica/context/decision_query.py +++ b/semantica/context/decision_query.py @@ -839,29 +839,27 @@ class DecisionQuery: } # Get causal chains - downstream_query = """ - MATCH (start:Decision {decision_id: $decision_id}) - MATCH path = (start)-[:CAUSED|:INFLUENCED|:PRECEDENT_FOR]->*1..{max_depth}(end:Decision) + downstream_query = f""" + MATCH (start:Decision {{decision_id: $decision_id}}) + MATCH path = (start)-[:CAUSED|INFLUENCED|PRECEDENT_FOR*1..{max_depth}]->(end:Decision) RETURN DISTINCT end, length(path) as distance ORDER BY distance """ - upstream_query = """ - MATCH (start:Decision {decision_id: $decision_id}) - MATCH path = (start)<-[:CAUSED|:INFLUENCED|:PRECEDENT_FOR]-*1..{max_depth}(end:Decision) + upstream_query = f""" + MATCH (start:Decision {{decision_id: $decision_id}}) + MATCH path = (start)<-[:CAUSED|INFLUENCED|PRECEDENT_FOR*1..{max_depth}]-(end:Decision) RETURN DISTINCT end, length(path) as distance ORDER BY distance """ # Execute queries downstream_results = self.graph_store.execute_query(downstream_query, { - "decision_id": decision_id, - "max_depth": max_depth + "decision_id": decision_id }) upstream_results = self.graph_store.execute_query(upstream_query, { - "decision_id": decision_id, - "max_depth": max_depth + "decision_id": decision_id }) # Process results