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
This commit is contained in:
KaifAhmad1
2026-02-13 16:23:18 +05:30
parent 62bf3bada9
commit 17fc42ccaa
+8 -10
View File
@@ -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