SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
On Graph Databases



  Pere Urbón Bayes
         purbon@purbon.com


        May of 2010



   BcnOnRails May - 2010 - On Graph Databases   1
On Graph Databases

●   NoSQL movement.
●   Graph databases.
●   Pros and cons.
●   Use cases.
●   Technology overview.
●   Example.


                 BcnOnRails May - 2010 - On Graph Databases   2
NoSQL Movement

●   Next Generation of Databases.
●   Innovative. (?)
●   Open Source. (?)
●   Non-Relational.
●   Schema-less.
●   Distributed.
●   Scalable.



                      BcnOnRails May - 2010 - On Graph Databases   3
NoSQL Movement

●   Stores.                                  ●   More Stores.
        –   Document.                                    –   Grid database.
        –   Key/Value.                                   –   XML Database.
        –   Object oriented.                             –   RDF.
        –   Column.                                      –   .....
        –   Graph database.




                      BcnOnRails May - 2010 - On Graph Databases              4
NoSQL Movement

●   NoSQL is not the holy grail, never forget it.
●   Precursors & roots begun at the early 70's.
        –   Network databases, Charles Bachman 1969.




    案ずるより産むが易し。
               –   Giving birth to a baby is easier than worrying about it.



                         BcnOnRails May - 2010 - On Graph Databases           5
Graph Databases

●   Data strongly related.
        –   Social networks.
        –   GIS Systems.
        –   Transportation.
        –   Bibliographic.
        –   File systems.
        –   ........

                                                       GitHub Ruby community by country


                         BcnOnRails May - 2010 - On Graph Databases                       6
Graph Databases

●   The Property Graph.
        –   Labeled.
        –   Directed.
        –   Attributed.
        –   Multigraph.
●   Talk about.
        –   Nodes with types.
        –   Edges with types.
        –   Attributes.
                          BcnOnRails May - 2010 - On Graph Databases   7
Graph Databases

●   Graph storage.
       –   Adjacency Matrix.
       –   Adjacency List.
       –   Incidence Matrix.
       –   Incidence List.
●   GraphDB's.
       –   Bitmaps.
       –   B+Trees.
       –   RB Trees.
                       BcnOnRails May - 2010 - On Graph Databases   8
Graph Databases

                                                        Query           MySQL      OIM      DEX

                                                   Q1:count              20,38     17,35      0

            RDBMS       OIM            DEX         Q2:scan               32,76    174,64     3,14

  data      27.36 GB   54 GB         9.69 GB       Q3:select              7,34     5,43      0,84

                                                   Q4:projection         17,34     43,7     33,19
  ratio       10,9      21,51          3,86
overhead                                           Q5:combine             0,74     2,61      0,01
load time   52891 s    17543 s       95579 s
                                                   Q6:explode             0,07    202,07     0,01

                                                   Q7:values             12,28     20,77     0,01

                                                   Q8:hub               >3hours   >3hours   624,68



                                 BcnOnRails May - 2010 - On Graph Databases                       9
Graph Databases




  BcnOnRails May - 2010 - On Graph Databases   10
Use cases

●   Network analysis.
●   Link analysis.
●   Graph mining.
●   Neural networks.
●   Bibliographic search.
●   Semantic web.


                 BcnOnRails May - 2010 - On Graph Databases   11
Use cases

●   Algorithmic recruitment with GitHub.
       –   Centrality: The importance of a vertex within a
            graph.
               ●   Betweens: Vertex that occur on many shortest
                    path have higher centrality.
                        –   O(v^3) without any optimization.

               ●   Another possible choices:
                        –   Closeness: Vertex with a short geodesic distance
                              to other ones have a high closeness.
                                  ● Usually preferred on network analysis.




                       BcnOnRails May - 2010 - On Graph Databases              12
Graph Databases

●   Shortest Paths.                            ●   Centrality.
        –   BFS/DFS.                                       –   Betweenness.
        –   Dijkstra.                                      –   Closeness.
        –   Floyd-Warshall.                                –   Diameter.
        –   Ford.                                          –   Radius.
