SlideShare a Scribd company logo
1 of 51
NOSQL Databases and
      Neo4j
Database and DBMS
• Database - Organized collection of data
• The term database is correctly applied to the
  data and their supporting data structures.

• DBMS - Database Management System: a
  software package with computer programs
  that controls the creation, maintenance and
  use of a database.
Types of Happening Databases
• Relational database – nothing new but still in use
  and it seems it will always be a happening one.
• Cloud databases – everything is cloudy.
• Data warehouse – Huge! Huge! Huge! archives.
• Embedded databases – you can’t see them :P
• Document oriented database – the In thing.
• Hypermedia database – WWW.
• Graph database – facebook, twitter, social
  network.
NOSQL is simply…



Not OnlySQL
Why NOSQL now?

   Driving trends
Trend 1: Data Size
3000

                                   2011?
2500

2000

1500

                            2010
1000

 500                 2009
       2007   2008
  0
Trend 2: Connectedness
                                                                                          GGG
                                                                                 Onotologies

                                                                              RDFa


                                                                         Folksonomies
Information connectivity




                                                               Tagging

                                                     Wikis

                                                               UGC

                                                       Blogs

                                                    Feeds


                                        Hypertext
                              Text
                           Documents
Trend 3: Semi-structured information
• Individualisationof content
  – 1970’s salary lists, all elements exactly one job
  – 2000’s salary lists, we need many job columns!
• Store more data about each entity
• Trend accelerated by the decentralization of
  content generation
  – Age of participation (“web 2.0”)
Trend 4: Architecture
1980’s: Single Application




                             Application




                                 DB
Trend 4: Architecture
1990’s: Integration
Database Antipattern



           Application   Application   Application




                             DB
Trend 4: Architecture
2000’s: SOA

                   RESTful, hypermedia, composite apps

              Application        Application             Application




                  DB                 DB                      DB
Side note: RDBMS performance
 Salary list



               Most Web apps



                               Social Network



                                          Location-based services
Four NOSQL Categories
Four NOSQL Categories
Key-Value Stores
• “Dynamo: Amazon’s Highly Available Key-
  Value Store” (2007)
• Data model:
  – Global key-value mapping
  – Highly fault tolerant (typically)
• Examples:
  – Riak, Redis, Voldemort
Column Family (BigTable)
• Google’s “Bigtable: A Distributed Storage
  System for Structured Data” (2006)
• Data model:
  – A big table, with column families
  – Map-reduce for querying/processing
• Examples:
  – HBase, HyperTable, Cassandra
Document Databases
• Data model
  – Collections of documents
  – A document is a key-value collection
  – Index-centric, lots of map-reduce
• Examples
  – CouchDB, MongoDB
Graph Databases
• Data model:
  – Nodes with properties
  – Named relationships with properties
  – Hypergraph, sometimes
• Examples:
  – Neo4j (of
    course), SonesGraphDB, OrientDB, InfiniteGraph,
    AllegroGraph
Why Graph Databases?
• Schema Less and Efficient storage of Semi Structured Information
• No O/R mismatch – very natural to map a graph to an Object
  Oriented language like Ruby.
• Express Queries as Traversals. Fast deep traversal instead of slow
  SQL queries that span many table joins.
• Very natural to express graph related problem with traversals
  (recommendation engine, find shortest parth etc..)
• Seamless integration with various existing programming languages.
• ACID Transaction with rollbacks support.
• Whiteboard friendly – you use the language of node,properties and
  relationship to describe your domain (instead of e.g. UML) and
  there is no need to have a complicated O/R mapping tool to
  implement it in your database. You can say that Neo4j is
  “Whiteboard friendly” !(http://video.neo4j.org/JHU6F/live-graph-
  session-how-allison-knows-james/)
Social Network “path exists”
              Performance
• Experiment:
  • ~1k persons                           # persons query time

  • Average 50 friends per   Relational   1000      2000ms
                             database
    person
  • pathExists(a,b)
    limited to depth 4
Social Network “path exists”
              Performance
• Experiment:
  • ~1k persons                           # persons query time

  • Average 50 friends per   Relational   1000      2000ms
                             database
    person
                             Neo4j        1000      2ms
  • pathExists(a,b)
    limited to depth 4
