Database Reference
In-Depth Information
Table 3-1. The Main Components of the ER Model Compared to Neo4j
Entity─Relationship
Neo4j
Entity
Node
Relationship
Relationship
Attribute
Property
In either event, the model still serves as the high-level, conceptual representation for all of the data points.
The companion model will also allow us to see the transformation that would occur when moving from the relational
setting to the graph setting. Again, we will explore a bit more of the Cypher language in this chapter but only as it
applies to our modeling aim. In addition, your preferred programming language is important to how you might
consider some aspects of your model, but it is not critical to understanding the essential concepts for modeling
with Neo4j.
Modeling Relationships
As you will likely find in working more frequently with graphs, the node types can seem more natural than tables,
especially when creating and managing relationships. However, there are some common pitfalls or issues that can
surface during the first exercises in modeling.
Directed relationships are an important aspect of graph databases and understanding how they should be
modeled is necessary to improving the design, efficiency and manageability of your Neo4j database. The example in
Figure 3-4 clearly denotes the direction to infer that “Greg works at GraphStory.” In turn, this relationship implies that
“GraphStory is an employer of Greg.”
Figure 3-4. Directed relationship type
It is not necessary to explicitly add both relationship types, as shown in Figure 3-5 , because one directed
connection, by definition, suffices for the other direction. In fact, the speed of traversing the graph is not dependent
on the direction.
Figure 3-5. Two relationship connections are unneccesary as the first implies the other
 
 
Search WWH ::




Custom Search