Database Reference
In-Depth Information
Figure 2.12. A User with additional properties stored in a related UserEx node
A better approach here would be to apply a label to the User node indicating that it has
an extended property set, and place the extra properties directly on the User node itself.
Labels are a powerful mechanism, introduced in Neo4j version 2.0, for assigning nodes to
collections. A node can have multiple labels, so nodes can be treated as belonging to mul-
tiple, possibly overlapping, collections. By writing queries that target nodes with specific
labels, you can do two things:
• Improve the performance of queries by reducing the number of nodes they have to
consider when traversing the graph in search of pattern matches.
• Simplifyqueriesbyusinglabelstoassertthatnodeswillhaveparticularproperties,
so that queries don't have to handle the possibility of missing properties values.
 
Search WWH ::




Custom Search