SlideShare a Scribd company logo
A Walk in Graph Databases
Pierre De Wilde
4 May 2012
Global Brain Institute
VUB - ECCO Group
The Law of the Hammer




       If the only tool you have is a hammer,
             everything looks like a nail.
          Abraham Maslow - The Psychology of Science - 1966
The Law of the Relational Database




    If the only tool you have is a relational database,
               everything looks like a table.
                  A Walk in Graph Databases - 2012
doesn't
One size fits all


                    Scalability issue
                      Scale up
                      Scale out



                    Index-intensive issue
                      Find data
                      Join data
NoSQL ?! No SQL ? Not only SQL !


                Scalability solutions
                  Key-value stores
                  Column databases
                  Document databases

                Index-intensive solution
                  Graph databases
Query language for relational databases




                  SQL
               ISUD or CRUD
Traversal           graph
Query language for relational databases




       Gremlin is a graph traversal language
Map of walk
              Warm up
                Property Graph
                Graph Database

              Walk with Gremlin
                Graph Manipulation
                Graph Traversal

              Stretching
                Linked Data
                Global Graph
Map of walk
              Warm up
                Property Graph
                Graph Database

              Walk with Gremlin
                Graph Manipulation
                Graph Traversal

              Stretching
                Linked Data
                Global Graph
Graph




        G = (V, E)



                 --. .-. .- .--. ....
One graph doesn't fit all




    Marko A. Rodriguez and Peter Neubauer - Constructions from Dots and Lines - 2010
Property graph




    A property graph is a directed, labeled, attributed, multi graph.
Anatomy of a vertex


                      A vertex is composed of

                      - an unique identifier (id)
                      - a collection of properties
                      - a set of incoming edges (inE)
                      - a set of outgoing edges (outE)
Anatomy of an edge


                     An edge is composed of

                     - an unique identifier (id)
                     - an outgoing vertex (outV)
                     - a label
                     - an incoming vertex (inV)
                     - a collection of properties
Map of walk
              Warm up
                Property Graph
                Graph Database

              Walk with Gremlin
                Graph Manipulation
                Graph Traversal

              Stretching
                Linked Data
                Global Graph
Graph database
Key feature of a graph database




      Index-free adjacency
Some graph database vendors


                   Neo4j from Neo Technology
                   http://neo4j.org/


                   OrientDB from Orient Technologies
                   http://www.orientdb.org/


                   Dex from Sparsity-Technologies
                   http://www.sparsity-technologies.com/dex


                   InfiniteGraph from Objectivity, Inc.
                   http://www.infinitegraph.com/
Map of walk
              Warm up
                Property Graph
                Graph Database

              Walk with Gremlin
                Graph Manipulation
                Graph Traversal

              Stretching
                Linked Data
                Global Graph
TinkerPop




      Open source project in the graph space
TinkerPop family




          https://github.com/tinkerpop
Gremlin


                           $ gremlin.sh

                                    ,,,/
                                    (o o)
                           -----oOOo-(_)-oOOo-----
                           gremlin>




          Gremlin is a graph traversal language
Map of walk
              Warm up
                Property Graph
                Graph Database

              Walk with Gremlin
                Graph Manipulation
                Graph Traversal

              Stretching
                Linked Data
                Global Graph
Connect to a graph database


                    gremlin> g = new TinkerGraph(name)

                    gremlin> g = new Neo4jGraph(name)

                    gremlin> g = new OrientGraph(name)

                    gremlin> g = new DexGraph(name)

                    gremlin> g = new IGGraph(name)
Add a vertex / an edge


                     gremlin> v1 = g.addVertex()
                     gremlin> v2 = g.addVertex()
                     ...

                     gremlin> g.addEdge(v1, 'knows', v2)
                     ...

                     gremlin> g.loadGraphML(url)
Update a vertex


                  gremlin> v = g.getVertex(1)
                  ==>v[1]

                  gremlin> v.getPropertyKeys()
                  ==>age
                  ==>name

                  gremlin> v.getProperty('name')
                  ==>marko
                  gremlin> v.getProperty('age')
                  ==>29
                  gremlin> v.setProperty('age',32)
                  ==>32

                  gremlin> v.age
                  ==>32
                  gremlin> v.name
                  ==>marko
