SlideShare une entreprise Scribd logo
1  sur  28
Application Modeling
with Graph Databases



              http://joind.in/6694
@josh_adell

• Software developer: PHP, Javascript, SQL
• http://www.dunnwell.com
• http://blog.everymansoftware.com

• http://github.com/jadell/neo4jphp
• http://frostymug.herokuapp.com
The Problem
The Solution?

> -- First degree
> SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title
FROM cast WHERE actor_name='Kevin Bacon')

> -- Second degree
> SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title
FROM cast WHERE actor_name IN (SELECT actor_name FROM cast WHERE movie_title IN
(SELECT DISTINCT movie_title FROM cast WHERE actor_name='Kevin Bacon')))

> -- Third degree
> SELECT actor_name FROM cast WHERE movie_title IN(SELECT DISTINCT movie_title
FROM cast WHERE actor_name IN (SELECT actor_name FROM cast WHERE movie_title IN
(SELECT DISTINCT movie_title FROM cast WHERE actor_name IN (SELECT
actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title FROM
cast WHERE actor_name='Kevin Bacon'))))
The Truth

Relational databases aren't very good with relationships


                       Data



                      RDBMs
RDBs Use Set Math
Try again?
Right Tool for the Job



          =
Warning: Computer Science Ahead

     A graph is an ordered pair G = (V, E)

       where V is a set of vertices and

            E is a set of edges,
       which are pairs of vertices in V.
Graphs are Everywhere
Relational Databases are Graphs!
Everything is connected
Some Graph Use Cases

•   Social networking
•   Manufacturing
•   Map directions
•   Geo-spatial algorithms
•   Fraud detection
•   Multi-tenancy
•   Dependency mapping
•   Bioinformatics
•   Natural language processing
Graphs are "Whiteboard-Friendly"




   Nouns => nodes, Verbs => relationships
Back to Bacon




START s=node:actors(name="Keanu Reeves"),
      e=node:actors(name="Kevin Bacon")

MATCH p = shortestPath( s-[*]-e )

RETURN p, length(p)
                                            http://tinyurl.com/c65d99w
ACL

• Users can belong to groups
• Groups can belong to groups
• Groups and users have permissions on objects
  o read
  o write
  o denied
START u=node:users(name="User 3")
MATCH u-[:belongs_to*]->g
RETURN g

                                    http://tinyurl.com/cyn3rkx
START u=node:users(name="User 2"),
      o=node:objects(name="Home")
MATCH u-[:belongs_to*0..]->g,
      g-[:can_read]->o
RETURN g
                                     http://tinyurl.com/dx7onro
START u=node:users(name="User 3"),
      o=node:objects(name="Users 1 Blog")
MATCH u-[:belongs_to*0..]->g,
      g-[:can_read]->o,
      u-[d?:denied*]->o
WHERE d is null
RETURN g
                                            http://tinyurl.com/bwtyhvt
Real Life Example

• Companies have brands, locations, location groups
• Brands have locations, location groups
• Location groups have locations
START c=node:companies(name="Company 1")
MATCH c-[:HAS*]->l
WHERE l.type = 'location'
RETURN l ORDER BY l.name
                                           http://tinyurl.com/cxm4heh
START b=node:brands(name="Brand 1")
MATCH b<-[:HAS*]-c-[:HAS*]->l<-[h?:HAS*]-b
WHERE h IS NULL AND l.type='location'
RETURN l ORDER BY l.name
                                         http://tinyurl.com/cl537w6
Tweet

    @chicken_tech
we should be using graph dbs!
But Wait...There's More!

•   Mutating Cypher (insert, update)
•   Indexing (auto, full-text, spatial)
•   Batches and Transactions
•   Embedded (for JVM) or REST
Where fore art thou, RDB?

•   Aggregation
•   Ordered data
•   Truly tabular data
•   Few or clearly defined relationships
Questions?
Resources

• http://joind.in/6694

• http://neo4j.org
• http://docs.neo4j.org
• http://www.youtube.com/watch?v=UodTzseLh04

• http://github.com/jadell/neo4jphp

•   http://joshadell.com
•   josh.adell@gmail.com
•   @josh_adell
•   Google+, Facebook, LinkedIn

Contenu connexe

Tendances

Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenteninovex GmbH
 
ElasticSearch 5.x - New Tricks - 2017-02-08 - Elasticsearch Meetup
ElasticSearch 5.x -  New Tricks - 2017-02-08 - Elasticsearch Meetup ElasticSearch 5.x -  New Tricks - 2017-02-08 - Elasticsearch Meetup
ElasticSearch 5.x - New Tricks - 2017-02-08 - Elasticsearch Meetup Alberto Paro
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locatorAlberto Paro
 
