SlideShare uma empresa Scribd logo
1 de 65
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Dr. Volkan OBAN
 
Spatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the PrettySpatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the PrettyNoam Ross
 
лекция райгородский слайды версия 1.1
лекция райгородский слайды версия 1.1лекция райгородский слайды версия 1.1
лекция райгородский слайды версия 1.1csedays
 
peRm R group. Review of packages for r for market data downloading and analysis
peRm R group. Review of packages for r for market data downloading and analysispeRm R group. Review of packages for r for market data downloading and analysis
peRm R group. Review of packages for r for market data downloading and analysisVyacheslav Arbuzov
 
Lecture 6-1543909797
Lecture 6-1543909797Lecture 6-1543909797
Lecture 6-1543909797Canh Le
 
Dynamic Parameterized Problems - Algorithms and Complexity
Dynamic Parameterized Problems - Algorithms and ComplexityDynamic Parameterized Problems - Algorithms and Complexity
Dynamic Parameterized Problems - Algorithms and Complexitycseiitgn
 
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)
Quantum Machine Learning and QEM for Gaussian mixture models (Alessandro Luongo)MeetupDataScienceRoma
 
LSGAN - SIMPle(Simple Idea Meaningful Performance Level up)
LSGAN - SIMPle(Simple Idea Meaningful Performance Level up)LSGAN - SIMPle(Simple Idea Meaningful Performance Level up)
LSGAN - SIMPle(Simple Idea Meaningful Performance Level up)Hansol Kang
 
SUPER MAGIC CORONATIONS OF GRAPHS
SUPER MAGIC CORONATIONS OF GRAPHS SUPER MAGIC CORONATIONS OF GRAPHS
SUPER MAGIC CORONATIONS OF GRAPHS IAEME Publication
 
Multiclassification with Decision Tree in Spark MLlib 1.3
Multiclassification with Decision Tree in Spark MLlib 1.3Multiclassification with Decision Tree in Spark MLlib 1.3
Multiclassification with Decision Tree in Spark MLlib 1.3leorick lin
 
Complexity Classes and the Graph Isomorphism Problem
Complexity Classes and the Graph Isomorphism ProblemComplexity Classes and the Graph Isomorphism Problem
Complexity Classes and the Graph Isomorphism Problemcseiitgn
 
IRJET- Global Accurate Domination in Jump Graph
IRJET- Global Accurate Domination in Jump GraphIRJET- Global Accurate Domination in Jump Graph
IRJET- Global Accurate Domination in Jump GraphIRJET Journal
 
A Note on Correlated Topic Models
A Note on Correlated Topic ModelsA Note on Correlated Topic Models
A Note on Correlated Topic ModelsTomonari Masada
 
Functional Programming from OO perspective (Sayeret Lambda lecture)
Functional Programming from OO perspective (Sayeret Lambda lecture)Functional Programming from OO perspective (Sayeret Lambda lecture)
Functional Programming from OO perspective (Sayeret Lambda lecture)Ittay Dror
 
Paths and Polynomials
Paths and PolynomialsPaths and Polynomials
Paths and PolynomialsASPAK2014
 

Mais procurados (20)

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

Destaque

Small, Medium and Big Data
Small, Medium and Big DataSmall, Medium and Big Data
Small, Medium and Big DataPierre De Wilde
 
Vbug nov 2010 Visio Validation
Vbug nov 2010   Visio ValidationVbug nov 2010   Visio Validation
Vbug nov 2010 Visio ValidationDavid Parker
 
A survey of heterogeneous information network analysis
A survey of heterogeneous information network analysisA survey of heterogeneous information network analysis
A survey of heterogeneous information network analysisSOYEON KIM
 
Graph databases in PHP @ PHPCon Poland 10-22-2011
Graph databases in PHP @ PHPCon Poland 10-22-2011 Graph databases in PHP @ PHPCon Poland 10-22-2011
Graph databases in PHP @ PHPCon Poland 10-22-2011 Alessandro Nadalin
 
Visio 2010 tips and techniques handouts
Visio 2010 tips and techniques handoutsVisio 2010 tips and techniques handouts
Visio 2010 tips and techniques handoutsSteven XU
 