●   Connectivity.                              ●   Traversals.
        –   Strongly connected.                            –   BFS/DFS.
        –   Weakly connected.                  ●   Communities.
                                               ●   Staining.
                        BcnOnRails May - 2010 - On Graph Databases            13
Pros and cons

●   Data facts.                             ●   Relational model facts.
        –   Growths                                     –   E.F Codd model.
             exponentially.                             –   Normalization.
        –   Hugh                                        –   Object-Relational
             interdependency                                 impedance
             and complexity.                                 mismatch.
        –   Relationships are                           –   Join's doesn't scale.
             important.
                                                        –   Big tables.
        –   Structure change
              over time.                                –   Denormalization.

                     BcnOnRails May - 2010 - On Graph Databases                 14
Technology overview

●   Neo4J: Open source database NoSQL graph.
●   Dex: The high performance graph database.
●   HyperGraphDB: An IA and semantic web
     graph database.
●   Infogrid: The Internet Graph database.
●   Sones: SaaS dot Net Graph database.
●   VertexDB: High performance database server.

                 BcnOnRails May - 2010 - On Graph Databases   15
Benchmarking

Kernel      Scale 15   DEX        Neo4j        Jena      HypergraphDB
K1 Load (s)               7,44        697         141 +24h

K2 Scan edges (s)       0,0010       2,71        0,689
K3 2-hops (s)           0,0120     0,0260        0,443
                                                          Kernel           DEX          Neo4j     Jena     Hypergr
K4 BC (s)                 14,8       8,24         138                                                      aphDB
                                                                Scale 20
Db size (MB)                 30           17      207     K1 Load (s)             317    32.094    4.560 +24h

                                                          K2 Scan           0,005           751     18,6
 Graph Database Performance on the                        edges (s)
 HPC Scalable Graph Analysis Benchmark                    K3 2-hops (s)     0,033        0,0230 0,4580
                                                          K4 BC (s)               617     7.027 59.512

                                                          Db size (MB)            893       539    6.656


                                     BcnOnRails May - 2010 - On Graph Databases                              16
Technology overview




    BcnOnRails May - 2010 - On Graph Databases   17
Technology overview
●   Neo4J.rb ( JRuby target )
        –   Active record integration.
        –   Dynamic and schema free.
        –   Fast traversal of relationships.
        –   Transactions with rollbacks support.
        –   Indexing and querying of ruby objects.
        –   Massive loaders.
                                   http://wiki.neo4j.org/content/Ruby
        –   Ruby on Rails integration.
        –   Accessible throw REST.

                        BcnOnRails May - 2010 - On Graph Databases   18
Technology overview
    Creating nodes                                Properties
 require "rubygems"                        node = Neo4j::Node.new
 require 'neo4j'                           node[:name] = 'foo'
                                           node[:age] = 123
 Neo4j::Transaction.run do                 node[:hungry] = false
  node = Neo4j::Node.new                   node[4] = 3.14
 end                                       node[:age] # => 123

 Transactions over blocks                    Creating relationships

Neo4j::Transaction.run do                node1 = Neo4j::Node.new
  # neo4j operations goes here           node2 = Neo4j::Node.new
 end                                     Neo4j::Relationship.new(:friends, node1, node2)

                                         # which is same as
                                         node1.rels.outgoing(:friends) << node2



                             BcnOnRails May - 2010 - On Graph Databases                    19
Technology overview
 Accessing relationships
node1.rels.empty? # => false

# The rels method returns an enumeration of relationship objects.
# The nodes method on the relationships returns the nodes instead.
node1.rels.nodes.include?(node2) # => true

node1.rels.first # => the first relationship this node1 has.
node1.rels.nodes.first # => node2 first node of any relationship type
node2.rels.incoming(:friends).nodes.first # => node1 first node of relationship type 'friends'
node2.rels.incoming(:friends).first # => a relationship object between node1 and node2

 Properties on Relationships
rel = node1.rels.outgoing(:friends).first

rel[:since] = 1982
node1.rels.first[:since] # => 1982

                               BcnOnRails May - 2010 - On Graph Databases                  20
Example



For the joy of someone, lets play a little with a
                graph database.




               BcnOnRails May - 2010 - On Graph Databases   21
