To view the full-length video and tutorial, visit: https://academy.datastax.com/demos/getting-started-graph-databases
Getting Started with Graph Databases contains a brief overview of RDBMS architecture in comparison to graph, basic graph terminology, a real-world use case for graph, and an overview of Gremlin, the standard graph query language found in TinkerPop.
2. A Quick Look at Relational
View the Full-Length Video & Tutorial
https://academy.datastax.com/demos/
getting-started-graph-databases
3. Tables
• Very structured data
• Relational calculus
• Various normal forms
id name title country
1 jon evangelist usa
2 patrick chief evangelist usa
3 rebecca jr evangelist canada
4 billy ceo usa
4. Selecting and Filtering
id name title country
1 jon evangelist usa
2 patrick chief evangelist usa
3 rebecca jr evangelist canada
4 billy ceo usa
select * from people where country = 'canada';
5. Foreign Keys
id name title country
1 jon evangelist 1
2 patrick chief evangelist 1
3 rebecca jr evangelist 2
4 billy ceo 1
id name
1 usa
2 canada
3 germany
4 japan
6. Joins
select * from people join country on people.country = country.id;
id name title country name
1 jon evangelist 1 usa
2 patrick chief evangelist 1 usa
3 rebecca jr evangelist 2 canada
4 billy ceo 1 usa
7. Many to Many Relationships
id name title
1 jon evangelist
2 patrick chief evangelist
3 rebecca jr evangelist
4 billy ceo
id name
1 usa
2 canada
3 germany
4 japan
user country
1 1
1 2
2 1
3 2
4 1
8. Joining
select * from people
join people_country on people.id = people_country.user
join country on people_country.country = country.id;
id name title country name
1 jon evangelist 1 usa
1 jon evangelist 2 canada
2 patrick chief evangelist 1 usa
3 rebecca jr evangelist 2 canada
4 billy ceo 1 usa
11. Problems
• Every entity gets a table
• Lots of many to many tables
• Very rigid structure
• Going from one to many requires a
migration and new data model
15. Edges are always many to many
JCVD
Time
copActedIn
Blood
sport
ActedIn
16. Properties
• Similar to fields in a table
• Much more flexible
• Meta properties - properties on
properties
• Can be on an edge or a vertex
• Special property - a label
JCVD
status amazing
charm infinite
odds of rendezvous 99.6%
enemies decapitated 108747
17. Tinkerpop 3
• Cross database graph query
language
• API for graph
• Gremlin Server
19. Summary
• We don't define tables
• We create vertices to represent real
world objects
• Relationships don't need to be
explicitly modeled
• Expressing complex relationships is
not hard
• Adding new edge types is easy
21. Finding Vertices
single vertex g.V(4160)
matching a
property
g.V().has("name", "jean claude van damme")
range filtering
g.V().has("year",
between(1980, 1990))
24. Traversals
to other vertices g.V().has("name", "jean claude van damme").out()
to edges g.V().has("name", "jean claude van damme").outE()
filtering with
traversals
g.V().has("name", "jean claude van damme").out().
has("year", between(1980, 1990))