Seattle.rb 6.4
Seattle.rb 6.4Seattle.rb 6.4
Seattle.rb 6.4deanhudson
 
Manifests of Future Past
Manifests of Future PastManifests of Future Past
Manifests of Future PastPuppet
 
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...Arc & Codementor
 
20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia岳華 杜
 

Tendances (8)

Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenten
 
ElasticSearch 5.x - New Tricks - 2017-02-08 - Elasticsearch Meetup
ElasticSearch 5.x -  New Tricks - 2017-02-08 - Elasticsearch Meetup ElasticSearch 5.x -  New Tricks - 2017-02-08 - Elasticsearch Meetup
ElasticSearch 5.x - New Tricks - 2017-02-08 - Elasticsearch Meetup
 
2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator2017 02-07 - elastic & spark. building a search geo locator
2017 02-07 - elastic & spark. building a search geo locator
 
Seattle.rb 6.4
Seattle.rb 6.4Seattle.rb 6.4
Seattle.rb 6.4
 
Manifests of Future Past
Manifests of Future PastManifests of Future Past
Manifests of Future Past
 
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
Codementor Office Hours with Eric Chiang: Stdin, Stdout: pup, Go, and life at...
 
20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia20171014 tips for manipulating filesystem in julia
20171014 tips for manipulating filesystem in julia
 
Elegant APIs
Elegant APIsElegant APIs
Elegant APIs
 

En vedette

Persona-fication or: Falling in Love with a Bot
Persona-fication or: Falling in Love with a BotPersona-fication or: Falling in Love with a Bot
Persona-fication or: Falling in Love with a BotModern Hombre
 
The Long Term Investment Outlook for China
The Long Term Investment Outlook for ChinaThe Long Term Investment Outlook for China
The Long Term Investment Outlook for ChinaJohn M Olson, CLTC
 
لوحة الجيوب
لوحة الجيوبلوحة الجيوب
لوحة الجيوبboba56222
 
Building Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstepBuilding Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstepguest9efd1a1
 
StrongSteam AI at HackerNews London October 2011
StrongSteam AI at HackerNews London October 2011StrongSteam AI at HackerNews London October 2011
StrongSteam AI at HackerNews London October 2011Ian Ozsvald
 
Investors Need Purchasing Power
Investors Need Purchasing Power Investors Need Purchasing Power
Investors Need Purchasing Power John M Olson, CLTC
 
Data is a Designer's Best Friend - EuroIA 2016
Data is a Designer's Best Friend - EuroIA 2016Data is a Designer's Best Friend - EuroIA 2016
Data is a Designer's Best Friend - EuroIA 2016Kathryn Parkes
 
Lanyrd Pro
Lanyrd ProLanyrd Pro
Lanyrd ProLanyrd
 
EuroIA 2016 - Clementina Gentile - Hello stranger
EuroIA 2016 - Clementina Gentile - Hello strangerEuroIA 2016 - Clementina Gentile - Hello stranger
EuroIA 2016 - Clementina Gentile - Hello strangerClementina Gentile
 
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel HordesPyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordeskgrandis
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art Historyjeresig
 
Design your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBDesign your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBLuca Garulli
 
Neo4j - graph database for recommendations
Neo4j - graph database for recommendationsNeo4j - graph database for recommendations
Neo4j - graph database for recommendationsproksik
 
The Graph Traversal Programming Pattern
The Graph Traversal Programming PatternThe Graph Traversal Programming Pattern
The Graph Traversal Programming PatternMarko Rodriguez
 
Graphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks AgeGraphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks AgeLorenzo Alberton
 
Intro to Neo4j presentation
Intro to Neo4j presentationIntro to Neo4j presentation
Intro to Neo4j presentationjexp
 
Working With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingWorking With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingNeo4j
 
NoSQL Databases: Why, what and when
NoSQL Databases: Why, what and whenNoSQL Databases: Why, what and when
NoSQL Databases: Why, what and whenLorenzo Alberton
 
Webinar: RDBMS to Graphs
Webinar: RDBMS to GraphsWebinar: RDBMS to Graphs
Webinar: RDBMS to GraphsNeo4j
 

En vedette (20)

Persona-fication or: Falling in Love with a Bot
Persona-fication or: Falling in Love with a BotPersona-fication or: Falling in Love with a Bot
Persona-fication or: Falling in Love with a Bot
 
