SlideShare a Scribd company logo
1 of 47
Download to read offline
Introduction to Neo4j - a
hands-on crash course
Lju Lazarevic
lju@neo4j.com
@ellazal
community.neo4j.com
In this session
We will cover:
• What is a graph and why we need them
• Spotting good graph scenarios
• Property graph database anatomy and introduction to Cypher
• Hands-on: the movie graph on sandbox
• sandbox.neo4j.com
• Continuing your graph journey
What is a graph?
A graph is...
...a set of discrete objects, each of which has some set of relationships with
the other objects
Seven Bridges of Konigsberg problem. Leonhard Euler, 1735
Anything can be a graph
the Internet a water molecule
H
O
H
Why do we need graphs?
Reality
seldom
comes in
discrete
tables
Customer
Beverage
Mapping
Action
CI Name
BI Name AI Type
CI BI AIProblems are
best understood
with a
representation
of reality
Reality is often
about things
being
connected to
other things
drinks in store
A graph
provides a
better
approximation
of reality
Customer
Coffee
DRINKS
Reality does
not stop at
the border
of a data
silo
Customer
Product
Order
19 Jason
32 Ann
91 Dan
11 Filter
21 Latte
31 Flat W.
01 Buy
04 Preord.
09 Drink
91 21 01
91 21 09
32 11 04
Follow the flow - buying trainers
Panama papers:
simple model, powerful
outcome
The Panama papers data
model...
Roses are red,
facebook is blue,
No mutual friends,
So who are you?
Friends of friends
...or co-actors of co-actors
What are good graph
scenarios?
Scenario 1: Does our problem involve understanding relationships
between entities?
Identifying good graph scenarios
● Recommendations
● Fraud detection
● Finding duplicates
● Data lineage
Scenario 2: Does the problem involve a lot of self-referencing to the
same type of entity?
Identifying good graph scenarios
● Organisational
hierarchies
● Access management
● Social influencers
● Friends of friends
Scenario 3: Does the problem explore relationships of varying or
unknown depth?
Identifying good graph scenarios
● Supply chain
visibility
● Bill of Materials
● Network
management
Scenario 4: Does our problem involve discovering lots of different
routes or paths?
Identifying good graph scenarios
● Logistics and routing
● Infrastructure
management
● Dependency tracing
So what does a (property)
graph look like?
Node (Vertex)
● The main data element from which graphs are constructed
Graph components
Jane car
Graph components
Node (Vertex)
● The main data element from which graphs are constructed
Relationship (Edge)
● A link between two nodes. Has:
○ Direction
○ Type
● A node without relationships is permitted. A relationship without nodes is not
Jane carOWNS
Label property graph database
Node (Vertex)
Relationship (Edge)
OWNS
Label property graph database
Node (Vertex)
Relationship (Edge)
:Person :CarOWNS
Label
● Define node category (optional)
Label property graph database
Node (Vertex)
Relationship (Edge)
:Person :CarOWNS
Label
● Define node category (optional)
● Can have more than one
:Asset
Node (Vertex)
Relationship (Edge)
:Person :CarOWNS
Label
● Define node category (optional)
● Can have more than one
Properties
● Enrich a node or relationship
● No need for nulls!
name: Jane make: Volvo
model: V60
since: 2018
:Asset
Label property graph database
How do I query the graph?
27

Cypher
28

Cypher
29

