SlideShare a Scribd company logo
1 of 13
Download to read offline
The case for
Regular Path Queries
Tobias Lindaaker @ neo4j
CIR-2017-179
Why should we add Path Queries to Cypher?
● Find complex connections
○ Repetitions of patterns and not just single edge label
○ Alternatives between patterns and not just single edge label
● Express patterns as patterns instead of combinations of queries
(Using UNION to express disjunctions hides what is actually going on)
Path Pattern Queries
RPQs in Cypher
Tobias Lindaaker @ neo4j
CIP 2017-02-06
Path Patterns in Cypher
● Predicates on Edge Label: ()-/:FOO/-()
● Predicates on Nodes: ()-/(:Alpha{beta:'gamma'})/-()
● Alternatives: ()-/:FOO | :BAR | :BAZ/-()
● Sequence: ()-/:FOO :BAR :BAZ/-()
● Grouping: ()-/:FOO | [:BAR :BAZ]/-()
● Direction: ()-/<:FOO :BAR <:BAZ>/->()
● Any Edge: ()-/-/-()
● Repetition: ()-/:FOO? :BAR+ :BAZ* :FOO*3.. :BAR*1..5/-()
● Predicates on Edge Properties: ()-/ [- {some:'value'}] /-()
(applies to all edges matched by the group)
(for more complex predicates use Named Path Patterns)
● Negation: ()-/[^:FOO :BAR]/-()
(negation groups only allows edge labels - no other combinators or properties)
● Named Path Patterns: ()-/~foobar/-()
after declaring: PATH PATTERN foobar = ()-/:FOO :BAR/-()
Example
()-/[^:FOO :BAR]/-()
()-/[^:FOO|:BAR]/-()
()-/~not_foo_or_bar/-()
PATH PATTERN not_foo_or_bar = ()-[x]-()
WHERE label(x) <> 'FOO' AND label(x) <> 'BAR'
Atomic Patterns vs Path Patterns
Edge Patterns are delimited by square brackets [ ... ] and denotes a single edge
Edge Patterns can be used both for matching an edge and for creating an edge
Edge Patterns can bind a matched edge to a variable
Path Patterns are delimited by slashes / ... / and denotes a path of zero or more edges
Path Patterns can only be used for matching paths, and cannot be used for creating entities in a graph
Path Patterns can not bind individual edges (or nodes) to variables
Compared to Regular Expressions (over text)
Regular expression over text
● Atoms: text literals
● Disjunction: |
● Concatenation: juxtaposition
● Grouping: ( ... )
● Quantification:
○ ? - zero or one
○ * - zero or more
○ + - one or more
○ {n,m} - at least n, at most m
● Wildcard: . (any character)
● String start/end
● Disjunction of atoms short form: [ ... ]
● Negation of disjunction of atoms: [^...]
● Greedy, Lazy, Possessive
Cypher Path Patterns
● Atoms: Edge / Node (label) predicates
● Disjunction: |
● Concatenation: juxtaposition
● Grouping: [ ... ]
● Quantification:
○ ? - zero or one
○ * - zero or more
○ + - one or more
○ *n..m - at least n, at most m
● Wildcard: - (any edge)
● not applicable
● not available
● not supported
● not explored
Compared to GXPath (path expressions)
• ε G
- {(v,v) | v ∈ V} - yes: (v)-/()/->(v)
• _ G
- {(v,w)| (v,a,w) ∈ E for some a}
- yes: (v)-/-/->(w)
• a G
- {(v,w)| (v,a,w) ∈ E} - yes: (v)-/:a/->(w)
• a- G
= {(v,w) | (w,a,v) ∈ E} - yes: (v)-/<:a/->(w)
• ɑ* G
= reflexive transitive closure of ɑ
- yes: ()-[ɑ*]->()
• ɑ · β G
= ɑ G
β G
- yes: ()-[ɑ β]->()
• ɑ ∪ β G
= ɑ G
∪ β G
- yes: ()-[ɑ|β]->()
• ¬ɑ G
= V V - ɑ G
- NO! the PATH PATTERN syntax is limited to connected patterns
• [φ] G
= {(v,v) | v ∈ φ G
}
- yes: PATH PATTERN phi = (v) WHERE φ(v)
• ɑn,m G
= ⋃k=n
m
( ɑ G
)k - yes: ()-[ɑ*n..m]->()
• ɑ=
G
= {(v,w) ∈ ɑ=
G
| ρ(v)=ρ(w)}
- yes: PATH PATTERN alpha_eq = (v)-[ɑ]->(w) WHERE v.ρ = w.ρ
• ɑ≠
G
= {(v,w) ∈ ɑ=
G
| ρ(v)≠ρ(w)}
- yes: PATH PATTERN alpha_not_eq = (v)-[ɑ]->(w) WHERE v.ρ <> w.ρ
• Conjunctions (for CRPQs): ɑ ∩ β G
= ɑ G
∪ β G
- yes: PATH PATTERN alpha_and_beta = (v)-[ɑ]->(w)
- yes: WHERE EXISTS { (v)-[β]->(w) }
Cartesian product with negation
MATCH (a), (b)
WHERE NOT EXISTS {
(a)-/.../-(b)
}
Compared to GXPath (node tests)
• ɑ G
= {v | ∃w (v,w) ∈ ɑ G
}
- yes: PATH PATTERN has_alpha = (v) WHERE EXIST { (v)-[ ɑ]->() }
• ¬φ G
= V - φ G
- yes: PATH PATTERN not_phi = (v) WHERE NOT φ(v)
• φ ∧ ψ G
= φ G
∩ ψ G
- yes: PATH PATTERN phi_and_psi = (v) WHERE φ(v) AND ψ(v)
• φ ∨ ψ G
= φ G
∪ ψ G
- yes: PATH PATTERN phi_or_psi = (v) WHERE φ(v) OR ψ(v)
• c= G
= {v ∈ V | ρ(v) = c}
- yes: PATH PATTERN rho_is_c = (v) WHERE v.ρ = c
• c≠ G
= {v ∈ V | ρ(v) ≠ c}
- yes: PATH PATTERN rho_is_not_c = (v) WHERE v.ρ <> c
• ɑ = β G
= {v ∈ V | ∃w,y (v,w)∈ ɑ G
, (v,y)∈ β G
, ρ(w)=ρ(y)}
- yes: PATH PATTERN alpha_eq_beta = (v) WHERE EXIST {
- yes: MATCH (v)-[ ɑ]-(w), (v)-[β]-(y) WHERE w.ρ = y.ρ }
• ɑ ≠ β G
= {v ∈ V | ∃w,y (v,w)∈ ɑ G
, (v,y)∈ β G
, ρ(w)≠ρ(y)}
- yes: PATH PATTERN alpha_not_eq_beta = (v) WHERE EXIST {
- yes: MATCH (v)-[ ɑ]-(w), (v)-[β]-(y) WHERE w.ρ <> y.ρ }
Paths where property value differs from first
PATH PATTERN not_first_foo = (first)-/-*/-()
WHERE all( n IN nodes(not_first_foo)
WHERE n = first OR n.foo <> first.foo )
MATCH x = (a)-/~not_first_foo/-(b)
RETURN a, b, length(x)
Remaining work
● Incorporate negation into CIP
● Comparison with Conjunctive Context-Free Path Queries
● Are there things we can express in Named Path Patterns (WHERE) that cannot be implemented
using REMs?
● Make sure that the referenced papers are linked from the CIP
● Idea: :- instead of - for (edge label) wildcard
● Binding groups (paths), a better syntax than:
PATH PATTERN foo = ()-[x]-(b), p=(b)-/-*/-()
(at least a discussion section on it - either including or explaining why not)
○ Can we use bare words for that?
● Quite possibly juxtaposition will be used elsewhere for conjunction
so perhaps we should allow that here as well, and use a separate operator for sequences
Further reading
● The Cypher Improvement Proposal: CIP 2017-02-06 (rendered text)
● Presentation from oCIM 1
● Short presentation on Path Patterns
● Presentation from oCIM 2

