I have a cypher query and want to catch related nodes for each node in the result.
So my working raw cypher query looks like :
MATCH p = (:lookingType)<-[:specifiedRelation]-()
WITH nodes(p) AS nodes, relationships(p) AS relations
CALL {
WITH nodes
UNWIND nodes AS n
MATCH second_p=(n)-[second_relations:otherRelation]->(second_nodes)
RETURN second_nodes, second_relations
}
RETURN nodes, relations, collect(second_nodes), collect(second_relations)
In my java project, I want to use cypherdsl for this.
But, I have a problem using a Unwind inside a call. That's what I try :
But call doesn't manage OngoingReading objects. Is there any turn around?
As it is a common use case in my project, using only one query to the database is important.
I fail with multiple other ways. Thank you for reading and for your help.
MATCH p = (:lookingType)<-[:specifiedRelation]-()
WITH nodes(p) AS nodes, relationships(p) AS relations
CALL {
WITH nodes
WITH nodes AS nodes
UNWIND nodes AS n
WITH n
MATCH second_p = (n)-[second_relations:otherRelation]->(second_nodes)
RETURN second_nodes, second_relations
}
RETURN nodes, relations, collect(second_nodes), collect(second_relations)
Thank you so much for your help.
I was doing something quite ugly with some CypherParser, thank god, you came in!
With this use case, I have a new point of view on the convenient SymbolicName.