Cypher
ツ
Use MATCH to retrieve nodes
//Match all nodes
MATCH (n)
RETURN n;
Use MATCH to retrieve nodes
//Match all nodes
MATCH (n)
RETURN n;
//Match all nodes with a Person label
MATCH (n:Person)
RETURN n;
Use MATCH to retrieve nodes
//Match all nodes
MATCH (n)
RETURN n;
//Match all nodes with a Person label
MATCH (n:Person)
RETURN n;
//Match all nodes with a Person label and property name is "Tom Hanks"
MATCH (n:Person {name: "Tom Hanks"})
RETURN n;
//Return nodes with label Person and name property is "Tom Hanks" - Inline
MATCH (p:Person {name: "Tom Hanks"}) //Only works with exact matches
RETURN p;
Use MATCH and properties to retrieve nodes
//Return nodes with label Person and name property is "Tom Hanks" - Inline
MATCH (p:Person {name: "Tom Hanks"}) //Only works with exact matches
RETURN p;
//Return nodes with label Person and name property equals "Tom Hanks"
MATCH (p:Person)
WHERE p.name = "Tom Hanks"
RETURN p;
Use MATCH and properties to retrieve nodes
//Return nodes with label Person and name property is "Tom Hanks" - Inline
MATCH (p:Person {name: "Tom Hanks"}) //Only works with exact matches
RETURN p;
//Return nodes with label Person and name property equals "Tom Hanks"
MATCH (p:Person)
WHERE p.name = "Tom Hanks"
RETURN p;
//Return nodes with label Movie, released property is between 1991 and
1999
MATCH (m:Movie)
WHERE m.released > 1990 AND m.released < 2000
RETURN m;
Use MATCH and properties to retrieve nodes
Extending the MATCH
//Find all the movies Tom Hanks acted in
MATCH (:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie)
RETURN m.title;
Extending the MATCH
//Find all the movies Tom Hanks acted in
MATCH (:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie)
RETURN m.title;
//Find all the movies Tom Hanks directed and order by latest movie
MATCH (:Person {name:"Tom Hanks"})-[:DIRECTED]->(m:Movie)
RETURN m.title, m.released ORDER BY m.released DESC;
Extending the MATCH
//Find all the movies Tom Hanks acted in
MATCH (:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie)
RETURN m.title;
//Find all the movies Tom Hanks directed and order by latest movie
MATCH (:Person {name:"Tom Hanks"})-[:DIRECTED]->(m:Movie)
RETURN m.title, m.released ORDER BY m.released DESC;
//Find all of the co-actors Tom Hanks have worked with
MATCH (:Person {name:"Tom
Hanks"})-->(:Movie)<-[:ACTED_IN]-(coActor:Person)
Extending the MATCH
//Create a person node called "Tom Hanks"
CREATE (p:Person {name:"Tom Hanks"});
CREATE
//Create a person node called "Tom Hanks"
CREATE (p:Person {name:"Tom Hanks"});
//Create an ACTED_IN relationship between "Tom Hanks" and "Apollo 13"
MATCH (p:Person {name:"Tom Hanks"}), (m:Movie {title:"Apollo 13"})
CREATE (p)-[:ACTED_IN]->(m);
CREATE
//Create a person node called "Tom Hanks"
CREATE (p:Person {name:"Tom Hanks"});
//Create an ACTED_IN relationship between "Tom Hanks" and "Apollo 13"
MATCH (p:Person {name:"Tom Hanks"}), (m:Movie {title:"Apollo 13"})
CREATE (p)-[:ACTED_IN]->(m);
//Create the pattern of "Tom Hanks" ACTED_IN "Apollo 13"
//This will create the entire pattern, nodes and all!
CREATE (:Person {name:"Tom Hanks")-[:ACTED_IN]->(:Movie {title:"Apollo
13});
CREATE
Time to have a go!
We are going to:
• Go to sandbox.neo4j.com
• Sign in
• Select "Blank sandbox" and click Launch Project
We’ll all have a go together :)
So how do I continue my
graph journey?
Free book:
neo4j.com/graph-databases-book
Free online training and certification:
neo4j.com/graphacademy/online-training
How to, best practices and customer
stories:
youtube.com/neo4j
But you can still have a go at these fun challenges at
your own pace!
• Modelling a barbecue
• Exploring a museum collection
• Solving a murder mystery
• Virtually visiting Central Park
Start here: r.neo4j.com/son-week1
Summer of Nodes is over...
Ljubica Lazarevic
Developer Relations
Advocate
@ElLazal
lju@neo4j.com
Join the conversation at community.neo4j.com

More Related Content

Similar to Introduction to Neo4j - a hands-on crash course

Training Week: Introduction to Neo4j 2022
Training Week: Introduction to Neo4j 2022Training Week: Introduction to Neo4j 2022
Training Week: Introduction to Neo4j 2022Neo4j
 
Neo4j 20 minutes introduction
Neo4j 20 minutes introductionNeo4j 20 minutes introduction
Neo4j 20 minutes introductionAndrás Fehér
 
Neo4j GraphTalks Wien - Neo4j Bloom: an interactive Graph Visualisation Envir...
Neo4j GraphTalks Wien - Neo4j Bloom: an interactive Graph Visualisation Envir...Neo4j GraphTalks Wien - Neo4j Bloom: an interactive Graph Visualisation Envir...
Neo4j GraphTalks Wien - Neo4j Bloom: an interactive Graph Visualisation Envir...Neo4j
 
Imdb import presentation
Imdb import presentationImdb import presentation
Imdb import presentationJoshua Bae
 
Neo4j for Ruby and Rails
Neo4j for Ruby and RailsNeo4j for Ruby and Rails
Neo4j for Ruby and RailsPablo Delgado
 
Hands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4jHands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4jSerendio Inc.
 
ExpLOD: a framework for explaining recommendations based on the Linked Open D...
ExpLOD: a framework for explaining recommendations based on the Linked Open D...ExpLOD: a framework for explaining recommendations based on the Linked Open D...
ExpLOD: a framework for explaining recommendations based on the Linked Open D...Fedelucio Narducci
 
Morpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache SparkMorpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache SparkKnoldus Inc.
 
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
 
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH) Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH) David Fombella Pombal
 
