Database Reference
In-Depth Information
Starting nodes are presented as a comma-separated list, with each node having its own
identifier that can be used throughout the query . When you're matching patterns, all
starting nodes can be part of a single pattern, or they can be used in separate patterns as
in this example . Both patterns in this example refer to the movie node (called by the
same name in both patterns, so it represents the same node), which is the result of your
Cypher query
.
6.2.3. Filtering data
Starting nodes and graph patterns are sometimes not enough to get the results you need us-
ingaCypherquery.Insomecases,you'llneedtoperformadditional filtering onnodesand
relationships to determine what to return. Just as in SQL for relational databases, the query
filtering in Cypher is performed using the where clause.
Typically, the where clause filters the results based on some property of a node or rela-
tionship. Let's look at an example that finds all friends of user John who were born after
1980. Let's assume that every user node has a yearOfBirth integer property holding
the user's year of birth. The following snippet illustrates the solution:
You find the starting node by performing the index lookup
, and you pattern match
the friend nodes with an IS_FRIEND_OF relationship regardless of the direction
. Next, you filter only the matching friend nodes that have a yearOfBirth property
greater than 1980 . Because yearOfBirth is an integer property, you can perform a
standard number comparison in the where clause.
Search WWH ::




Custom Search