More Related Content

What's hot

Algorithm Design and Complexity - Course 12
Algorithm Design and Complexity - Course 12Algorithm Design and Complexity - Course 12
Algorithm Design and Complexity - Course 12Traian Rebedea
 
12 derivatives and integrals of inverse trigonometric functions x
12 derivatives and integrals of inverse trigonometric functions x12 derivatives and integrals of inverse trigonometric functions x
12 derivatives and integrals of inverse trigonometric functions xmath266
 
11 the inverse trigonometric functions x
11 the inverse trigonometric functions x11 the inverse trigonometric functions x
11 the inverse trigonometric functions xmath266
 
Lesson 8: Curves, Arc Length, Acceleration
Lesson 8: Curves, Arc Length, AccelerationLesson 8: Curves, Arc Length, Acceleration
Lesson 8: Curves, Arc Length, AccelerationMatthew Leingang
 
Bezier Curve(Computer Graphics)
Bezier Curve(Computer Graphics)Bezier Curve(Computer Graphics)
Bezier Curve(Computer Graphics)Namra Mumtaz
 
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)Madhu Bala
 
Minimum spanning tree algorithms by ibrahim_alfayoumi
Minimum spanning tree algorithms by ibrahim_alfayoumiMinimum spanning tree algorithms by ibrahim_alfayoumi
Minimum spanning tree algorithms by ibrahim_alfayoumiIbrahim Alfayoumi
 
