Database Reference
In-Depth Information
Note
In this chapter we're covering the basic Cypher concepts and syntax, and some advanced
use of Cypher queries. For a full list of Cypher features and syntax, refer to the extensive
online documentation in the Neo4j Manual: http://docs.neo4j.org/chunked/stable/cypher-
query-lang.html .
Let's now take a more in-depth look at the anatomy of a Cypher query.
6.2.2. Finding the starting node
ThequeryingofaNeo4jgraphdatabasefollowsastandardpattern:findthestartingnode(s)
and run a traversal. You've followed this pattern in all your traversals so far, using the
Neo4j Core API, the Traversal API, and Cypher. Starting nodes can be located by direct
lookup by unique node ID, or, more typically, by using a Lucene index lookup, as you
learned in chapter 5 . Let's review the direct lookup by ID first.
Node lookup by ID
As far as Cypher is concerned, starting nodes are specified at the beginning of the Cypher
query, after the start keyword. In the examples so far, you've been loading the starting
node with a direct ID lookup, as in the following snippet:
You can load the node by ID by simply specifying the ID in the parentheses right after the
node keyword
.
That works if you have one starting node, but sometimes you may need to apply the same
pattern for multiple starting nodes and get all matching results—if, for example, you want
to find all movies that either John or Jack have seen.
Search WWH ::




Custom Search