Mongodbworkshop I: get started
Mongodbworkshop I: get startedMongodbworkshop I: get started
Mongodbworkshop I: get startedVivian S. Zhang
 
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...NoSQLmatters
 
Introduction to Cypher
Introduction to Cypher Introduction to Cypher
Introduction to Cypher Neo4j
 
Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft A...
Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft A...Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft A...
Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft A...Chris Grabosky
 
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27Ruby Meditation
 
Dove sono i tuoi vertici e di cosa stanno parlando?
Dove sono i tuoi vertici e di cosa stanno parlando?Dove sono i tuoi vertici e di cosa stanno parlando?
Dove sono i tuoi vertici e di cosa stanno parlando?Codemotion
 

Similar to Introduction to Neo4j - a hands-on crash course (20)

Training Week: Introduction to Neo4j 2022
Training Week: Introduction to Neo4j 2022Training Week: Introduction to Neo4j 2022
Training Week: Introduction to Neo4j 2022
 
Neo4j 20 minutes introduction
Neo4j 20 minutes introductionNeo4j 20 minutes introduction
Neo4j 20 minutes introduction
 
Neo4j GraphTalks Wien - Neo4j Bloom: an interactive Graph Visualisation Envir...
Neo4j GraphTalks Wien - Neo4j Bloom: an interactive Graph Visualisation Envir...Neo4j GraphTalks Wien - Neo4j Bloom: an interactive Graph Visualisation Envir...
Neo4j GraphTalks Wien - Neo4j Bloom: an interactive Graph Visualisation Envir...
 
Imdb import presentation
Imdb import presentationImdb import presentation
Imdb import presentation
 
Neo4j for Ruby and Rails
Neo4j for Ruby and RailsNeo4j for Ruby and Rails
Neo4j for Ruby and Rails
 
Neo4j (Part 1)
Neo4j (Part 1)Neo4j (Part 1)
Neo4j (Part 1)
 
Hands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4jHands on Training – Graph Database with Neo4j
Hands on Training – Graph Database with Neo4j
 
ExpLOD: a framework for explaining recommendations based on the Linked Open D...
ExpLOD: a framework for explaining recommendations based on the Linked Open D...ExpLOD: a framework for explaining recommendations based on the Linked Open D...
ExpLOD: a framework for explaining recommendations based on the Linked Open D...
 
Morpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache SparkMorpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache Spark
 
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
 
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH) Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
Neo4j Introduction (Basics, Cypher, RDBMS to GRAPH)
 
Mongodbworkshop I: get started
Mongodbworkshop I: get startedMongodbworkshop I: get started
Mongodbworkshop I: get started
 
MongoDB Workshop
MongoDB WorkshopMongoDB Workshop
MongoDB Workshop
 
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
Max Neunhöffer – Joins and aggregations in a distributed NoSQL DB - NoSQL mat...
 
Introduction to Cypher
Introduction to Cypher Introduction to Cypher
Introduction to Cypher
 
Neo4j
Neo4jNeo4j
Neo4j
 
Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft A...
Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft A...Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft A...
Microsoft cloud workshop - automated cloud service for MongoDB on Microsoft A...
 
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
 
Dove sono i tuoi vertici e di cosa stanno parlando?
Dove sono i tuoi vertici e di cosa stanno parlando?Dove sono i tuoi vertici e di cosa stanno parlando?
Dove sono i tuoi vertici e di cosa stanno parlando?
 
HyperGraphQL
HyperGraphQLHyperGraphQL
HyperGraphQL
 

More from Neo4j

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansQIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansNeo4j
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...Neo4j
 
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosBBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosNeo4j
 
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Neo4j
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j
 
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfRabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j
 
Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Neo4j
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeNeo4j
 
Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j
 
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j
 
Enabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge GraphsEnabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge GraphsNeo4j
 
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdfNeo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdfNeo4j
 
Neo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with GraphNeo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with GraphNeo4j
 

