SlideShare a Scribd company logo
1 of 23
Download to read offline
Getting started with
Graph Databases & Neo4j
Suroor Wijdan
@wotthetech
Agenda for Today
● Intro to Graph Databases
● Who is using graph databases?
● What is Neo4j?
● MongoDB vs Neo4j?
● Nodes and Relationships
● Cypher Query Language
● CRUD operations in CQL
● Project Use Case
● Questions?
● Exercises
What is NoSQL?
● NoSQL stands for “Not Only SQL”
● Some questions which you can ask to database:
○ What is my Average Income?
○ What Items I have in his Shopping Cart?
○ How did I get into this session?
- Ask a RDBMS
- Ask a Key Value Store
- Ask a Graph
Intro to Graph Databases
Graph is everywhere
● Graph Databases
present a new
perspective on the
same type of data.
● Graph is the most
generic type of data
structure capable of
storing data in highly
accessible way
● Suitable for any kind of
data that is related
● Graph databases are
optimized for the
relations between
records
● a graph containing Nodes &
Relationships
● with both having Properties
● verily perfect for complex and
highly connected data
Important Quote
A Quote....
“A relational database may tell you how much your
customer has spent at your store”
“but”
“a graph database will tell your customers what
should they buy next”
Who is using Graph Databases?
● Some big names using Graph Databases:
○ Facebook - Open Graph Database
○ Google - Knowledge Graph
○ Twitter - FlockDB distributed graph Database
○ Adobe
○ Glassdoor
○ JustDial
○ CareerBuilder
○ Indiatimes
○ telenor
○ Hellwet Packard
○ T-Mobile
○ Cisco
ALL
THESE
USE
What is Neo4j?
● Neo4j is a robust property graph database
● Fully Transactional (ACID)
● Highly Agile
● Best suited for data which is highly
connected
● Is supremely fast when it comes to querying
connected data
● The most popular graph database in the
world
● Highly scalable, up to several billion
nodes/relationships/properties
What is Neo4j?
● Neo4j allows infinite depth
● Uses Cypher Query Language for querying,
also has Java and REST API’s
● Human Readable Queries
● Data Modelling in Neo4j :
○ The whole model relies on the questions we have to
ask our database
○ Very easily done, even when designing domains in
SQL we tend to make graphs on whiteboards
● Neo4j helps us derive patterns from our data
MongoDB vs Neo4j
MongoDB is meant for cases where you would
like to have dynamic queries on quite a size of
data.
- Not capable of handling relationships
Neo4j is best suitable in use cases where you
have complex relationships and data which is
highly connected. Neo4j can help you find
routes, social patterns, etc. from your data.
- Not Horizontally Scalable (as of now)
Nodes and Relationships
● A minimal graph can consist of a single node
with properties defined on it.
● A Property graph has Nodes
and Relationships with properties
defined on them.
● node ( vertex)
● relationship (edge) :- with direction
● property(attribute) :- on nodes and relationships
Lets see an example: -
Nodes and Relationships
Da Vinci Code
Dan Brown Manoj
Roni
The Lost Symbol
Gone with the Wind
Suspense
Thriller
Nodes and Relationships
Da Vinci Code
Dan Brown Manoj
Roni
The Lost Symbol
Harry Potter
Suspense
Thriller
Authored By
Read By
Friendswith
Authored By
Recommends
Belongs To
BelongsTo
Belongs
To
Release Date
Recom
m
ends
J.K Rowling Authored By
An Example of Book Store with Recommendations
Cypher Query Language
● Is a declarative query language for querying Neo4j
● Expressive and Human readable syntax
● Matches patterns of nodes and relationships to
extract/modify information in the graph
● With cypher, we can create, update, remove
nodes, relationships and properties
● Has an online console at http://www.neo4j.
org/console
● Has a short learning curve due to similarities with
SQL query statements
Cypher Query Language
Create a Node:
CREATE (n:User { fname:"Manoj", lname:“Nama” });
● User is the Label
● n is the variable for new node
● {} brackets to add properties to the node
Cypher Query Language
Read Properties of a Node:
MATCH (n:User)
WHERE n.fname = “Manoj”
RETURN n
● User is the Label
● n is the variable for node
● WHERE to restrict the result to our
criteria
● RETURN the properties on the node
Cypher Query Language
Update property on a Node:
MATCH (user:User)
WHERE user.fname = 'Manoj'
SET user.lname = ‘Mohan’
RETURN user.fname, user.lname;
● User is the Label
● Restricts search to the nodes under USER
label
● SET adds a new property to the node
● RETURN clause indicates what data to
return
Cypher Query Language
Delete a Node:
MATCH (user:User)
WHERE user.fname = 'Emily'
DELETE user
● User is the Label
● Restricts search to the nodes under USER
label
● DELETE clause deletes a node from graph
● RETURN clause indicates what data to
return
Cypher Query Language
Set a new property on a Node after creation:
MATCH (user:User)
WHERE user.name = 'Roni'
SET user.country = ‘India’
RETURN user.name, user.country;
● User is the Label
● Restricts search to the nodes under USER
label
● SET adds or updates a property on a node
● RETURN clause indicates what data to
return
Cypher Query Language
Find a node in CQL
START n=node(*)
WHERE HAS (n.name) AND n.name = "Roni"
RETURN n;
● START clause to begin a query
● n=node(*) to search through all nodes
● WHERE clause to constrain the results
● n.name indicates the name property must
exist
● = "Roni" compares an existing name to the
value Roni
● RETURN clause requests particular results
Steps to get a Neo4j server up & running
(Linux)
Run the following commands in Terminal:
● sudo bash
● wget -O - http://debian.neo4j.
org/neotechnology.gpg.key | apt-key add -
● echo 'deb http://debian.neo4j.org/repo
stable/' > /etc/apt/sources.list.d/neo4j.
list
● apt-get install neo4j
● start neo4j server, available at http:
//localhost:7474 of the machine
neo4j start
Neo4j Web Admin
References
1. Online Manual - http://docs.neo4j.org/chunked/milestone/
2. Online Cypher Console - http://console.neo4j.org
3. Cypher Cheat Sheet - http://docs.neo4j.org/refcard/1.9/
4. Graph image taken from - http://www.neo4j.org
THANKS!
Get in touch for any queries :
twitter: @wotthetech
github: suroorwijdan
PS: You are free to share this ppt but give due credit to the creator wherever used.