Sql saturday and share point saturday cambridge 2015 - david parker - visio
Sql saturday and share point saturday cambridge 2015 - david parker - visioSql saturday and share point saturday cambridge 2015 - david parker - visio
Sql saturday and share point saturday cambridge 2015 - david parker - visioDavid Parker
 
Graph Search: The Power of Connected Data
Graph Search: The Power of Connected DataGraph Search: The Power of Connected Data
Graph Search: The Power of Connected DataCodemotion
 
Graph Theory #searchlove The theory that underpins how all search engines wor...
Graph Theory #searchlove The theory that underpins how all search engines wor...Graph Theory #searchlove The theory that underpins how all search engines wor...
Graph Theory #searchlove The theory that underpins how all search engines wor...Kelvin Newman
 
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)Emil Eifrem
 
Large Scale Graph Processing with Apache Giraph
Large Scale Graph Processing with Apache GiraphLarge Scale Graph Processing with Apache Giraph
Large Scale Graph Processing with Apache Giraphsscdotopen
 
Improving and Scaling SCADA Systems: Is WinCC OA Right for Me?
Improving and Scaling SCADA Systems: Is WinCC OA Right for Me?Improving and Scaling SCADA Systems: Is WinCC OA Right for Me?
Improving and Scaling SCADA Systems: Is WinCC OA Right for Me?DMC, Inc.
 
Dbta Webinar Realize Value of Big Data with graph 011713
Dbta Webinar Realize Value of Big Data with graph  011713Dbta Webinar Realize Value of Big Data with graph  011713
Dbta Webinar Realize Value of Big Data with graph 011713InfiniteGraph
 
Graph Databases - Where Do We Do the Modeling Part?
Graph Databases - Where Do We Do the Modeling Part?Graph Databases - Where Do We Do the Modeling Part?
Graph Databases - Where Do We Do the Modeling Part?DATAVERSITY
 
102602994 wincc-course-ppt
102602994 wincc-course-ppt102602994 wincc-course-ppt
102602994 wincc-course-pptMrBundle JB
 
Graph Databases for SQL Server Professionals
Graph Databases for SQL Server ProfessionalsGraph Databases for SQL Server Professionals
Graph Databases for SQL Server ProfessionalsStéphane Fréchette
 

Destaque (20)

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

Semelhante a A walk in graph databases v1.0

Loom & Functional Graphs in Clojure @ LambdaConf 2015
Loom & Functional Graphs in Clojure @ LambdaConf 2015Loom & Functional Graphs in Clojure @ LambdaConf 2015
Loom & Functional Graphs in Clojure @ LambdaConf 2015Aysylu Greenberg
 
Introduction to Gremlin
Introduction to GremlinIntroduction to Gremlin
Introduction to GremlinMax De Marzi
 
Vasia Kalavri – Training: Gelly School
Vasia Kalavri – Training: Gelly School Vasia Kalavri – Training: Gelly School
Vasia Kalavri – Training: Gelly School Flink Forward
 
Gremlin's Graph Traversal Machinery
Gremlin's Graph Traversal MachineryGremlin's Graph Traversal Machinery
Gremlin's Graph Traversal MachineryMarko Rodriguez
 
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...DataStax
 
A gremlin in my graph confoo 2014
A gremlin in my graph confoo 2014A gremlin in my graph confoo 2014
A gremlin in my graph confoo 2014Damien Seguy
 
Loom and Graphs in Clojure
Loom and Graphs in ClojureLoom and Graphs in Clojure
Loom and Graphs in ClojureAysylu Greenberg
 
A Gremlin ate my graph
A Gremlin ate my graphA Gremlin ate my graph
A Gremlin ate my graphDamien Seguy
 
Apache Flink & Graph Processing
Apache Flink & Graph ProcessingApache Flink & Graph Processing
Apache Flink & Graph ProcessingVasia Kalavri
 
The Path-o-Logical Gremlin
The Path-o-Logical GremlinThe Path-o-Logical Gremlin
The Path-o-Logical GremlinMarko Rodriguez
 
