SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

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岳華 杜
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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
 

Último

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 

Último (20)

Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 

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

Notas do Editor

  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