On Graph Databases




    Thanks you!
    Pere Urbón Bayes
         purbon@purbon.com




   BcnOnRails May - 2010 - On Graph Databases   22

Más contenido relacionado

Destacado

Graph Databases, The Web of Data Storage Engines
Graph Databases, The Web of Data Storage EnginesGraph Databases, The Web of Data Storage Engines
Graph Databases, The Web of Data Storage Engines
Pere Urbón-Bayes
 

Destacado (6)

Advantages in Place: Federal Funding
Advantages in Place: Federal Funding Advantages in Place: Federal Funding
Advantages in Place: Federal Funding
 
Graph Databases introduction to rug-b
Graph Databases introduction to rug-bGraph Databases introduction to rug-b
Graph Databases introduction to rug-b
 
Try NoSQL it doesn't hurts and is fun
Try NoSQL it doesn't hurts and is funTry NoSQL it doesn't hurts and is fun
Try NoSQL it doesn't hurts and is fun
 
Graph Databases, The Web of Data Storage Engines
Graph Databases, The Web of Data Storage EnginesGraph Databases, The Web of Data Storage Engines
Graph Databases, The Web of Data Storage Engines
 
Graph Theory and Databases
Graph Theory and DatabasesGraph Theory and Databases
Graph Theory and Databases
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Similar a Bcn On Rails May2010 On Graph Databases

An Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDBAn Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDB
William LaForest
 
Big data hadoop-no sql and graph db-final
Big data hadoop-no sql and graph db-finalBig data hadoop-no sql and graph db-final
Big data hadoop-no sql and graph db-final
ramazan fırın
 
CSC 8101 Non Relational Databases
CSC 8101 Non Relational DatabasesCSC 8101 Non Relational Databases
CSC 8101 Non Relational Databases
sjwoodman
 
Data-Intensive Text Processing with MapReduce
Data-Intensive Text Processing  with MapReduce Data-Intensive Text Processing  with MapReduce
Data-Intensive Text Processing with MapReduce
George Ang
 
Data-Intensive Text Processing with MapReduce
Data-Intensive Text Processing with MapReduceData-Intensive Text Processing with MapReduce
Data-Intensive Text Processing with MapReduce
George Ang
 

Similar a Bcn On Rails May2010 On Graph Databases (20)

Anti-social Databases
Anti-social DatabasesAnti-social Databases
Anti-social Databases
 
Spring Data Neo4j Intro SpringOne 2011
Spring Data Neo4j Intro SpringOne 2011Spring Data Neo4j Intro SpringOne 2011
Spring Data Neo4j Intro SpringOne 2011
 
Drill njhug -19 feb2013
Drill njhug -19 feb2013Drill njhug -19 feb2013
Drill njhug -19 feb2013
 
Grails goes Graph
Grails goes GraphGrails goes Graph
Grails goes Graph
 
An Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDBAn Introduction to Big Data, NoSQL and MongoDB
An Introduction to Big Data, NoSQL and MongoDB
 
Django and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks assDjango and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks ass
 
NOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the CloudNOSQL, CouchDB, and the Cloud
NOSQL, CouchDB, and the Cloud
 
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)
 
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
 
RTree Spatial Indexing with MongoDB - MongoDC
RTree Spatial Indexing with MongoDB - MongoDC RTree Spatial Indexing with MongoDB - MongoDC
RTree Spatial Indexing with MongoDB - MongoDC
 
Big data hadoop-no sql and graph db-final
Big data hadoop-no sql and graph db-finalBig data hadoop-no sql and graph db-final
Big data hadoop-no sql and graph db-final
 
What is the "Big Data" version of the Linpack Benchmark? ; What is “Big Data...
What is the "Big Data" version of the Linpack Benchmark?; What is “Big Data...What is the "Big Data" version of the Linpack Benchmark?; What is “Big Data...
What is the "Big Data" version of the Linpack Benchmark? ; What is “Big Data...
 
CSC 8101 Non Relational Databases
CSC 8101 Non Relational DatabasesCSC 8101 Non Relational Databases
CSC 8101 Non Relational Databases
 
