SlideShare a Scribd company logo
1 of 20
Download to read offline
Introduction to Cypher
Graph Query Language
October 6, 2016
Graph Databases in Silicon Valley Meetup
Overview
Goal
Understand the benefits of Cypher query language
Graph Data Models and Query Languages
Basics of Cypher Query Language
Features and Execution Structure
Who am I
Ph.D Kisung Kim - Chief Technology Officer of Bitnine Global Inc.
Developed a distributed relational database engine in TmaxSoft
Lead the development of a new graph database, Agens Graph in Bitnine
Global
Graph Enthusiast !
Graph Data Model and Query Languages
● Property graph model
○ Cypher query language from Cypher
○ AQL from ArangoDB
○ OrientDB’s SQL dialect
○ Tinkerpop API, a domain specific language, from Titan
● RDF graph model
○ W3C standard recommendation for the Semantic Web
○ SPARQL query language
● Facebook’s GraphQL (?)
Property Graph Model
Terminology:
Node(vertex) - Entity
Relationships(Edge)
Property - Attribute
Label(type) - Group nodes and relationships
person company
works_for
Name: Kisung Kim
Email: kskim@bitnine.net
Name: Bitnine Global
Homepage: http://bitnine.net
title: CTO
Team: agens graph
Property
Node
Relationship
Very intuitive and easy
to model E-R diagram to property graphs
Cypher
● Declarative query language for the property graph model
○ Inspired by SQL and SPARQL
○ Designed to be human-readable query language
● Developed by Neo technology Inc. since 2011
● Cypher is now evolving
○ Current version is 3.0
● OpenCypher.org
○ Participate in developing the query language
OpenCypher.org
http://www.slideshare.net/neo4j/the-opencypher-project-an-open-graph-query-language
Cypher is Human-Readable
Finding all ancestor-descendant pairs in the graph
with recursive
as (
select
parent, child as descendant,
1 as level from source
union all
select
d.parent, s.child, d.level + 1
from descendants as d
join source s on d.descendant = s.parent
)
select * from descendants
order by parent, level, descendant ;
SQL
MATCH
p=(descendant)-[:Parent*]->(ancestor)
RETURN
(ancestor), (descendant), length(p)
ORDER BY (ancestor), (descendant), length(p)
Cypher
descendant ancestor
Cypher Query Example
Graph Pattern
Results
Graph Pattern Matching
● Graph pattern matching is at the heart of Cypher
● Find subgraphs which are matched to the specified graph pattern
○ Subgraph isomorphism
Query Pattern
Graph Data
Graph Pattern
● How can we represent graph patterns in a query?
○ Use ASCII art to represent the graph pattern easily
○ Like a diagram
● Node : ( )
● Relationship : --> or <-- (with direction),
-- (without direction)
● Node label : ( :LABEL_NAME )
● Relationship type : -[ :TYPE_NAME ]->
:Actor :Movie
ACTS_IN
(:Actor)-[:ACTS_IN]->(:Movie)
Graph Pattern
● Property
○ Node property: ( { field : value, … } )
○ Relationship property: -[ { field : value, … } ]->
● Assign nodes and relations to variables
:Actor
name=’TOM’
:Movie (:Actor {name: “TOM”})-[:ACTS_IN]->(:Movie)
ACTS_IN
(a:Actor {name: “TOM”})-[ r:ACTS_IN]->(b:Movie)
Graph Pattern
Represent more complicated patterns
:Person :Movie
RATED
:Person
RATED
FRIEND
(a:Person)-[:RATED]->(m:Movie)<-[:RATED]-( c:Person),
(a)-[:FRIEND]-(c)
Path1
Path2
Path1
Path2
MATCH Clause
● Find the specified patterns
● Return matched variables to the next clause
MATCH
(a:Person)-[:RATED]->( m:Movie)<-[:RATED]-( c:Person),(a)-[:FRIEND]-(c
)
a (node) m (node) c (node)
Results of MATCH clause
Cypher Clause
● For reading
○ MATCH / OPTIONAL MATCH
● For updating
○ CREATE
○ MERGE
○ SET
● For filtering
○ WHERE
● For handling results
○ WITH, RETURN
○ And ORDER BY, LIMIT, SKIP https://s3.amazonaws.com/artifacts.opencypher.org/M02/railroad/Cypher.html
Cypher Query Structure
Pipelined Execution
Clauses are provided results from the former clause
MATCH
MATCH
RETURN
tom movie
tom movie nicole
tom.name movie.title nicole.name
Clause Chain Result Format
Uniqueness in Pattern Matching
● Cypher defines that pattern matching does not match a relationship to be
matched to several relationships in a pattern
● If we want multiple matching, then separate into multiple MATCH clauses
b
a
c
Graph Data Query Pattern
Friend r1:Friend r2:Friend
MATCH (a)-[r1:Friend]->(b), (a)-[r2:Friend]->(c) MATCH (a)-[r1:Friend]->(b)
MATCH (a)-[r2:Friend]->(c)
Variable Length Relationship Matching
● One of the important features of the Cypher
● Finding all people links between two specified persons
Kisung Kim Joshua
MATCH
(:person {name: “Kisung Kim”})- [:friends*]->(:person {name: “Joshua”})
MATCH
(:person {name: “Kisung Kim”})- [:friends*3..5]->(:person {name:
“Joshua”})
Specify the path length 3 to 5
?
Summary
Query database using graph patterns using Cypher
Cyper features
● Graph pattern syntax
● Uniqueness restriction of relationship matching
● Pipelined execution structure
● Variable length path matching
Graph query is much easier than SQL query
Thank you
How do you feel about
Graph Database?

