SlideShare ist ein Scribd-Unternehmen logo
1 von 72
Downloaden Sie, um offline zu lesen
Graph Databases
A little connected tour
!
@fcofdezc
Francisco Fernández Castaño
@fcofdezc Sw Engineer @biicode
Beginning
The old town of Königsberg has seven bridges:
Can you take a walk through town, visiting each part of
the town and crossing each bridge only once?
El origenG = (V, E)
What is a Graph DB?
Graph
Nodes Relationships
Properties
Store
Store
Connect
Have
Have
Written in Java
ACID
Rest interface
Cypher
Why NOSQL?
The value of Relational Databases
Ventajas de BD Relacionales
Concurrencia
Persistencia
Integración
Estándar
Persistence
Ventajas de BD Relacionales
Concurrencia
Persistencia
Integración
Estándar
Concurrency
Ventajas de BD Relacionales
Concurrencia
Persistencia
Integración
Estándar
Integration
Ventajas de BD Relacionales
Concurrencia
Persistencia
Integración
Estándar
Standard
inconveniences Relational DBs
El OrigenImpedance Mismatch
class Client < ActiveRecord::Base	
has_one :address	
has_many :orders	
has_and_belongs_to_many :roles	
end
DesVentajas de BD Relacionales
Fricción!
Interoperabilidad
Adaptación al cambio
Escalabilidad
No está destinada para ciertos escenarios
Interoperability
Adaptation to changes
!Scalability
The traditional way in the context
of connected data is artificial
Depth MySQL time (s) Neo4j time (s) Results
2 0.016 0.01 ~2500
3 30.267 0.168 ~110,000
4 1543.505 1.359 ~600,000
5 No Acaba 2.132 ~800,000
MySQL vs Neo4j
* Neo4J in Action
Person
Id Person
1 Frank
2 John
.. …
99 Alice
PersonFriend
PersonID FriendID
1 2
2 1
.. …
99 2
O(log n)
O(1)
O(m log n)
O(m)
We can transform our domain model in a
natural way
Use cases
Social Networks
Follow
Follow
John Jeff
Douglas
Geospatial problems
Fraud detection
Authorization
Network management
Cypher
Declarative language
ASCII oriented
Pattern matching
Cypher
Cypher
Traverser API
Core API
Kernel
Cypher
a b
(a)-->(b)
Cypher
clapton cream
(clapton)-[:play_in]->(cream)
play_in
Follow
FollowJohn Jeff
Douglas
Cypher
(john:User)-[:FOLLOW]->(jeff:User)	
!
(douglas:User)-[:FOLLOW]->(john:User)
Cypher
clapton
{name: Eric
Clapton}
cream
(clapton)-[:play_in]->(cream)<-[:labeled]-(blues)
play_in
{date: 1968}
Blues
labeled
Cypher
MATCH (a)-—>(b)	
RETURN a,b;
Cypher
MATCH (a)-[:PLAY_IN]—>(b)	
RETURN a,b;
Cypher
MATCH (a)-[:PLAY_IN]—>(g),	
	 	 (g)<-[:LABELED]-(e)	
RETURN a.name,	
	 	 	 t.date,	
	 	 	 e.name;
Cypher
MATCH (c {name: ‘clapton’})-[t:PLAY_IN]—>(g),	
	 (g)<-[:LABELED]-(e)	
RETURN c.name,	
	 	 t.date,	
	 	 e.name;
Cypher
MATCH (c {name: ‘clapton’})-[t:PLAY_IN]—>(g),	
	 (g)<-[:LABELED]-(e {name: ‘blues’})	
RETURN c.name,	
		 e.name	
ORDER BY t.date
Cypher
MATCH (c {name: ‘clapton’})-[r:PLAY_IN | PRODUCE]—>(g),	
	 (g)<-[:LABELED]-(e {name: ‘blues’})	
RETURN c.name,	
	 e.name	
WHERE r.date > 1968	
ORDER BY r.date
Cypher
MATCH (carlo)-[:KNOW*5]—>(john)
MATCH p = (startNode:Station {name: ‘Sol’})	
	 -[rels:CONNECTED_TO*]->	
