mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user