More Related Content

What's hot

GraphFrames: Graph Queries in Spark SQL by Ankur Dave
GraphFrames: Graph Queries in Spark SQL by Ankur DaveGraphFrames: Graph Queries in Spark SQL by Ankur Dave
GraphFrames: Graph Queries in Spark SQL by Ankur DaveSpark Summit
 
Writing a Cypher Engine in Clojure
Writing a Cypher Engine in ClojureWriting a Cypher Engine in Clojure
Writing a Cypher Engine in ClojureGábor Szárnyas
 
What Makes Graph Queries Difficult?
What Makes Graph Queries Difficult?What Makes Graph Queries Difficult?
What Makes Graph Queries Difficult?Gábor Szárnyas
 
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseApache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseMo Patel
 
Signals from outer space
Signals from outer spaceSignals from outer space
Signals from outer spaceGraphAware
 
GraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communitiesGraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communitiesPaco Nathan
 
Machine Learning and GraphX
Machine Learning and GraphXMachine Learning and GraphX
Machine Learning and GraphXAndy Petrella
 
MLSD18. Basic Transformations - QCRI
MLSD18. Basic Transformations - QCRIMLSD18. Basic Transformations - QCRI
MLSD18. Basic Transformations - QCRIBigML, Inc
 
BUILDING WHILE FLYING
BUILDING WHILE FLYINGBUILDING WHILE FLYING
BUILDING WHILE FLYINGKamal Shannak
 
Gephi, Graphx, and Giraph
Gephi, Graphx, and GiraphGephi, Graphx, and Giraph
Gephi, Graphx, and GiraphDoug Needham
 
GraphGen: Conducting Graph Analytics over Relational Databases
GraphGen: Conducting Graph Analytics over Relational DatabasesGraphGen: Conducting Graph Analytics over Relational Databases
GraphGen: Conducting Graph Analytics over Relational DatabasesKonstantinos Xirogiannopoulos
 
Benchmarking graph databases on the problem of community detection
Benchmarking graph databases on the problem of community detectionBenchmarking graph databases on the problem of community detection
Benchmarking graph databases on the problem of community detectionSymeon Papadopoulos
 
Graphalytics: A big data benchmark for graph-processing platforms
Graphalytics: A big data benchmark for graph-processing platformsGraphalytics: A big data benchmark for graph-processing platforms
Graphalytics: A big data benchmark for graph-processing platformsGraph-TA
 
