SlideShare a Scribd company logo
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Graph pattern matching semantics
First openCypher Implementers Meeting
Oskar van Rest
Oracle
February 8, 2017
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
2
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Graph pattern matching semantics
Isomorphism
• Two query vertices may
not map to the same data
vertex
– Semantic for multi-graphs is
undefined
Cyphermorphism
• Two query edges may not
map to the same data
edge
Homomorphism
• No restriction
3
less restrictive (more powerful)
easier to get started with
For most queries, this works very well: users
who are not aware of the semantic still get the
desired result.
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
:Person
name = ‘John’
When does the semantic fails?
Isomorphism Cyphermorphism
4
MATCH (n:Function) -[:calls]-> (m)
WHERE n.name = ‘factorial’
RETURN m.name
:Function
name = ‘factorial’
100
:Function
name = ‘factorial_helper’
200
1 :calls
codeGraph0
:calls
m.name
‘factorial’
‘factorialHelper’
Result with isomorphism
m.name
‘factorialHelper’
Result with homomorphism
Query: which functions are
called by function ‘factorial’
:Person
name = ‘Ann’
200
100
familyTree
MATCH
(n:Person) -[:has_parent]-> () –[:has_parent]- (grandparent)
(m:Person) -[:has_parent]-> () –[:has_parent]- (grandparent)
WHERE n <> m
RETURN grandparent.name Query: “find common
grandparents”
300 400
:has_parent
:has_parent
0
:has_parent
1
2
:Person
name = ‘Klara’
:Person
name = ‘Amber’
grandparent.name
‘Amber’
Result with cyphermorphism
grandparent.name
Result with homomorphism
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Pros and cons of the different semantics
• They all have the same worst-case time complexity: O(nk) (n = num. data vertices, k =
num. query vertices)
– However, if we apply iso/cypher-morphism to recursive path queries, things blow up
• Isomorphism & cyphermorphism have limitations (see previous slide)
• Homomorphism may return more matches than expected and requires
additional non-equality constraints
• Isomorphism & cyphermorphism don’t translate as well to/from SQL
5
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The preceding is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
6

More Related Content

PDF
Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...
PDF
Future features for openCypher: Schema, Constraints, Subqueries, Configurable...
PDF
Formal semantics for Cypher queries and updates
PDF
openCypher: Technology Compatibility Kit (TCK) and Vendor Extensions
PPTX
Mapping Graph Queries to PostgreSQL
PPTX
The openCypher Project - An Open Graph Query Language
PDF
The 2nd graph database in sv meetup
PDF
Writing a Cypher Engine in Clojure
Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...
Future features for openCypher: Schema, Constraints, Subqueries, Configurable...
Formal semantics for Cypher queries and updates
openCypher: Technology Compatibility Kit (TCK) and Vendor Extensions
Mapping Graph Queries to PostgreSQL
The openCypher Project - An Open Graph Query Language
The 2nd graph database in sv meetup
Writing a Cypher Engine in Clojure

Similar to Graph pattern matching semantics (7)

PDF
Path Pattern Queries: Introducing Regular Path Queries in openCypher
PDF
openCypher: Further Developments on Path Pattern Queries (Regular Path Queries)
PDF
Comparing PGQL, G-Core and Cypher
PDF
Cypher.PL: Executable Specification of Cypher written in Prolog
PDF
Propel your Performance: AgensGraph, the multi-model database
PDF
PGConf APAC 2018 - Where's Waldo - Text Search and Pattern in PostgreSQL
PDF
I know greater-than-or-equal-to when I see it! (PGCon 2014)
 
Path Pattern Queries: Introducing Regular Path Queries in openCypher
openCypher: Further Developments on Path Pattern Queries (Regular Path Queries)
Comparing PGQL, G-Core and Cypher
Cypher.PL: Executable Specification of Cypher written in Prolog
Propel your Performance: AgensGraph, the multi-model database
PGConf APAC 2018 - Where's Waldo - Text Search and Pattern in PostgreSQL
I know greater-than-or-equal-to when I see it! (PGCon 2014)
 
Ad

More from openCypher (20)

