Skip to content
Open
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5c6f9d7
Added the nested subqueries CIP
Jun 22, 2016
d7d0a83
Sundry content edits to the subquery CIP
Jun 23, 2016
bf71712
Clarified the syntax wrt `OPTIONAL`
Jun 23, 2016
f6245fd
Added the notion of write subqueries, with `UNWIND` + `DO {...}` repl…
Jul 20, 2016
ede1334
Clarified the way in which variable bindings work (based on comments …
Jul 20, 2016
a1c6442
Addressed some feedback
boggle Sep 26, 2016
4caeb54
Addressing comments; making clarifications
Nov 17, 2016
5b5b9cc
Sketched out additional forms of nested subqueries.
boggle Mar 27, 2017
fe21475
Homogeneous syntax for OPTIONAL, MANDATORY, MATCH, DO WHEN
boggle Mar 30, 2017
80a1ce4
Address feedback and introduce new syntactic short forms
boggle Apr 13, 2017
b8f49d6
Add chained subqueries with `THEN` and overhaul document
boggle Apr 19, 2017
bf53252
Reflect discussion; add new conditional form of DO and WHERE shorthand
boggle Apr 20, 2017
70a91cd
Textual improvements
Apr 21, 2017
1f02e2b
Refer to Query Combinator CIP
Apr 21, 2017
cc176e8
Wording
boggle May 1, 2017
2921112
Rework CIP
boggle Oct 16, 2017
3ed1ca9
Clarify precedence rules
boggle Oct 16, 2017
2d2435f
Add ammending nested subqueries and fix query combinator precedence
boggle Oct 16, 2017
0156bc3
Fix definition of chained queries and move to right directory
boggle Oct 16, 2017
acfac59
Textual edits
Oct 17, 2017
7554cc9
Clarified query combinator semantics
boggle Oct 17, 2017
10fa182
Fixed erroneous queries
Oct 19, 2017
1ca70bf
Reformatted title
Jan 17, 2018
cfc2a43
Reworking/incorporating alternative CIP
boggle May 6, 2018
6199430
Fused with nested subqueries CIP from multigraph work
boggle May 6, 2018
5b6a333
Added stand-alone nested calls and some clarifications/fix-ups
boggle May 7, 2018
077fb18
Grammar fix
boggle May 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clarified query combinator semantics
  • Loading branch information
boggle committed Oct 17, 2017
commit 7554cc9685217205912a59e3e680706336fd350d
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,22 @@ A query may end with a conditional `DO` subquery in the same way that a query ca

=== Chained subqueries

_Chained_ subqueries are queries that compose a top-level result query using a _query combinator_ clause from two input queries: a left-hand side 'top-level' query and a right-hand side argument query.
Chained subqueries are queries that compose a top-level result query using a sequence of _query combinator_ clauses each followed by a query component.

In this definition, top-level queries are arbitrary Cypher queries, while argument queries are queries that may *not* contain query combinators.
Argument queries may however contain nested subqueries whose inner queries again may be top-level queries (that may very well contain query combinators).
A query component is a sequence of clauses that either describes an updating query or a read-only that ends in a `RETURN` clause but does not contain any top-level query combinator clauses.
Query components may however contain nested subqueries whose inner queries contain query combinator clauses.

Currently Cypher only supports the `UNION` and `UNION ALL` query combinators.
This CIP proposes to extend this set of query combinators with new forms as outlined below.


==== Chained data-dependent subqueries

We propose the introduction of using the `WITH` projection clause as a new query combinator that can sequentially compose arbitrary queries to form a chained data-dependent subquery without having to resort to nesting and indentation (e.g. as a short-hand syntax for post-UNION processing).

Chained data-dependent subqueries have the following general form `<Q1> WITH ... <Q2>`.

Both `<Q1`> and `<Q2>` are arbitrary argument queries.
Both `<Q1`> and `<Q2>` are arbitrary query components.

Conceptually, the query `<Q2>` is evaluated for each incoming input record from the query `<Q1>` and may produce an arbitrary number of result records.
In other words, the query `<Q2>` will be provided with all variables returned by the query `<Q1>` as input variable bindings.
Expand All @@ -168,7 +169,7 @@ We propose introducing the `THEN` projection clause as a new query combinator th

Chained data-independent subqueries have the following general form `<Q1> THEN <Q2>`.

Both `<Q1`> and `<Q2>` are arbitrary argument queries.
Both `<Q1`> and `<Q2>` are query components.
No variables and no input records are passed from `<Q1>` to `<Q2>`.
Instead `<Q2>` is executed in a standalone fashion after the execution of `<Q1>` has finished.

Expand Down