More Related Content

What's hot

An Introduction to NOSQL, Graph Databases and Neo4j
An Introduction to NOSQL, Graph Databases and Neo4jAn Introduction to NOSQL, Graph Databases and Neo4j
An Introduction to NOSQL, Graph Databases and Neo4jDebanjan Mahata
 
Introducing Neo4j graph database
Introducing Neo4j graph databaseIntroducing Neo4j graph database
Introducing Neo4j graph databaseAmirhossein Saberi
 
RDBMS to Graph
RDBMS to GraphRDBMS to Graph
RDBMS to GraphNeo4j
 
Using Neo4j from Java
Using Neo4j from JavaUsing Neo4j from Java
Using Neo4j from JavaNeo4j
 
Relational to Graph - Import
Relational to Graph - ImportRelational to Graph - Import
Relational to Graph - ImportNeo4j
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph DatabasesMax De Marzi
 
Neo4J : Introduction to Graph Database
Neo4J : Introduction to Graph DatabaseNeo4J : Introduction to Graph Database
Neo4J : Introduction to Graph DatabaseMindfire Solutions
 
Introduction to Graph databases and Neo4j (by Stefan Armbruster)
Introduction to Graph databases and Neo4j (by Stefan Armbruster)Introduction to Graph databases and Neo4j (by Stefan Armbruster)
Introduction to Graph databases and Neo4j (by Stefan Armbruster)barcelonajug
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4jSandip Jadhav
 
NOSQLEU - Graph Databases and Neo4j
NOSQLEU - Graph Databases and Neo4jNOSQLEU - Graph Databases and Neo4j
NOSQLEU - Graph Databases and Neo4jTobias Lindaaker
 
