Database Reference
In-Depth Information
can also return relationships, properties of both nodes and relationships, and even entire
paths of the subgraph.
Note
A
path
in Neo4j represents the collection of nodes connected via relationships; for ex-
ample,
node1-[:relationship1]-node2-[:relationship2]-node3
.
Returning properties
In one of the earlier examples, you used Cypher to find all movies that John's friends have
seenbutJohnhasn't,andyoureturnedmatching
movie
nodesfromthequery.Ifyouwere
using this data to display recommended movie titles on a web page, you'd be returning en-
tire
movie
nodeswithallproperties—muchmoredatathanyouneed.Thebetterapproach
would be to just return the
node
property you're interested in from the query.
The following snippet illustrates this:
If you run this query from Neo4j Shell, for example, you can see that the output is much
less verbose than what you've seen previously:
| "Alien" |
| "Heat" |
Note
If the property you're referencing isn't present on all entities in the result set, it will be re-
turned as
null
for those entities that don't have the property.