(endNode:Station {name: ‘Retiro’})	
RETURN p AS shortestPath,	
reduce(weight=0, r in rels: weight + r.weight) as tWeight	
ORDER BY tWeight ASC	
LIMIT 1
Recommendation
System
Social network
Movies social network
Users rate movies
People act in movies
People direct movies
Users follow other users
Movies social network
How do we model it?
Movies social network
Follow
Rate
{stars}
User
Film
User
Actor
Director
Act in
Direct
Movies social network
MATCH (fran:User {name: ‘Fran’})	
	 	 	 -[or:Rate]->	
(pf:Film {title: ‘Pulp Fiction’}),	
!
(pf)<-[:Rate]-(other_users)-[:Rate]->(other_films)	
!
RETURN distinct other_films.title;
Movies social network
Rate
{stars}
Rate
{stars}
User 1
Film
PF
Fran User 2
Rate
{stars}
Film
Film
Rate
{stars}
Rate
{stars}
Movies social network
MATCH (fran:User {name: ‘Fran’})	
	 	 	 -[or:Rate]->	
	 (pf:Film {title: ‘Pulp Fiction’}),	
!
(pf)<-[:Rate]-(other_users)-[r:Rate]->(other_films)	
!
WHERE or.stars = r.stars	
!
RETURN distinct other_films.title;
Movies social network
MATCH (fran:User {name: ‘Fran’})	
	 	 	 -[or:Rate]->	
	 (pf:Film {title: ‘Pulp Fiction’}),	
!
(pf)<-[:Rate]-(other_users)-[r:Rate]->(other_films),	
!
	 (other_users)-[:FOLLOW]-(fran)	
!
WHERE or.stars = r.stars	
!
RETURN distinct other_films.title;
Movies social network
Rate
{star}
User 1
Film
PF
Fran
Rate
{stars}
Film
Follow
Rate
{star}
Movies social network
MATCH (tarantino:User {name: ‘Quentin Tarantino’}),	
(tarantino)-[:DIRECT]->(movie)<-[:ACT_IN]-(tarantino)	
RETURN movie.title
Movies social network
Film Actor
Director
Act_in
Direct
Movies social network
Now you should be able to categorize the movies
Movies social network
Film
SubGenre
Belongs_to
SubGenre
Belongs_to
GenreGenre
Belongs_toBelongs_to
Movies social network
MATCH (fran:User {name: ‘Fran’})	
	 	 -[or:Rate]->	
	 (pf:Film {title: ‘Pulp Fiction’}),	
!
(pf)<-[:Rate]-(other_users)-[r:Rate]->(other_films),	
	 	
	 (film)->[:BELONGS_TO*3]->(genre)<-[:BELONGS_TO]-(other_films),	
!
	 (other_users)-[:FOLLOW]-(fran)	
!
WHERE or.stars = r.stars	
!
RETURN distinct other_films.title;
Neo4J extensions
Managed
Unmanaged
Neo4J extensions
Managed
Unmanaged
Neo4J extensions
Managed
Unmanaged
Drivers/Clients
Instead of just picking a relational database
because everyone does, we need to
understand the nature of the data we’re
storing and how we want to manipulate it.
Martin Fowler
References
Neo4J as a service
http://www.graphenedb.com
Grazie

Weitere ähnliche Inhalte

Andere mochten auch

Andere mochten auch (17)

GraphTalks Rome - Selecting the right Technology
GraphTalks Rome - Selecting the right TechnologyGraphTalks Rome - Selecting the right Technology
GraphTalks Rome - Selecting the right Technology
 
GraphTalks Rome - Identity and Access Management
GraphTalks Rome - Identity and Access ManagementGraphTalks Rome - Identity and Access Management
GraphTalks Rome - Identity and Access Management
 
GraphTalks Rome - The Italian Business Graph
GraphTalks Rome - The Italian Business GraphGraphTalks Rome - The Italian Business Graph
GraphTalks Rome - The Italian Business Graph
 
Knowledge Architecture: Graphing Your Knowledge
Knowledge Architecture: Graphing Your KnowledgeKnowledge Architecture: Graphing Your Knowledge
Knowledge Architecture: Graphing Your Knowledge
 
IT in Healthcare
IT in HealthcareIT in Healthcare
IT in Healthcare
 
Dear NSA, let me take care of your slides.
Dear NSA, let me take care of your slides.Dear NSA, let me take care of your slides.
Dear NSA, let me take care of your slides.
 