Update an edge


                 gremlin> e = g.getEdge(8)
                 ==>e[8][1-knows->4]

                 gremlin> e.getPropertyKeys()
                 ==>weight

                 gremlin> e.getProperty('weight')
                 ==>1.0
                 gremlin> e.setProperty('weigth',0.9)
                 ==>0.9

                 gremlin> e.map()
                 ==>weigth=0.9
                 ==>weight=1.0

                 gremlin> e.removeProperty('weigth')
                 ==>0.9
Remove a vertex


                  gremlin> v = g.getVertex(3)
                  ==>v[3]
                  gremlin> g.removeVertex(v)
                  ==>null
Remove an edge


                 gremlin> e = g.getEdge(10)
                 ==>e[10][4-created->5]
                 gremlin> g.removeEdge(e)
                 ==>null
Disconnect from the graph database


                   gremlin> g.shutdown()
Map of walk
              Warm up
                Property Graph
                Graph Database

              Walk with Gremlin
                Graph Manipulation
                Graph Traversal

              Stretching
                Linked Data
                Global Graph
Graph traversal


                  Jump

                  - from vertex to edge
                  - from edge to vertex
                  - from vertex to vertex
Graph traversal: starting the traversal


                      gremlin> g.v(1)
                      ==>v[1]
Graph traversal: outgoing edges


                    gremlin> g.v(1).outE
                    ==>e[7][1-knows->2]
                    ==>e[9][1-created->3]
                    ==>e[8][1-knows->4]
Graph traversal: incoming vertices


                    gremlin> g.v(1).outE.inV
                    ==>v[2]
                    ==>v[4]
                    ==>v[3]
Graph traversal: outgoing edges (cont.)


                     gremlin> g.v(1).outE.inV.outE
                     ==>e[10][4-created->5]
                     ==>e[11][4-created->3]
Graph traversal: incoming vertices (cont.)


                     gremlin> g.v(1).outE.inV.outE.inV
                     ==>v[5]
                     ==>v[3]
Graph traversal: ending the traversal


                     gremlin> g.v(1).outE.inV.outE.inV.outE
Graph traversal: starting vertex


                     gremlin> g.v(1)
                     ==>v[1]
Graph traversal: adjacent vertices


                     gremlin> g.v(1).out
                     ==>v[2]
                     ==>v[4]
                     ==>v[3]
Graph traversal: adjacent vertices (cont.)


                     gremlin> g.v(1).out.out
                     ==>v[5]
                     ==>v[3]
Graph traversal: starting vertex


                     gremlin> g.v(1)
                     ==>v[1]
Graph traversal: labeled outgoing edges


                    gremlin> g.v(1).outE('created')
                    ==>e[9][1-created->3]
Graph traversal: labeled adjacent vertices


                     gremlin> g.v(1).outE('created').inV
                     ==>v[3]

                     gremlin> g.v(1).out('created')
                     ==>v[3]
Graph traversal: labeled adjacent (cont.)


                     gremlin> g.v(1).out('created').in('created')
                     ==>v[1]
                     ==>v[4]
                     ==>v[6]
Graph traversal and ...


                      index
                      transform
                      filter
                      compute
                      manipulate
                      loop
                      path
Graph traversal and index


                    gremlin> g.idx('vertices')[[name:'marko']]
                    ==>v[1]
Graph traversal and transform


                    gremlin> g.v(1).outE.label.dedup
                    ==>knows
                    ==>created

                    gremlin> g.v(1).out('knows').name
                    ==>vadas
                    ==>josh
Graph traversal and filter


                      gremlin> g.v(1).out('knows').age
                      ==>27
                      ==>32

                      gremlin> g.v(1).out('knows').filter{it
                      .age>30}.age
                      ==>32
Graph traversal and compute


                   gremlin> g.v(1).outE.weight
                   ==>0.5
                   ==>1.0
                   ==>0.4

                   gremlin> g.v(1).outE.weight.mean()
                   ==>0.6333333353201548
