Database Reference
In-Depth Information
Chapter 1. A case for a Neo4j database
This chapter covers
• Use cases for Neo4j graph databases
• How Neo4j compares with more traditional relational databases
• Neo4j's place in the larger NoSQL world
• Key characteristics of Neo4j
Computerscienceiscloselyrelatedtomathematics,withalotofitsconceptsoriginallycom-
ingfrommathematicalphilosophy.Algorithms,cryptography,computation,automation,and
evenbasictheoriesofmathematicallogicandBooleanalgebraareallmathematicalconcepts
that closely couple these two disciplines. Another mathematical topic can often be found in
computer science topics and articles: graph theory . In computer science, graphs are used to
represent specific data structures, such as organizational hierarchies, social networks, and
processing flows. Typically, during the software design phase, the structures, flows, and al-
gorithms are described with graph diagrams on a whiteboard. The object-oriented structure
of the computer system is modeled as a graph as well, with inheritance, composition, and
object members.
But although graphs are used extensively during the software development process, deve-
loperstendtoforgetaboutgraphswhenitcomestodatapersistence.Wetrytofitthedatain-
torelational tablesandcolumns,andtonormalize andrenormalize itsstructureuntilitlooks
completely different from what it's trying to represent.
An access control list is one example. This is a problem solved over and over again in many
enterprise applications. You'd typically have tables for users, roles, and resources. Then
you'd have many-to-many tables to map users to roles, and roles to resources. In the end,
you'd have at least five relational tables to represent a rather simple data structure, which is
actually a graph. Then you'd use an object-relational mapping (ORM) tool to map this data
to your object model, which is also a graph.
Wouldn't it be nice if you could represent the data in its natural form, making mappings
moreintuitive,andskippingtherepeatedprocessof“translating”thedatatoandfromastor-
age engine? Thanks to graph databases, you can. Graph databases use the graph model to
Search WWH ::




Custom Search