SlideShare a Scribd company logo
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 Dave
Spark Summit
 
Writing a Cypher Engine in Clojure
Writing a Cypher Engine in ClojureWriting a Cypher Engine in Clojure
Writing a Cypher Engine in Clojure
Gá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 Case
Mo Patel
 
Signals from outer space
Signals from outer spaceSignals from outer space
Signals from outer space
GraphAware
 
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
Paco Nathan
 
Machine Learning and GraphX
Machine Learning and GraphXMachine Learning and GraphX
Machine Learning and GraphX
Andy Petrella
 
MLSD18. Basic Transformations - QCRI
MLSD18. Basic Transformations - QCRIMLSD18. Basic Transformations - QCRI
MLSD18. Basic Transformations - QCRI
BigML, Inc
 
Data_Size_statistics
Data_Size_statisticsData_Size_statistics
Data_Size_statistics
Sudhanshu Sharma
 
BUILDING WHILE FLYING
BUILDING WHILE FLYINGBUILDING WHILE FLYING
BUILDING WHILE FLYING
Kamal Shannak
 
Gephi, Graphx, and Giraph
Gephi, Graphx, and GiraphGephi, Graphx, and Giraph
Gephi, Graphx, and Giraph
Doug 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 Databases
Konstantinos 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 detection
Symeon 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 platforms
Graph-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 GIS
Safe Software
 
Graph Databases - RedisGraph and RedisInsight
Graph Databases - RedisGraph and RedisInsightGraph Databases - RedisGraph and RedisInsight
Graph Databases - RedisGraph and RedisInsight
Md. Farhan Memon
 
Graph database & neo4j
Graph database & neo4jGraph database & neo4j
Graph database & neo4j
Sandip 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 GIS
Safe Software
 
MLSD18. Summary of Morning Sessions
MLSD18. Summary of Morning SessionsMLSD18. Summary of Morning Sessions
MLSD18. Summary of Morning Sessions
BigML, 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 Extraction
Databricks
 

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 The 2nd graph database in sv meetup

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 Graphs
Jean 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 Neo4j
Databricks
 
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 Munich
Martin 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 Spark
Henning Kropp
 
Morpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache SparkMorpheus - Cypher for Apache Spark
Morpheus - Cypher for Apache Spark
Knoldus 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 League
Mark 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 openCypher
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
Serendio Inc.
 
AgensGraph Presentation at PGConf.us 2017
AgensGraph Presentation at PGConf.us 2017AgensGraph Presentation at PGConf.us 2017
AgensGraph Presentation at PGConf.us 2017
Kisung 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 League
Mark 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 R
GraphRM
 
Processing Large Graphs
Processing Large GraphsProcessing Large Graphs
Processing Large Graphs
Nishant 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 Language
Neo4j
 
Neo4j graph database
Neo4j graph databaseNeo4j graph database
Neo4j graph database
Prashant Bhargava
 
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-converted
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-convertedNeo4j graphdatabaseforrecommendations-130531021030-phpapp02-converted
Neo4j graphdatabaseforrecommendations-130531021030-phpapp02-converted
snehapandey01
 
Introduction to Graphs with Neo4j
Introduction to Graphs with Neo4jIntroduction to Graphs with Neo4j
Introduction to Graphs with Neo4j
Neo4j
 

Similar to The 2nd graph database in sv meetup (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

Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
Neo4j
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Undress Baby
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
lorraineandreiamcidl
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
Green Software Development
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
Gerardo Pardo-Castellote
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
Hironori Washizaki
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 

Recently uploaded (20)

Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
GraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph TechnologyGraphSummit Paris - The art of the possible with Graph Technology
GraphSummit Paris - The art of the possible with Graph Technology
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdfRevolutionizing Visual Effects Mastering AI Face Swaps.pdf
Revolutionizing Visual Effects Mastering AI Face Swaps.pdf
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptxLORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
LORRAINE ANDREI_LEQUIGAN_HOW TO USE WHATSAPP.pptx
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-JurisicGreenCode-A-VSCode-Plugin--Dario-Jurisic
GreenCode-A-VSCode-Plugin--Dario-Jurisic
 
DDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systemsDDS-Security 1.2 - What's New? Stronger security for long-running systems
DDS-Security 1.2 - What's New? Stronger security for long-running systems
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024SWEBOK and Education at FUSE Okinawa 2024
SWEBOK and Education at FUSE Okinawa 2024
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 

The 2nd graph database in sv meetup

  • 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?