MicroStation DGN: How to Integrate CAD and GIS
MicroStation DGN: How to Integrate CAD and GISMicroStation DGN: How to Integrate CAD and GIS
MicroStation DGN: How to Integrate CAD and GISSafe Software
 
Graph Databases - RedisGraph and RedisInsight
Graph Databases - RedisGraph and RedisInsightGraph Databases - RedisGraph and RedisInsight
Graph Databases - RedisGraph and RedisInsightMd. Farhan Memon
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4jSandip Jadhav
 
How to Exchange Data between CAD and GIS
How to Exchange Data between CAD and GISHow to Exchange Data between CAD and GIS
How to Exchange Data between CAD and GISSafe Software
 
MLSD18. Summary of Morning Sessions
MLSD18. Summary of Morning SessionsMLSD18. Summary of Morning Sessions
MLSD18. Summary of Morning SessionsBigML, Inc
 
Improve ML Predictions using Connected Feature Extraction
Improve ML Predictions using Connected Feature ExtractionImprove ML Predictions using Connected Feature Extraction
Improve ML Predictions using Connected Feature ExtractionDatabricks
 

What's hot (20)

GraphFrames: Graph Queries in Spark SQL by Ankur Dave
GraphFrames: Graph Queries in Spark SQL by Ankur DaveGraphFrames: Graph Queries in Spark SQL by Ankur Dave
GraphFrames: Graph Queries in Spark SQL by Ankur Dave
 
Writing a Cypher Engine in Clojure
Writing a Cypher Engine in ClojureWriting a Cypher Engine in Clojure
Writing a Cypher Engine in Clojure
 
What Makes Graph Queries Difficult?
What Makes Graph Queries Difficult?What Makes Graph Queries Difficult?
What Makes Graph Queries Difficult?
 
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use CaseApache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
Apache Spark GraphX & GraphFrame Synthetic ID Fraud Use Case
 
Signals from outer space
Signals from outer spaceSignals from outer space
Signals from outer space
 
GraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communitiesGraphX: Graph analytics for insights about developer communities
GraphX: Graph analytics for insights about developer communities
 
Machine Learning and GraphX
Machine Learning and GraphXMachine Learning and GraphX
Machine Learning and GraphX
 
MLSD18. Basic Transformations - QCRI
MLSD18. Basic Transformations - QCRIMLSD18. Basic Transformations - QCRI
MLSD18. Basic Transformations - QCRI
 
Data_Size_statistics
Data_Size_statisticsData_Size_statistics
Data_Size_statistics
 
BUILDING WHILE FLYING
BUILDING WHILE FLYINGBUILDING WHILE FLYING
BUILDING WHILE FLYING
 
Gephi, Graphx, and Giraph
Gephi, Graphx, and GiraphGephi, Graphx, and Giraph
Gephi, Graphx, and Giraph
 
GraphGen: Conducting Graph Analytics over Relational Databases
GraphGen: Conducting Graph Analytics over Relational DatabasesGraphGen: Conducting Graph Analytics over Relational Databases
GraphGen: Conducting Graph Analytics over Relational Databases
 
Benchmarking graph databases on the problem of community detection
Benchmarking graph databases on the problem of community detectionBenchmarking graph databases on the problem of community detection
Benchmarking graph databases on the problem of community detection
 
Graphalytics: A big data benchmark for graph-processing platforms
Graphalytics: A big data benchmark for graph-processing platformsGraphalytics: A big data benchmark for graph-processing platforms
Graphalytics: A big data benchmark for graph-processing platforms
 
MicroStation DGN: How to Integrate CAD and GIS
MicroStation DGN: How to Integrate CAD and GISMicroStation DGN: How to Integrate CAD and GIS
MicroStation DGN: How to Integrate CAD and GIS
 
Graph Databases - RedisGraph and RedisInsight
Graph Databases - RedisGraph and RedisInsightGraph Databases - RedisGraph and RedisInsight
Graph Databases - RedisGraph and RedisInsight
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4j
 