Social Network “path exists”
              Performance
• Experiment:
  • ~1k persons                           # persons query time

  • Average 50 friends per   Relational   1000      2000ms
                             database
    person
                             Neo4j        1000      2ms
  • pathExists(a,b)
                             Neo4j        1000000   2ms
    limited to depth 4
What are graphs good for?
•   Recommendations
•   Business intelligence
•   Social computing
•   Geospatial
•   Systems management
•   Web of things
•   Genealogy
•   Time series data
•   Product catalogue
•   Web analytics
•   Scientific computing (especially bioinformatics)
•   Indexing your slow RDBMS
•   And much more!
Graphs
Directed Graphs
Breadth First Search
Depth First Search


  ?????????????????
Graph Databases


• A graph database stores data in a graph, the
  most generic of data structures, capable of
  elegantly representing any kind of data in a
  highly accessible way.
Graphs
• “A Graph —records data in→ Nodes —which
  have→ Properties”
Graphs
• “Nodes —are organized by→ Relationships —
  which also have→ Properties”
Query a graph with Traversal
• “A Traversal —navigates→ a Graph; it —
  identifies→ Paths —which order→ Nodes”
Indexes
• “An Index —maps from→ Properties —to
  either→ Nodes or Relationships”
Neo4j is a Graph Database
• “A Graph Database —manages a→ Graph and
  —also manages related→ Indexes”
Neo4j – Hey! This is why I am a Graph
             Database.
• The fundamental units that form a graph are
  nodes and relationships.

• In Neo4j, both nodes and relationships can
  contain properties.

• Nodes are often used to represent
  entities, but depending on the domain
  relationships may be used for that purpose as
  well.
Node in Neo4j
Relationships in Neo4j
• Relationships between nodes are a key part of
  Neo4j.
Relationships in Neo4j
Twitter and relationships
Properties
• Both nodes and relationships can have
  properties.
• Properties are key-value pairs where the key is
  a string.
• Property values can be either a primitive or an
array of one primitive type.
  For example String, int and int[] values are
  valid for properties.
Properties
Paths in Neo4j
• A path is one or more nodes with connecting
  relationships, typically retrieved as a query or
  traversal result.
Traversals in Neo4j
• Traversing a graph means visiting its nodes,
  following relationships according to some rules.

• In most cases only a subgraph is visited, as you
  already know where in the graph the interesting
  nodes and relationships are found.

• Traversal API

• Depth first and Breadth first.
Starting and Stopping
Preparing the database
Wrap mutating operations in a
       transaction.
Creating a small graph
Print the data
Remove the data
The Matrix Graph Database
Traversing the Graph
Resources & References
• Neo4j website : http://neo4j.org/
• Neo4j learning resources:
  http://neo4j.org/resources/
• Videos about Neo4j: http://video.neo4j.org/
• Neo4j tutorial:
  http://docs.neo4j.org/chunked/snapshot/tuto
  rials.html
• Neo4j Java API documentation:
  http://api.neo4j.org/current/

More Related Content

What's hot

Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4j
jexp
 
Knowledge Graphs - The Power of Graph-Based Search
Knowledge Graphs - The Power of Graph-Based SearchKnowledge Graphs - The Power of Graph-Based Search
Knowledge Graphs - The Power of Graph-Based Search
Neo4j
 

What's hot (20)

Graph based data models
Graph based data modelsGraph based data models
Graph based data models
 
Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4j
 
Knowledge Graphs - The Power of Graph-Based Search
Knowledge Graphs - The Power of Graph-Based SearchKnowledge Graphs - The Power of Graph-Based Search
Knowledge Graphs - The Power of Graph-Based Search
 
NOSQLEU - Graph Databases and Neo4j
NOSQLEU - Graph Databases and Neo4jNOSQLEU - Graph Databases and Neo4j
NOSQLEU - Graph Databases and Neo4j
 
Intro to Cypher
Intro to CypherIntro to Cypher
Intro to Cypher
 
Converting Relational to Graph Databases
Converting Relational to Graph DatabasesConverting Relational to Graph Databases
Converting Relational to Graph Databases
 
