Skip to content

Commit 4714ca6

Browse files
committed
Remove graph space notion and consolidate update semantics section
1 parent 98d78b6 commit 4714ca6

File tree

1 file changed

+17
-34
lines changed

1 file changed

+17
-34
lines changed

cip/CIP2017-06-18-multiple-graphs.adoc

+17-34
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
*Author:* Stefan Plantikow <stefan[email protected]>
88

9+
This material is based on internal contributions of Alastair Green <alastair[email protected]>, Mats Rydberg <mats[email protected]>, Martin Junghanns <martin[email protected]>, Tobias Lindaaker <tobias[email protected]>.
10+
911
[abstract]
1012
.Abstract
1113
--
@@ -66,18 +68,6 @@ The details regarding the format and choice of graph URLs is outside the scope o
6668

6769
A graph is considered to have been deleted if it is no longer registered under a graph URL and no other reference to it is retained (e.g. from a running query).
6870

69-
=== Entity Identity
70-
71-
In the single property graph model, nodes and relationships are commonly identified by a single integer id.
72-
This model was originally not designed for sharing entities between many different graphs while ensuring that entity ids are unique.
73-
74-
In the multiple property graphs model, entities are additionally implicitly associated with a _graph space_ that allows to distinguish between entities with the same original id from different sources (e.g. different databases or even snapshots of the same database).
75-
76-
In the multiple property graphs model, no graph may contain two entities from the same graph space that have the same original id.
77-
78-
Graph spaces may be made identifiable by a conforming implementation by assigning a _graph URI_ to them.
79-
The details regarding the format and choice of graph URIs is outside the scope of this proposal.
80-
8171
== Background: Single Graph Execution Model
8272

8373
To describe the foundational shift proposed by this CIP, we'll define some terminology for describing the state that is manipulated by Cypher's current single graph execution model.
@@ -155,11 +145,20 @@ This CIP proposes that `UNION` (and `UNION ALL` respectively) compute the union
155145

156146
=== Updating queries
157147

158-
This CIP proposes that all updating clauses update the provided target graph of their current query context.
159-
160-
This CIP proposes that all entities of bound pattern variables in `CREATE` and `MERGE` are always added to the provided target graph of the current query context.
148+
This CIP proposes the following update semantics for Cypher with support for multiple graphs:
161149

162-
This CIP proposes that deleting an entity only affects the provided target graph of the current query context.
150+
* All updating clauses update the provided target graph of their current query context.
151+
More concretely:
152+
** Entities are always created in and deleted from the currently provided target graph.
153+
** All entities of bound pattern variables in `CREATE` and `MERGE` are always added to the provided target graph of the current query context.
154+
** Deleting an entity only affects the provided target graph of the current query context.
155+
* Updating queries always return all variables and graphs in scope, i.e. the behave as if they would end in `RETURN * GRAPHS *` (This syntax is introduced below).
156+
* Semantically, all effects of an updating clause must be made visible before proceeding with the execution of the next clause.
157+
In other words, a conforming implementation must ensure that a later clause alway sees the complete set of updates of a preceding updating clause.
158+
* A single update clause may perform multiple conflicting updates on the same node or relationship.
159+
In this situation, the outcome is undefined.
160+
Conflicting updates are considered to be out of scope of this CIP and will be addressed in a future proposal.
161+
For now it is proposed that a conforming implementation must choose at least either the original value or one of the values written or `NULL` as the final outcome of a conflicting update.
163162

164163
=== Simulating the single graph execution model
165164

@@ -260,7 +259,7 @@ However if `<graph-return-items>` already passes on a reference for the `SOURCE
260259

261260
If the current named source graph (or the current named target graph) are not passed on, they are discarded and due to the rules regarding partial query contexts the provided source graph (or target respectively) again are chosen to be the default graph of the outer execution context.
262261

263-
Note: `WITH <return-items> GRAPHS *` may be used to pass through the initial query context without having to alias source and target graphs explicitly.
262+
Note: `WITH <return-items> GRAPHS *` may be used to pass through the initial query context without having to alias incoming source and target graphs explicitly.
264263

265264
=== Discarding available tabular data
266265

@@ -286,26 +285,10 @@ INTO < graph-specifier > | '-' { < graph-construction-subquery > }
286285

287286
A `<graph-construction-subquery>` is an updating subquery (i.e. a sequence of clauses, including update clauses) that may or may not end in `RETURN`.
288287
All variables bound before the nested `FROM` and `INTO` subqueries are made visible to the `<graph-construction-subquery>`.
289-
All variables bound at the end of the `<graph-construction-subquery>` are made visible to the remaining outer query.
288+
All variables and graphs visible at the end of the `<graph-construction-subquery>` are made visible to the remaining outer query.
290289

291290
These forms have the exact same effect as creating fresh aliases for the current source and target graph, then changing the current source and target graph as specified before executing the given `<graph-construction-subquery>`, and finally restoring the original source and target graphs using the aliases followed by discarding those aliases from the current scope.
292291

293-
=== Updating graphs
294-
295-
This CIP proposes the following update semantics for Cypher with support for multiple graphs.
296-
297-
Entities are always created in and deleted from the currently provided target graph.
298-
299-
Semantically, all effects of an updating clause must be made visible before proceeding with the execution of the next clause.
300-
In other words, a conforming implementation must ensure that a later clause alway sees the complete set of updates of a preceding updating clause.
301-
302-
A single update clause may perform multiple conflicting updates on the same node or relationship.
303-
In this situation, the outcome is undefined.
304-
305-
Conflicting updates are considered to be out of scope of this CIP.
306-
307-
For now it is proposed that a conforming implementation must choose at least either the original value or one of the values written or `NULL` as the final outcome of a conflicting update.
308-
309292
=== Query signature declarations
310293

311294
Finally this CIP proposed using the `WITH` clause as the initial clause in a query for declaring all query inputs:

0 commit comments

Comments
 (0)