SlideShare a Scribd company logo
©2013 DataStax Confidential. Do not distribute without consent.
@rustyrazorblade
Jon Haddad

Technical Evangelist, DataStax
Graph Databases 101
1
A Quick Look at Relational
View the Full-Length Video & Tutorial
https://academy.datastax.com/demos/
getting-started-graph-databases
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
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';
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
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
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
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
A Fun, Real World Example
movie
id
name
year
tv_show
id
name
person
id
name
dob
actor_movie
person
movie
role
actor_tv
person
tv_show
dob
episode
tv_show
season
episode
actor_episode
episode
actor
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
How is this Solved with a Graph?
Vertex
• A vertex represents a "thing"
• For example: Movie, Person
JCVD
Time
cop
JCVD
Time
cop
Edge
• Edges are labeled relationships
• Edges have direction
ActedIn
Edges are always many to many
JCVD
Time
copActedIn
Blood
sport
ActedIn
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
Tinkerpop 3
• Cross database graph query
language
• API for graph
• Gremlin Server
Adding Data
1 graph = TitanFactory.build().set('storage.backend', 'inmemory').open()
2
3 g = graph.traversal()
4
5 jcvd = graph.addVertex(label, "actor",
6 "name", "jean claude van damme")
7
8 kick = graph.addVertex(label, "movie", "name", "Kickboxer",
9 "year", 1989)
10
11 blood = graph.addVertex(label, "movie", "name", "Bloodsport",
12 "year", 1988)
13
14 jcvd.addEdge("acted_in", kick)
15 jcvd.addEdge("acted_in", blood)
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
Traversing the Graph
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))
Traversals
Bloodsport (1988)
Kickboxer (1989)
Timecop (1994)jcvd.out()
Traversals
Bloodsport (1988)
Kickboxer (1989)
Timecop (1994)
jcvd.outE()
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))
Getting Started with Graph Databases
Use Cases
Recommendation Engines
• What do I like?
• What do others like?
• What do others listen to?
• Find correlations
Fraud & Anomaly Detection
Complex Taxonomies
Titan
• Open Source
• Works with Cassandra to scale to massive
graphs
• OLTP + OLAP graph queries via Spark
• Works with Solr or Elastic Search
DSE Graph
• Next generation of distributed graph
• Benefits of Titan but tightly integrated
with DataStax Enterprise
©2013 DataStax Confidential. Do not distribute without consent. 32

More Related Content

PDF
Playing with Natural Language ― in a friendly way
PDF
Analytics with Spark and Cassandra
PDF
Cassandra Data Maintenance with Spark
PDF
Successful Software Development with Apache Cassandra
PDF
Cassandra: One (is the loneliest number)
PPTX
Bad Habits Die Hard
PDF
Advanced Cassandra
Playing with Natural Language ― in a friendly way
Analytics with Spark and Cassandra
Cassandra Data Maintenance with Spark
Successful Software Development with Apache Cassandra
Cassandra: One (is the loneliest number)
Bad Habits Die Hard
Advanced Cassandra

Viewers also liked (20)

PDF
Standing Up Your First Cluster
PDF
Apache Cassandra and Drivers
PDF
Cassandra Core Concepts
PDF
Introduction to Data Modeling with Apache Cassandra
PDF
Production Ready Cassandra
PDF
Coursera Cassandra Driver
PDF
Advanced Data Modeling with Apache Cassandra
PPTX
Cassandra Adoption on Cisco UCS & Open stack
PPTX
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
PDF
Client Drivers and Cassandra, the Right Way
PDF
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
PDF
Data Modeling for Apache Cassandra
PPTX
Introduction to DataStax Enterprise Graph Database
PDF
Cassandra 3.0 Data Modeling
PPTX
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
PPTX
Cassandra on Docker @ Walmart Labs
PDF
Real Time Analytics with Dse
PDF
Coursera's Adoption of Cassandra
PDF
Production Ready Cassandra (Beginner)
PDF
New features in 3.0
Standing Up Your First Cluster
Apache Cassandra and Drivers
Cassandra Core Concepts
Introduction to Data Modeling with Apache Cassandra
Production Ready Cassandra
Coursera Cassandra Driver
Advanced Data Modeling with Apache Cassandra
Cassandra Adoption on Cisco UCS & Open stack
Introduction to DataStax Enterprise Advanced Replication with Apache Cassandra
Client Drivers and Cassandra, the Right Way
Cassandra @ Netflix: Monitoring C* at Scale, Gossip and Tickler & Python
Data Modeling for Apache Cassandra
Introduction to DataStax Enterprise Graph Database
Cassandra 3.0 Data Modeling
Tales From The Front: An Architecture For Multi-Data Center Scalable Applicat...
Cassandra on Docker @ Walmart Labs
Real Time Analytics with Dse
Coursera's Adoption of Cassandra
Production Ready Cassandra (Beginner)
New features in 3.0
Ad