Neo4j 4 Overview
Neo4j 4 OverviewNeo4j 4 Overview
Neo4j 4 Overview
 
Graph Databases for Master Data Management
Graph Databases for Master Data ManagementGraph Databases for Master Data Management
Graph Databases for Master Data Management
 
Introduction to Neo4j and .Net
Introduction to Neo4j and .NetIntroduction to Neo4j and .Net
Introduction to Neo4j and .Net
 
SQL vs. NoSQL Databases
SQL vs. NoSQL DatabasesSQL vs. NoSQL Databases
SQL vs. NoSQL Databases
 
Graph Analytics with ArangoDB
Graph Analytics with ArangoDBGraph Analytics with ArangoDB
Graph Analytics with ArangoDB
 
Sql vs NoSQL
Sql vs NoSQLSql vs NoSQL
Sql vs NoSQL
 
Data catalog
Data catalogData catalog
Data catalog
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
Knowledge Graphs & Graph Data Science, More Context, Better Predictions - Neo...
Knowledge Graphs & Graph Data Science, More Context, Better Predictions - Neo...Knowledge Graphs & Graph Data Science, More Context, Better Predictions - Neo...
Knowledge Graphs & Graph Data Science, More Context, Better Predictions - Neo...
 
GDPR: Leverage the Power of Graphs
GDPR: Leverage the Power of GraphsGDPR: Leverage the Power of Graphs
GDPR: Leverage the Power of Graphs
 
Big Data Fabric 2.0 Drives Data Democratization
Big Data Fabric 2.0 Drives Data DemocratizationBig Data Fabric 2.0 Drives Data Democratization
Big Data Fabric 2.0 Drives Data Democratization
 
Neo4J : Introduction to Graph Database
Neo4J : Introduction to Graph DatabaseNeo4J : Introduction to Graph Database
Neo4J : Introduction to Graph Database
 
Neo4j Graph Platform Overview, Kurt Freytag, Neo4j
Neo4j Graph Platform Overview, Kurt Freytag, Neo4jNeo4j Graph Platform Overview, Kurt Freytag, Neo4j
Neo4j Graph Platform Overview, Kurt Freytag, Neo4j
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
 

Viewers also liked

Using a Graph Database for Next-Gen MDM
Using a Graph Database for Next-Gen MDMUsing a Graph Database for Next-Gen MDM
Using a Graph Database for Next-Gen MDM
Neo4j
 
An Introduction to Graph Databases
An Introduction to Graph DatabasesAn Introduction to Graph Databases
An Introduction to Graph Databases
InfiniteGraph
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
BigBlueHat
 
Introduction to graph databases GraphDays
Introduction to graph databases  GraphDaysIntroduction to graph databases  GraphDays
Introduction to graph databases GraphDays
Neo4j
 

Viewers also liked (15)

Data Modeling with Neo4j
Data Modeling with Neo4jData Modeling with Neo4j
Data Modeling with Neo4j
 
Using a Graph Database for Next-Gen MDM
Using a Graph Database for Next-Gen MDMUsing a Graph Database for Next-Gen MDM
Using a Graph Database for Next-Gen MDM
 
Relational vs. Non-Relational
Relational vs. Non-RelationalRelational vs. Non-Relational
Relational vs. Non-Relational
 
An Introduction to Graph Databases
An Introduction to Graph DatabasesAn Introduction to Graph Databases
An Introduction to Graph Databases
 
Neo4j - graph database for recommendations
Neo4j - graph database for recommendationsNeo4j - graph database for recommendations
Neo4j - graph database for recommendations
 
Lju Lazarevic
Lju LazarevicLju Lazarevic
Lju Lazarevic
 
NoSQL: Why, When, and How
NoSQL: Why, When, and HowNoSQL: Why, When, and How
NoSQL: Why, When, and How
 
Graph Based Recommendation Systems at eBay
Graph Based Recommendation Systems at eBayGraph Based Recommendation Systems at eBay
Graph Based Recommendation Systems at eBay
 
Graph Database, a little connected tour - Castano
Graph Database, a little connected tour - CastanoGraph Database, a little connected tour - Castano
Graph Database, a little connected tour - Castano
 
