Introduction to Cypher

Neo4j
Neo4jOpen Source NOSQL Graph Database em Neo4j
Introduction to Cypher
Adam Cowley
Developer Advocate - @adamcowley
Introduction to Cypher
Toy
Story
Toy
Story
Nodes represent
things
Toy
Story
Movie
Nodes represent
things
Toy
Story
Movie
Nodes can be identified by
one or more labels
Nodes represent
things
Toy
Story
Movie
Animated
Nodes can be identified by
one or more labels
Nodes represent
things
Toy
Story
Movie
Animated
Nodes can be identified by
one or more labels
title: Toy Story
released: 1995
Nodes represent
things
Toy
Story
Movie
Animated
Nodes can be identified by
one or more labels
title: Toy Story
released: 1995
Nodes represent
things
Nodes can hold
properties as key/value
pairs
Toy
Story
Movie
Tom
Hanks
Actor
Toy
Story
Movie
Toy
Story
Movie
Tom
Hanks
Actor
Toy
Story
Movie
Tom
Hanks
Actor
Relationships connect two nodes
Toy
Story
Movie
Tom
Hanks
Actor
Relationships connect two nodes
ACTED_IN
Toy
Story
Movie
Tom
Hanks
Actor
Relationships connect two nodes
ACTED_IN
Relationships
have a type
Toy
Story
Movie
Tom
Hanks
Actor
Relationships connect two nodes
ACTED_IN
Relationships
have a type
Relationships
have a direction
Toy
Story
Movie
Tom
Hanks
Actor
Relationships connect two nodes
ACTED_IN
roles: Woody
Relationships
have a type
Relationships
have a direction
Toy
Story
Movie
Tom
Hanks
Actor
Relationships connect two nodes
ACTED_IN
roles: Woody
Relationships
have a type
Relationships can also
hold properties as
key/value pairs
Relationships
have a direction
Cypher
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
(p:Person)-[r:ACTED_IN]->(m:Movie)
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
(p:Person)-[r:ACTED_IN]->(m:Movie)
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
(p:Person)-[r:ACTED_IN]->(m:Movie)
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
(p:Person)-[r:ACTED_IN]->(m:Movie)
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
(p:Person)-[r:ACTED_IN]->(m:Movie)
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
(p:Person)-[r:ACTED_IN]->(m:Movie)
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
(p:Person)-[r:ACTED_IN]->(m:Movie)
Cypher is a declarative language that allows you
to identify patterns in your data using an ASCII-
art style syntax consisting of brackets, dashes
and arrows.
Movie
ACTED_IN
Person
(p:Person)-[r:ACTED_IN]->(m:Movie)
Writing to Neo4j
// Create a pattern
CREATE (:Person {name: "Tom Hanks"})
-[:ACTED_IN {roles: "Woody"}]->
(:Movie {title: "Toy Story"})
Writing to Neo4j
// Find or create using MERGE
MERGE (p:Person {name: "Tom Hanks"})
Writing to Neo4j
// Find or create using MERGE
MERGE (p:Person {name: "Tom Hanks"})
MERGE (m:Movie {title: "Toy Story"})
Writing to Neo4j
// Find or create using MERGE
MERGE (p:Person {name: "Tom Hanks"})
MERGE (m:Movie {title: "Toy Story"})
MERGE (p)-[r:ACTED_IN]->(m)
Writing to Neo4j
// Find or create using MERGE
MERGE (p:Person {name: "Tom Hanks"})
MERGE (m:Movie {title: "Toy Story"})
MERGE (p)-[r:ACTED_IN]->(m)
SET r.roles = "Woody"
Reading from Neo4j
// Find a pattern in the database
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
Reading from Neo4j
// Find a pattern in the database
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
// Filter on a node property
WHERE m.title = "Toy Story"
// Find a pattern in the database
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
// Filter on a node property
WHERE m.title = "Toy Story"
// Choose what to return
RETURN p.name AS actor, r.roles AS roles
Reading from Neo4j
// Find a pattern in the database
SQL Equivalent
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
FROM/JOIN
// Filter on a node property
WHERE m.title = "Toy Story"
WHERE
// Choose what to return
RETURN p.name AS actor, r.roles AS roles SELECT
Reading from Neo4j
// Actors who acted with Tom Hanks also acted in...
MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
<-[:ACTED_IN]-(p2)-[r2:ACTED_IN]->(m2:Movie)
WHERE p.name = "Tom Hanks"
// Return their name and a list of the movie titles
RETURN p2.name AS actor, collect(m2.title) AS
movies
Reading from Neo4j
Introduction to Cypher
LOAD CSV WITH HEADERS FROM 'file:///stations.csv' AS row
MERGE (s:Station {id: row.id})
SET s.name = row.name,
s.zone = row.zone,
s.location = point({
latitude: toFloat(row.latitude),
longitude: toFloat(row.longitude)
})
Going Underground
LOAD CSV WITH HEADERS FROM 'file:///lines.csv' AS row
MERGE (l:Line {id: row.line})
SET l += row {
.name,
.colour,
.stripe
}
Going Underground
Going Underground
LOAD CSV WITH HEADERS FROM 'file:///stops.csv' AS row
MATCH (s1:Station {id: row.station1})
MATCH (s2:Station {id: row.station2})
MATCH (l:Line {id: row.line})
CALL apoc.create.relationship(
s1,
toUpper(replace(l.name, ' ', '_')), {}, s2
) YIELD rel
Introduction to Cypher
Introduction to Cypher
MATCH (start:Station {name: "Liverpool Street"})
MATCH (end:Station {name: "Kensington (Olympia)"})
MATCH path = allShortestPaths((start)-[*..99]-(end))
WHERE all(r in relationships(path) WHERE not r:`WATERLOO_&_CITY_LINE`)
AND all(n in nodes(path) WHERE not r:Busy)
RETURN path
● Completely Free
● Hands-on Courses
teaching Neo4j Fundamentals, Cypher,
Drivers and Graph Data Science
● Curated Learning Paths
catering for everyone from beginners to
experts
● Free Certifications
graphacademy.neo4j.com
Learn more with
1 de 48