More from Neo4j (20)

Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansQIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
QIAGEN: Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
ISDEFE - GraphSummit Madrid - ARETA: Aviation Real-Time Emissions Token Accre...
 
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafosBBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
BBVA - GraphSummit Madrid - Caso de éxito en BBVA: Optimizando con grafos
 
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
Graph Everywhere - Josep Taruella - Por qué Graph Data Science en tus modelos...
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdfNeo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
Neo4j_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdfRabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
Rabobank_Exploring the Impact of Graph Technology on Financial Services.pdf
 
Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!Webinar - IA generativa e grafi Neo4j: RAG time!
Webinar - IA generativa e grafi Neo4j: RAG time!
 
IA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG timeIA Generativa y Grafos de Neo4j: RAG time
IA Generativa y Grafos de Neo4j: RAG time
 
Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)Neo4j: Data Engineering for RAG (retrieval augmented generation)
Neo4j: Data Engineering for RAG (retrieval augmented generation)
 
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdfNeo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
Neo4j Graph Summit 2024 Workshop - EMEA - Breda_and_Munchen.pdf
 
Enabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge GraphsEnabling GenAI Breakthroughs with Knowledge Graphs
Enabling GenAI Breakthroughs with Knowledge Graphs
 
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdfNeo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
Neo4j_Anurag Tandon_Product Vision and Roadmap.Benelux.pptx.pdf
 
Neo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with GraphNeo4j Jesus Barrasa The Art of the Possible with Graph
Neo4j Jesus Barrasa The Art of the Possible with Graph
 

Recently uploaded

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 

Recently uploaded (20)

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

