In The Land Of Graphs...
Upcoming SlideShare
Loading in...5
×
 

In The Land Of Graphs...

on

  • 203 views

Scottland Ruby Conference 2014

Scottland Ruby Conference 2014

Statistics

Views

Total Views
203
Views on SlideShare
200
Embed Views
3

Actions

Likes
0
Downloads
3
Comments
0

1 Embed 3

https://twitter.com 3

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    In The Land Of Graphs... In The Land Of Graphs... Presentation Transcript

    • In the land of graphs Fernand Galiana @kitesurfer
    • Agenda • Graph morphology • Persistence mechanisms • Terminology • Modeling • Graph databases and API’s • Integrating with Ruby/Rails • How to win $1,000,000
    • Graph Databases
    • Morphology Dots and lines
    • Undirected graph (~200BC)
    • Directed graph (~14th-16th century)
    • MultiRelational Graph (19th century) followsfollows likes likes
    • Property Graph (present) followsfollows likes likes name: Fred age: 29 name: Jim age: 19
    • Property Graph (cont) followsfollows likes likes name: Fred age: 29 name: James age: 19 weight: 0.9 date: 11/12/13
    • @jimweirich
    • Persistence
    • Any database can model a graph
    • Index Base Traversal DC E A B B,C E E,D CB D E A
    • DC E A B B,C E E,D CB D E A Index Base Traversal
    • DC E A B B,C E E,D CB D E A Index Base Traversal
    • DC E A B B,C E E,D CB D E A Index Base Traversal
    • A graph database is any storage system that can provide index-free adjacency.
    • GraphDB DC E A B
    • GraphDB DC E A B
    • Performance Depth SQL Neo4j Recs 2 0.01 0.01 2.5k 3 30.26 0.16 100k 4 1,543 1.35 600k 5 Toast! 2.1 800k
    • @jimweirich
    • Why use a graph DB? • Recommendations - densifying the graph • Social • Ranking • Merging domains • Data analysis
    • Terminology
    • Terminology 1 2 follows 3 likes loves
    • Terminology 1 2 follows 3 likes loves OUT Vertex IN Vertex
    • Terminology 1 2 follows 3 likes loves vertex 1 OUT edges
    • Terminology 1 2 follows 3 likes loves vertex 2 IN edges
    • Terminology 1 2 follows 3 likes loves vertex 3 BOTH edges
    • @jimweirich
    • Modeling A B
    • Modeling • Vertex • Edge • Properties • Relationships
    • Modeling • Assess the space • Nodes = Entities • Edges = connections + semantic context • NProperties = entity attrs + meta • EProperties = strength + weight
    • @jimweirich
    • The Scene …
    • DSLs • Cypher (Neo4j) • Gremlin (BluePrint) • SPARQL
    • Rexster • Rexster (REST) • RexPro (bin) • Rexster Kibbles
    • Blueprints
    • Gremlin
    • Gremlin[CruD] • g.addVertex(id,[a:10,b:’Hello’]) • g.addEdge(id,v1,v2,’friend’,[a:10]) • g.removeVertex(g.v(id)) • g.removeEdge(g.e(id)) • g.v(id).remove() • …
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g = rexster.getGraph('derailed_graph')
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.V ==> v[1], v[2], v[3], v[4], v[5], v[6], v[7]
    • gremlin> g.E ==> e[1][1-friend-2], e[2][1-friend-3], etc… 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.v(1) ==> v[1]
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.V(‘name’, ‘Gustave’) ==> v[1]
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.e(1) ==> e[1][1-friend-2]
    • gremlin> g.v(1).outE ==> e[1][1-friend-2], e[2][1-friend-3],e[3][1-friend-4] 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend
    • gremlin> g.v(7).inE ==> e[7][3-friend-7] 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend
    • gremlin> g.v(4).bothE ==> e[3][1-friend-4], e[8][4-friend-6] 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.v(4).both ==> v[1], v[6]
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.v(1) ==> v[1]
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.v(1).out(‘friend’) ==> v[2], v[3], v[4]
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.v(1).out(‘friend’).out(‘friend’) ==> v[5], v[6], v[6], v[6], v[7]
    • 2 4 5 6 7 1 3 Oscar Rango BatisteGustave Gertrude Stew Olaf friend friend friend friend friend friend friend friend gremlin> g.v(1).out(‘friend’).out(‘friend’).groupCount.cap ==> {v[5]=1,v[6]=3,v[7]=1}
    • DEMO! • Rexster DogHouse • Wewoo
 (coz self promotion is underated!)
    • @jimweirich
    • Conclusion • Mining relationships • Recommendation, data analysis • Scoring, Ranking • Understand problem space • Search engine integration • Combining several problem spaces
    • References • https://github.com/tinkerpop/gremlin • http://gremlindocs.com • http://sql2gremlin.com • github.com/derailed/wewoo • @jimweirich
    • Is a Graph worth a thousand joins? ! ! ! Thank you! @kitesurfer fernand.galiana@gmail.com