Recomendados

Imdb import presentation por
Imdb import presentationImdb import presentation
Imdb import presentationJoshua Bae
2.1K visualizações30 slides
Neo4J Coursework - Sammy Hegab 22-04-2016 por
Neo4J Coursework - Sammy Hegab  22-04-2016Neo4J Coursework - Sammy Hegab  22-04-2016
Neo4J Coursework - Sammy Hegab 22-04-2016Sammy Hegab
136 visualizações7 slides
How would I write this SQL correctly Let us consider the f.pdf por
How would I write this SQL correctly  Let us consider the f.pdfHow would I write this SQL correctly  Let us consider the f.pdf
How would I write this SQL correctly Let us consider the f.pdfsukhvir71
4 visualizações1 slide
Keyword Search over RDF Graphs por
Keyword Search over RDF GraphsKeyword Search over RDF Graphs
Keyword Search over RDF GraphsRoi Blanco
1.4K visualizações23 slides
Introduction to Cypher.pptx por
Introduction to Cypher.pptxIntroduction to Cypher.pptx
Introduction to Cypher.pptxtuanpham21012003
1 visão29 slides
Training Week: Introduction to Neo4j por
Training Week: Introduction to Neo4jTraining Week: Introduction to Neo4j
Training Week: Introduction to Neo4jNeo4j
559 visualizações47 slides

Mais conteúdo relacionado

Similar a Introduction to Cypher

As audits por
As auditsAs audits
As auditsemilyblyth
147 visualizações6 slides
TMDb movie dataset by kaggle por
TMDb movie dataset by kaggleTMDb movie dataset by kaggle
TMDb movie dataset by kaggleMouhamadou Gueye, PhD
2.2K visualizações1 slide
Data Modeling Using the EntityRelationship (ER) Model por
Data Modeling Using the EntityRelationship (ER) ModelData Modeling Using the EntityRelationship (ER) Model
Data Modeling Using the EntityRelationship (ER) Modelsontumax
1.6K visualizações46 slides
Introduction to neo4j - a hands-on crash course por
Introduction to neo4j - a hands-on crash courseIntroduction to neo4j - a hands-on crash course
Introduction to neo4j - a hands-on crash courseNeo4j
263 visualizações47 slides
LIS 60020 Metadata Schema por
LIS 60020 Metadata SchemaLIS 60020 Metadata Schema
LIS 60020 Metadata SchemaLaura Levy
514 visualizações9 slides
Intro to TypeDB and TypeQL | A strongly-typed database por
Intro to TypeDB and TypeQL | A strongly-typed databaseIntro to TypeDB and TypeQL | A strongly-typed database
Intro to TypeDB and TypeQL | A strongly-typed databaseVaticle
272 visualizações88 slides

