Presentation about Graph databases that I gave at the Yourstory Progate Developer Summit. Useful for anyone who wants to get a glimpse into graph databases
2. Why are databases still evolving
Handling velocity of data
has become important
Data is getting more
connected
Development timelines are
getting shorter
4. How Graph Databases Fulfill the wish list
O(1)
Joins
Master-master
replication
Natural and intuitive
representation of data
5.
6. User User
Post
friend
message
creates
comments
Graph SQL NoSQL
User Vertex
Type
Table Collection
friend Edge Type Intermediate
Table
DBref
Steve jobs Vertex Row Document
Birthday pic Vertex Row Document
Steve jobs’
age
Property Field Field
Data Modelling
8. Use
r
Use
r
Post
friend
message
creates
comment
s
Entire database g
All vertices g.V()
All edges g.E()
All users g.V().hasLabel(‘user’)
All message edges g.E().hasLabel(‘message’)
Specific vertex g.V(1)
Specific Edge g.E(1)
Steve Jobs g.V().has(‘name’, ‘Steve
Jobs’)
Age of Steve Jobs g.V().has(‘name’, ‘Steve
Jobs’).values(‘age’)
9. Use
r
Use
r
Post
friend
message
creates
comment
s
Me g.V(1)
My friends g.V(1).out(‘friend’)
Friends of
friends
g.V(1).out(‘friend’).out(‘friend’
)
Everyone g.V().out(‘friend’).loop(6)
My inbox g.V(1).inE(‘message’)
My best friend g.V(2)
Messages with my
best friend
g.V(1).bothE(‘message’).as(‘x’).b
othV.retain([g.V(2)]).back(‘x’)
10. Use
r
Use
r
Post
friend
message
creates
comment
s
My friends
ordered by date
g.V(1).outE(‘friend’)
.order({it.a.getProperty(‘date’)<i
t.b.getProperty(‘date’)}).outV
My latest 5
friends
g.V(1).outE(‘friend’)
.order({it.b.getProperty(‘date’)<i
t.a.getProperty(‘date’)})
.limit(5)
My friends who
are older than
30
g.V(1).out(‘friend’)
.filter({it.getProperty(‘age’)>30}
)
How well are my
friends
connected?
g.V(1).out(‘friend’).order(outE(‘f
riend’).count())
11. Use
r
Use
r
Post
friend
message
creates
comment
s
How many posts
have I created?
g.V(1).out(‘creates’).count()
Mean age of all
my friends
g.V(1).out(‘friend’).values(‘age’)
.mean()
Gender ratio of
my friends
g.V(1).out(‘friend’).groupCount().
by(‘gender’)
Average age of
men and women
in my friend
list
g.V(1).out(‘friend’).group().by(‘g
ender’).by(values(“age”).mean())
12.
13. Download Gremlin Console from http://tinkerpop.apache.org
gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
14. Neo4j OrientDB
high performance in queries Tops the XGDBench
benchmark
Gremlin support is new Evolving very fast, great
community support
No Master-master
replication
Master-master replication
Documentation is poor
Has mixed response from
customers
Once you get serious, pick a Graph DB
15. If you choose OrientDB...
Checkout https://github.com/bitonator/oriental
16. Develop a demo and check performance
before you deploy to production