The Long Term Investment Outlook for China
The Long Term Investment Outlook for ChinaThe Long Term Investment Outlook for China
The Long Term Investment Outlook for China
 
لوحة الجيوب
لوحة الجيوبلوحة الجيوب
لوحة الجيوب
 
Building Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstepBuilding Server Applications Using ObjectiveC And GNUstep
Building Server Applications Using ObjectiveC And GNUstep
 
StrongSteam AI at HackerNews London October 2011
StrongSteam AI at HackerNews London October 2011StrongSteam AI at HackerNews London October 2011
StrongSteam AI at HackerNews London October 2011
 
Boomers to Millennials
Boomers to MillennialsBoomers to Millennials
Boomers to Millennials
 
Investors Need Purchasing Power
Investors Need Purchasing Power Investors Need Purchasing Power
Investors Need Purchasing Power
 
Data is a Designer's Best Friend - EuroIA 2016
Data is a Designer's Best Friend - EuroIA 2016Data is a Designer's Best Friend - EuroIA 2016
Data is a Designer's Best Friend - EuroIA 2016
 
Lanyrd Pro
Lanyrd ProLanyrd Pro
Lanyrd Pro
 
EuroIA 2016 - Clementina Gentile - Hello stranger
EuroIA 2016 - Clementina Gentile - Hello strangerEuroIA 2016 - Clementina Gentile - Hello stranger
EuroIA 2016 - Clementina Gentile - Hello stranger
 
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel HordesPyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
PyCon 2012: Militarizing Your Backyard: Computer Vision and the Squirrel Hordes
 
Applying Computer Vision to Art History
Applying Computer Vision to Art HistoryApplying Computer Vision to Art History
Applying Computer Vision to Art History
 
Design your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDBDesign your application using Persistent Graphs and OrientDB
Design your application using Persistent Graphs and OrientDB
 
Neo4j - graph database for recommendations
Neo4j - graph database for recommendationsNeo4j - graph database for recommendations
Neo4j - graph database for recommendations
 
The Graph Traversal Programming Pattern
The Graph Traversal Programming PatternThe Graph Traversal Programming Pattern
The Graph Traversal Programming Pattern
 
Graphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks AgeGraphs in the Database: Rdbms In The Social Networks Age
Graphs in the Database: Rdbms In The Social Networks Age
 
Intro to Neo4j presentation
Intro to Neo4j presentationIntro to Neo4j presentation
Intro to Neo4j presentation
 
Working With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and ModelingWorking With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and Modeling
 
NoSQL Databases: Why, what and when
NoSQL Databases: Why, what and whenNoSQL Databases: Why, what and when
NoSQL Databases: Why, what and when
 
Webinar: RDBMS to Graphs
Webinar: RDBMS to GraphsWebinar: RDBMS to Graphs
Webinar: RDBMS to Graphs
 

Similaire à Application Modeling with Graph Databases

React Native Evening
React Native EveningReact Native Evening
React Native EveningTroy Miles
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme SwiftMovel
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Qiangning Hong
 
JIP Pipeline System Introduction
JIP Pipeline System IntroductionJIP Pipeline System Introduction
JIP Pipeline System Introductionthasso23
 
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 PHPJeremy Kendall
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeProf. Wim Van Criekinge
 
Hypertable - massively scalable nosql database
Hypertable - massively scalable nosql databaseHypertable - massively scalable nosql database
Hypertable - massively scalable nosql databasebigdatagurus_meetup
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Jonathan Felch
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageNeo4j
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoMatt Stine
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring DataEric Bottard
 
Async. and Realtime Geo Applications with Node.js
Async. and Realtime Geo Applications with Node.jsAsync. and Realtime Geo Applications with Node.js
Async. and Realtime Geo Applications with Node.jsShoaib Burq
 
JavaScript for Flex Devs
JavaScript for Flex DevsJavaScript for Flex Devs
JavaScript for Flex DevsAaronius
 
Make BDD great again
Make BDD great againMake BDD great again
Make BDD great againYana Gusti
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web DevelopmentCheng-Yi Yu
 
Introductionto fp with groovy
Introductionto fp with groovyIntroductionto fp with groovy
Introductionto fp with groovyIsuru Samaraweera
 
Rails and alternative ORMs
Rails and alternative ORMsRails and alternative ORMs
Rails and alternative ORMsJonathan Dahl
 

Similaire à Application Modeling with Graph Databases (20)

React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010
 