Performance of graph query languages
Performance of graph query languagesPerformance of graph query languages
Performance of graph query languagesAthiq Ahamed
 
Neo4j Fundamentals
Neo4j FundamentalsNeo4j Fundamentals
Neo4j FundamentalsMax De Marzi
 
An Introduction to Graph Databases
An Introduction to Graph DatabasesAn Introduction to Graph Databases
An Introduction to Graph DatabasesInfiniteGraph
 
The Graph Database Universe: Neo4j Overview
The Graph Database Universe: Neo4j OverviewThe Graph Database Universe: Neo4j Overview
The Graph Database Universe: Neo4j OverviewNeo4j
 
Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4jjexp
 
Introduction to graph databases, Neo4j and Spring Data - English 2015 Edition
Introduction to graph databases, Neo4j and Spring Data - English 2015 EditionIntroduction to graph databases, Neo4j and Spring Data - English 2015 Edition
Introduction to graph databases, Neo4j and Spring Data - English 2015 EditionAleksander Stensby
 
Intro to Cypher
Intro to CypherIntro to Cypher
Intro to CypherNeo4j
 
Django and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks assDjango and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks assTobias Lindaaker
 

What's hot (20)

An Introduction to NOSQL, Graph Databases and Neo4j
An Introduction to NOSQL, Graph Databases and Neo4jAn Introduction to NOSQL, Graph Databases and Neo4j
An Introduction to NOSQL, Graph Databases and Neo4j
 
Introducing Neo4j graph database
Introducing Neo4j graph databaseIntroducing Neo4j graph database
Introducing Neo4j graph database
 
RDBMS to Graph
RDBMS to GraphRDBMS to Graph
RDBMS to Graph
 
Using Neo4j from Java
Using Neo4j from JavaUsing Neo4j from Java
Using Neo4j from Java
 
Graph based data models
Graph based data modelsGraph based data models
Graph based data models
 
Relational to Graph - Import
Relational to Graph - ImportRelational to Graph - Import
Relational to Graph - Import
 
Intro to Neo4j 2.0
Intro to Neo4j 2.0Intro to Neo4j 2.0
Intro to Neo4j 2.0
 
Introduction to Graph Databases
Introduction to Graph DatabasesIntroduction to Graph Databases
Introduction to Graph Databases
 
Neo4J : Introduction to Graph Database
Neo4J : Introduction to Graph DatabaseNeo4J : Introduction to Graph Database
Neo4J : Introduction to Graph Database
 
Introduction to Graph databases and Neo4j (by Stefan Armbruster)
Introduction to Graph databases and Neo4j (by Stefan Armbruster)Introduction to Graph databases and Neo4j (by Stefan Armbruster)
Introduction to Graph databases and Neo4j (by Stefan Armbruster)
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4j
 
NOSQLEU - Graph Databases and Neo4j
NOSQLEU - Graph Databases and Neo4jNOSQLEU - Graph Databases and Neo4j
NOSQLEU - Graph Databases and Neo4j
 
Performance of graph query languages
Performance of graph query languagesPerformance of graph query languages
Performance of graph query languages
 
Neo4j Fundamentals
Neo4j FundamentalsNeo4j Fundamentals
Neo4j Fundamentals
 
An Introduction to Graph Databases
An Introduction to Graph DatabasesAn Introduction to Graph Databases
An Introduction to Graph Databases
 
The Graph Database Universe: Neo4j Overview
The Graph Database Universe: Neo4j OverviewThe Graph Database Universe: Neo4j Overview
The Graph Database Universe: Neo4j Overview
 
Intro to Graphs and Neo4j
Intro to Graphs and Neo4jIntro to Graphs and Neo4j
Intro to Graphs and Neo4j
 
Introduction to graph databases, Neo4j and Spring Data - English 2015 Edition
Introduction to graph databases, Neo4j and Spring Data - English 2015 EditionIntroduction to graph databases, Neo4j and Spring Data - English 2015 Edition
Introduction to graph databases, Neo4j and Spring Data - English 2015 Edition
 
