Predicate Functions
Predicates are boolean functions that return true or false for a given set of input. They are most commonly used to filter out subgraphs in the WHERE part of a query.
Exists(Property)
exists() returns true if the specified property exists in the node, relationship or map. This is different from the EXISTS clause.
Syntax:exists(property)
Returns:
An agtype boolean
Arguments:
| Name | Description |
| property | A property from a vertex or edge |
Query
SELECT *
FROM cypher('graph_name', $$
MATCH (n)
WHERE exists(n.surname)
RETURN n.first_name, n.last_name
$$) as (first_name agtype, last_name agtype);
Results:
| first_name | last_name |
| ‘John | ‘Smith’ |
| ‘Patty’ | ‘Patterson’ |
| 2 row(s) returned | |