Similar a Introduction to Cypher (12)

As audits por emilyblyth
As auditsAs audits
As audits
emilyblyth147 visualizações
Data Modeling Using the EntityRelationship (ER) Model por sontumax
Data Modeling Using the EntityRelationship (ER) ModelData Modeling Using the EntityRelationship (ER) Model
Data Modeling Using the EntityRelationship (ER) Model
sontumax1.6K visualizações
Introduction to neo4j - a hands-on crash course por Neo4j
Introduction to neo4j - a hands-on crash courseIntroduction to neo4j - a hands-on crash course
Introduction to neo4j - a hands-on crash course
Neo4j263 visualizações
LIS 60020 Metadata Schema por Laura Levy
LIS 60020 Metadata SchemaLIS 60020 Metadata Schema
LIS 60020 Metadata Schema
Laura Levy514 visualizações
Intro to TypeDB and TypeQL | A strongly-typed database por Vaticle
Intro to TypeDB and TypeQL | A strongly-typed databaseIntro to TypeDB and TypeQL | A strongly-typed database
Intro to TypeDB and TypeQL | A strongly-typed database
Vaticle272 visualizações
Introduction to Graphs with Neo4j por Neo4j
Introduction to Graphs with Neo4jIntroduction to Graphs with Neo4j
Introduction to Graphs with Neo4j
Neo4j244 visualizações
4Developers: Norbert Wójtowicz- Data-Oriented Architecture por PROIDEA
4Developers: Norbert Wójtowicz- Data-Oriented Architecture4Developers: Norbert Wójtowicz- Data-Oriented Architecture
4Developers: Norbert Wójtowicz- Data-Oriented Architecture
PROIDEA159 visualizações
Evaluation por guest9943fc
EvaluationEvaluation
Evaluation
guest9943fc274 visualizações
Formai sec por ttasi86
Formai secFormai sec
Formai sec
ttasi86223 visualizações
Uso di Schema.org per il tuo sito web por semrush_webinars
Uso di Schema.org per il tuo sito webUso di Schema.org per il tuo sito web
Uso di Schema.org per il tuo sito web
semrush_webinars161 visualizações

Mais de Neo4j

FIMA 2023 Neo4j & FS - Entity Resolution.pptx por
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptxNeo4j
6 visualizações26 slides
Operations & Data Graph por
Operations & Data GraphOperations & Data Graph
Operations & Data GraphNeo4j
36 visualizações25 slides
TAGTTOO: La nova xarxa social por
TAGTTOO: La nova xarxa socialTAGTTOO: La nova xarxa social
TAGTTOO: La nova xarxa socialNeo4j
24 visualizações19 slides
El Arte de lo Possible por
El Arte de lo PossibleEl Arte de lo Possible
El Arte de lo PossibleNeo4j
40 visualizações35 slides
Neo4j y GenAI por
Neo4j y GenAI Neo4j y GenAI
Neo4j y GenAI Neo4j
45 visualizações41 slides
Roadmap y Novedades de producto por
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de productoNeo4j
51 visualizações33 slides

Mais de Neo4j(20)