How to Exchange Data between CAD and GIS
How to Exchange Data between CAD and GISHow to Exchange Data between CAD and GIS
How to Exchange Data between CAD and GIS
 
MLSD18. Summary of Morning Sessions
MLSD18. Summary of Morning SessionsMLSD18. Summary of Morning Sessions
MLSD18. Summary of Morning Sessions
 
Improve ML Predictions using Connected Feature Extraction
Improve ML Predictions using Connected Feature ExtractionImprove ML Predictions using Connected Feature Extraction
Improve ML Predictions using Connected Feature Extraction
 

Similar to Introduction to Cypher Graph Query Language

Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Databricks
 
PGQL: A Language for Graphs
PGQL: A Language for GraphsPGQL: A Language for Graphs
PGQL: A Language for GraphsJean Ihm
 
Extending Spark Graph for the Enterprise with Morpheus and Neo4j
Extending Spark Graph for the Enterprise with Morpheus and Neo4jExtending Spark Graph for the Enterprise with Morpheus and Neo4j
Extending Spark Graph for the Enterprise with Morpheus and Neo4jDatabricks
 
Graph db - Pramati Technologies [Meetup]
Graph db - Pramati Technologies [Meetup]Graph db - Pramati Technologies [Meetup]
Graph db - Pramati Technologies [Meetup]Pramati Technologies
 
Morpheus SQL and Cypher® in Apache® Spark - Big Data Meetup Munich
Morpheus SQL and Cypher® in Apache® Spark - Big Data Meetup MunichMorpheus SQL and Cypher® in Apache® Spark - Big Data Meetup Munich
Morpheus SQL and Cypher® in Apache® Spark - Big Data Meetup MunichMartin Junghanns
 
Morpheus - SQL and Cypher in Apache Spark
Morpheus - SQL and Cypher in Apache SparkMorpheus - SQL and Cypher in Apache Spark
Morpheus - SQL and Cypher in Apache SparkHenning Kropp
 
Morpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache SparkMorpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache SparkKnoldus Inc.
 
Football graph - Neo4j and the Premier League
Football graph - Neo4j and the Premier LeagueFootball graph - Neo4j and the Premier League
Football graph - Neo4j and the Premier LeagueMark Needham
 
Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark wi...
Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark wi...Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark wi...
Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark wi...Databricks
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypheropenCypher
 
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.
 
AgensGraph Presentation at PGConf.us 2017
AgensGraph Presentation at PGConf.us 2017AgensGraph Presentation at PGConf.us 2017
AgensGraph Presentation at PGConf.us 2017Kisung Kim
 
The Football Graph - Neo4j and the Premier League
The Football Graph - Neo4j and the Premier LeagueThe Football Graph - Neo4j and the Premier League
The Football Graph - Neo4j and the Premier LeagueMark Needham
 
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...Jean Ihm
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RGraphRM
 
Processing Large Graphs
Processing Large GraphsProcessing Large Graphs
Processing Large GraphsNishant Gandhi
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageNeo4j
 
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-converted
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-convertedNeo4j graphdatabaseforrecommendations-130531021030-phpapp02-converted
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-convertedsnehapandey01
 
Introduction to Graphs with Neo4j
Introduction to Graphs with Neo4jIntroduction to Graphs with Neo4j
Introduction to Graphs with Neo4jNeo4j
 

Similar to Introduction to Cypher Graph Query Language (20)

Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
Neo4j Morpheus: Interweaving Table and Graph Data with SQL and Cypher in Apac...
 
PGQL: A Language for Graphs
PGQL: A Language for GraphsPGQL: A Language for Graphs
PGQL: A Language for Graphs
 
Extending Spark Graph for the Enterprise with Morpheus and Neo4j
Extending Spark Graph for the Enterprise with Morpheus and Neo4jExtending Spark Graph for the Enterprise with Morpheus and Neo4j
Extending Spark Graph for the Enterprise with Morpheus and Neo4j
 