Designing and Building a Graph Database Application – Architectural Choices, ...
Designing and Building a Graph Database Application – Architectural Choices, ...Designing and Building a Graph Database Application – Architectural Choices, ...
Designing and Building a Graph Database Application – Architectural Choices, ...
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
 
Relational to Graph - Import
Relational to Graph - ImportRelational to Graph - Import
Relational to Graph - Import
 
Semantic Graph Databases: The Evolution of Relational Databases
Semantic Graph Databases: The Evolution of Relational DatabasesSemantic Graph Databases: The Evolution of Relational Databases
Semantic Graph Databases: The Evolution of Relational Databases
 
Introduction to graph databases GraphDays
Introduction to graph databases  GraphDaysIntroduction to graph databases  GraphDays
Introduction to graph databases GraphDays
 
Data Mining: Graph mining and social network analysis
Data Mining: Graph mining and social network analysisData Mining: Graph mining and social network analysis
Data Mining: Graph mining and social network analysis
 

Similar to An Introduction to NOSQL, Graph Databases and Neo4j

CSC 8101 Non Relational Databases
CSC 8101 Non Relational DatabasesCSC 8101 Non Relational Databases
CSC 8101 Non Relational Databases
sjwoodman
 
Linked data and the future of libraries
Linked data and the future of librariesLinked data and the future of libraries
Linked data and the future of libraries
Regan Harper
 
Linked Data (1st Linked Data Meetup Malmö)
Linked Data (1st Linked Data Meetup Malmö)Linked Data (1st Linked Data Meetup Malmö)
Linked Data (1st Linked Data Meetup Malmö)
Anja Jentzsch
 
Linked data demystified:Practical efforts to transform CONTENTDM metadata int...
Linked data demystified:Practical efforts to transform CONTENTDM metadata int...Linked data demystified:Practical efforts to transform CONTENTDM metadata int...
Linked data demystified:Practical efforts to transform CONTENTDM metadata int...
Cory Lampert
 
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
 

Similar to An Introduction to NOSQL, Graph Databases and Neo4j (20)

No Sql Movement
No Sql MovementNo Sql Movement
No Sql Movement
 
CSC 8101 Non Relational Databases
CSC 8101 Non Relational DatabasesCSC 8101 Non Relational Databases
CSC 8101 Non Relational Databases
 
Grails goes Graph
Grails goes GraphGrails goes Graph
Grails goes Graph
 
Spring Data Neo4j Intro SpringOne 2011
Spring Data Neo4j Intro SpringOne 2011Spring Data Neo4j Intro SpringOne 2011
Spring Data Neo4j Intro SpringOne 2011
 
Hide the Stack: Toward Usable Linked Data
Hide the Stack:Toward Usable Linked DataHide the Stack:Toward Usable Linked Data
Hide the Stack: Toward Usable Linked Data
 
Anti-social Databases
Anti-social DatabasesAnti-social Databases
Anti-social Databases
 
What is New in W3C land?
What is New in W3C land?What is New in W3C land?
What is New in W3C land?
 
Graph Databases
Graph DatabasesGraph Databases
Graph Databases
 
Linked data and the future of libraries
Linked data and the future of librariesLinked data and the future of libraries
Linked data and the future of libraries
 
NoSQL in the context of Social Web
NoSQL in the context of Social WebNoSQL in the context of Social Web
NoSQL in the context of Social Web
 
Introduction_to_knowledge_graph.pdf
Introduction_to_knowledge_graph.pdfIntroduction_to_knowledge_graph.pdf
Introduction_to_knowledge_graph.pdf
 
Linked Data (1st Linked Data Meetup Malmö)
Linked Data (1st Linked Data Meetup Malmö)Linked Data (1st Linked Data Meetup Malmö)
Linked Data (1st Linked Data Meetup Malmö)
 
Linked data demystified:Practical efforts to transform CONTENTDM metadata int...
Linked data demystified:Practical efforts to transform CONTENTDM metadata int...Linked data demystified:Practical efforts to transform CONTENTDM metadata int...
Linked data demystified:Practical efforts to transform CONTENTDM metadata int...
 
Our World is Socio-technical
Our World is Socio-technicalOur World is Socio-technical
Our World is Socio-technical
 
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
 
No SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageNo SQL- The Future Of Data Storage
No SQL- The Future Of Data Storage
 
A theory of Metadata enriching & filtering
A theory of  Metadata enriching & filteringA theory of  Metadata enriching & filtering
A theory of Metadata enriching & filtering
 
Modern database
Modern databaseModern database
Modern database
 
Linked Data
Linked DataLinked Data
Linked Data
 
Presentation on the Warsaw Conference on National Bibliographies August 2012
Presentation on the Warsaw Conference on National Bibliographies August 2012Presentation on the Warsaw Conference on National Bibliographies August 2012
Presentation on the Warsaw Conference on National Bibliographies August 2012
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
"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 ...
 
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...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 

An Introduction to NOSQL, Graph Databases and Neo4j

  • 2. Database and DBMS • Database - Organized collection of data • The term database is correctly applied to the data and their supporting data structures. • DBMS - Database Management System: a software package with computer programs that controls the creation, maintenance and use of a database.
  • 3. Types of Happening Databases • Relational database – nothing new but still in use and it seems it will always be a happening one. • Cloud databases – everything is cloudy. • Data warehouse – Huge! Huge! Huge! archives. • Embedded databases – you can’t see them :P • Document oriented database – the In thing. • Hypermedia database – WWW. • Graph database – facebook, twitter, social network.
  • 5. Why NOSQL now? Driving trends
  • 6. Trend 1: Data Size 3000 2011? 2500 2000 1500 2010 1000 500 2009 2007 2008 0
  • 7. Trend 2: Connectedness GGG Onotologies RDFa Folksonomies Information connectivity Tagging Wikis UGC Blogs Feeds Hypertext Text Documents
  • 8. Trend 3: Semi-structured information • Individualisationof content – 1970’s salary lists, all elements exactly one job – 2000’s salary lists, we need many job columns! • Store more data about each entity • Trend accelerated by the decentralization of content generation – Age of participation (“web 2.0”)
  • 9. Trend 4: Architecture 1980’s: Single Application Application DB
  • 10. Trend 4: Architecture 1990’s: Integration Database Antipattern Application Application Application DB
  • 11. Trend 4: Architecture 2000’s: SOA RESTful, hypermedia, composite apps Application Application Application DB DB DB
  • 12. Side note: RDBMS performance Salary list Most Web apps Social Network Location-based services
  • 15. Key-Value Stores • “Dynamo: Amazon’s Highly Available Key- Value Store” (2007) • Data model: – Global key-value mapping – Highly fault tolerant (typically) • Examples: – Riak, Redis, Voldemort
  • 16. Column Family (BigTable) • Google’s “Bigtable: A Distributed Storage System for Structured Data” (2006) • Data model: – A big table, with column families – Map-reduce for querying/processing • Examples: – HBase, HyperTable, Cassandra
  • 17. Document Databases • Data model – Collections of documents – A document is a key-value collection – Index-centric, lots of map-reduce • Examples – CouchDB, MongoDB
  • 18. Graph Databases • Data model: – Nodes with properties – Named relationships with properties – Hypergraph, sometimes • Examples: – Neo4j (of course), SonesGraphDB, OrientDB, InfiniteGraph, AllegroGraph
  • 19. Why Graph Databases? • Schema Less and Efficient storage of Semi Structured Information • No O/R mismatch – very natural to map a graph to an Object Oriented language like Ruby. • Express Queries as Traversals. Fast deep traversal instead of slow SQL queries that span many table joins. • Very natural to express graph related problem with traversals (recommendation engine, find shortest parth etc..) • Seamless integration with various existing programming languages. • ACID Transaction with rollbacks support. • Whiteboard friendly – you use the language of node,properties and relationship to describe your domain (instead of e.g. UML) and there is no need to have a complicated O/R mapping tool to implement it in your database. You can say that Neo4j is “Whiteboard friendly” !(http://video.neo4j.org/JHU6F/live-graph- session-how-allison-knows-james/)
  • 20. Social Network “path exists” Performance • Experiment: • ~1k persons # persons query time • Average 50 friends per Relational 1000 2000ms database person • pathExists(a,b) limited to depth 4
  • 21. Social Network “path exists” Performance • Experiment: • ~1k persons # persons query time • Average 50 friends per Relational 1000 2000ms database person Neo4j 1000 2ms • pathExists(a,b) limited to depth 4
  • 22. Social Network “path exists” Performance • Experiment: • ~1k persons # persons query time • Average 50 friends per Relational 1000 2000ms database person Neo4j 1000 2ms • pathExists(a,b) Neo4j 1000000 2ms limited to depth 4
  • 23. What are graphs good for? • Recommendations • Business intelligence • Social computing • Geospatial • Systems management • Web of things • Genealogy • Time series data • Product catalogue • Web analytics • Scientific computing (especially bioinformatics) • Indexing your slow RDBMS • And much more!
  • 27. Depth First Search ?????????????????
  • 28. Graph Databases • A graph database stores data in a graph, the most generic of data structures, capable of elegantly representing any kind of data in a highly accessible way.
  • 29. Graphs • “A Graph —records data in→ Nodes —which have→ Properties”
  • 30. Graphs • “Nodes —are organized by→ Relationships — which also have→ Properties”
  • 31. Query a graph with Traversal • “A Traversal —navigates→ a Graph; it — identifies→ Paths —which order→ Nodes”
  • 32. Indexes • “An Index —maps from→ Properties —to either→ Nodes or Relationships”
  • 33. Neo4j is a Graph Database • “A Graph Database —manages a→ Graph and —also manages related→ Indexes”
  • 34. Neo4j – Hey! This is why I am a Graph Database. • The fundamental units that form a graph are nodes and relationships. • In Neo4j, both nodes and relationships can contain properties. • Nodes are often used to represent entities, but depending on the domain relationships may be used for that purpose as well.
  • 36. Relationships in Neo4j • Relationships between nodes are a key part of Neo4j.
  • 39. Properties • Both nodes and relationships can have properties. • Properties are key-value pairs where the key is a string. • Property values can be either a primitive or an array of one primitive type. For example String, int and int[] values are valid for properties.
  • 41. Paths in Neo4j • A path is one or more nodes with connecting relationships, typically retrieved as a query or traversal result.
  • 42. Traversals in Neo4j • Traversing a graph means visiting its nodes, following relationships according to some rules. • In most cases only a subgraph is visited, as you already know where in the graph the interesting nodes and relationships are found. • Traversal API • Depth first and Breadth first.
  • 45. Wrap mutating operations in a transaction.
  • 49. The Matrix Graph Database
  • 51. Resources & References • Neo4j website : http://neo4j.org/ • Neo4j learning resources: http://neo4j.org/resources/ • Videos about Neo4j: http://video.neo4j.org/ • Neo4j tutorial: http://docs.neo4j.org/chunked/snapshot/tuto rials.html • Neo4j Java API documentation: http://api.neo4j.org/current/

Editor's Notes

  1. Future stores will be mixed – right shape for the right jobPolyglot persistenceFrameworks (e.g. spring data) embracing this already
  2. UGC = User Generated ContentGGG = Giant Global Graph (what the web will become)
  3. This is strictly about connected data – joins kill performance there.No bashing of RDBMS performance for tabular transaction processingGreen line denotes “zone of SQL adequacy”
  4. Fowler points out that KV/Column/Document stores are all aggregates: they’re different from graphs because they enforce structure at design time – as an aggregate of data.Clump of data that can be co-located on a cluster instance and which is accessed together.“a fundamental unit of storage which is a rich structure of closely related data: for key-value stores it's the value, for document stores it's the document, and for column-family stores it's the column family. In DDD terms, this group of data is an aggregate.”
  5. History – Amazon decide that they always wanted the shopping basket to be available, but couldn’t take a chance on RDBMSSo they built their ownBig risk, but simple data model and well-known computing science underpinning it (e.g. consistent hashing, Bloom filters for sensible replication)+ Massive read/write scale- Simplistic data model moves heavy lifting into the app tier (e.g. map reduce)
  6. People talk about Codd’s relational model being mature because it was proposed in 1969 – 42 years old.Euler’s graph theory was proposed in 1736 – 275 years old.