What I Carry: 10 Tools for Success
What I Carry: 10 Tools for SuccessWhat I Carry: 10 Tools for Success
What I Carry: 10 Tools for Success
 
Visualization of Publication Impact
Visualization of Publication ImpactVisualization of Publication Impact
Visualization of Publication Impact
 
GraphDay Stockholm - Levaraging Graph-Technology to fight Financial Fraud
GraphDay Stockholm - Levaraging Graph-Technology to fight Financial FraudGraphDay Stockholm - Levaraging Graph-Technology to fight Financial Fraud
GraphDay Stockholm - Levaraging Graph-Technology to fight Financial Fraud
 
GraphDay Stockholm - Graphs in Action
GraphDay Stockholm - Graphs in ActionGraphDay Stockholm - Graphs in Action
GraphDay Stockholm - Graphs in Action
 
GraphDay Stockholm - iKnow Solutions - The Value Add of Graphs to Analytics a...
GraphDay Stockholm - iKnow Solutions - The Value Add of Graphs to Analytics a...GraphDay Stockholm - iKnow Solutions - The Value Add of Graphs to Analytics a...
GraphDay Stockholm - iKnow Solutions - The Value Add of Graphs to Analytics a...
 
Webinar: Intro to Cypher
Webinar: Intro to CypherWebinar: Intro to Cypher
Webinar: Intro to Cypher
 
GraphDay Stockholm - Telia Zone
GraphDay Stockholm - Telia Zone GraphDay Stockholm - Telia Zone
GraphDay Stockholm - Telia Zone
 
Neo4j GraphTalks - Einführung in Graphdatenbanken
Neo4j GraphTalks - Einführung in GraphdatenbankenNeo4j GraphTalks - Einführung in Graphdatenbanken
Neo4j GraphTalks - Einführung in Graphdatenbanken
 
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph Databases
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph DatabasesGraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph Databases
GraphDay Stockholm - Graphs in the Real World: Top Use Cases for Graph Databases
 
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, ...
 
Identity and Access Management
Identity and Access ManagementIdentity and Access Management
Identity and Access Management
 

Ähnlich wie Graph Databases, a little connected tour (Codemotion Rome)

MLconf NYC Shan Shan Huang
MLconf NYC Shan Shan HuangMLconf NYC Shan Shan Huang
MLconf NYC Shan Shan Huang
MLconf
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)
Vitaly Baum
 
Polyglot Programming in the JVM
Polyglot Programming in the JVMPolyglot Programming in the JVM
Polyglot Programming in the JVM
Andres Almiray
 

Ähnlich wie Graph Databases, a little connected tour (Codemotion Rome) (20)

Neo4j
Neo4jNeo4j
Neo4j
 
Hands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4jHands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4j
 
React & Radium (Colin Megill)
React & Radium (Colin Megill) React & Radium (Colin Megill)
React & Radium (Colin Megill)
 
Neo4J
Neo4JNeo4J
Neo4J
 
A Tour of PostgREST
A Tour of PostgRESTA Tour of PostgREST
A Tour of PostgREST
 
A Theory of Service Behavior
A Theory of Service BehaviorA Theory of Service Behavior
A Theory of Service Behavior
 
Ruby on Big Data @ Philly Ruby Group
Ruby on Big Data @ Philly Ruby GroupRuby on Big Data @ Philly Ruby Group
Ruby on Big Data @ Philly Ruby Group
 
Graph Database Query Languages
Graph Database Query LanguagesGraph Database Query Languages
Graph Database Query Languages
 
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
3rd Athens Big Data Meetup - 2nd Talk - Neo4j: The World's Leading Graph DB
 
The 2nd graph database in sv meetup
The 2nd graph database in sv meetupThe 2nd graph database in sv meetup
The 2nd graph database in sv meetup
 
MLconf NYC Shan Shan Huang
MLconf NYC Shan Shan HuangMLconf NYC Shan Shan Huang
MLconf NYC Shan Shan Huang
 
Propel your Performance: AgensGraph, the multi-model database
Propel your Performance: AgensGraph, the multi-model databasePropel your Performance: AgensGraph, the multi-model database
Propel your Performance: AgensGraph, the multi-model database
 