8 arc length and area of surfaces x
8 arc length and area of surfaces x8 arc length and area of surfaces x
8 arc length and area of surfaces xmath266
 
Prims and kruskal algorithms
Prims and kruskal algorithmsPrims and kruskal algorithms
Prims and kruskal algorithmsSaga Valsalan
 
Introduccio al calculo vectorial
Introduccio  al calculo vectorialIntroduccio  al calculo vectorial
Introduccio al calculo vectorialEDESMITCRUZ1
 
Graph for Coulomb damped oscillation
Graph for Coulomb damped oscillationGraph for Coulomb damped oscillation
Graph for Coulomb damped oscillationphanhung20
 
Dokumen.tips mathematics ii-institute-of-aeronautical-engineering-pptpdfadvan...
Dokumen.tips mathematics ii-institute-of-aeronautical-engineering-pptpdfadvan...Dokumen.tips mathematics ii-institute-of-aeronautical-engineering-pptpdfadvan...
Dokumen.tips mathematics ii-institute-of-aeronautical-engineering-pptpdfadvan...Mahmood Adel
 
1.7 derivative
1.7 derivative1.7 derivative
1.7 derivativemath265
 
Hermite cubic spline curve
Hermite cubic spline curveHermite cubic spline curve
Hermite cubic spline curveDeepak Antil
 
Unit 2 analysis of continuous time signals-mcq questions
Unit 2   analysis of continuous time signals-mcq questionsUnit 2   analysis of continuous time signals-mcq questions
Unit 2 analysis of continuous time signals-mcq questionsDr.SHANTHI K.G
 
Fuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoningFuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoningVeni7
 

What's hot (20)

Topological sorting
Topological sortingTopological sorting
Topological sorting
 
Algorithm Design and Complexity - Course 12
Algorithm Design and Complexity - Course 12Algorithm Design and Complexity - Course 12
Algorithm Design and Complexity - Course 12
 
12 derivatives and integrals of inverse trigonometric functions x
12 derivatives and integrals of inverse trigonometric functions x12 derivatives and integrals of inverse trigonometric functions x
12 derivatives and integrals of inverse trigonometric functions x
 
11 the inverse trigonometric functions x
11 the inverse trigonometric functions x11 the inverse trigonometric functions x
11 the inverse trigonometric functions x
 