Graph db - Pramati Technologies [Meetup]
Graph db - Pramati Technologies [Meetup]Graph db - Pramati Technologies [Meetup]
Graph db - Pramati Technologies [Meetup]
 
Morpheus SQL and Cypher® in Apache® Spark - Big Data Meetup Munich
Morpheus SQL and Cypher® in Apache® Spark - Big Data Meetup MunichMorpheus SQL and Cypher® in Apache® Spark - Big Data Meetup Munich
Morpheus SQL and Cypher® in Apache® Spark - Big Data Meetup Munich
 
Morpheus - SQL and Cypher in Apache Spark
Morpheus - SQL and Cypher in Apache SparkMorpheus - SQL and Cypher in Apache Spark
Morpheus - SQL and Cypher in Apache Spark
 
Morpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache SparkMorpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache Spark
 
Football graph - Neo4j and the Premier League
Football graph - Neo4j and the Premier LeagueFootball graph - Neo4j and the Premier League
Football graph - Neo4j and the Premier League
 
Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark wi...
Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark wi...Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark wi...
Neo4j Morpheus: Interweaving Documents, Tables and and Graph Data in Spark wi...
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypher
 
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
 
AgensGraph Presentation at PGConf.us 2017
AgensGraph Presentation at PGConf.us 2017AgensGraph Presentation at PGConf.us 2017
AgensGraph Presentation at PGConf.us 2017
 
