Applications are built around domain and business concepts. As developers, we model these concepts and their relationships all the time in our heads, on whiteboards, and in code. Then we perform mental gymnastics translating objects and relationships into tables, rows and columns. Wouldn't it be better if our data storage thought the same way we do? This talk will describe a few types of problems that relational databases and many contemporary NOSQL solutions have trouble modeling, and how graph databases are a solution to those problems. Along the way, attendees will be introduced to the graph database Neo4j, will see how to interact with it via the Cypher query language, and learn how they can start modeling their own application domains as graphs.
4. The Solution?
> -- First degree
> SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title
FROM cast WHERE actor_name='Kevin Bacon')
> -- Second degree
> SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title
FROM cast WHERE actor_name IN (SELECT actor_name FROM cast WHERE movie_title IN
(SELECT DISTINCT movie_title FROM cast WHERE actor_name='Kevin Bacon')))
> -- Third degree
> SELECT actor_name FROM cast WHERE movie_title IN(SELECT DISTINCT movie_title
FROM cast WHERE actor_name IN (SELECT actor_name FROM cast WHERE movie_title IN
(SELECT DISTINCT movie_title FROM cast WHERE actor_name IN (SELECT
actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title FROM
cast WHERE actor_name='Kevin Bacon'))))
8. Warning: Computer Science Ahead
A graph is an ordered pair G = (V, E)
where V is a set of vertices and
E is a set of edges,
which are pairs of vertices in V.
If vertex pairs in E are ordered,
the graph is directed.
9. Property Graph
Nodes have properties and labels
Relationships have properties, a type and direction
Relationships are first-class entities
Queried just like Nodes
Indexes
Unique constraints
new in Neo4j 2.0!