Lect7
Lect7Lect7
Lect7
 
Lesson 8: Curves, Arc Length, Acceleration
Lesson 8: Curves, Arc Length, AccelerationLesson 8: Curves, Arc Length, Acceleration
Lesson 8: Curves, Arc Length, Acceleration
 
Bezier Curve(Computer Graphics)
Bezier Curve(Computer Graphics)Bezier Curve(Computer Graphics)
Bezier Curve(Computer Graphics)
 
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
GRAPH APPLICATION - MINIMUM SPANNING TREE (MST)
 
Minimum spanning tree algorithms by ibrahim_alfayoumi
Minimum spanning tree algorithms by ibrahim_alfayoumiMinimum spanning tree algorithms by ibrahim_alfayoumi
Minimum spanning tree algorithms by ibrahim_alfayoumi
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
8 arc length and area of surfaces x
8 arc length and area of surfaces x8 arc length and area of surfaces x
8 arc length and area of surfaces x
 
Prims and kruskal algorithms
Prims and kruskal algorithmsPrims and kruskal algorithms
Prims and kruskal algorithms
 
Introduccio al calculo vectorial
Introduccio  al calculo vectorialIntroduccio  al calculo vectorial
Introduccio al calculo vectorial
 
Graph for Coulomb damped oscillation
Graph for Coulomb damped oscillationGraph for Coulomb damped oscillation
Graph for Coulomb damped oscillation
 
Dokumen.tips mathematics ii-institute-of-aeronautical-engineering-pptpdfadvan...
Dokumen.tips mathematics ii-institute-of-aeronautical-engineering-pptpdfadvan...Dokumen.tips mathematics ii-institute-of-aeronautical-engineering-pptpdfadvan...
Dokumen.tips mathematics ii-institute-of-aeronautical-engineering-pptpdfadvan...
 
1.7 derivative
1.7 derivative1.7 derivative
1.7 derivative
 
Hermite cubic spline curve
Hermite cubic spline curveHermite cubic spline curve
Hermite cubic spline curve
 
Directional derivative and gradient
Directional derivative and gradientDirectional derivative and gradient
Directional derivative and gradient
 
Unit 2 analysis of continuous time signals-mcq questions
Unit 2   analysis of continuous time signals-mcq questionsUnit 2   analysis of continuous time signals-mcq questions
Unit 2 analysis of continuous time signals-mcq questions
 
Fuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoningFuzzy rules and fuzzy reasoning
Fuzzy rules and fuzzy reasoning
 

Similar to openCypher: Further Developments on Path Pattern Queries (Regular Path Queries)

Future features for openCypher: Schema, Constraints, Subqueries, Configurable...
Future features for openCypher: Schema, Constraints, Subqueries, Configurable...Future features for openCypher: Schema, Constraints, Subqueries, Configurable...
Future features for openCypher: Schema, Constraints, Subqueries, Configurable...openCypher
 
Algorithm to count number of disjoint paths
Algorithm to count number of disjoint pathsAlgorithm to count number of disjoint paths
Algorithm to count number of disjoint pathsSujith Jay Nair
 
Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...
Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...
Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...openCypher
 
Advanced Regular Expressions Redux
Advanced Regular Expressions ReduxAdvanced Regular Expressions Redux
Advanced Regular Expressions ReduxJakub Nesetril
 
Path Pattern Queries: Introducing Regular Path Queries in openCypher
Path Pattern Queries: Introducing Regular Path Queries in openCypherPath Pattern Queries: Introducing Regular Path Queries in openCypher
Path Pattern Queries: Introducing Regular Path Queries in openCypheropenCypher
 
lecture 17
lecture 17lecture 17
lecture 17sajinsc
 
Graph Representation, DFS and BFS Presentation.pptx
Graph Representation, DFS and BFS Presentation.pptxGraph Representation, DFS and BFS Presentation.pptx
Graph Representation, DFS and BFS Presentation.pptxbashirabdullah789
 