FIMA 2023 Neo4j & FS - Entity Resolution.pptx por Neo4j
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptx
Neo4j6 visualizações
Operations & Data Graph por Neo4j
Operations & Data GraphOperations & Data Graph
Operations & Data Graph
Neo4j36 visualizações
TAGTTOO: La nova xarxa social por Neo4j
TAGTTOO: La nova xarxa socialTAGTTOO: La nova xarxa social
TAGTTOO: La nova xarxa social
Neo4j24 visualizações
El Arte de lo Possible por Neo4j
El Arte de lo PossibleEl Arte de lo Possible
El Arte de lo Possible
Neo4j40 visualizações
Neo4j y GenAI por Neo4j
Neo4j y GenAI Neo4j y GenAI
Neo4j y GenAI
Neo4j45 visualizações
Roadmap y Novedades de producto por Neo4j
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de producto
Neo4j51 visualizações
Neo4j : Graphes de Connaissance, IA et LLMs por Neo4j
Neo4j : Graphes de Connaissance, IA et LLMsNeo4j : Graphes de Connaissance, IA et LLMs
Neo4j : Graphes de Connaissance, IA et LLMs
Neo4j48 visualizações
Les nouveautés produit Neo4j por Neo4j
 Les nouveautés produit Neo4j Les nouveautés produit Neo4j
Les nouveautés produit Neo4j
Neo4j28 visualizações
Sopra Steria : Analyse intelligente des réseaux dans le domaine des télécommu... por Neo4j
Sopra Steria : Analyse intelligente des réseaux dans le domaine des télécommu...Sopra Steria : Analyse intelligente des réseaux dans le domaine des télécommu...
Sopra Steria : Analyse intelligente des réseaux dans le domaine des télécommu...
Neo4j25 visualizações
Generali : SPIDER, notre produit au cœur des enjeux Generali en termes de Com... por Neo4j
Generali : SPIDER, notre produit au cœur des enjeux Generali en termes de Com...Generali : SPIDER, notre produit au cœur des enjeux Generali en termes de Com...
Generali : SPIDER, notre produit au cœur des enjeux Generali en termes de Com...
Neo4j53 visualizações
Neo4j Generative AI workshop at GraphSummit London 14 Nov 2023.pdf por Neo4j
Neo4j Generative AI workshop at GraphSummit London 14 Nov 2023.pdfNeo4j Generative AI workshop at GraphSummit London 14 Nov 2023.pdf
Neo4j Generative AI workshop at GraphSummit London 14 Nov 2023.pdf
Neo4j58 visualizações
Neo4j & AWS Bedrock workshop at GraphSummit London 14 Nov 2023.pptx por Neo4j
Neo4j & AWS Bedrock workshop at GraphSummit London 14 Nov 2023.pptxNeo4j & AWS Bedrock workshop at GraphSummit London 14 Nov 2023.pptx
Neo4j & AWS Bedrock workshop at GraphSummit London 14 Nov 2023.pptx
Neo4j49 visualizações
Neo4j workshop at GraphSummit London 14 Nov 2023.pdf por Neo4j
Neo4j workshop at GraphSummit London 14 Nov 2023.pdfNeo4j workshop at GraphSummit London 14 Nov 2023.pdf
Neo4j workshop at GraphSummit London 14 Nov 2023.pdf
Neo4j50 visualizações
Neo4j Product Updates & Knowledge Graphs at GraphSummit London 14 Nov 2023.pptx por Neo4j
Neo4j Product Updates & Knowledge Graphs at GraphSummit London 14 Nov 2023.pptxNeo4j Product Updates & Knowledge Graphs at GraphSummit London 14 Nov 2023.pptx
Neo4j Product Updates & Knowledge Graphs at GraphSummit London 14 Nov 2023.pptx
Neo4j62 visualizações
AstraZeneca at Neo4j GraphSummit London 14Nov23.pptx por Neo4j
AstraZeneca at Neo4j GraphSummit London 14Nov23.pptxAstraZeneca at Neo4j GraphSummit London 14Nov23.pptx
AstraZeneca at Neo4j GraphSummit London 14Nov23.pptx
Neo4j41 visualizações
Google Cloud at GraphSummit London 14 Nov 2023.pptx por Neo4j
Google Cloud at GraphSummit London 14 Nov 2023.pptxGoogle Cloud at GraphSummit London 14 Nov 2023.pptx
Google Cloud at GraphSummit London 14 Nov 2023.pptx
Neo4j27 visualizações
The Art of the Possible with Graph - Sudhir Hasbe - GraphSummit London 14 Nov... por Neo4j
The Art of the Possible with Graph - Sudhir Hasbe - GraphSummit London 14 Nov...The Art of the Possible with Graph - Sudhir Hasbe - GraphSummit London 14 Nov...
The Art of the Possible with Graph - Sudhir Hasbe - GraphSummit London 14 Nov...
Neo4j77 visualizações
Northern Gas Networks and CKDelta at Neo4j GraphSummit London 14Nov23.pptx por Neo4j
Northern Gas Networks and CKDelta at Neo4j GraphSummit London 14Nov23.pptxNorthern Gas Networks and CKDelta at Neo4j GraphSummit London 14Nov23.pptx
Northern Gas Networks and CKDelta at Neo4j GraphSummit London 14Nov23.pptx
Neo4j46 visualizações
Peek into Neo4j Product Strategy and Roadmap por Neo4j
Peek into Neo4j Product Strategy and RoadmapPeek into Neo4j Product Strategy and Roadmap
Peek into Neo4j Product Strategy and Roadmap
Neo4j87 visualizações
Transforming Intelligence Analysis with Knowledge Graphs por Neo4j
Transforming Intelligence Analysis with Knowledge GraphsTransforming Intelligence Analysis with Knowledge Graphs
Transforming Intelligence Analysis with Knowledge Graphs
Neo4j60 visualizações

