SlideShare a Scribd company logo
Formal Semantics for Cypher Queries and Updates
Martin Schuster
University of Edinburgh
oCIM 4
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 1 / 21
Overview
Background:
Ongoing project on formal definition of Cypher
Started January 2017
Edinburgh database group and Neo4j Cypher group
Status:
Core is done (to be published in SIGMOD)
Next stage: Looking at extensions
This talk: Issues discovered at this stage
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 2 / 21
What we do, and why
What we do:
Mathematically model behaviour of Cypher
Establish formal semantics
Why we do it:
Provable insights into properties of Cypher
Formal semantics is unambiguous
Yields exact specification for implementers
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 3 / 21
Our goals
Our semantics aims to be:
Denotational
Describes what Cypher statements do, not how
“how” left up to implementation
Deterministic
Same Cypher statement on same graph/table should always yield same
result
Not as trivial to achieve as it sounds (examples later)
Consistent
Similar Cypher statements should be formalised similarly
Example: MATCH/CREATE/MERGE
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 4 / 21
Overview
1 Motivation
2 Our work so far
Query semantics
Reference implementation
3 Issues and open problems
Minor issues
Atomicity and determinism issues
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 5 / 21
Overview
1 Motivation
2 Our work so far
Query semantics
Reference implementation
3 Issues and open problems
Minor issues
Atomicity and determinism issues
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 6 / 21
Basics of query semantics (1)
Basic objects:
Property graphs
Tables (i.e. bags of records)
Query parts:
Query: (Union of) clause sequence(s) terminated with RETURN clause
Clause: “Atomic” statement, e.g.
[OPTIONAL] MATCH pattern tuple [WHERE expr ]
Subclause: Dependent part of clause, e.g. [WHERE expr ]
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 7 / 21
Basics of query semantics (2)
Basic properties:
Tables are unordered
{(a : 1, b : 3), (a : "Martin", b : "UoE"), (a : 1, b : 3)} =
{(a : 1, b : 3), (a : 1, b : 3), (a : "Martin", b : "UoE")}
Semantics of query Q given graph G maps tables to tables:
[[Q]]G : Tables → Tables
Output of Q on a G: Result of evaluating Q on empty table given G
(i.e. [[Q]]G ({})).
More details: Nadime Francis, Formal Specification of Cypher, oCIM 2
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 8 / 21
Basics of update semantics
For updates: Slight change to query semantics
Cypher statements (consisting of query and update clauses) map
graphs and tables to graphs and tables
[[S]] : (Graphs × Tables) → (Graphs × Tables)
Queries are statements that do not change the graph
[[Q]](G, T) = (G, [[Q]]G (T))
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 9 / 21
Current status of query semantics
Core fragment of Cypher queries already formalised:
UNION+[OPTIONAL ]MATCH+WHERE+UNWIND+WITH
(without aggregation)
Accepted for publication in SIGMOD 2018
Current version (at published state) available at
http://arxiv.org/abs/1802.09984
Current work (so far unpublished): Adding order, aggregation, updates.
arXiv version will be updated as more features get added
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 10 / 21
Reference implementation
Parallel to work on semantics
Direct (non-optimised) implementation of semantics
Intention: Allow implementers to directly compare their
implementation with formal semantics
Current status: Core query fragment and order implemented;
aggregation is WIP
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 11 / 21
Overview
1 Motivation
2 Our work so far
Query semantics
Reference implementation
3 Issues and open problems
Minor issues
Atomicity and determinism issues
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 12 / 21
Unification of CREATE and MERGE syntax
CREATE allows for...
Path pattern tuples
Directed relationships
Unit-length relationships
MERGE allows for...
Single path patterns
Undirected relationships
Unit-length relationships
Proposal: Unify syntax
Path pattern tuples
Directed relationships (avoid nondeterminism)
Possible extension: Fixed-length relationships
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 13 / 21
Status/semantics of WHERE
Cypher 9 reference:
“WHERE adds constraints to the patterns in a MATCH or OPTIONAL
MATCH clause or filters the results of a WITH clause.”
Different roles of WHERE as dependent subclause vs “stand-alone” clause
Current state: Filter anywhere but with OPTIONAL MATCH
(extreme example: WHERE false).
Proposal:
WHERE only as subclause of OPTIONAL MATCH
Introduce FILTER clause that can be used anywhere
(not just after MATCH/WITH)
For backward compatibility: Alias “stand-alone” WHERE to FILTER.
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 14 / 21
Nondeterminism in SET
Consider MATCH (a),(b) SET a.prop = b.prop
What happens if a and b match multiple nodes?
Nondeterminism
a b
n1 n1
n1 n2
n2 n1
n2 n2
vs.
a b
n2 n1
n2 n2
n1 n2
n1 n1
Current semantics approach:
Leave ambiguous cases undefined
Behaviour may depend on implementation
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 15 / 21
Atomicity of SET
Consider SET a.prop = b.prop, b.prop = a.prop;
assume a’s and b’s are uniquely matched (i.e. no nondeterminism)
What should this do?
Set a.prop to b.prop, then b.prop to a.prop?
(i.e. like SET a.prop = b.prop SET b.prop = a.prop)
Or switch the values of a.prop and b.prop?
Current Neo4j implementation does the former, we propose the latter
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 16 / 21
Atomicity/semantics of DELETE
Consider MATCH (a)-[r]->(b) DELETE a,b . . . DELETE r
Should this be allowed?
What does CREATE (n :label {num:1}) DELETE n RETURN n return?
Proposal:
DELETE is atomic, but order-independent inside clauses
MATCH (a)-[r]->(b) DELETE a,b,r allowed
MATCH (a)-[r]->(b) DELETE a,b DELETE r forbidden
Strict semantics (as in CIR-2017-263): Deleted entities inaccessible
immediately after deletion, retrieval attempts yield null or fail
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 17 / 21
Issue: Atomicity of CREATE
Consider CREATE (a {num:1})-[:r]->(b {num:a.num})
Should this be allowed?
What about CREATE (a {num:1}), (a)-[:r]->(b {num:a.num}) ?
What about CREATE (a {num:1}), (a)-[:r]->(a :label) ?
Is CREATE π1, π2 the same as CREATE π1 CREATE π2?
Proposal:
CREATE may only access the graph prior to its execution
Labels/properties of newly created nodes must be stated at “first
occurrence” of creation pattern
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 18 / 21
Atomicity/determinism of MERGE (1)
Given graph created by CREATE (:a {num:1})-[:r]->(:a {num:2})
What should MATCH (n:a) MERGE (n)-[:r]->()-[:r]->() do?
What about MERGE (n)-[:r]-(m) with example
table (and no existing relationships)?
n m
n1 n2
n1 n2
n2 n1
Should MERGE see...
All of its own creations?
Or only some?
Or none at all?
This is still very much open (CIR-2018-296).
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 19 / 21
Atomicity/determinism of MERGE (2)
Proposal:
MERGE can see prior graph G and a change graph Gc (initially empty)
MERGE π (with pattern π). . .
. . . tries to match π in G,
. . . otherwise, tries to match π in Gc ,
. . . otherwise, creates π in Gc.
Finally, MERGE inserts Gc into G, attached at distinguished nodes.
Fixes nondeterminism for path pattern tuples with directed fixed-length
relationships.
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 20 / 21
Summary
Query semantics: Mostly formalised, minor issues
Update semantics:
Crucial issues: atomicity and determinism of statements
Main factor in this: Driving tables are unordered
Any feedback is appreciated!
Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 21 / 21