Data-Intensive Text Processing with MapReduce
Data-Intensive Text Processing  with MapReduce Data-Intensive Text Processing  with MapReduce
Data-Intensive Text Processing with MapReduce
 
Data-Intensive Text Processing with MapReduce
Data-Intensive Text Processing with MapReduceData-Intensive Text Processing with MapReduce
Data-Intensive Text Processing with MapReduce
 
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
 
Relational vs. Non-Relational
Relational vs. Non-RelationalRelational vs. Non-Relational
Relational vs. Non-Relational
 
NoSQL & Big Data Analytics: History, Hype, Opportunities
NoSQL & Big Data Analytics: History, Hype, OpportunitiesNoSQL & Big Data Analytics: History, Hype, Opportunities
NoSQL & Big Data Analytics: History, Hype, Opportunities
 
DevNation Atlanta
DevNation AtlantaDevNation Atlanta
DevNation Atlanta
 
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Bcn On Rails May2010 On Graph Databases

  • 1. On Graph Databases Pere Urbón Bayes purbon@purbon.com May of 2010 BcnOnRails May - 2010 - On Graph Databases 1
  • 2. On Graph Databases ● NoSQL movement. ● Graph databases. ● Pros and cons. ● Use cases. ● Technology overview. ● Example. BcnOnRails May - 2010 - On Graph Databases 2
  • 3. NoSQL Movement ● Next Generation of Databases. ● Innovative. (?) ● Open Source. (?) ● Non-Relational. ● Schema-less. ● Distributed. ● Scalable. BcnOnRails May - 2010 - On Graph Databases 3
  • 4. NoSQL Movement ● Stores. ● More Stores. – Document. – Grid database. – Key/Value. – XML Database. – Object oriented. – RDF. – Column. – ..... – Graph database. BcnOnRails May - 2010 - On Graph Databases 4
  • 5. NoSQL Movement ● NoSQL is not the holy grail, never forget it. ● Precursors & roots begun at the early 70's. – Network databases, Charles Bachman 1969. 案ずるより産むが易し。 – Giving birth to a baby is easier than worrying about it. BcnOnRails May - 2010 - On Graph Databases 5
  • 6. Graph Databases ● Data strongly related. – Social networks. – GIS Systems. – Transportation. – Bibliographic. – File systems. – ........ GitHub Ruby community by country BcnOnRails May - 2010 - On Graph Databases 6
  • 7. Graph Databases ● The Property Graph. – Labeled. – Directed. – Attributed. – Multigraph. ● Talk about. – Nodes with types. – Edges with types. – Attributes. BcnOnRails May - 2010 - On Graph Databases 7
  • 8. Graph Databases ● Graph storage. – Adjacency Matrix. – Adjacency List. – Incidence Matrix. – Incidence List. ● GraphDB's. – Bitmaps. – B+Trees. – RB Trees. BcnOnRails May - 2010 - On Graph Databases 8
  • 9. Graph Databases Query MySQL OIM DEX Q1:count 20,38 17,35 0 RDBMS OIM DEX Q2:scan 32,76 174,64 3,14 data 27.36 GB 54 GB 9.69 GB Q3:select 7,34 5,43 0,84 Q4:projection 17,34 43,7 33,19 ratio 10,9 21,51 3,86 overhead Q5:combine 0,74 2,61 0,01 load time 52891 s 17543 s 95579 s Q6:explode 0,07 202,07 0,01 Q7:values 12,28 20,77 0,01 Q8:hub >3hours >3hours 624,68 BcnOnRails May - 2010 - On Graph Databases 9
  • 10. Graph Databases BcnOnRails May - 2010 - On Graph Databases 10
  • 11. Use cases ● Network analysis. ● Link analysis. ● Graph mining. ● Neural networks. ● Bibliographic search. ● Semantic web. BcnOnRails May - 2010 - On Graph Databases 11
  • 12. Use cases ● Algorithmic recruitment with GitHub. – Centrality: The importance of a vertex within a graph. ● Betweens: Vertex that occur on many shortest path have higher centrality. – O(v^3) without any optimization. ● Another possible choices: – Closeness: Vertex with a short geodesic distance to other ones have a high closeness. ● Usually preferred on network analysis. BcnOnRails May - 2010 - On Graph Databases 12
  • 13. Graph Databases ● Shortest Paths. ● Centrality. – BFS/DFS. – Betweenness. – Dijkstra. – Closeness. – Floyd-Warshall. – Diameter. – Ford. – Radius. ● Connectivity. ● Traversals. – Strongly connected. – BFS/DFS. – Weakly connected. ● Communities. ● Staining. BcnOnRails May - 2010 - On Graph Databases 13
  • 14. Pros and cons ● Data facts. ● Relational model facts. – Growths – E.F Codd model. exponentially. – Normalization. – Hugh – Object-Relational interdependency impedance and complexity. mismatch. – Relationships are – Join's doesn't scale. important. – Big tables. – Structure change over time. – Denormalization. BcnOnRails May - 2010 - On Graph Databases 14
  • 15. Technology overview ● Neo4J: Open source database NoSQL graph. ● Dex: The high performance graph database. ● HyperGraphDB: An IA and semantic web graph database. ● Infogrid: The Internet Graph database. ● Sones: SaaS dot Net Graph database. ● VertexDB: High performance database server. BcnOnRails May - 2010 - On Graph Databases 15
  • 16. Benchmarking Kernel Scale 15 DEX Neo4j Jena HypergraphDB K1 Load (s) 7,44 697 141 +24h K2 Scan edges (s) 0,0010 2,71 0,689 K3 2-hops (s) 0,0120 0,0260 0,443 Kernel DEX Neo4j Jena Hypergr K4 BC (s) 14,8 8,24 138 aphDB Scale 20 Db size (MB) 30 17 207 K1 Load (s) 317 32.094 4.560 +24h K2 Scan 0,005 751 18,6 Graph Database Performance on the edges (s) HPC Scalable Graph Analysis Benchmark K3 2-hops (s) 0,033 0,0230 0,4580 K4 BC (s) 617 7.027 59.512 Db size (MB) 893 539 6.656 BcnOnRails May - 2010 - On Graph Databases 16
  • 17. Technology overview BcnOnRails May - 2010 - On Graph Databases 17
  • 18. Technology overview ● Neo4J.rb ( JRuby target ) – Active record integration. – Dynamic and schema free. – Fast traversal of relationships. – Transactions with rollbacks support. – Indexing and querying of ruby objects. – Massive loaders. http://wiki.neo4j.org/content/Ruby – Ruby on Rails integration. – Accessible throw REST. BcnOnRails May - 2010 - On Graph Databases 18
  • 19. Technology overview Creating nodes Properties require "rubygems" node = Neo4j::Node.new require 'neo4j' node[:name] = 'foo' node[:age] = 123 Neo4j::Transaction.run do node[:hungry] = false node = Neo4j::Node.new node[4] = 3.14 end node[:age] # => 123 Transactions over blocks Creating relationships Neo4j::Transaction.run do node1 = Neo4j::Node.new # neo4j operations goes here node2 = Neo4j::Node.new end Neo4j::Relationship.new(:friends, node1, node2) # which is same as node1.rels.outgoing(:friends) << node2 BcnOnRails May - 2010 - On Graph Databases 19
  • 20. Technology overview Accessing relationships node1.rels.empty? # => false # The rels method returns an enumeration of relationship objects. # The nodes method on the relationships returns the nodes instead. node1.rels.nodes.include?(node2) # => true node1.rels.first # => the first relationship this node1 has. node1.rels.nodes.first # => node2 first node of any relationship type node2.rels.incoming(:friends).nodes.first # => node1 first node of relationship type 'friends' node2.rels.incoming(:friends).first # => a relationship object between node1 and node2 Properties on Relationships rel = node1.rels.outgoing(:friends).first rel[:since] = 1982 node1.rels.first[:since] # => 1982 BcnOnRails May - 2010 - On Graph Databases 20
  • 21. Example For the joy of someone, lets play a little with a graph database. BcnOnRails May - 2010 - On Graph Databases 21
  • 22. On Graph Databases Thanks you! Pere Urbón Bayes purbon@purbon.com BcnOnRails May - 2010 - On Graph Databases 22