Introduction to Neo4j - a hands-on crash course

  • 1. Introduction to Neo4j - a hands-on crash course Lju Lazarevic lju@neo4j.com @ellazal community.neo4j.com
  • 2. In this session We will cover: • What is a graph and why we need them • Spotting good graph scenarios • Property graph database anatomy and introduction to Cypher • Hands-on: the movie graph on sandbox • sandbox.neo4j.com • Continuing your graph journey
  • 3. What is a graph?
  • 4. A graph is... ...a set of discrete objects, each of which has some set of relationships with the other objects Seven Bridges of Konigsberg problem. Leonhard Euler, 1735
  • 5. Anything can be a graph the Internet a water molecule H O H
  • 6. Why do we need graphs?
  • 7. Reality seldom comes in discrete tables Customer Beverage Mapping Action CI Name BI Name AI Type CI BI AIProblems are best understood with a representation of reality Reality is often about things being connected to other things drinks in store A graph provides a better approximation of reality Customer Coffee DRINKS Reality does not stop at the border of a data silo Customer Product Order 19 Jason 32 Ann 91 Dan 11 Filter 21 Latte 31 Flat W. 01 Buy 04 Preord. 09 Drink 91 21 01 91 21 09 32 11 04
  • 8.
  • 9. Follow the flow - buying trainers
  • 10. Panama papers: simple model, powerful outcome
  • 11. The Panama papers data model...
  • 12. Roses are red, facebook is blue, No mutual friends, So who are you?
  • 13. Friends of friends ...or co-actors of co-actors
  • 14. What are good graph scenarios?
  • 15. Scenario 1: Does our problem involve understanding relationships between entities? Identifying good graph scenarios ● Recommendations ● Fraud detection ● Finding duplicates ● Data lineage
  • 16. Scenario 2: Does the problem involve a lot of self-referencing to the same type of entity? Identifying good graph scenarios ● Organisational hierarchies ● Access management ● Social influencers ● Friends of friends
  • 17. Scenario 3: Does the problem explore relationships of varying or unknown depth? Identifying good graph scenarios ● Supply chain visibility ● Bill of Materials ● Network management
  • 18. Scenario 4: Does our problem involve discovering lots of different routes or paths? Identifying good graph scenarios ● Logistics and routing ● Infrastructure management ● Dependency tracing
  • 19. So what does a (property) graph look like?
  • 20. Node (Vertex) ● The main data element from which graphs are constructed Graph components Jane car
  • 21. Graph components Node (Vertex) ● The main data element from which graphs are constructed Relationship (Edge) ● A link between two nodes. Has: ○ Direction ○ Type ● A node without relationships is permitted. A relationship without nodes is not Jane carOWNS
  • 22. Label property graph database Node (Vertex) Relationship (Edge) OWNS
  • 23. Label property graph database Node (Vertex) Relationship (Edge) :Person :CarOWNS Label ● Define node category (optional)
  • 24. Label property graph database Node (Vertex) Relationship (Edge) :Person :CarOWNS Label ● Define node category (optional) ● Can have more than one :Asset
  • 25. Node (Vertex) Relationship (Edge) :Person :CarOWNS Label ● Define node category (optional) ● Can have more than one Properties ● Enrich a node or relationship ● No need for nulls! name: Jane make: Volvo model: V60 since: 2018 :Asset Label property graph database
  • 26. How do I query the graph?
  • 30. Use MATCH to retrieve nodes //Match all nodes MATCH (n) RETURN n;
  • 31. Use MATCH to retrieve nodes //Match all nodes MATCH (n) RETURN n; //Match all nodes with a Person label MATCH (n:Person) RETURN n;
  • 32. Use MATCH to retrieve nodes //Match all nodes MATCH (n) RETURN n; //Match all nodes with a Person label MATCH (n:Person) RETURN n; //Match all nodes with a Person label and property name is "Tom Hanks" MATCH (n:Person {name: "Tom Hanks"}) RETURN n;
  • 33. //Return nodes with label Person and name property is "Tom Hanks" - Inline MATCH (p:Person {name: "Tom Hanks"}) //Only works with exact matches RETURN p; Use MATCH and properties to retrieve nodes
  • 34. //Return nodes with label Person and name property is "Tom Hanks" - Inline MATCH (p:Person {name: "Tom Hanks"}) //Only works with exact matches RETURN p; //Return nodes with label Person and name property equals "Tom Hanks" MATCH (p:Person) WHERE p.name = "Tom Hanks" RETURN p; Use MATCH and properties to retrieve nodes
  • 35. //Return nodes with label Person and name property is "Tom Hanks" - Inline MATCH (p:Person {name: "Tom Hanks"}) //Only works with exact matches RETURN p; //Return nodes with label Person and name property equals "Tom Hanks" MATCH (p:Person) WHERE p.name = "Tom Hanks" RETURN p; //Return nodes with label Movie, released property is between 1991 and 1999 MATCH (m:Movie) WHERE m.released > 1990 AND m.released < 2000 RETURN m; Use MATCH and properties to retrieve nodes
  • 37. //Find all the movies Tom Hanks acted in MATCH (:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie) RETURN m.title; Extending the MATCH
  • 38. //Find all the movies Tom Hanks acted in MATCH (:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie) RETURN m.title; //Find all the movies Tom Hanks directed and order by latest movie MATCH (:Person {name:"Tom Hanks"})-[:DIRECTED]->(m:Movie) RETURN m.title, m.released ORDER BY m.released DESC; Extending the MATCH
  • 39. //Find all the movies Tom Hanks acted in MATCH (:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m:Movie) RETURN m.title; //Find all the movies Tom Hanks directed and order by latest movie MATCH (:Person {name:"Tom Hanks"})-[:DIRECTED]->(m:Movie) RETURN m.title, m.released ORDER BY m.released DESC; //Find all of the co-actors Tom Hanks have worked with MATCH (:Person {name:"Tom Hanks"})-->(:Movie)<-[:ACTED_IN]-(coActor:Person) Extending the MATCH
  • 40. //Create a person node called "Tom Hanks" CREATE (p:Person {name:"Tom Hanks"}); CREATE
  • 41. //Create a person node called "Tom Hanks" CREATE (p:Person {name:"Tom Hanks"}); //Create an ACTED_IN relationship between "Tom Hanks" and "Apollo 13" MATCH (p:Person {name:"Tom Hanks"}), (m:Movie {title:"Apollo 13"}) CREATE (p)-[:ACTED_IN]->(m); CREATE
  • 42. //Create a person node called "Tom Hanks" CREATE (p:Person {name:"Tom Hanks"}); //Create an ACTED_IN relationship between "Tom Hanks" and "Apollo 13" MATCH (p:Person {name:"Tom Hanks"}), (m:Movie {title:"Apollo 13"}) CREATE (p)-[:ACTED_IN]->(m); //Create the pattern of "Tom Hanks" ACTED_IN "Apollo 13" //This will create the entire pattern, nodes and all! CREATE (:Person {name:"Tom Hanks")-[:ACTED_IN]->(:Movie {title:"Apollo 13}); CREATE
  • 43. Time to have a go! We are going to: • Go to sandbox.neo4j.com • Sign in • Select "Blank sandbox" and click Launch Project We’ll all have a go together :)
  • 44. So how do I continue my graph journey?
  • 45. Free book: neo4j.com/graph-databases-book Free online training and certification: neo4j.com/graphacademy/online-training How to, best practices and customer stories: youtube.com/neo4j
  • 46. But you can still have a go at these fun challenges at your own pace! • Modelling a barbecue • Exploring a museum collection • Solving a murder mystery • Virtually visiting Central Park Start here: r.neo4j.com/son-week1 Summer of Nodes is over...