Intro to Cypher
Intro to CypherIntro to Cypher
Intro to Cypher
 
Django and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks assDjango and Neo4j - Domain modeling that kicks ass
Django and Neo4j - Domain modeling that kicks ass
 

Similar to Getting started with Graph Databases & Neo4j

No sql database and python -- Presentation done at Python Developer's meetup ...
No sql database and python -- Presentation done at Python Developer's meetup ...No sql database and python -- Presentation done at Python Developer's meetup ...
No sql database and python -- Presentation done at Python Developer's meetup ...Roshan Bhandari
 
Discovering Emerging Tech through Graph Analysis - Henry Hwangbo @ GraphConne...
Discovering Emerging Tech through Graph Analysis - Henry Hwangbo @ GraphConne...Discovering Emerging Tech through Graph Analysis - Henry Hwangbo @ GraphConne...
Discovering Emerging Tech through Graph Analysis - Henry Hwangbo @ GraphConne...Neo4j
 
DubJug: Neo4J and Open Data
DubJug: Neo4J and Open DataDubJug: Neo4J and Open Data
DubJug: Neo4J and Open DataScott Sosna
 
Polyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jPolyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jCorie Pollock
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually restJakub Riedl
 
Training Week: Build APIs with Neo4j GraphQL Library
Training Week: Build APIs with Neo4j GraphQL LibraryTraining Week: Build APIs with Neo4j GraphQL Library
Training Week: Build APIs with Neo4j GraphQL LibraryNeo4j
 
AI from your data lake: Using Solr for analytics
AI from your data lake: Using Solr for analyticsAI from your data lake: Using Solr for analytics
AI from your data lake: Using Solr for analyticsDataWorks Summit
 
GR8Conf 2011: Neo4j Plugin
GR8Conf 2011: Neo4j PluginGR8Conf 2011: Neo4j Plugin
GR8Conf 2011: Neo4j PluginGR8Conf
 
Metadata and Access Control
Metadata and Access ControlMetadata and Access Control
Metadata and Access ControlNeo4j
 
A quick review of Python and Graph Databases
A quick review of Python and Graph DatabasesA quick review of Python and Graph Databases
A quick review of Python and Graph DatabasesNicholas Crouch
 
Interpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsInterpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsNeo4j
 
Change RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDBChange RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDBApaichon Punopas
 
Mongodb open data day 2014
Mongodb open data day 2014Mongodb open data day 2014
Mongodb open data day 2014David Green
 
Graph database
Graph databaseGraph database
Graph databaseYen Pham
 

Similar to Getting started with Graph Databases & Neo4j (20)

Neo4j graph database
Neo4j graph databaseNeo4j graph database
Neo4j graph database
 
MongoDB Basics
MongoDB BasicsMongoDB Basics
MongoDB Basics
 
No sql database and python -- Presentation done at Python Developer's meetup ...
No sql database and python -- Presentation done at Python Developer's meetup ...No sql database and python -- Presentation done at Python Developer's meetup ...
No sql database and python -- Presentation done at Python Developer's meetup ...
 
Discovering Emerging Tech through Graph Analysis - Henry Hwangbo @ GraphConne...
Discovering Emerging Tech through Graph Analysis - Henry Hwangbo @ GraphConne...Discovering Emerging Tech through Graph Analysis - Henry Hwangbo @ GraphConne...
Discovering Emerging Tech through Graph Analysis - Henry Hwangbo @ GraphConne...
 
Neo4j: Graph-like power
Neo4j: Graph-like powerNeo4j: Graph-like power
Neo4j: Graph-like power
 
DubJug: Neo4J and Open Data
DubJug: Neo4J and Open DataDubJug: Neo4J and Open Data
DubJug: Neo4J and Open Data
 
Polyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4jPolyglot Persistence with MongoDB and Neo4j
Polyglot Persistence with MongoDB and Neo4j
 
GraphQL is actually rest
GraphQL is actually restGraphQL is actually rest
GraphQL is actually rest
 
