AQL 2 Cypher issue: e/ehr_id/value
Queries like
SELECT c, e/ehr_id/value FROM EHR e CONTAINS COMPOSITION c
translates to
MATCH
(A:EHR), (A)-[*]->(B:COMPOSITION), (A)-[:ehr_id]->(C:HIER_OBJECT_ID)
MATCH path_B = (B) -[*]-> (leaf)
WITH collect(path_B) as paths_B, B
CALL apoc.convert.toTree(paths_B) yield value as tree_B
RETURN
tree_B AS c, C as e_ehr_id
And Neo4j complains
Neo.ClientError.Statement.SyntaxError: Variable `C` not defined (line 7, column 15 (offset: 221))
" tree_B AS c, C as e_ehr_id"
^
The query translator assumes "HIER_OBJECT_ID" nodes exist. But our Neo4J database has moved the relationship "ehr_id",EHR-HIER_OBJECT_ID to an attribute "ehr_id" in EHR NODES.
- Expected
MATCH
(A:EHR), (A)-[*]->(B:COMPOSITION)
MATCH path_B = (B) -[*]-> (leaf)
WITH collect(path_B) as paths_B, B, A
CALL apoc.convert.toTree(paths_B) yield value as tree_B
RETURN
tree_B AS c, A.ehr_id
Here the the value "A" is passed down using the WITH keyword.
Edited by Ghost User