Every query describes a pattern, and in that pattern one can have multiple bound points. A bound point is a relationship or a node that form the starting points for a pattern match. You can either bind points by id, or by index lookups.
Including a node as a start point is done by using parenthesis.
Graph
Query
start n=(1) return n
The reference node is returned
Result
+--------------------+ | n | +--------------------+ | Node[1]{name->"A"} | +--------------------+ 1 rows, 1 ms
Multiple nodes are selected by listing them separated by commas.
Graph
Query
start n=(1, 2, 3) return n
The nodes listed in the START statement.
Result
+--------------------+ | n | +--------------------+ | Node[1]{name->"A"} | | Node[2]{name->"B"} | | Node[3]{name->"C"} | +--------------------+ 3 rows, 0 ms
If the start point can be found by index lookups, it can be done like this: (index-name, key, "value"). Like this:
Graph
Query
start n=(nodes,name,"A") return n
The node indexed with name "A" is returned
Result
+--------------------+ | n | +--------------------+ | Node[1]{name->"A"} | +--------------------+ 1 rows, 1 ms
If the start point can be found by index queries, it can be done like this: (index-name, "query").This allows you to write more advanced index queries
Graph
Query
start n=(nodes,"name:A") return n
The node indexed with name "A" is returned
Result
+--------------------+ | n | +--------------------+ | Node[1]{name->"A"} | +--------------------+ 1 rows, 1 ms
Sometimes you want to bind multiple start points. Just list them separated by commas.
Graph
Query
start a=(1), b=(2) return a,b
Both the A and the B node are returned
Result
+-----------------------------------------+ | a | b | +-----------------------------------------+ | Node[1]{name->"A"} | Node[2]{name->"B"} | +-----------------------------------------+ 1 rows, 1 ms
Copyright © 2011 Neo Technology