Neo4j Davide Francesconi
Neo4j Davide FrancesconiNeo4j Davide Francesconi
Neo4j Davide Francesconi
 
Training Week: Build APIs with Neo4j GraphQL Library
Training Week: Build APIs with Neo4j GraphQL LibraryTraining Week: Build APIs with Neo4j GraphQL Library
Training Week: Build APIs with Neo4j GraphQL Library
 
AI from your data lake: Using Solr for analytics
AI from your data lake: Using Solr for analyticsAI from your data lake: Using Solr for analytics
AI from your data lake: Using Solr for analytics
 
GR8Conf 2011: Neo4j Plugin
GR8Conf 2011: Neo4j PluginGR8Conf 2011: Neo4j Plugin
GR8Conf 2011: Neo4j Plugin
 
Grails and Neo4j
Grails and Neo4jGrails and Neo4j
Grails and Neo4j
 
Metadata and Access Control
Metadata and Access ControlMetadata and Access Control
Metadata and Access Control
 
A quick review of Python and Graph Databases
A quick review of Python and Graph DatabasesA quick review of Python and Graph Databases
A quick review of Python and Graph Databases
 
Interpreting Relational Schema to Graphs
Interpreting Relational Schema to GraphsInterpreting Relational Schema to Graphs
Interpreting Relational Schema to Graphs
 
Change RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDBChange RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDB
 
Mongodb open data day 2014
Mongodb open data day 2014Mongodb open data day 2014
Mongodb open data day 2014
 
Graph database
Graph databaseGraph database
Graph database
 
Graph Databases
Graph DatabasesGraph Databases
Graph Databases
 

Recently uploaded

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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