Último

UNEP FI CRS Climate Risk Results.pptx por
UNEP FI CRS Climate Risk Results.pptxUNEP FI CRS Climate Risk Results.pptx
UNEP FI CRS Climate Risk Results.pptxpekka28
11 visualizações51 slides
MOSORE_BRESCIA por
MOSORE_BRESCIAMOSORE_BRESCIA
MOSORE_BRESCIAFederico Karagulian
5 visualizações8 slides
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... por
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...DataScienceConferenc1
6 visualizações11 slides
Cross-network in Google Analytics 4.pdf por
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdfGA4 Tutorials
6 visualizações7 slides
How Leaders See Data? (Level 1) por
How Leaders See Data? (Level 1)How Leaders See Data? (Level 1)
How Leaders See Data? (Level 1)Narendra Narendra
14 visualizações76 slides
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks por
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks
[DSC Europe 23] Aleksandar Tomcic - Adversarial AttacksDataScienceConferenc1
5 visualizações20 slides

Último(20)

UNEP FI CRS Climate Risk Results.pptx por pekka28
UNEP FI CRS Climate Risk Results.pptxUNEP FI CRS Climate Risk Results.pptx
UNEP FI CRS Climate Risk Results.pptx
pekka2811 visualizações
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M... por DataScienceConferenc1
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
[DSC Europe 23] Milos Grubjesic Empowering Business with Pepsico s Advanced M...
DataScienceConferenc16 visualizações
Cross-network in Google Analytics 4.pdf por GA4 Tutorials
Cross-network in Google Analytics 4.pdfCross-network in Google Analytics 4.pdf
Cross-network in Google Analytics 4.pdf
GA4 Tutorials6 visualizações
How Leaders See Data? (Level 1) por Narendra Narendra
How Leaders See Data? (Level 1)How Leaders See Data? (Level 1)
How Leaders See Data? (Level 1)
Narendra Narendra14 visualizações
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks por DataScienceConferenc1
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks
[DSC Europe 23] Aleksandar Tomcic - Adversarial Attacks
DataScienceConferenc15 visualizações
CRIJ4385_Death Penalty_F23.pptx por yvettemm100
CRIJ4385_Death Penalty_F23.pptxCRIJ4385_Death Penalty_F23.pptx
CRIJ4385_Death Penalty_F23.pptx
yvettemm1006 visualizações
Chapter 3b- Process Communication (1) (1)(1) (1).pptx por ayeshabaig2004
Chapter 3b- Process Communication (1) (1)(1) (1).pptxChapter 3b- Process Communication (1) (1)(1) (1).pptx
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
ayeshabaig20046 visualizações
Survey on Factuality in LLM's.pptx por NeethaSherra1
Survey on Factuality in LLM's.pptxSurvey on Factuality in LLM's.pptx
Survey on Factuality in LLM's.pptx
NeethaSherra16 visualizações
VoxelNet por taeseon ryu
VoxelNetVoxelNet
VoxelNet
taeseon ryu7 visualizações
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx por DataScienceConferenc1
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx
[DSC Europe 23] Stefan Mrsic_Goran Savic - Evolving Technology Excellence.pptx
DataScienceConferenc15 visualizações
RIO GRANDE SUPPLY COMPANY INC, JAYSON.docx por JaysonGarabilesEspej
RIO GRANDE SUPPLY COMPANY INC, JAYSON.docxRIO GRANDE SUPPLY COMPANY INC, JAYSON.docx
RIO GRANDE SUPPLY COMPANY INC, JAYSON.docx
JaysonGarabilesEspej6 visualizações
Data about the sector workshop por info828217
Data about the sector workshopData about the sector workshop
Data about the sector workshop
info82821712 visualizações
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation por DataScienceConferenc1
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
[DSC Europe 23] Spela Poklukar & Tea Brasanac - Retrieval Augmented Generation
DataScienceConferenc113 visualizações
[DSC Europe 23] Ivana Sesic - Use of AI in Public Health.pptx por DataScienceConferenc1
[DSC Europe 23] Ivana Sesic - Use of AI in Public Health.pptx[DSC Europe 23] Ivana Sesic - Use of AI in Public Health.pptx
[DSC Europe 23] Ivana Sesic - Use of AI in Public Health.pptx
DataScienceConferenc15 visualizações
Advanced_Recommendation_Systems_Presentation.pptx por neeharikasingh29
Advanced_Recommendation_Systems_Presentation.pptxAdvanced_Recommendation_Systems_Presentation.pptx
Advanced_Recommendation_Systems_Presentation.pptx
neeharikasingh295 visualizações
TGP 2.docx por sandi636490
TGP 2.docxTGP 2.docx
TGP 2.docx
sandi63649010 visualizações
3196 The Case of The East River por ErickANDRADE90
3196 The Case of The East River3196 The Case of The East River
3196 The Case of The East River
ErickANDRADE9016 visualizações
CRM stick or twist workshop por info828217
CRM stick or twist workshopCRM stick or twist workshop
CRM stick or twist workshop
info8282179 visualizações