Microsoft NERD Talk - R and Tableau - 2-4-2013
Microsoft NERD Talk - R and Tableau - 2-4-2013Microsoft NERD Talk - R and Tableau - 2-4-2013
Microsoft NERD Talk - R and Tableau - 2-4-2013
 
Lighting talk neo4j fosdem 2011
Lighting talk neo4j fosdem 2011Lighting talk neo4j fosdem 2011
Lighting talk neo4j fosdem 2011
 
Clojure: Simple By Design
Clojure: Simple By DesignClojure: Simple By Design
Clojure: Simple By Design
 
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
 
Leveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHPLeveraging the Power of Graph Databases in PHP
Leveraging the Power of Graph Databases in PHP
 
Coral & Transport UDFs: Building Blocks of a Postmodern Data Warehouse​
Coral & Transport UDFs: Building Blocks of a Postmodern Data Warehouse​Coral & Transport UDFs: Building Blocks of a Postmodern Data Warehouse​
Coral & Transport UDFs: Building Blocks of a Postmodern Data Warehouse​
 
Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)Building DSLs On CLR and DLR (Microsoft.NET)
Building DSLs On CLR and DLR (Microsoft.NET)
 
Polyglot Programming in the JVM
Polyglot Programming in the JVMPolyglot Programming in the JVM
Polyglot Programming in the JVM
 

Mehr von fcofdezc

Extending Python - FOSDEM 2015
Extending Python - FOSDEM 2015Extending Python - FOSDEM 2015
Extending Python - FOSDEM 2015
fcofdezc
 
Biicode OpenExpoDay
Biicode OpenExpoDayBiicode OpenExpoDay
Biicode OpenExpoDay
fcofdezc
 
biicode, reuse and play
biicode, reuse and playbiicode, reuse and play
biicode, reuse and play
fcofdezc
 
Graph databases, a little connected tour
Graph databases, a little connected tourGraph databases, a little connected tour
Graph databases, a little connected tour
fcofdezc
 

Mehr von fcofdezc (13)

Knowing your garbage collector - PyCon Italy 2015
Knowing your garbage collector - PyCon Italy 2015Knowing your garbage collector - PyCon Italy 2015
Knowing your garbage collector - PyCon Italy 2015
 
STM on PyPy
STM on PyPySTM on PyPy
STM on PyPy
 
Knowing your garbage collector - FOSDEM 2015
Knowing your garbage collector - FOSDEM 2015Knowing your garbage collector - FOSDEM 2015
Knowing your garbage collector - FOSDEM 2015
 
Extending Python - FOSDEM 2015
Extending Python - FOSDEM 2015Extending Python - FOSDEM 2015
Extending Python - FOSDEM 2015
 
Extending Python - Codemotion Milano 2014
Extending Python - Codemotion Milano 2014Extending Python - Codemotion Milano 2014
Extending Python - Codemotion Milano 2014
 
Understanding PyPy - PyConEs 14
Understanding PyPy - PyConEs 14Understanding PyPy - PyConEs 14
Understanding PyPy - PyConEs 14
 
Knowing your Garbage Collector / Python Madrid
Knowing your Garbage Collector / Python MadridKnowing your Garbage Collector / Python Madrid
Knowing your Garbage Collector / Python Madrid
 
Knowing your Python Garbage Collector
Knowing your Python Garbage CollectorKnowing your Python Garbage Collector
Knowing your Python Garbage Collector
 
Graph databases - EuroPython 2014
Graph databases - EuroPython 2014Graph databases - EuroPython 2014
Graph databases - EuroPython 2014
 
Extending Python - EuroPython 2014
Extending Python - EuroPython 2014Extending Python - EuroPython 2014
Extending Python - EuroPython 2014
 
Biicode OpenExpoDay
Biicode OpenExpoDayBiicode OpenExpoDay
Biicode OpenExpoDay
 
biicode, reuse and play
biicode, reuse and playbiicode, reuse and play
biicode, reuse and play
 
Graph databases, a little connected tour
Graph databases, a little connected tourGraph databases, a little connected tour
Graph databases, a little connected tour
 

Kürzlich hochgeladen

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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
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
 

Kürzlich hochgeladen (20)

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
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
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...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
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...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
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
 
"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 ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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
 
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
 
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...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 

Graph Databases, a little connected tour (Codemotion Rome)