Database Reference
In-Depth Information
model to a relational database and vice versa adds more complexity to the project and in-
creases the number of lines of code you have to write, affecting efficiency and prolong-
ing project delivery time. This is simply because you have to think about, implement, and
configure a translation mechanism, using, for example, object-relational mapping (ORM)
tools.
This is where Neo4j comes into play. Instead of storing graph-like structures in relational
databases with the additional effort of creating a mapping mechanism, you can store graph
objects like nodes and relationships natively in the Neo4j graph database. This allows you
to model and code the software application at the same time, using the structure and ter-
minology from the whiteboard more or less directly to drive your code.
3.2. Using the Neo4j API
When using Neo4j as underlying storage for the graph data structures, the modeling and
coding can go hand in hand, as we'll demonstrate in the following sections.
3.2.1. Creating nodes
You can start by creating a node representing a user in the social network, using the in-
stantiated graph database. Figure 3.1 (reproduced here as figure 3.7 ) illustrates the model
drawing at this stage, containing three users.
Search WWH ::




Custom Search