Databases Reference
In-Depth Information
CHAPTER 3
Data Modeling with Graphs
In previous chapters we've described the substantial benefits of the graph database when
compared both with document, column family, and key-value NOSQL stores, and with
traditional relational databases. But having chosen to adopt a graph database, the ques‐
tion arises: how do we model the world in graph terms?
This chapter focuses on graph modeling. Starting with a recap of the property graph
model—the most widely adopted graph data model—we then provide an overview of
the graph query language used for most of the code examples in this topic: Cypher.
Cypher is one of several languages for describing and querying property graphs. There
is, as of today, no agreed-upon standard for graph query languages, as exists in the
relational database management systems (RDBMS) world with SQL. Cypher was chosen
in part because of the authors' fluency with the language, but also because it is easy to
learn and understand, and is widely used. With these fundamentals in place, we dive
into a couple of examples of graph modeling. With our first example, that of a systems
management domain, we compare relational and graph modeling techniques. With the
second example, the production and consumption of Shakespearean literature, we use
a graph to connect and query several disparate domains. We end the chapter by looking
at some common pitfalls when modeling with graphs, and highlight some good
practices.
Models and Goals
Before we dig deeper into modeling with graphs, a word on models in general. Modeling
is an abstracting activity motivated by a particular need or goal. We model in order to
bring specific facets of an unruly domain into a space where they can be structured and
manipulated. There are no natural representations of the world the way it “really is,” just
many purposeful selections, abstractions, and simplifications, some of which are more
useful than others for satisfying a particular goal.
 
Search WWH ::




Custom Search