According to the Neo4j documentation about the WHERE
clause, I should be able to filter the search using patterns with properties such as this:
SELECT *
FROM cypher('test', $$
MATCH (n:Person)
WHERE (n)-[:KNOWS]-({name: 'Timothy'})
RETURN n.name, n.age
$$) AS (name agtype, age agtype);
However, I am getting an error that says:
ERROR: syntax error at or near ":"
LINE 4: WHERE (n)-[:KNOWS]-({name: 'Timothy'})
^
I’m guessing this feature has not yet been implemented in AGE but is there a way to get this to work, or is there an alternative for this to get a similar result?
2
Answers
To get a similar result you can completely disregard the
WHERE
clause:This way you will find bidirectional relationships of nodes that have the relationship
KNOWS
withTimothy
and vice verca.Yes, you can use
exists()
to find whether a path with properties exists or not as