Similar to Getting Started with Graph Databases (20)

PDF
DataStax Enterprise Graph Fundamentals with Real World Example
PPTX
A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...
PDF
In The Land Of Graphs...
PDF
Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...
PPTX
Se2017 query-optimizer
PDF
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
PDF
MongoDB: Optimising for Performance, Scale & Analytics
PDF
Как мы сделали многопользовательскую браузерную игру для HL++ с воксельной гр...
PDF
Graph Data Modeling in DataStax Enterprise
PDF
DataStax | Graph Data Modeling in DataStax Enterprise (Artem Chebotko) | Cass...
PDF
Building a Large Scale Recommendation Engine with Spark and Redis-ML with Sha...
PDF
Data-Ed Webinar: Data Modeling Fundamentals
PPTX
Introduction to NoSQL
PDF
Traversing Graphs with Gremlin
PDF
Getting started with Spark & Cassandra by Jon Haddad of Datastax
PPTX
GraphTour Boston - Graphs for AI and ML
PPTX
VRA 2012, Cataloging Case Studies, Metadata Magic
PDF
Ben Coverston - The Apache Cassandra Project
KEY
mongoDB at Visibiz
PDF
Wrangling data like a boss
DataStax Enterprise Graph Fundamentals with Real World Example
A Little Graph Theory for the Busy Developer - Jim Webber @ GraphConnect Chic...
In The Land Of Graphs...
Searching and Querying Knowledge Graphs with Solr/SIREn - A Reference Archite...
Se2017 query-optimizer
Ensuring High Availability for Real-time Analytics featuring Boxed Ice / Serv...
MongoDB: Optimising for Performance, Scale & Analytics
Как мы сделали многопользовательскую браузерную игру для HL++ с воксельной гр...
Graph Data Modeling in DataStax Enterprise
DataStax | Graph Data Modeling in DataStax Enterprise (Artem Chebotko) | Cass...
Building a Large Scale Recommendation Engine with Spark and Redis-ML with Sha...
Data-Ed Webinar: Data Modeling Fundamentals
Introduction to NoSQL
Traversing Graphs with Gremlin
Getting started with Spark & Cassandra by Jon Haddad of Datastax
GraphTour Boston - Graphs for AI and ML
VRA 2012, Cataloging Case Studies, Metadata Magic
Ben Coverston - The Apache Cassandra Project
mongoDB at Visibiz
Wrangling data like a boss
Ad

More from DataStax Academy (7)

PDF
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
PPTX
Cassandra @ Sony: The good, the bad, and the ugly part 1
PPTX
Cassandra @ Sony: The good, the bad, and the ugly part 2
PPTX
Enabling Search in your Cassandra Application with DataStax Enterprise
PDF
Make 2016 your year of SMACK talk
PDF
Traveler's Guide to Cassandra
PPTX
Spark Cassandra Connector: Past, Present and Furure
Forrester CXNYC 2017 - Delivering great real-time cx is a true craft
Cassandra @ Sony: The good, the bad, and the ugly part 1
Cassandra @ Sony: The good, the bad, and the ugly part 2
Enabling Search in your Cassandra Application with DataStax Enterprise
Make 2016 your year of SMACK talk
Traveler's Guide to Cassandra
Spark Cassandra Connector: Past, Present and Furure

Recently uploaded (20)

PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PPTX
Cloud computing and distributed systems.
PDF
Chapter 2 Digital Image Fundamentals.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Advanced IT Governance
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
Review of recent advances in non-invasive hemoglobin estimation
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Cloud computing and distributed systems.
Chapter 2 Digital Image Fundamentals.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Diabetes mellitus diagnosis method based random forest with bat algorithm
NewMind AI Monthly Chronicles - July 2025
Telecom Fraud Prevention Guide | Hyperlink InfoSystem
Chapter 3 Spatial Domain Image Processing.pdf
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectral efficient network and resource selection model in 5G networks
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Advanced IT Governance
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
The Rise and Fall of 3GPP – Time for a Sabbatical?
20250228 LYD VKU AI Blended-Learning.pptx
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
Transforming Manufacturing operations through Intelligent Integrations
Review of recent advances in non-invasive hemoglobin estimation

Getting Started with Graph Databases