The Football Graph - Neo4j and the Premier League
The Football Graph - Neo4j and the Premier LeagueThe Football Graph - Neo4j and the Premier League
The Football Graph - Neo4j and the Premier League
 
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
How To Model and Construct Graphs with Oracle Database (AskTOM Office Hours p...
 
aRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con RaRangodb, un package per l'utilizzo di ArangoDB con R
aRangodb, un package per l'utilizzo di ArangoDB con R
 
Processing Large Graphs
Processing Large GraphsProcessing Large Graphs
Processing Large Graphs
 
The openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query LanguageThe openCypher Project - An Open Graph Query Language
The openCypher Project - An Open Graph Query Language
 
Neo4j graph database
Neo4j graph databaseNeo4j graph database
Neo4j graph database
 
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-converted
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-convertedNeo4j graphdatabaseforrecommendations-130531021030-phpapp02-converted
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-converted
 
Introduction to Graphs with Neo4j
Introduction to Graphs with Neo4jIntroduction to Graphs with Neo4j
Introduction to Graphs with Neo4j
 

Recently uploaded

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
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
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
 
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
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Recently uploaded (20)

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...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
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
 
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 ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
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
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

Introduction to Cypher Graph Query Language

  • 1. Introduction to Cypher Graph Query Language October 6, 2016 Graph Databases in Silicon Valley Meetup
  • 2. Overview Goal Understand the benefits of Cypher query language Graph Data Models and Query Languages Basics of Cypher Query Language Features and Execution Structure
  • 3. Who am I Ph.D Kisung Kim - Chief Technology Officer of Bitnine Global Inc. Developed a distributed relational database engine in TmaxSoft Lead the development of a new graph database, Agens Graph in Bitnine Global Graph Enthusiast !
  • 4. Graph Data Model and Query Languages ● Property graph model ○ Cypher query language from Cypher ○ AQL from ArangoDB ○ OrientDB’s SQL dialect ○ Tinkerpop API, a domain specific language, from Titan ● RDF graph model ○ W3C standard recommendation for the Semantic Web ○ SPARQL query language ● Facebook’s GraphQL (?)
  • 5. Property Graph Model Terminology: Node(vertex) - Entity Relationships(Edge) Property - Attribute Label(type) - Group nodes and relationships person company works_for Name: Kisung Kim Email: kskim@bitnine.net Name: Bitnine Global Homepage: http://bitnine.net title: CTO Team: agens graph Property Node Relationship Very intuitive and easy to model E-R diagram to property graphs
  • 6. Cypher ● Declarative query language for the property graph model ○ Inspired by SQL and SPARQL ○ Designed to be human-readable query language ● Developed by Neo technology Inc. since 2011 ● Cypher is now evolving ○ Current version is 3.0 ● OpenCypher.org ○ Participate in developing the query language
  • 8. Cypher is Human-Readable Finding all ancestor-descendant pairs in the graph with recursive as ( select parent, child as descendant, 1 as level from source union all select d.parent, s.child, d.level + 1 from descendants as d join source s on d.descendant = s.parent ) select * from descendants order by parent, level, descendant ; SQL MATCH p=(descendant)-[:Parent*]->(ancestor) RETURN (ancestor), (descendant), length(p) ORDER BY (ancestor), (descendant), length(p) Cypher descendant ancestor
  • 9. Cypher Query Example Graph Pattern Results
  • 10. Graph Pattern Matching ● Graph pattern matching is at the heart of Cypher ● Find subgraphs which are matched to the specified graph pattern ○ Subgraph isomorphism Query Pattern Graph Data
  • 11. Graph Pattern ● How can we represent graph patterns in a query? ○ Use ASCII art to represent the graph pattern easily ○ Like a diagram ● Node : ( ) ● Relationship : --> or <-- (with direction), -- (without direction) ● Node label : ( :LABEL_NAME ) ● Relationship type : -[ :TYPE_NAME ]-> :Actor :Movie ACTS_IN (:Actor)-[:ACTS_IN]->(:Movie)
  • 12. Graph Pattern ● Property ○ Node property: ( { field : value, … } ) ○ Relationship property: -[ { field : value, … } ]-> ● Assign nodes and relations to variables :Actor name=’TOM’ :Movie (:Actor {name: “TOM”})-[:ACTS_IN]->(:Movie) ACTS_IN (a:Actor {name: “TOM”})-[ r:ACTS_IN]->(b:Movie)
  • 13. Graph Pattern Represent more complicated patterns :Person :Movie RATED :Person RATED FRIEND (a:Person)-[:RATED]->(m:Movie)<-[:RATED]-( c:Person), (a)-[:FRIEND]-(c) Path1 Path2 Path1 Path2
  • 14. MATCH Clause ● Find the specified patterns ● Return matched variables to the next clause MATCH (a:Person)-[:RATED]->( m:Movie)<-[:RATED]-( c:Person),(a)-[:FRIEND]-(c ) a (node) m (node) c (node) Results of MATCH clause
  • 15. Cypher Clause ● For reading ○ MATCH / OPTIONAL MATCH ● For updating ○ CREATE ○ MERGE ○ SET ● For filtering ○ WHERE ● For handling results ○ WITH, RETURN ○ And ORDER BY, LIMIT, SKIP https://s3.amazonaws.com/artifacts.opencypher.org/M02/railroad/Cypher.html
  • 16. Cypher Query Structure Pipelined Execution Clauses are provided results from the former clause MATCH MATCH RETURN tom movie tom movie nicole tom.name movie.title nicole.name Clause Chain Result Format
  • 17. Uniqueness in Pattern Matching ● Cypher defines that pattern matching does not match a relationship to be matched to several relationships in a pattern ● If we want multiple matching, then separate into multiple MATCH clauses b a c Graph Data Query Pattern Friend r1:Friend r2:Friend MATCH (a)-[r1:Friend]->(b), (a)-[r2:Friend]->(c) MATCH (a)-[r1:Friend]->(b) MATCH (a)-[r2:Friend]->(c)
  • 18. Variable Length Relationship Matching ● One of the important features of the Cypher ● Finding all people links between two specified persons Kisung Kim Joshua MATCH (:person {name: “Kisung Kim”})- [:friends*]->(:person {name: “Joshua”}) MATCH (:person {name: “Kisung Kim”})- [:friends*3..5]->(:person {name: “Joshua”}) Specify the path length 3 to 5 ?
  • 19. Summary Query database using graph patterns using Cypher Cyper features ● Graph pattern syntax ● Uniqueness restriction of relationship matching ● Pipelined execution structure ● Variable length path matching Graph query is much easier than SQL query
  • 20. Thank you How do you feel about Graph Database?