Database Reference
In-Depth Information
Chapter 3
Modeling
This chapter reviews the elements that make up Neo4j and the proper way to view relationships within the model.
This chapter recurs to some of the concepts first addressed in earlier chapters from the perspective of how modeling
is handled within Neo4j. It also explores a little more of the Cypher language, but only as it applies to our modeling
effort. Chapter 4 will deal with Cypher in greater depth. Finally, this chapter goes over some common models found in
various domains and looks at some of the common issues that data architects and developers face when modeling for
a graph. The chapter will begin with an overview of data modeling and why it can help ensure your application starts
on a solid foundation.
Data Modeling
If you are comfortable with the concepts of modeling, feel free to skip ahead to the next section. If, however, you are
still fairly new to data modeling or just need a refresher, this section will provide a quick conceptual overview and
cover the basics for proper modeling.
Data Modeling Overview
Data models serve as visual representations of the specific data that will reside within database and almost exclusively
in support of an external application. The models represent objects, such as a User or Shopping Cart, the connections
between the objects, and the rules that determine how the objects are stored within the database. The model typically
concentrates on what data will be stored and how it will be organized. The specific functions or how the application
will operate on the model should be considered separate from the modeling tasks. One common analogy of the model
are the blueprints of a house, where there is direction as to how the spaces are defined but the exact contents remain
to be determined after the main construction is completed.
In addition, for the some areas the data model is independent from the constraints of the database platform.
As you will see in the later sections of this chapter, there is a divergence that takes place when modeling relationships
within a relational database versus modeling within Neo4j. In either event, the model still serves as the high-level,
conceptual representation for all of the data points.
Why Is Data Modeling Important?
Regardless of whether you are using a graph database like Neo4j or a relational database, modeling is a critical part in
helping to ensure your application's data can be stored and retrieved as efficiently as possible. In the case where there
is a dedicated database administrator (DBA), the model is provided as a diagram—almost like a set of “blueprints”—to
use as a guide while creating the actual database. In most cases, the model represents the basics of the tables, the
primary and foreign keys, and the meta-information on properties, such as their type. The model might also contain
constraint information, such as whether a value of field is required or can be null or empty.
 
Search WWH ::




Custom Search