Graph traversal and manipulate


                    gremlin> g.v(1).outE.sideEffect{it.
                    weight+=0.1}.weight
                    ==>0.6
                    ==>1.1
                    ==>0.5
Graph traversal and loop


                    gremlin> g.v(1).out.loop(1){it.loops<3}
                    ==>v[5]
                    ==>v[3]
Graph traversal and path


                    gremlin> g.v(1).outE.inV.path
                    ==>[v[1], e[7][1-knows->2], v[2]]
                    ==>[v[1], e[8][1-knows->4], v[4]]
                    ==>[v[1], e[9][1-created->3], v[3]]

                    gremlin> g.v(1).out.path
                    ==>[v[1], v[2]]
                    ==>[v[1], v[4]]
                    ==>[v[1], v[3]]
Global traversal: in-degree distribution


                      gremlin> m=[:].withDefault{0}; g.V.
                      sideEffect{m[it.in.count()]+=1}.
                      iterate(); m.sort()
                      ==>0=2
                      ==>1=3
                      ==>3=1
Walk is ending




               flexible
       Gremlin is a graph traversal language
Map of walk
              Warm up
                Property Graph
                Graph Database

              Walk with Gremlin
                Graph Manipulation
                Graph Traversal

              Stretching
                Linked Data
                Global Graph
Linked Data




          http://www.w3.org/DesignIssues/LinkedData.html
Linked Data cloud




 Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/
Linked Data initiative




                http://freeyourmetadata.org/
Linked Data and Gremlin


                        +                     +
gremlin> g = new SparqlRepositorySailGraph("http://dbpedia.org/sparql")