Introduction to Cypher

  • 1. Introduction to Cypher Adam Cowley Developer Advocate - @adamcowley
  • 6. Toy Story Movie Nodes can be identified by one or more labels Nodes represent things
  • 7. Toy Story Movie Animated Nodes can be identified by one or more labels Nodes represent things
  • 8. Toy Story Movie Animated Nodes can be identified by one or more labels title: Toy Story released: 1995 Nodes represent things
  • 9. Toy Story Movie Animated Nodes can be identified by one or more labels title: Toy Story released: 1995 Nodes represent things Nodes can hold properties as key/value pairs
  • 15. Toy Story Movie Tom Hanks Actor Relationships connect two nodes ACTED_IN Relationships have a type
  • 16. Toy Story Movie Tom Hanks Actor Relationships connect two nodes ACTED_IN Relationships have a type Relationships have a direction
  • 17. Toy Story Movie Tom Hanks Actor Relationships connect two nodes ACTED_IN roles: Woody Relationships have a type Relationships have a direction
  • 18. Toy Story Movie Tom Hanks Actor Relationships connect two nodes ACTED_IN roles: Woody Relationships have a type Relationships can also hold properties as key/value pairs Relationships have a direction
  • 20. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows.
  • 21. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows.
  • 22. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person
  • 23. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 24. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 25. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 26. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 27. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 28. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 29. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 30. Cypher is a declarative language that allows you to identify patterns in your data using an ASCII- art style syntax consisting of brackets, dashes and arrows. Movie ACTED_IN Person (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 31. Writing to Neo4j // Create a pattern CREATE (:Person {name: "Tom Hanks"}) -[:ACTED_IN {roles: "Woody"}]-> (:Movie {title: "Toy Story"})
  • 32. Writing to Neo4j // Find or create using MERGE MERGE (p:Person {name: "Tom Hanks"})
  • 33. Writing to Neo4j // Find or create using MERGE MERGE (p:Person {name: "Tom Hanks"}) MERGE (m:Movie {title: "Toy Story"})
  • 34. Writing to Neo4j // Find or create using MERGE MERGE (p:Person {name: "Tom Hanks"}) MERGE (m:Movie {title: "Toy Story"}) MERGE (p)-[r:ACTED_IN]->(m)
  • 35. Writing to Neo4j // Find or create using MERGE MERGE (p:Person {name: "Tom Hanks"}) MERGE (m:Movie {title: "Toy Story"}) MERGE (p)-[r:ACTED_IN]->(m) SET r.roles = "Woody"
  • 36. Reading from Neo4j // Find a pattern in the database MATCH (p:Person)-[r:ACTED_IN]->(m:Movie)
  • 37. Reading from Neo4j // Find a pattern in the database MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) // Filter on a node property WHERE m.title = "Toy Story"
  • 38. // Find a pattern in the database MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) // Filter on a node property WHERE m.title = "Toy Story" // Choose what to return RETURN p.name AS actor, r.roles AS roles Reading from Neo4j
  • 39. // Find a pattern in the database SQL Equivalent MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) FROM/JOIN // Filter on a node property WHERE m.title = "Toy Story" WHERE // Choose what to return RETURN p.name AS actor, r.roles AS roles SELECT Reading from Neo4j
  • 40. // Actors who acted with Tom Hanks also acted in... MATCH (p:Person)-[r:ACTED_IN]->(m:Movie) <-[:ACTED_IN]-(p2)-[r2:ACTED_IN]->(m2:Movie) WHERE p.name = "Tom Hanks" // Return their name and a list of the movie titles RETURN p2.name AS actor, collect(m2.title) AS movies Reading from Neo4j
  • 42. LOAD CSV WITH HEADERS FROM 'file:///stations.csv' AS row MERGE (s:Station {id: row.id}) SET s.name = row.name, s.zone = row.zone, s.location = point({ latitude: toFloat(row.latitude), longitude: toFloat(row.longitude) }) Going Underground
  • 43. LOAD CSV WITH HEADERS FROM 'file:///lines.csv' AS row MERGE (l:Line {id: row.line}) SET l += row { .name, .colour, .stripe } Going Underground
  • 44. Going Underground LOAD CSV WITH HEADERS FROM 'file:///stops.csv' AS row MATCH (s1:Station {id: row.station1}) MATCH (s2:Station {id: row.station2}) MATCH (l:Line {id: row.line}) CALL apoc.create.relationship( s1, toUpper(replace(l.name, ' ', '_')), {}, s2 ) YIELD rel
  • 47. MATCH (start:Station {name: "Liverpool Street"}) MATCH (end:Station {name: "Kensington (Olympia)"}) MATCH path = allShortestPaths((start)-[*..99]-(end)) WHERE all(r in relationships(path) WHERE not r:`WATERLOO_&_CITY_LINE`) AND all(n in nodes(path) WHERE not r:Busy) RETURN path
  • 48. ● Completely Free ● Hands-on Courses teaching Neo4j Fundamentals, Cypher, Drivers and Graph Data Science ● Curated Learning Paths catering for everyone from beginners to experts ● Free Certifications graphacademy.neo4j.com Learn more with

Notas do Editor

  1. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  2. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  3. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  4. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  5. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  6. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  7. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  8. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  9. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  10. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  11. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  12. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  13. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  14. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  15. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  16. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  17. Graphs essentially consist of nodes, and these nodes represent things, they represent entities. In this case it's a MacBook, it could be a product, a car, a location, it's something physical.We can identify these nodes with one or more labels.
  18. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  19. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  20. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  21. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  22. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  23. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  24. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  25. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  26. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  27. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  28. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.
  29. And the way we query this structure of known term relationships is with a language called cypher. Cypher is a declarative query language that allows you to identify patterns in your data. In this case, a customer who is rated a product. We do that by drawing the patterns on screen using an ASCII-art style syntax.