Distributed graph processing
Distributed graph processingDistributed graph processing
Distributed graph processingBartosz Konieczny
 
R visualization: ggplot2, googlevis, plotly, igraph Overview
R visualization: ggplot2, googlevis, plotly, igraph OverviewR visualization: ggplot2, googlevis, plotly, igraph Overview
R visualization: ggplot2, googlevis, plotly, igraph OverviewOlga Scrivner
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JFlorent Biville
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojurePaul Lam
 
RDataMining slides-network-analysis-with-r
RDataMining slides-network-analysis-with-rRDataMining slides-network-analysis-with-r
RDataMining slides-network-analysis-with-rYanchang Zhao
 
ImplementDijkstra’s algorithm using the graph class you implemente.pdf
ImplementDijkstra’s algorithm using the graph class you implemente.pdfImplementDijkstra’s algorithm using the graph class you implemente.pdf
ImplementDijkstra’s algorithm using the graph class you implemente.pdfgopalk44
 
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)Ankur Dave
 
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedis Labs
 

Semelhante a A walk in graph databases v1.0 (20)

Loom & Functional Graphs in Clojure @ LambdaConf 2015
Loom & Functional Graphs in Clojure @ LambdaConf 2015Loom & Functional Graphs in Clojure @ LambdaConf 2015
Loom & Functional Graphs in Clojure @ LambdaConf 2015
 
Introduction to Gremlin
Introduction to GremlinIntroduction to Gremlin
Introduction to Gremlin
 
Igraph
IgraphIgraph
Igraph
 
Vasia Kalavri – Training: Gelly School
Vasia Kalavri – Training: Gelly School Vasia Kalavri – Training: Gelly School
Vasia Kalavri – Training: Gelly School
 
Gremlin's Graph Traversal Machinery
Gremlin's Graph Traversal MachineryGremlin's Graph Traversal Machinery
Gremlin's Graph Traversal Machinery
 
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
DataStax | Graph Computing with Apache TinkerPop (Marko Rodriguez) | Cassandr...
 
A gremlin in my graph confoo 2014
A gremlin in my graph confoo 2014A gremlin in my graph confoo 2014
A gremlin in my graph confoo 2014
 
Loom and Graphs in Clojure
Loom and Graphs in ClojureLoom and Graphs in Clojure
Loom and Graphs in Clojure
 
A Gremlin ate my graph
A Gremlin ate my graphA Gremlin ate my graph
A Gremlin ate my graph
 
Apache Flink & Graph Processing
Apache Flink & Graph ProcessingApache Flink & Graph Processing
Apache Flink & Graph Processing
 
The Path-o-Logical Gremlin
The Path-o-Logical GremlinThe Path-o-Logical Gremlin
The Path-o-Logical Gremlin
 
Distributed graph processing
Distributed graph processingDistributed graph processing
Distributed graph processing
 
Gremlin
Gremlin Gremlin
Gremlin
 
R visualization: ggplot2, googlevis, plotly, igraph Overview
R visualization: ggplot2, googlevis, plotly, igraph OverviewR visualization: ggplot2, googlevis, plotly, igraph Overview
R visualization: ggplot2, googlevis, plotly, igraph Overview
 
Soft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4JSoft Shake Event / A soft introduction to Neo4J
Soft Shake Event / A soft introduction to Neo4J
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojure
 
RDataMining slides-network-analysis-with-r
RDataMining slides-network-analysis-with-rRDataMining slides-network-analysis-with-r
RDataMining slides-network-analysis-with-r
 
ImplementDijkstra’s algorithm using the graph class you implemente.pdf
ImplementDijkstra’s algorithm using the graph class you implemente.pdfImplementDijkstra’s algorithm using the graph class you implemente.pdf
ImplementDijkstra’s algorithm using the graph class you implemente.pdf
 
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
GraphX: Graph Analytics in Apache Spark (AMPCamp 5, 2014-11-20)
 
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis GraphRedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
RedisConf18 - Lower Latency Graph Queries in Cypher with Redis Graph
 

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