age
age copied to clipboard
some useful cypher statements
Is your feature request related to a problem? Please describe. I find it is difficult when I try to query a link list. I searched and found some useful cypher statements which works for Neo4j.
Describe the solution you'd like
- UNWIND a vertex list
MATCH p=()-[]->()
WITH nodes(p) AS a
UNWIND a AS b
RETURN b
- WHERE not a relationship
MATCH (head)-[:edge*]->()
WHERE NOT ()-[:edge]->(head)
RETURN head
- list generation using IN
MATCH p=()-[]->()
WITH nodes(p) AS a
RETURN [x IN a | x.name]
I find 'WHERE NOT EXISTS' can do path pattern not match
MATCH (head)-[:edge*]->()
WHERE NOT EXISTS (()-[:edge]->(head))
RETURN head
List comprehension will be upcoming. Unwind should work, we will be looking into that.