Php String And Regular Expressions
Php String  And Regular ExpressionsPhp String  And Regular Expressions
Php String And Regular Expressionsmussawir20
 

Similar to openCypher: Further Developments on Path Pattern Queries (Regular Path Queries) (20)

Future features for openCypher: Schema, Constraints, Subqueries, Configurable...
Future features for openCypher: Schema, Constraints, Subqueries, Configurable...Future features for openCypher: Schema, Constraints, Subqueries, Configurable...
Future features for openCypher: Schema, Constraints, Subqueries, Configurable...
 
[Book Reading] 機械翻訳 - Section 5 No.2
[Book Reading] 機械翻訳 - Section 5 No.2[Book Reading] 機械翻訳 - Section 5 No.2
[Book Reading] 機械翻訳 - Section 5 No.2
 
Algorithm to count number of disjoint paths
Algorithm to count number of disjoint pathsAlgorithm to count number of disjoint paths
Algorithm to count number of disjoint paths
 
Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...
Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...
Configurable Pattern Matching Semantics in openCypher: Defining Levels of Nod...
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Reg EX
Reg EXReg EX
Reg EX
 
Graps 2
Graps 2Graps 2
Graps 2
 
Regular Expressions
Regular ExpressionsRegular Expressions
Regular Expressions
 
Advanced Regular Expressions Redux
Advanced Regular Expressions ReduxAdvanced Regular Expressions Redux
Advanced Regular Expressions Redux
 
6. Graphs
6. Graphs6. Graphs
6. Graphs
 
Path Pattern Queries: Introducing Regular Path Queries in openCypher
Path Pattern Queries: Introducing Regular Path Queries in openCypherPath Pattern Queries: Introducing Regular Path Queries in openCypher
Path Pattern Queries: Introducing Regular Path Queries in openCypher
 
Swift School #1
Swift School #1Swift School #1
Swift School #1
 
lecture 17
lecture 17lecture 17
lecture 17
 
Graph Representation, DFS and BFS Presentation.pptx
Graph Representation, DFS and BFS Presentation.pptxGraph Representation, DFS and BFS Presentation.pptx
Graph Representation, DFS and BFS Presentation.pptx
 
Shortest Path in Graph
Shortest Path in GraphShortest Path in Graph
Shortest Path in Graph
 
Ppt 1
Ppt 1Ppt 1
Ppt 1
 
Topological Sort
Topological SortTopological Sort
Topological Sort
 
Lecture13
Lecture13Lecture13
Lecture13
 
Php String And Regular Expressions
Php String  And Regular ExpressionsPhp String  And Regular Expressions
Php String And Regular Expressions
 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
 

More from openCypher

Learning Timed Automata with Cypher
Learning Timed Automata with CypherLearning Timed Automata with Cypher
Learning Timed Automata with CypheropenCypher
 
Incremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher QueriesIncremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher QueriesopenCypher
 
Formal semantics for Cypher queries and updates
Formal semantics for Cypher queries and updatesFormal semantics for Cypher queries and updates
Formal semantics for Cypher queries and updatesopenCypher
 
Cypher.PL: an executable specification of Cypher semantics
Cypher.PL: an executable specification of Cypher semanticsCypher.PL: an executable specification of Cypher semantics
Cypher.PL: an executable specification of Cypher semanticsopenCypher
 
Multiple Graphs: Updatable Views
Multiple Graphs: Updatable ViewsMultiple Graphs: Updatable Views
Multiple Graphs: Updatable ViewsopenCypher
 
Micro-Servicing Linked Data
Micro-Servicing Linked DataMicro-Servicing Linked Data
Micro-Servicing Linked DataopenCypher
 
Graph abstraction
Graph abstractionGraph abstraction
Graph abstractionopenCypher
 
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...openCypher
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for GremlinopenCypher
 
Comparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and CypherComparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and CypheropenCypher
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypheropenCypher
 