gremlin> v = g.v(' http://dbpedia.org/resource/Global_brain')
==>v[http://dbpedia.org/resource/Global_brain]

gremlin> v.out('http://www.w3.org/2000/01/rdf-schema#comment').has('lang',
'en').value
==>The Global Brain is a metaphor for the worldwide intelligent network...

gremlin> v.inE('http://dbpedia.org/ontology/knownFor').outV
==>v[http://dbpedia.org/resource/Francis_Heylighen]

gremlin> v.inE('http://dbpedia.org/ontology/knownFor').outV.outE('http://
dbpedia.org/ontology/knownFor').inV
==>v[http://dbpedia.org/resource/Self-organization]
==>v[http://dbpedia.org/resource/Memetics]
==>v[http://dbpedia.org/resource/Global_brain]
Map of walk
              Warm up
                Property Graph
                Graph Database

              Walk with Gremlin
                Graph Manipulation
                Graph Traversal

              Stretching
                Linked Data
                Global Graph
Graph and Brain
Global Graph



                     Internet             =>         net of computers

   Word Wide Web                          =>         web of documents

Giant Global Graph                        =>         graph of metadata



  I called this graph the Semantic Web, but maybe it should have been Giant Global Graph.

                           Tim Berners-Lee - timbl's blog - 2007
Thank you
http://tinkerpop.com




         Logos created by Ketrina Yim for TinkerPop geeks
        Images created by Flickr Creative Commons Artists
        Graphs created by Memotive Concept Mapping tool

More Related Content

PDF
r for data science 2. grammar of graphics (ggplot2) clean -ref
PDF
WE4.L09 - MEAN-SHIFT AND HIERARCHICAL CLUSTERING FOR TEXTURED POLARIMETRIC SA...
DOCX
R-ggplot2 package Examples
PDF
Q plot tutorial
PPTX
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
PDF
Perm winter school 2014.01.31
PPTX
Seminar psu 20.10.2013
DOCX
Data Visualization with R.ggplot2 and its extensions examples.
r for data science 2. grammar of graphics (ggplot2) clean -ref
WE4.L09 - MEAN-SHIFT AND HIERARCHICAL CLUSTERING FOR TEXTURED POLARIMETRIC SA...
R-ggplot2 package Examples
Q plot tutorial
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Perm winter school 2014.01.31
Seminar psu 20.10.2013
Data Visualization with R.ggplot2 and its extensions examples.

What's hot (20)

PDF
Spatial Analysis with R - the Good, the Bad, and the Pretty
PPTX
Seminar PSU 10.10.2014 mme
PDF
1452 86301000013 m
PDF
Linear Classifiers
PDF
лекция райгородский слайды версия 1.1
PDF
peRm R group. Review of packages for r for market data downloading and analysis
PPTX
Lecture 6-1543909797
PDF
Dynamic Parameterized Problems - Algorithms and Complexity
PDF
Triggering patterns of topology changes in dynamic attributed graphs
PDF
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
PDF
PDF
LSGAN - SIMPle(Simple Idea Meaningful Performance Level up)
PDF
SUPER MAGIC CORONATIONS OF GRAPHS
PDF
Multiclassification with Decision Tree in Spark MLlib 1.3
PDF
Complexity Classes and the Graph Isomorphism Problem
PDF
IRJET- Global Accurate Domination in Jump Graph
PDF
A Note on Correlated Topic Models
PDF
Functional Programming from OO perspective (Sayeret Lambda lecture)
PDF
Paths and Polynomials
PDF
Distributed Support Vector Machines
Spatial Analysis with R - the Good, the Bad, and the Pretty
Seminar PSU 10.10.2014 mme
1452 86301000013 m
Linear Classifiers
лекция райгородский слайды версия 1.1
peRm R group. Review of packages for r for market data downloading and analysis
Lecture 6-1543909797
Dynamic Parameterized Problems - Algorithms and Complexity
Triggering patterns of topology changes in dynamic attributed graphs
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
LSGAN - SIMPle(Simple Idea Meaningful Performance Level up)
SUPER MAGIC CORONATIONS OF GRAPHS
Multiclassification with Decision Tree in Spark MLlib 1.3
Complexity Classes and the Graph Isomorphism Problem
IRJET- Global Accurate Domination in Jump Graph
A Note on Correlated Topic Models
Functional Programming from OO perspective (Sayeret Lambda lecture)
Paths and Polynomials
Distributed Support Vector Machines
Ad

Viewers also liked (20)

PDF
Small, Medium and Big Data
PPTX
Vbug nov 2010 Visio Validation
PDF
A survey of heterogeneous information network analysis
PDF
Graph databases in PHP @ PHPCon Poland 10-22-2011
PDF
Visio 2010 tips and techniques handouts
PPTX
Sql saturday and share point saturday cambridge 2015 - david parker - visio
PPT
Flexsim y Visio
PDF
Graph Search: The Power of Connected Data
PPTX
Getting Started with Graph Databases
PDF
Graph Theory #searchlove The theory that underpins how all search engines wor...
PDF
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
PDF
Large Scale Graph Processing with Apache Giraph
PPTX
Improving and Scaling SCADA Systems: Is WinCC OA Right for Me?
PDF
Big Graph Data
PDF
Dbta Webinar Realize Value of Big Data with graph 011713
PDF
Graph Databases - Where Do We Do the Modeling Part?
PPT
102602994 wincc-course-ppt
PPTX
Graph Databases for SQL Server Professionals
PPSX
SIEMENS PLC S7-300&WINCC COURSE
PPT
10. Graph Databases
Small, Medium and Big Data
Vbug nov 2010 Visio Validation
A survey of heterogeneous information network analysis
Graph databases in PHP @ PHPCon Poland 10-22-2011
Visio 2010 tips and techniques handouts
Sql saturday and share point saturday cambridge 2015 - david parker - visio
Flexsim y Visio
Graph Search: The Power of Connected Data
Getting Started with Graph Databases
Graph Theory #searchlove The theory that underpins how all search engines wor...
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
Large Scale Graph Processing with Apache Giraph
Improving and Scaling SCADA Systems: Is WinCC OA Right for Me?
Big Graph Data
Dbta Webinar Realize Value of Big Data with graph 011713
Graph Databases - Where Do We Do the Modeling Part?
102602994 wincc-course-ppt
Graph Databases for SQL Server Professionals
SIEMENS PLC S7-300&WINCC COURSE
10. Graph Databases
Ad

Similar to A walk in graph databases v1.0 (20)

PDF
Diving into DSE Graph
PDF
1st UIM-GDB - Connections to the Real World
PDF
In The Land Of Graphs...
PDF
Gremlin's Graph Traversal Machinery
PDF
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
PDF
Gremlin 101.3 On Your FM Dial
PPTX
Introduction to Gremlin
PDF
Memoirs of a Graph Addict: Despair to Redemption
PPTX
Meet Gremlin – your guide through graphs in Cosmos DB
PPTX
Data Con LA 2018 - Graph Computing: How the Gremlin Stole Christmas by Justin...
PDF
The Path-o-Logical Gremlin
PDF
The Pathology of Graph Databases
PDF
TinkerPop: a story of graphs, DBs, and graph DBs
PPTX
DATA STRUCTURES.pptx
PDF
Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at...
PDF
TinkerPop 2020
KEY
ソーシャルグラフ分析
PDF
ACM DBPL Keynote: The Graph Traversal Machine and Language
Diving into DSE Graph
1st UIM-GDB - Connections to the Real World
In The Land Of Graphs...
Gremlin's Graph Traversal Machinery
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
Gremlin 101.3 On Your FM Dial
Introduction to Gremlin
Memoirs of a Graph Addict: Despair to Redemption
Meet Gremlin – your guide through graphs in Cosmos DB
Data Con LA 2018 - Graph Computing: How the Gremlin Stole Christmas by Justin...
The Path-o-Logical Gremlin
The Pathology of Graph Databases
TinkerPop: a story of graphs, DBs, and graph DBs
DATA STRUCTURES.pptx
Processing large-scale graphs with Google(TM) Pregel by MICHAEL HACKSTEIN at...
TinkerPop 2020
ソーシャルグラフ分析
ACM DBPL Keynote: The Graph Traversal Machine and Language

A walk in graph databases v1.0

  • 1. A Walk in Graph Databases Pierre De Wilde 4 May 2012 Global Brain Institute VUB - ECCO Group
  • 2. The Law of the Hammer If the only tool you have is a hammer, everything looks like a nail. Abraham Maslow - The Psychology of Science - 1966
  • 3. The Law of the Relational Database If the only tool you have is a relational database, everything looks like a table. A Walk in Graph Databases - 2012
  • 4. doesn't One size fits all Scalability issue Scale up Scale out Index-intensive issue Find data Join data
  • 5. NoSQL ?! No SQL ? Not only SQL ! Scalability solutions Key-value stores Column databases Document databases Index-intensive solution Graph databases
  • 6. Query language for relational databases SQL ISUD or CRUD
  • 7. Traversal graph Query language for relational databases Gremlin is a graph traversal language
  • 8. Map of walk Warm up Property Graph Graph Database Walk with Gremlin Graph Manipulation Graph Traversal Stretching Linked Data Global Graph
  • 9. Map of walk Warm up Property Graph Graph Database Walk with Gremlin Graph Manipulation Graph Traversal Stretching Linked Data Global Graph
  • 10. Graph G = (V, E) --. .-. .- .--. ....
  • 11. One graph doesn't fit all Marko A. Rodriguez and Peter Neubauer - Constructions from Dots and Lines - 2010
  • 12. Property graph A property graph is a directed, labeled, attributed, multi graph.
  • 13. Anatomy of a vertex A vertex is composed of - an unique identifier (id) - a collection of properties - a set of incoming edges (inE) - a set of outgoing edges (outE)
  • 14. Anatomy of an edge An edge is composed of - an unique identifier (id) - an outgoing vertex (outV) - a label - an incoming vertex (inV) - a collection of properties
  • 15. Map of walk Warm up Property Graph Graph Database Walk with Gremlin Graph Manipulation Graph Traversal Stretching Linked Data Global Graph
  • 17. Key feature of a graph database Index-free adjacency
  • 18. Some graph database vendors Neo4j from Neo Technology http://neo4j.org/ OrientDB from Orient Technologies http://www.orientdb.org/ Dex from Sparsity-Technologies http://www.sparsity-technologies.com/dex InfiniteGraph from Objectivity, Inc. http://www.infinitegraph.com/
  • 19. Map of walk Warm up Property Graph Graph Database Walk with Gremlin Graph Manipulation Graph Traversal Stretching Linked Data Global Graph
  • 20. TinkerPop Open source project in the graph space
  • 21. TinkerPop family https://github.com/tinkerpop
  • 22. Gremlin $ gremlin.sh ,,,/ (o o) -----oOOo-(_)-oOOo----- gremlin> Gremlin is a graph traversal language
  • 23. Map of walk Warm up Property Graph Graph Database Walk with Gremlin Graph Manipulation Graph Traversal Stretching Linked Data Global Graph
  • 24. Connect to a graph database gremlin> g = new TinkerGraph(name) gremlin> g = new Neo4jGraph(name) gremlin> g = new OrientGraph(name) gremlin> g = new DexGraph(name) gremlin> g = new IGGraph(name)
  • 25. Add a vertex / an edge gremlin> v1 = g.addVertex() gremlin> v2 = g.addVertex() ... gremlin> g.addEdge(v1, 'knows', v2) ... gremlin> g.loadGraphML(url)
  • 26. Update a vertex gremlin> v = g.getVertex(1) ==>v[1] gremlin> v.getPropertyKeys() ==>age ==>name gremlin> v.getProperty('name') ==>marko gremlin> v.getProperty('age') ==>29 gremlin> v.setProperty('age',32) ==>32 gremlin> v.age ==>32 gremlin> v.name ==>marko
  • 27. Update an edge gremlin> e = g.getEdge(8) ==>e[8][1-knows->4] gremlin> e.getPropertyKeys() ==>weight gremlin> e.getProperty('weight') ==>1.0 gremlin> e.setProperty('weigth',0.9) ==>0.9 gremlin> e.map() ==>weigth=0.9 ==>weight=1.0 gremlin> e.removeProperty('weigth') ==>0.9
  • 28. Remove a vertex gremlin> v = g.getVertex(3) ==>v[3] gremlin> g.removeVertex(v) ==>null
  • 29. Remove an edge gremlin> e = g.getEdge(10) ==>e[10][4-created->5] gremlin> g.removeEdge(e) ==>null
  • 30. Disconnect from the graph database gremlin> g.shutdown()
  • 31. Map of walk Warm up Property Graph Graph Database Walk with Gremlin Graph Manipulation Graph Traversal Stretching Linked Data Global Graph
  • 32. Graph traversal Jump - from vertex to edge - from edge to vertex - from vertex to vertex
  • 33. Graph traversal: starting the traversal gremlin> g.v(1) ==>v[1]
  • 34. Graph traversal: outgoing edges gremlin> g.v(1).outE ==>e[7][1-knows->2] ==>e[9][1-created->3] ==>e[8][1-knows->4]
  • 35. Graph traversal: incoming vertices gremlin> g.v(1).outE.inV ==>v[2] ==>v[4] ==>v[3]
  • 36. Graph traversal: outgoing edges (cont.) gremlin> g.v(1).outE.inV.outE ==>e[10][4-created->5] ==>e[11][4-created->3]
  • 37. Graph traversal: incoming vertices (cont.) gremlin> g.v(1).outE.inV.outE.inV ==>v[5] ==>v[3]
  • 38. Graph traversal: ending the traversal gremlin> g.v(1).outE.inV.outE.inV.outE
  • 39. Graph traversal: starting vertex gremlin> g.v(1) ==>v[1]
  • 40. Graph traversal: adjacent vertices gremlin> g.v(1).out ==>v[2] ==>v[4] ==>v[3]
  • 41. Graph traversal: adjacent vertices (cont.) gremlin> g.v(1).out.out ==>v[5] ==>v[3]
  • 42. Graph traversal: starting vertex gremlin> g.v(1) ==>v[1]
  • 43. Graph traversal: labeled outgoing edges gremlin> g.v(1).outE('created') ==>e[9][1-created->3]
  • 44. Graph traversal: labeled adjacent vertices gremlin> g.v(1).outE('created').inV ==>v[3] gremlin> g.v(1).out('created') ==>v[3]
  • 45. Graph traversal: labeled adjacent (cont.) gremlin> g.v(1).out('created').in('created') ==>v[1] ==>v[4] ==>v[6]
  • 46. Graph traversal and ... index transform filter compute manipulate loop path
  • 47. Graph traversal and index gremlin> g.idx('vertices')[[name:'marko']] ==>v[1]
  • 48. Graph traversal and transform gremlin> g.v(1).outE.label.dedup ==>knows ==>created gremlin> g.v(1).out('knows').name ==>vadas ==>josh
  • 49. Graph traversal and filter gremlin> g.v(1).out('knows').age ==>27 ==>32 gremlin> g.v(1).out('knows').filter{it .age>30}.age ==>32
  • 50. Graph traversal and compute gremlin> g.v(1).outE.weight ==>0.5 ==>1.0 ==>0.4 gremlin> g.v(1).outE.weight.mean() ==>0.6333333353201548
  • 51. Graph traversal and manipulate gremlin> g.v(1).outE.sideEffect{it. weight+=0.1}.weight ==>0.6 ==>1.1 ==>0.5
  • 52. Graph traversal and loop gremlin> g.v(1).out.loop(1){it.loops<3} ==>v[5] ==>v[3]
  • 53. Graph traversal and path gremlin> g.v(1).outE.inV.path ==>[v[1], e[7][1-knows->2], v[2]] ==>[v[1], e[8][1-knows->4], v[4]] ==>[v[1], e[9][1-created->3], v[3]] gremlin> g.v(1).out.path ==>[v[1], v[2]] ==>[v[1], v[4]] ==>[v[1], v[3]]
  • 54. Global traversal: in-degree distribution gremlin> m=[:].withDefault{0}; g.V. sideEffect{m[it.in.count()]+=1}. iterate(); m.sort() ==>0=2 ==>1=3 ==>3=1
  • 55. Walk is ending flexible Gremlin is a graph traversal language
  • 56. Map of walk Warm up Property Graph Graph Database Walk with Gremlin Graph Manipulation Graph Traversal Stretching Linked Data Global Graph
  • 57. Linked Data http://www.w3.org/DesignIssues/LinkedData.html
  • 58. Linked Data cloud Linking Open Data cloud diagram, by Richard Cyganiak and Anja Jentzsch. http://lod-cloud.net/
  • 59. Linked Data initiative http://freeyourmetadata.org/
  • 60. Linked Data and Gremlin + + gremlin> g = new SparqlRepositorySailGraph("http://dbpedia.org/sparql") gremlin> v = g.v(' http://dbpedia.org/resource/Global_brain') ==>v[http://dbpedia.org/resource/Global_brain] gremlin> v.out('http://www.w3.org/2000/01/rdf-schema#comment').has('lang', 'en').value ==>The Global Brain is a metaphor for the worldwide intelligent network... gremlin> v.inE('http://dbpedia.org/ontology/knownFor').outV ==>v[http://dbpedia.org/resource/Francis_Heylighen] gremlin> v.inE('http://dbpedia.org/ontology/knownFor').outV.outE('http:// dbpedia.org/ontology/knownFor').inV ==>v[http://dbpedia.org/resource/Self-organization] ==>v[http://dbpedia.org/resource/Memetics] ==>v[http://dbpedia.org/resource/Global_brain]
  • 61. Map of walk Warm up Property Graph Graph Database Walk with Gremlin Graph Manipulation Graph Traversal Stretching Linked Data Global Graph
  • 63. Global Graph Internet => net of computers Word Wide Web => web of documents Giant Global Graph => graph of metadata I called this graph the Semantic Web, but maybe it should have been Giant Global Graph. Tim Berners-Lee - timbl's blog - 2007
  • 65. http://tinkerpop.com Logos created by Ketrina Yim for TinkerPop geeks Images created by Flickr Creative Commons Artists Graphs created by Memotive Concept Mapping tool