Nodes
And relationships between nodes
Animal
"name" : "Banana",
"color" : "orange"
Furnishing
"type" : "carpet"
Scratched
"timestamp" : 1417126199
Barfed On
"timestamp" : 1417136235
Parentheses = nodes
(user)
Arrows and square brackets = relationships
-[:has]->
Together
(user)-[:has]->(role)
Identifiers
(foo:User)-[bar:has]->()
Labels
(creature:Dog)
Relationship types
[:purchased]
Properties
(user {name:"Daniel"}) -[:purchased {timestamp: 1417631772}]->
Graph databases are part of the NoSQL family
... but they're pretty different.
Aggregate-Oriented
2 main categories of NoSQL databases:
Graph Databases
When people talk about NoSQL, they're usually referring to the aggregate oriented databases.
Let's build a to-do list app
SELECT tasks.id, tasks.description, users.name owner, users2.name assignee
FROM tasks
JOIN users ON users.id = tasks.creator_id
JOIN users users2 ON users2.id = tasks.assignee_id
WHERE users.name = "Daniel";
1 - "Graph Databases" e-book, O'Reilly, pg 8
Stored the same way you might describe your data naturally
Reflects your application's domain
MATCH (User {name:"Daniel"})-[:OWNS]->(task),
(task)<-[:IS_ASSIGNED_TO]-(assignee)
RETURN task, assignee
Even with many 'joins', query performance is only limited by the portion of the graph that is searched.
This graph search...
... has the same performance as this one
Videos
References / Training
Books