More Related Content

What's hot

Otter 2016-11-14-ss
Otter 2016-11-14-ssOtter 2016-11-14-ss
Otter 2016-11-14-ss
Ruo Ando
 
Find Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall AlgorithmFind Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall Algorithm
Rajib Roy
 
A* algorithm
A* algorithmA* algorithm
A* algorithm
Komal Samdariya
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
vikas dhakane
 
Data structure
Data structureData structure
Data structure
Vivek Kumar Sinha
 
ASP.NET With C# (Revised Syllabus) [QP / April - 2013]
ASP.NET With C# (Revised Syllabus) [QP / April - 2013]ASP.NET With C# (Revised Syllabus) [QP / April - 2013]
ASP.NET With C# (Revised Syllabus) [QP / April - 2013]
Mumbai B.Sc.IT Study
 
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
Mumbai B.Sc.IT Study
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Dfs presentation
Dfs presentationDfs presentation
Dfs presentationAlizay Khan
 
gSpan algorithm
gSpan algorithmgSpan algorithm
gSpan algorithm
Sadik Mussah
 
Digital Signals and Systems (April – 2015) [Question Paper | IDOL: Revised Co...
Digital Signals and Systems (April – 2015) [Question Paper | IDOL: Revised Co...Digital Signals and Systems (April – 2015) [Question Paper | IDOL: Revised Co...
Digital Signals and Systems (April – 2015) [Question Paper | IDOL: Revised Co...
Mumbai B.Sc.IT Study
 
1984 Article on An Application of AI to Operations Reserach
1984 Article on An Application of AI to Operations Reserach1984 Article on An Application of AI to Operations Reserach
1984 Article on An Application of AI to Operations Reserach
Bob Marcus
 
Statistics 101 for System Administrators
Statistics 101 for System AdministratorsStatistics 101 for System Administrators
Statistics 101 for System Administrators
Roberto Polli
 
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
Mumbai B.Sc.IT Study
 
[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...
Mumbai B.Sc.IT Study
 
EC202 SIGNALS & SYSTEMS PREVIOUS QUESTION PAPER
EC202 SIGNALS & SYSTEMS PREVIOUS QUESTION PAPEREC202 SIGNALS & SYSTEMS PREVIOUS QUESTION PAPER
EC202 SIGNALS & SYSTEMS PREVIOUS QUESTION PAPER
VISHNUPRABHANKAIMAL
 
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015][Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
Mumbai B.Sc.IT Study
 
A star algorithms
A star algorithmsA star algorithms
A star algorithms
sandeep54552
 

What's hot (18)

Otter 2016-11-14-ss
Otter 2016-11-14-ssOtter 2016-11-14-ss
Otter 2016-11-14-ss
 
Find Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall AlgorithmFind Transitive Closure Using Floyd-Warshall Algorithm
Find Transitive Closure Using Floyd-Warshall Algorithm
 
A* algorithm
A* algorithmA* algorithm
A* algorithm
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
 
Data structure
Data structureData structure
Data structure
 
ASP.NET With C# (Revised Syllabus) [QP / April - 2013]
ASP.NET With C# (Revised Syllabus) [QP / April - 2013]ASP.NET With C# (Revised Syllabus) [QP / April - 2013]
ASP.NET With C# (Revised Syllabus) [QP / April - 2013]
 
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
[Question Paper] Introduction To C++ Programming (Revised Course) [January / ...
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Dfs presentation
Dfs presentationDfs presentation
Dfs presentation
 
gSpan algorithm
gSpan algorithmgSpan algorithm
gSpan algorithm
 
Digital Signals and Systems (April – 2015) [Question Paper | IDOL: Revised Co...
Digital Signals and Systems (April – 2015) [Question Paper | IDOL: Revised Co...Digital Signals and Systems (April – 2015) [Question Paper | IDOL: Revised Co...
Digital Signals and Systems (April – 2015) [Question Paper | IDOL: Revised Co...
 
1984 Article on An Application of AI to Operations Reserach
1984 Article on An Application of AI to Operations Reserach1984 Article on An Application of AI to Operations Reserach
1984 Article on An Application of AI to Operations Reserach
 
Statistics 101 for System Administrators
Statistics 101 for System AdministratorsStatistics 101 for System Administrators
Statistics 101 for System Administrators
 
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [April / ...
 
[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...
[Question Paper] Fundamentals of Digital Computing (Revised Course) [January ...
 
EC202 SIGNALS & SYSTEMS PREVIOUS QUESTION PAPER
EC202 SIGNALS & SYSTEMS PREVIOUS QUESTION PAPEREC202 SIGNALS & SYSTEMS PREVIOUS QUESTION PAPER
EC202 SIGNALS & SYSTEMS PREVIOUS QUESTION PAPER
 
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015][Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
[Question Paper] Introduction To C++ Programming (Revised Course) [April / 2015]
 
A star algorithms
A star algorithmsA star algorithms
A star algorithms
 

Similar to Formal semantics for Cypher queries and updates

AUGUR: Forecasting the Emergence of New Research Topics
AUGUR: Forecasting the Emergence of New Research TopicsAUGUR: Forecasting the Emergence of New Research Topics
AUGUR: Forecasting the Emergence of New Research Topics
Angelo Salatino
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
Fine Grained Complexity
Fine Grained ComplexityFine Grained Complexity
Fine Grained Complexity
AkankshaAgrawal55
 
breaking_dependencies_the_solid_principles__klaus_iglberger__cppcon_2020.pdf
breaking_dependencies_the_solid_principles__klaus_iglberger__cppcon_2020.pdfbreaking_dependencies_the_solid_principles__klaus_iglberger__cppcon_2020.pdf
breaking_dependencies_the_solid_principles__klaus_iglberger__cppcon_2020.pdf
VishalKumarJha10
 
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
Eelco Visser
 
Natural Language Generation in the Wild
Natural Language Generation in the WildNatural Language Generation in the Wild
Natural Language Generation in the Wild
Daniel Beck
 
NL to OCL via SBVR
NL to OCL via SBVRNL to OCL via SBVR
NL to OCL via SBVR
Imran Bajwa
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
Mary Margarat
 
data-microscopes
data-microscopesdata-microscopes
data-microscopes
Stephen Tu
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
James Wong
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Harry Potter
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Luis Goldster
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
Fraboni Ec
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Young Alista
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
Tony Nguyen
 
Ontopia tutorial
Ontopia tutorialOntopia tutorial
Ontopia tutorial
Lars Marius Garshol
 
Designing Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.ProtoDesigning Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.Proto
Joel Falcou
 
Visualizing UML’s Sequence and Class Diagrams Using Graph-Based Clusters
Visualizing UML’s Sequence and   Class Diagrams Using Graph-Based Clusters  Visualizing UML’s Sequence and   Class Diagrams Using Graph-Based Clusters
Visualizing UML’s Sequence and Class Diagrams Using Graph-Based Clusters
Nakul Sharma
 
Mapreduce Algorithms
Mapreduce AlgorithmsMapreduce Algorithms
Mapreduce Algorithms
Amund Tveit
 
Automatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSELAutomatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSEL
Joel Falcou
 

Similar to Formal semantics for Cypher queries and updates (20)

AUGUR: Forecasting the Emergence of New Research Topics
AUGUR: Forecasting the Emergence of New Research TopicsAUGUR: Forecasting the Emergence of New Research Topics
AUGUR: Forecasting the Emergence of New Research Topics
 
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term RewritingCompiler Construction | Lecture 5 | Transformation by Term Rewriting
Compiler Construction | Lecture 5 | Transformation by Term Rewriting
 
Fine Grained Complexity
Fine Grained ComplexityFine Grained Complexity
Fine Grained Complexity
 
breaking_dependencies_the_solid_principles__klaus_iglberger__cppcon_2020.pdf
breaking_dependencies_the_solid_principles__klaus_iglberger__cppcon_2020.pdfbreaking_dependencies_the_solid_principles__klaus_iglberger__cppcon_2020.pdf
breaking_dependencies_the_solid_principles__klaus_iglberger__cppcon_2020.pdf
 
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term RewritingCS4200 2019 | Lecture 5 | Transformation by Term Rewriting
CS4200 2019 | Lecture 5 | Transformation by Term Rewriting
 
Natural Language Generation in the Wild
Natural Language Generation in the WildNatural Language Generation in the Wild
Natural Language Generation in the Wild
 
NL to OCL via SBVR
NL to OCL via SBVRNL to OCL via SBVR
NL to OCL via SBVR
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
 
data-microscopes
data-microscopesdata-microscopes
data-microscopes
 
Stack squeues lists
Stack squeues listsStack squeues lists
Stack squeues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacksqueueslists
StacksqueueslistsStacksqueueslists
Stacksqueueslists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Stacks queues lists
Stacks queues listsStacks queues lists
Stacks queues lists
 
Ontopia tutorial
Ontopia tutorialOntopia tutorial
Ontopia tutorial
 
Designing Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.ProtoDesigning Architecture-aware Library using Boost.Proto
Designing Architecture-aware Library using Boost.Proto
 
Visualizing UML’s Sequence and Class Diagrams Using Graph-Based Clusters
Visualizing UML’s Sequence and   Class Diagrams Using Graph-Based Clusters  Visualizing UML’s Sequence and   Class Diagrams Using Graph-Based Clusters
Visualizing UML’s Sequence and Class Diagrams Using Graph-Based Clusters
 
Mapreduce Algorithms
Mapreduce AlgorithmsMapreduce Algorithms
Mapreduce Algorithms
 
Automatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSELAutomatic Task-based Code Generation for High Performance DSEL
Automatic Task-based Code Generation for High Performance DSEL
 

More from openCypher

Learning Timed Automata with Cypher
Learning Timed Automata with CypherLearning Timed Automata with Cypher
Learning Timed Automata with Cypher
openCypher
 
Incremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher QueriesIncremental View Maintenance for openCypher Queries
Incremental View Maintenance for openCypher Queries
openCypher
 
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
openCypher
 
Multiple Graphs: Updatable Views
Multiple Graphs: Updatable ViewsMultiple Graphs: Updatable Views
Multiple Graphs: Updatable Views
openCypher
 
Micro-Servicing Linked Data
Micro-Servicing Linked DataMicro-Servicing Linked Data
Micro-Servicing Linked Data
openCypher
 
Graph abstraction
Graph abstractionGraph abstraction
Graph abstraction
openCypher
 
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 Gremlin
openCypher
 
Comparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and CypherComparing PGQL, G-Core and Cypher
Comparing PGQL, G-Core and Cypher
openCypher
 
Multiple graphs in openCypher
Multiple graphs in openCypherMultiple graphs in openCypher
Multiple graphs in openCypher
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
openCypher
 
Cypher for Gremlin
Cypher for GremlinCypher for Gremlin
Cypher for Gremlin
openCypher
 
Supporting dates and times in Cypher
Supporting dates and times in CypherSupporting dates and times in Cypher
Supporting dates and times in Cypher
openCypher
 
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
openCypher
 
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 Time
openCypher
 
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
openCypher
 
Use case: processing multiple graphs
Use case: processing multiple graphsUse case: processing multiple graphs
Use case: processing multiple graphs
openCypher
 
openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)openCypher Technology Compatibility Kit (TCK)
openCypher Technology Compatibility Kit (TCK)
openCypher
 
Cypher Editor in the Web
Cypher Editor in the WebCypher Editor in the Web
Cypher Editor in the Web
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
 
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)
 
Cypher Editor in the Web
Cypher Editor in the WebCypher Editor in the Web
Cypher Editor in the Web
 

Recently uploaded

Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 

Recently uploaded (20)

Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 

Formal semantics for Cypher queries and updates

  • 1. Formal Semantics for Cypher Queries and Updates Martin Schuster University of Edinburgh oCIM 4 Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 1 / 21
  • 2. Overview Background: Ongoing project on formal definition of Cypher Started January 2017 Edinburgh database group and Neo4j Cypher group Status: Core is done (to be published in SIGMOD) Next stage: Looking at extensions This talk: Issues discovered at this stage Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 2 / 21
  • 3. What we do, and why What we do: Mathematically model behaviour of Cypher Establish formal semantics Why we do it: Provable insights into properties of Cypher Formal semantics is unambiguous Yields exact specification for implementers Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 3 / 21
  • 4. Our goals Our semantics aims to be: Denotational Describes what Cypher statements do, not how “how” left up to implementation Deterministic Same Cypher statement on same graph/table should always yield same result Not as trivial to achieve as it sounds (examples later) Consistent Similar Cypher statements should be formalised similarly Example: MATCH/CREATE/MERGE Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 4 / 21
  • 5. Overview 1 Motivation 2 Our work so far Query semantics Reference implementation 3 Issues and open problems Minor issues Atomicity and determinism issues Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 5 / 21
  • 6. Overview 1 Motivation 2 Our work so far Query semantics Reference implementation 3 Issues and open problems Minor issues Atomicity and determinism issues Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 6 / 21
  • 7. Basics of query semantics (1) Basic objects: Property graphs Tables (i.e. bags of records) Query parts: Query: (Union of) clause sequence(s) terminated with RETURN clause Clause: “Atomic” statement, e.g. [OPTIONAL] MATCH pattern tuple [WHERE expr ] Subclause: Dependent part of clause, e.g. [WHERE expr ] Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 7 / 21
  • 8. Basics of query semantics (2) Basic properties: Tables are unordered {(a : 1, b : 3), (a : "Martin", b : "UoE"), (a : 1, b : 3)} = {(a : 1, b : 3), (a : 1, b : 3), (a : "Martin", b : "UoE")} Semantics of query Q given graph G maps tables to tables: [[Q]]G : Tables → Tables Output of Q on a G: Result of evaluating Q on empty table given G (i.e. [[Q]]G ({})). More details: Nadime Francis, Formal Specification of Cypher, oCIM 2 Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 8 / 21
  • 9. Basics of update semantics For updates: Slight change to query semantics Cypher statements (consisting of query and update clauses) map graphs and tables to graphs and tables [[S]] : (Graphs × Tables) → (Graphs × Tables) Queries are statements that do not change the graph [[Q]](G, T) = (G, [[Q]]G (T)) Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 9 / 21
  • 10. Current status of query semantics Core fragment of Cypher queries already formalised: UNION+[OPTIONAL ]MATCH+WHERE+UNWIND+WITH (without aggregation) Accepted for publication in SIGMOD 2018 Current version (at published state) available at http://arxiv.org/abs/1802.09984 Current work (so far unpublished): Adding order, aggregation, updates. arXiv version will be updated as more features get added Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 10 / 21
  • 11. Reference implementation Parallel to work on semantics Direct (non-optimised) implementation of semantics Intention: Allow implementers to directly compare their implementation with formal semantics Current status: Core query fragment and order implemented; aggregation is WIP Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 11 / 21
  • 12. Overview 1 Motivation 2 Our work so far Query semantics Reference implementation 3 Issues and open problems Minor issues Atomicity and determinism issues Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 12 / 21
  • 13. Unification of CREATE and MERGE syntax CREATE allows for... Path pattern tuples Directed relationships Unit-length relationships MERGE allows for... Single path patterns Undirected relationships Unit-length relationships Proposal: Unify syntax Path pattern tuples Directed relationships (avoid nondeterminism) Possible extension: Fixed-length relationships Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 13 / 21
  • 14. Status/semantics of WHERE Cypher 9 reference: “WHERE adds constraints to the patterns in a MATCH or OPTIONAL MATCH clause or filters the results of a WITH clause.” Different roles of WHERE as dependent subclause vs “stand-alone” clause Current state: Filter anywhere but with OPTIONAL MATCH (extreme example: WHERE false). Proposal: WHERE only as subclause of OPTIONAL MATCH Introduce FILTER clause that can be used anywhere (not just after MATCH/WITH) For backward compatibility: Alias “stand-alone” WHERE to FILTER. Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 14 / 21
  • 15. Nondeterminism in SET Consider MATCH (a),(b) SET a.prop = b.prop What happens if a and b match multiple nodes? Nondeterminism a b n1 n1 n1 n2 n2 n1 n2 n2 vs. a b n2 n1 n2 n2 n1 n2 n1 n1 Current semantics approach: Leave ambiguous cases undefined Behaviour may depend on implementation Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 15 / 21
  • 16. Atomicity of SET Consider SET a.prop = b.prop, b.prop = a.prop; assume a’s and b’s are uniquely matched (i.e. no nondeterminism) What should this do? Set a.prop to b.prop, then b.prop to a.prop? (i.e. like SET a.prop = b.prop SET b.prop = a.prop) Or switch the values of a.prop and b.prop? Current Neo4j implementation does the former, we propose the latter Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 16 / 21
  • 17. Atomicity/semantics of DELETE Consider MATCH (a)-[r]->(b) DELETE a,b . . . DELETE r Should this be allowed? What does CREATE (n :label {num:1}) DELETE n RETURN n return? Proposal: DELETE is atomic, but order-independent inside clauses MATCH (a)-[r]->(b) DELETE a,b,r allowed MATCH (a)-[r]->(b) DELETE a,b DELETE r forbidden Strict semantics (as in CIR-2017-263): Deleted entities inaccessible immediately after deletion, retrieval attempts yield null or fail Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 17 / 21
  • 18. Issue: Atomicity of CREATE Consider CREATE (a {num:1})-[:r]->(b {num:a.num}) Should this be allowed? What about CREATE (a {num:1}), (a)-[:r]->(b {num:a.num}) ? What about CREATE (a {num:1}), (a)-[:r]->(a :label) ? Is CREATE π1, π2 the same as CREATE π1 CREATE π2? Proposal: CREATE may only access the graph prior to its execution Labels/properties of newly created nodes must be stated at “first occurrence” of creation pattern Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 18 / 21
  • 19. Atomicity/determinism of MERGE (1) Given graph created by CREATE (:a {num:1})-[:r]->(:a {num:2}) What should MATCH (n:a) MERGE (n)-[:r]->()-[:r]->() do? What about MERGE (n)-[:r]-(m) with example table (and no existing relationships)? n m n1 n2 n1 n2 n2 n1 Should MERGE see... All of its own creations? Or only some? Or none at all? This is still very much open (CIR-2018-296). Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 19 / 21
  • 20. Atomicity/determinism of MERGE (2) Proposal: MERGE can see prior graph G and a change graph Gc (initially empty) MERGE π (with pattern π). . . . . . tries to match π in G, . . . otherwise, tries to match π in Gc , . . . otherwise, creates π in Gc. Finally, MERGE inserts Gc into G, attached at distinguished nodes. Fixes nondeterminism for path pattern tuples with directed fixed-length relationships. Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 20 / 21
  • 21. Summary Query semantics: Mostly formalised, minor issues Update semantics: Crucial issues: atomicity and determinism of statements Main factor in this: Driving tables are unordered Any feedback is appreciated! Martin Schuster (UoE) Formal Semantics for Cypher oCIM 4 21 / 21