JIP Pipeline System Introduction
JIP Pipeline System IntroductionJIP Pipeline System Introduction
JIP Pipeline System Introduction
 
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
 
Bioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekingeBioinformatics p5-bioperl v2013-wim_vancriekinge
Bioinformatics p5-bioperl v2013-wim_vancriekinge
 
Hypertable - massively scalable nosql database
Hypertable - massively scalable nosql databaseHypertable - massively scalable nosql database
Hypertable - massively scalable nosql database
 
Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)Groovy On Trading Desk (2010)
Groovy On Trading Desk (2010)
 
Bioinformatica p6-bioperl
Bioinformatica p6-bioperlBioinformatica p6-bioperl
Bioinformatica p6-bioperl
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
Hands On Spring Data
Hands On Spring DataHands On Spring Data
Hands On Spring Data
 
Async. and Realtime Geo Applications with Node.js
Async. and Realtime Geo Applications with Node.jsAsync. and Realtime Geo Applications with Node.js
Async. and Realtime Geo Applications with Node.js
 
CakePHP
CakePHPCakePHP
CakePHP
 
Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09Spl Not A Bridge Too Far phpNW09
Spl Not A Bridge Too Far phpNW09
 
JavaScript for Flex Devs
JavaScript for Flex DevsJavaScript for Flex Devs
JavaScript for Flex Devs
 
Make BDD great again
Make BDD great againMake BDD great again
Make BDD great again
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
Introductionto fp with groovy
Introductionto fp with groovyIntroductionto fp with groovy
Introductionto fp with groovy
 
Rails and alternative ORMs
Rails and alternative ORMsRails and alternative ORMs
Rails and alternative ORMs
 

Dernier

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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.pdfsudhanshuwaghmare1
 
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 WorkerThousandEyes
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Dernier (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Application Modeling with Graph Databases

  • 1. Application Modeling with Graph Databases http://joind.in/6694
  • 2. @josh_adell • Software developer: PHP, Javascript, SQL • http://www.dunnwell.com • http://blog.everymansoftware.com • http://github.com/jadell/neo4jphp • http://frostymug.herokuapp.com
  • 4. The Solution? > -- First degree > SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title FROM cast WHERE actor_name='Kevin Bacon') > -- Second degree > SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title FROM cast WHERE actor_name IN (SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title FROM cast WHERE actor_name='Kevin Bacon'))) > -- Third degree > SELECT actor_name FROM cast WHERE movie_title IN(SELECT DISTINCT movie_title FROM cast WHERE actor_name IN (SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title FROM cast WHERE actor_name IN (SELECT actor_name FROM cast WHERE movie_title IN (SELECT DISTINCT movie_title FROM cast WHERE actor_name='Kevin Bacon'))))
  • 5. The Truth Relational databases aren't very good with relationships Data RDBMs
  • 8. Right Tool for the Job =
  • 9.
  • 10. Warning: Computer Science Ahead A graph is an ordered pair G = (V, E) where V is a set of vertices and E is a set of edges, which are pairs of vertices in V.
  • 14. Some Graph Use Cases • Social networking • Manufacturing • Map directions • Geo-spatial algorithms • Fraud detection • Multi-tenancy • Dependency mapping • Bioinformatics • Natural language processing
  • 15. Graphs are "Whiteboard-Friendly" Nouns => nodes, Verbs => relationships
  • 16. Back to Bacon START s=node:actors(name="Keanu Reeves"), e=node:actors(name="Kevin Bacon") MATCH p = shortestPath( s-[*]-e ) RETURN p, length(p) http://tinyurl.com/c65d99w
  • 17. ACL • Users can belong to groups • Groups can belong to groups • Groups and users have permissions on objects o read o write o denied
  • 18. START u=node:users(name="User 3") MATCH u-[:belongs_to*]->g RETURN g http://tinyurl.com/cyn3rkx
  • 19. START u=node:users(name="User 2"), o=node:objects(name="Home") MATCH u-[:belongs_to*0..]->g, g-[:can_read]->o RETURN g http://tinyurl.com/dx7onro
  • 20. START u=node:users(name="User 3"), o=node:objects(name="Users 1 Blog") MATCH u-[:belongs_to*0..]->g, g-[:can_read]->o, u-[d?:denied*]->o WHERE d is null RETURN g http://tinyurl.com/bwtyhvt
  • 21. Real Life Example • Companies have brands, locations, location groups • Brands have locations, location groups • Location groups have locations
  • 22. START c=node:companies(name="Company 1") MATCH c-[:HAS*]->l WHERE l.type = 'location' RETURN l ORDER BY l.name http://tinyurl.com/cxm4heh
  • 23. START b=node:brands(name="Brand 1") MATCH b<-[:HAS*]-c-[:HAS*]->l<-[h?:HAS*]-b WHERE h IS NULL AND l.type='location' RETURN l ORDER BY l.name http://tinyurl.com/cl537w6
  • 24. Tweet @chicken_tech we should be using graph dbs!
  • 25. But Wait...There's More! • Mutating Cypher (insert, update) • Indexing (auto, full-text, spatial) • Batches and Transactions • Embedded (for JVM) or REST
  • 26. Where fore art thou, RDB? • Aggregation • Ordered data • Truly tabular data • Few or clearly defined relationships
  • 28. Resources • http://joind.in/6694 • http://neo4j.org • http://docs.neo4j.org • http://www.youtube.com/watch?v=UodTzseLh04 • http://github.com/jadell/neo4jphp • http://joshadell.com • josh.adell@gmail.com • @josh_adell • Google+, Facebook, LinkedIn