Eighth openCypher Implementers Group Meeting: Status Update
Eighth openCypher Implementers Group Meeting: Status UpdateEighth openCypher Implementers Group Meeting: Status Update
Eighth openCypher Implementers Group Meeting: Status UpdateopenCypher
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for GremlinopenCypher
 
Supporting dates and times in Cypher
Supporting dates and times in CypherSupporting dates and times in Cypher
Supporting dates and times in CypheropenCypher
 
Seventh openCypher Implementers Group Meeting: Status Update
Seventh openCypher Implementers Group Meeting: Status UpdateSeventh openCypher Implementers Group Meeting: Status Update
Seventh openCypher Implementers Group Meeting: Status UpdateopenCypher
 
Academic research on graph processing: connecting recent findings to industri...
Academic research on graph processing: connecting recent findings to industri...Academic research on graph processing: connecting recent findings to industri...
Academic research on graph processing: connecting recent findings to industri...openCypher
 
Property Graphs with Time
Property Graphs with TimeProperty Graphs with Time
Property Graphs with TimeopenCypher
 
Cypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologCypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologopenCypher
 
Use case: processing multiple graphs
Use case: processing multiple graphsUse case: processing multiple graphs
Use case: processing multiple graphsopenCypher
 
openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)openCypher
 

More from openCypher (20)

Learning Timed Automata with Cypher
Learning Timed Automata with CypherLearning Timed Automata with Cypher
Learning Timed Automata with Cypher
 
Incremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher QueriesIncremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher Queries
 
Formal semantics for Cypher queries and updates
Formal semantics for Cypher queries and updatesFormal semantics for Cypher queries and updates
Formal semantics for Cypher queries and updates
 
Cypher.PL: an executable specification of Cypher semantics
Cypher.PL: an executable specification of Cypher semanticsCypher.PL: an executable specification of Cypher semantics
Cypher.PL: an executable specification of Cypher semantics
 
Multiple Graphs: Updatable Views
Multiple Graphs: Updatable ViewsMultiple Graphs: Updatable Views
Multiple Graphs: Updatable Views
 
Micro-Servicing Linked Data
Micro-Servicing Linked DataMicro-Servicing Linked Data
Micro-Servicing Linked Data
 
Graph abstraction
Graph abstractionGraph abstraction
Graph abstraction
 
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
From Cypher 9 to GQL: Conceptual overview of multiple named graphs and compos...
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for Gremlin
 
Comparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and CypherComparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and Cypher
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypher
 
Eighth openCypher Implementers Group Meeting: Status Update
Eighth openCypher Implementers Group Meeting: Status UpdateEighth openCypher Implementers Group Meeting: Status Update
Eighth openCypher Implementers Group Meeting: Status Update
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for Gremlin
 
Supporting dates and times in Cypher
Supporting dates and times in CypherSupporting dates and times in Cypher
Supporting dates and times in Cypher
 
Seventh openCypher Implementers Group Meeting: Status Update
Seventh openCypher Implementers Group Meeting: Status UpdateSeventh openCypher Implementers Group Meeting: Status Update
Seventh openCypher Implementers Group Meeting: Status Update
 
Academic research on graph processing: connecting recent findings to industri...
Academic research on graph processing: connecting recent findings to industri...Academic research on graph processing: connecting recent findings to industri...
Academic research on graph processing: connecting recent findings to industri...
 
Property Graphs with Time
Property Graphs with TimeProperty Graphs with Time
Property Graphs with Time
 
Cypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in PrologCypher.PL: Executable Specification of Cypher written in Prolog
Cypher.PL: Executable Specification of Cypher written in Prolog
 
Use case: processing multiple graphs
Use case: processing multiple graphsUse case: processing multiple graphs
Use case: processing multiple graphs
 
openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)
 

Recently uploaded

Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfalexjohnson7307
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Paige Cruz
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdfMuhammad Subhan
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهMohamed Sweelam
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 

Recently uploaded (20)

Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 