PDF
Learning Timed Automata with Cypher
PDF
Incremental View Maintenance for openCypher Queries
PDF
Cypher.PL: an executable specification of Cypher semantics
PDF
Multiple Graphs: Updatable Views
PDF
Micro-Servicing Linked Data
PDF
Graph abstraction
PDF
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
PDF
Cypher for Gremlin
PDF
Multiple graphs in openCypher
PDF
Eighth openCypher Implementers Group Meeting: Status Update
PDF
Cypher for Gremlin
PDF
Supporting dates and times in Cypher
PDF
Seventh openCypher Implementers Group Meeting: Status Update
PDF
Academic research on graph processing: connecting recent findings to industri...
PDF
Property Graphs with Time
PDF
Use case: processing multiple graphs
PDF
openCypher Technology Compatibility Kit (TCK)
PDF
Cypher Editor in the Web
PDF
The inGraph project and incremental evaluation of Cypher queries
PDF
Formal Specification of Cypher
Learning Timed Automata with Cypher
Incremental View Maintenance for openCypher Queries
Cypher.PL: an executable specification of Cypher semantics
Multiple Graphs: Updatable Views
Micro-Servicing Linked Data
Graph abstraction
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
Cypher for Gremlin
Multiple graphs in openCypher
Eighth openCypher Implementers Group Meeting: Status Update
Cypher for Gremlin
Supporting dates and times in Cypher
Seventh openCypher Implementers Group Meeting: Status Update
Academic research on graph processing: connecting recent findings to industri...
Property Graphs with Time
Use case: processing multiple graphs
openCypher Technology Compatibility Kit (TCK)
Cypher Editor in the Web
The inGraph project and incremental evaluation of Cypher queries
Formal Specification of Cypher
Ad

Recently uploaded (20)

PPTX
MYSQL Presentation for SQL database connectivity
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Approach and Philosophy of On baking technology
PPTX
Cloud computing and distributed systems.
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Machine Learning_overview_presentation.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MYSQL Presentation for SQL database connectivity
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Dropbox Q2 2025 Financial Results & Investor Presentation
Network Security Unit 5.pdf for BCA BBA.
Building Integrated photovoltaic BIPV_UPV.pdf
sap open course for s4hana steps from ECC to s4
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
“AI and Expert System Decision Support & Business Intelligence Systems”
Encapsulation_ Review paper, used for researhc scholars
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Advanced methodologies resolving dimensionality complications for autism neur...
Approach and Philosophy of On baking technology
Cloud computing and distributed systems.
The AUB Centre for AI in Media Proposal.docx
Machine Learning_overview_presentation.pptx
MIND Revenue Release Quarter 2 2025 Press Release
The Rise and Fall of 3GPP – Time for a Sabbatical?
Build a system with the filesystem maintained by OSTree @ COSCUP 2025

Graph pattern matching semantics

  • 1. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Graph pattern matching semantics First openCypher Implementers Meeting Oskar van Rest Oracle February 8, 2017
  • 2. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Graph pattern matching semantics Isomorphism • Two query vertices may not map to the same data vertex – Semantic for multi-graphs is undefined Cyphermorphism • Two query edges may not map to the same data edge Homomorphism • No restriction 3 less restrictive (more powerful) easier to get started with For most queries, this works very well: users who are not aware of the semantic still get the desired result.
  • 4. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | :Person name = ‘John’ When does the semantic fails? Isomorphism Cyphermorphism 4 MATCH (n:Function) -[:calls]-> (m) WHERE n.name = ‘factorial’ RETURN m.name :Function name = ‘factorial’ 100 :Function name = ‘factorial_helper’ 200 1 :calls codeGraph0 :calls m.name ‘factorial’ ‘factorialHelper’ Result with isomorphism m.name ‘factorialHelper’ Result with homomorphism Query: which functions are called by function ‘factorial’ :Person name = ‘Ann’ 200 100 familyTree MATCH (n:Person) -[:has_parent]-> () –[:has_parent]- (grandparent) (m:Person) -[:has_parent]-> () –[:has_parent]- (grandparent) WHERE n <> m RETURN grandparent.name Query: “find common grandparents” 300 400 :has_parent :has_parent 0 :has_parent 1 2 :Person name = ‘Klara’ :Person name = ‘Amber’ grandparent.name ‘Amber’ Result with cyphermorphism grandparent.name Result with homomorphism
  • 5. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Pros and cons of the different semantics • They all have the same worst-case time complexity: O(nk) (n = num. data vertices, k = num. query vertices) – However, if we apply iso/cypher-morphism to recursive path queries, things blow up • Isomorphism & cyphermorphism have limitations (see previous slide) • Homomorphism may return more matches than expected and requires additional non-equality constraints • Isomorphism & cyphermorphism don’t translate as well to/from SQL 5
  • 6. Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 6