Getting started with Graph Databases & Neo4j

  • 1. Getting started with Graph Databases & Neo4j Suroor Wijdan @wotthetech
  • 2. Agenda for Today ● Intro to Graph Databases ● Who is using graph databases? ● What is Neo4j? ● MongoDB vs Neo4j? ● Nodes and Relationships ● Cypher Query Language ● CRUD operations in CQL ● Project Use Case ● Questions? ● Exercises
  • 3. What is NoSQL? ● NoSQL stands for “Not Only SQL” ● Some questions which you can ask to database: ○ What is my Average Income? ○ What Items I have in his Shopping Cart? ○ How did I get into this session? - Ask a RDBMS - Ask a Key Value Store - Ask a Graph
  • 4. Intro to Graph Databases Graph is everywhere ● Graph Databases present a new perspective on the same type of data. ● Graph is the most generic type of data structure capable of storing data in highly accessible way ● Suitable for any kind of data that is related ● Graph databases are optimized for the relations between records ● a graph containing Nodes & Relationships ● with both having Properties ● verily perfect for complex and highly connected data Important Quote
  • 5. A Quote.... “A relational database may tell you how much your customer has spent at your store” “but” “a graph database will tell your customers what should they buy next”
  • 6. Who is using Graph Databases? ● Some big names using Graph Databases: ○ Facebook - Open Graph Database ○ Google - Knowledge Graph ○ Twitter - FlockDB distributed graph Database ○ Adobe ○ Glassdoor ○ JustDial ○ CareerBuilder ○ Indiatimes ○ telenor ○ Hellwet Packard ○ T-Mobile ○ Cisco ALL THESE USE
  • 7. What is Neo4j? ● Neo4j is a robust property graph database ● Fully Transactional (ACID) ● Highly Agile ● Best suited for data which is highly connected ● Is supremely fast when it comes to querying connected data ● The most popular graph database in the world ● Highly scalable, up to several billion nodes/relationships/properties
  • 8. What is Neo4j? ● Neo4j allows infinite depth ● Uses Cypher Query Language for querying, also has Java and REST API’s ● Human Readable Queries ● Data Modelling in Neo4j : ○ The whole model relies on the questions we have to ask our database ○ Very easily done, even when designing domains in SQL we tend to make graphs on whiteboards ● Neo4j helps us derive patterns from our data
  • 9. MongoDB vs Neo4j MongoDB is meant for cases where you would like to have dynamic queries on quite a size of data. - Not capable of handling relationships Neo4j is best suitable in use cases where you have complex relationships and data which is highly connected. Neo4j can help you find routes, social patterns, etc. from your data. - Not Horizontally Scalable (as of now)
  • 10. Nodes and Relationships ● A minimal graph can consist of a single node with properties defined on it. ● A Property graph has Nodes and Relationships with properties defined on them. ● node ( vertex) ● relationship (edge) :- with direction ● property(attribute) :- on nodes and relationships Lets see an example: -
  • 11. Nodes and Relationships Da Vinci Code Dan Brown Manoj Roni The Lost Symbol Gone with the Wind Suspense Thriller
  • 12. Nodes and Relationships Da Vinci Code Dan Brown Manoj Roni The Lost Symbol Harry Potter Suspense Thriller Authored By Read By Friendswith Authored By Recommends Belongs To BelongsTo Belongs To Release Date Recom m ends J.K Rowling Authored By An Example of Book Store with Recommendations
  • 13. Cypher Query Language ● Is a declarative query language for querying Neo4j ● Expressive and Human readable syntax ● Matches patterns of nodes and relationships to extract/modify information in the graph ● With cypher, we can create, update, remove nodes, relationships and properties ● Has an online console at http://www.neo4j. org/console ● Has a short learning curve due to similarities with SQL query statements
  • 14. Cypher Query Language Create a Node: CREATE (n:User { fname:"Manoj", lname:“Nama” }); ● User is the Label ● n is the variable for new node ● {} brackets to add properties to the node
  • 15. Cypher Query Language Read Properties of a Node: MATCH (n:User) WHERE n.fname = “Manoj” RETURN n ● User is the Label ● n is the variable for node ● WHERE to restrict the result to our criteria ● RETURN the properties on the node
  • 16. Cypher Query Language Update property on a Node: MATCH (user:User) WHERE user.fname = 'Manoj' SET user.lname = ‘Mohan’ RETURN user.fname, user.lname; ● User is the Label ● Restricts search to the nodes under USER label ● SET adds a new property to the node ● RETURN clause indicates what data to return
  • 17. Cypher Query Language Delete a Node: MATCH (user:User) WHERE user.fname = 'Emily' DELETE user ● User is the Label ● Restricts search to the nodes under USER label ● DELETE clause deletes a node from graph ● RETURN clause indicates what data to return
  • 18. Cypher Query Language Set a new property on a Node after creation: MATCH (user:User) WHERE user.name = 'Roni' SET user.country = ‘India’ RETURN user.name, user.country; ● User is the Label ● Restricts search to the nodes under USER label ● SET adds or updates a property on a node ● RETURN clause indicates what data to return
  • 19. Cypher Query Language Find a node in CQL START n=node(*) WHERE HAS (n.name) AND n.name = "Roni" RETURN n; ● START clause to begin a query ● n=node(*) to search through all nodes ● WHERE clause to constrain the results ● n.name indicates the name property must exist ● = "Roni" compares an existing name to the value Roni ● RETURN clause requests particular results
  • 20. Steps to get a Neo4j server up & running (Linux) Run the following commands in Terminal: ● sudo bash ● wget -O - http://debian.neo4j. org/neotechnology.gpg.key | apt-key add - ● echo 'deb http://debian.neo4j.org/repo stable/' > /etc/apt/sources.list.d/neo4j. list ● apt-get install neo4j ● start neo4j server, available at http: //localhost:7474 of the machine neo4j start
  • 22. References 1. Online Manual - http://docs.neo4j.org/chunked/milestone/ 2. Online Cypher Console - http://console.neo4j.org 3. Cypher Cheat Sheet - http://docs.neo4j.org/refcard/1.9/ 4. Graph image taken from - http://www.neo4j.org
  • 23. THANKS! Get in touch for any queries : twitter: @wotthetech github: suroorwijdan PS: You are free to share this ppt but give due credit to the creator wherever used.