Notes de l'éditeur

  1. * Goal here is to inspire further investigation * Not going to go into nuts &amp; bolts * Docs are amazing!
  2. * graph db usage poll
  3. * Six degrees game * Relational databases can&apos;t easily answer certain types of questions * arbitrary path query * the basic unit of social networking
  4. * Each degree adds a join * Increases complexity * Decreases performance * Stop when the actor you&apos;re looking for is in the list
  5. * this problem highlights the ugly truth about RDBs * they weren&apos;t designed to handle these types of problems. * RDB relationships join data, but are not data in themselves * arbitrary path query * RDB does &amp;quot;query&amp;quot;, not &amp;quot;path&amp;quot; * certainly not &amp;quot;arbitrary&amp;quot;
  6. * Gather everything in the set that matches these criteria, then tell me if this thing is in the set * 1 set, no problem * 2nd set no problem * 3rd set not related to 1st * 4th not related to 2nd * 5th related to 1st and 4th * etc. * Relationships are only available between overlapping sets
  7. * avoid schema lock-in * intuitive * ditch digger&apos;s dilemma
  8. * Neo4j * AGPL for community * ACID compliant * High Availablity mode * Embedded and REST
  9. * Neo4j * AGPL for community * ACID compliant * High Availablity mode * Embedded and REST * Bindings for every language
  10. * graph theory * edges can be ordered or unordered pairs * vocab: - vertex -&gt; node - edge -&gt; relationship
  11. * Tree data-structures * Networks * Maps * vehicles on streets == packets through network * social networking * manufacturing * fraud detection * supply chain
  12. * Make each record a node * Make every foreign key a relationship * RDB indexes are usually stored in a tree structure * Trees are graphs * Why not use RDBs? * The trouble with RDBs is how they are stored in memory and queried   * Require a translation step from memory blocks to graph structure * ORMs hide the problem, but do not solve it * Relationships not first-class citizens * Many problem domains map poorly to rows/tables
  13. The zen of graph databases
  14. * Social networking - friends of friends of friends of friends * Assembly/Manufacturing - 1 widget contains 3 gadgets each contain 2 gizmos * Map directions - starting at my house find a route to the office that goes past the pub * Multi-tenancy - root node per tenant * all queries start at root * No overlap between graphs = no accidental data spillage * Fraud: track transactions back to origination * Pretty much anything that can be drawn on a whiteboard
  15. * Example: retail system * Customer makes Order * Store sells Order * Order contains Items * Supplier supplied Items * Customer rates Items * Did this customer rank supplier X highly? * Which suppliers sell the highest rated items? * Does item A get rated higher when ordered with Item B? * All can be answered with RDBs as well * Not as elegant * Not as performant
  16. * Actors are nodes * Movies are nodes * Relationship: Actor is IN a movie * Compare to degree selection join queries
  17. * all groups user 3 is a member of directly or inherited
  18. * does user 2 have permission to read the home page?
  19. * does user 3 have permission to read the user 1&apos;s blog?
  20. * Find all locations in company
  21. * For a given brand, find all locations not under that brand
  22. * RDBs are really good at data aggregation * Set math, duh * Have to traverse the whole graph in order to do aggregation * Truly tabular means not a lot of relationships between the data types * Neo4j guys say: rdb will tell you the salary of everyone in the room; graph db will tell you who will buy you a beer
  23. * Emil Eifrem (Neo Tech CEO) webinar * Check out 54 minute mark