Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-27-2021 02:56 AM
I have the following Cypher query which works fine:
MATCH (c:Company)-[r:CONTAINS]->(e) WHERE r.associationType='COMPOSITION' return c, e
Now, I'd like to go down to the unlimited depth with [r:CONTAINS]
relationship and return all of the nodes, something like this:
MATCH (c:Company)-[r:CONTAINS*]->(e) WHERE r.associationType='COMPOSITION' return c, e
I added *
there, but right now the query fails with the following error:
Type mismatch: expected Map, Node, Relationship, Point, Duration, Date, Time, LocalTime, LocalDateTime or DateTime but was List (line 1, column 44 (offset: 43))
"MATCH (c:Company)-[r:CONTAINS*]->(e) WHERE r.associationType='COMPOSITION' return c, e"
What am I doing wrong and how to properly implement such query? Thanks!
Solved! Go to Solution.
06-27-2021 06:16 AM
Hello @myshareit
MATCH p=(:Company)-[:CONTAINS*]->()
WHERE all(r IN relationships(p) WHERE r.associationType = 'COMPOSITION')
RETURN nodes(p) AS nodes
Regards,
Cobra
06-27-2021 06:16 AM
Hello @myshareit
MATCH p=(:Company)-[:CONTAINS*]->()
WHERE all(r IN relationships(p) WHERE r.associationType = 'COMPOSITION')
RETURN nodes(p) AS nodes
Regards,
Cobra
All the sessions of the conference are now available online