openCypher: Further Developments on Path Pattern Queries (Regular Path Queries)

  • 1. The case for Regular Path Queries Tobias Lindaaker @ neo4j CIR-2017-179
  • 2. Why should we add Path Queries to Cypher? ● Find complex connections ○ Repetitions of patterns and not just single edge label ○ Alternatives between patterns and not just single edge label ● Express patterns as patterns instead of combinations of queries (Using UNION to express disjunctions hides what is actually going on)
  • 3. Path Pattern Queries RPQs in Cypher Tobias Lindaaker @ neo4j CIP 2017-02-06
  • 4. Path Patterns in Cypher ● Predicates on Edge Label: ()-/:FOO/-() ● Predicates on Nodes: ()-/(:Alpha{beta:'gamma'})/-() ● Alternatives: ()-/:FOO | :BAR | :BAZ/-() ● Sequence: ()-/:FOO :BAR :BAZ/-() ● Grouping: ()-/:FOO | [:BAR :BAZ]/-() ● Direction: ()-/<:FOO :BAR <:BAZ>/->() ● Any Edge: ()-/-/-() ● Repetition: ()-/:FOO? :BAR+ :BAZ* :FOO*3.. :BAR*1..5/-() ● Predicates on Edge Properties: ()-/ [- {some:'value'}] /-() (applies to all edges matched by the group) (for more complex predicates use Named Path Patterns) ● Negation: ()-/[^:FOO :BAR]/-() (negation groups only allows edge labels - no other combinators or properties) ● Named Path Patterns: ()-/~foobar/-() after declaring: PATH PATTERN foobar = ()-/:FOO :BAR/-()
  • 5. Example ()-/[^:FOO :BAR]/-() ()-/[^:FOO|:BAR]/-() ()-/~not_foo_or_bar/-() PATH PATTERN not_foo_or_bar = ()-[x]-() WHERE label(x) <> 'FOO' AND label(x) <> 'BAR'
  • 6. Atomic Patterns vs Path Patterns Edge Patterns are delimited by square brackets [ ... ] and denotes a single edge Edge Patterns can be used both for matching an edge and for creating an edge Edge Patterns can bind a matched edge to a variable Path Patterns are delimited by slashes / ... / and denotes a path of zero or more edges Path Patterns can only be used for matching paths, and cannot be used for creating entities in a graph Path Patterns can not bind individual edges (or nodes) to variables
  • 7. Compared to Regular Expressions (over text) Regular expression over text ● Atoms: text literals ● Disjunction: | ● Concatenation: juxtaposition ● Grouping: ( ... ) ● Quantification: ○ ? - zero or one ○ * - zero or more ○ + - one or more ○ {n,m} - at least n, at most m ● Wildcard: . (any character) ● String start/end ● Disjunction of atoms short form: [ ... ] ● Negation of disjunction of atoms: [^...] ● Greedy, Lazy, Possessive Cypher Path Patterns ● Atoms: Edge / Node (label) predicates ● Disjunction: | ● Concatenation: juxtaposition ● Grouping: [ ... ] ● Quantification: ○ ? - zero or one ○ * - zero or more ○ + - one or more ○ *n..m - at least n, at most m ● Wildcard: - (any edge) ● not applicable ● not available ● not supported ● not explored
  • 8. Compared to GXPath (path expressions) • ε G - {(v,v) | v ∈ V} - yes: (v)-/()/->(v) • _ G - {(v,w)| (v,a,w) ∈ E for some a} - yes: (v)-/-/->(w) • a G - {(v,w)| (v,a,w) ∈ E} - yes: (v)-/:a/->(w) • a- G = {(v,w) | (w,a,v) ∈ E} - yes: (v)-/<:a/->(w) • ɑ* G = reflexive transitive closure of ɑ - yes: ()-[ɑ*]->() • ɑ · β G = ɑ G β G - yes: ()-[ɑ β]->() • ɑ ∪ β G = ɑ G ∪ β G - yes: ()-[ɑ|β]->() • ¬ɑ G = V V - ɑ G - NO! the PATH PATTERN syntax is limited to connected patterns • [φ] G = {(v,v) | v ∈ φ G } - yes: PATH PATTERN phi = (v) WHERE φ(v) • ɑn,m G = ⋃k=n m ( ɑ G )k - yes: ()-[ɑ*n..m]->() • ɑ= G = {(v,w) ∈ ɑ= G | ρ(v)=ρ(w)} - yes: PATH PATTERN alpha_eq = (v)-[ɑ]->(w) WHERE v.ρ = w.ρ • ɑ≠ G = {(v,w) ∈ ɑ= G | ρ(v)≠ρ(w)} - yes: PATH PATTERN alpha_not_eq = (v)-[ɑ]->(w) WHERE v.ρ <> w.ρ • Conjunctions (for CRPQs): ɑ ∩ β G = ɑ G ∪ β G - yes: PATH PATTERN alpha_and_beta = (v)-[ɑ]->(w) - yes: WHERE EXISTS { (v)-[β]->(w) }
  • 9. Cartesian product with negation MATCH (a), (b) WHERE NOT EXISTS { (a)-/.../-(b) }
  • 10. Compared to GXPath (node tests) • ɑ G = {v | ∃w (v,w) ∈ ɑ G } - yes: PATH PATTERN has_alpha = (v) WHERE EXIST { (v)-[ ɑ]->() } • ¬φ G = V - φ G - yes: PATH PATTERN not_phi = (v) WHERE NOT φ(v) • φ ∧ ψ G = φ G ∩ ψ G - yes: PATH PATTERN phi_and_psi = (v) WHERE φ(v) AND ψ(v) • φ ∨ ψ G = φ G ∪ ψ G - yes: PATH PATTERN phi_or_psi = (v) WHERE φ(v) OR ψ(v) • c= G = {v ∈ V | ρ(v) = c} - yes: PATH PATTERN rho_is_c = (v) WHERE v.ρ = c • c≠ G = {v ∈ V | ρ(v) ≠ c} - yes: PATH PATTERN rho_is_not_c = (v) WHERE v.ρ <> c • ɑ = β G = {v ∈ V | ∃w,y (v,w)∈ ɑ G , (v,y)∈ β G , ρ(w)=ρ(y)} - yes: PATH PATTERN alpha_eq_beta = (v) WHERE EXIST { - yes: MATCH (v)-[ ɑ]-(w), (v)-[β]-(y) WHERE w.ρ = y.ρ } • ɑ ≠ β G = {v ∈ V | ∃w,y (v,w)∈ ɑ G , (v,y)∈ β G , ρ(w)≠ρ(y)} - yes: PATH PATTERN alpha_not_eq_beta = (v) WHERE EXIST { - yes: MATCH (v)-[ ɑ]-(w), (v)-[β]-(y) WHERE w.ρ <> y.ρ }
  • 11. Paths where property value differs from first PATH PATTERN not_first_foo = (first)-/-*/-() WHERE all( n IN nodes(not_first_foo) WHERE n = first OR n.foo <> first.foo ) MATCH x = (a)-/~not_first_foo/-(b) RETURN a, b, length(x)
  • 12. Remaining work ● Incorporate negation into CIP ● Comparison with Conjunctive Context-Free Path Queries ● Are there things we can express in Named Path Patterns (WHERE) that cannot be implemented using REMs? ● Make sure that the referenced papers are linked from the CIP ● Idea: :- instead of - for (edge label) wildcard ● Binding groups (paths), a better syntax than: PATH PATTERN foo = ()-[x]-(b), p=(b)-/-*/-() (at least a discussion section on it - either including or explaining why not) ○ Can we use bare words for that? ● Quite possibly juxtaposition will be used elsewhere for conjunction so perhaps we should allow that here as well, and use a separate operator for sequences
  • 13. Further reading ● The Cypher Improvement Proposal: CIP 2017-02-06 (rendered text) ● Presentation from oCIM 1 ● Short presentation on Path Patterns ● Presentation from oCIM 2