Skip to content

Commit 76c904b

Browse files
fixes
1 parent f926d60 commit 76c904b

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

modules/ROOT/pages/clauses/load-csv.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,7 @@ person_tmdbId,bio,born,bornIn,died,person_imdbId,name,person_poster,person_url
708708
----
709709
710710
[NOTE]
711-
The query below uses a xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause] (introduced in Neo4j 5.23) to import variables into the `CALL` subquery.
712-
If you are using an older version of Neo4j, use an xref:subqueries/call-subquery.adoc#importing-with[importing `WITH` clause] instead.
711+
The below query uses a xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause] to import variables into the `CALL` subquery.
713712
714713
.Query
715714
// tag::clauses_load_csv_transactions[]

modules/ROOT/pages/clauses/where.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ MATCH (n:Person)
6969
WHERE n.age < 35
7070
RETURN n.name AS name, n.age AS age
7171
----
72-
// end::clauses_where_boolean_operations[]
7372

7473
.Result
7574
[role="queryresult",options="header,footer",cols="2*<m"]
@@ -82,6 +81,7 @@ RETURN n.name AS name, n.age AS age
8281
|===
8382

8483
.Filter on a relationship property
84+
// tag::clauses_where_relationship_property[]
8585
[source, cypher]
8686
----
8787
MATCH (:Person {name:'Andy'})-[k:KNOWS]->(f)

modules/ROOT/pages/clauses/with.adoc

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ CREATE (techCorp:Supplier {name: 'TechCorp', email: '[email protected]'}),
6161
(foodies)-[:SUPPLIES]->(chocolate),
6262
(foodies)-[:SUPPLIES]->(coffee)
6363
----
64-
// end::clauses_with_variables[]
6564

6665
[[create-new-variables]]
6766
== Create new variables
@@ -89,14 +88,14 @@ In the below example, the `WITH` clause binds all matched `Customer` nodes to a
8988
The bound nodes are `MAP` values which can then be referenced from the new variable.
9089

9190
.Create a new variable bound to matched nodes
92-
// tag::clauses_with_wildcard[]
91+
// tag::clauses_with_new_variable[]
9392
[source, cypher]
9493
----
9594
MATCH (c:Customer)-[:BUYS]->(:Product {name: 'Chocolate'})
9695
WITH c AS customer
9796
RETURN customer.firstName AS chocolateCustomer
9897
----
99-
// end::clauses_with_wildcard[]
98+
// end::clauses_with_new_variable[]
10099

101100
.Result
102101
[role="queryresult",options="header,footer",cols="1*<m"]
@@ -131,7 +130,6 @@ WITH c.name AS chocolateCustomers
131130
RETURN chocolateCustomers,
132131
p.price AS chocolatePrice
133132
----
134-
// end::clauses_with_wildcard[]
135133

136134
.Error message
137135
[source, error]
@@ -140,6 +138,7 @@ Variable `p` not defined
140138
----
141139

142140
.Retain all variables with `WITH *`
141+
// tag::clauses_with_all_variables[]
143142
[source, cypher]
144143
----
145144
MATCH (supplier:Supplier)-[r]->(product:Product)
@@ -148,6 +147,7 @@ RETURN supplier.name AS company,
148147
type(r) AS relType,
149148
product.name AS product
150149
----
150+
// end::clauses_with_all_variables[]
151151

152152
.Result
153153
[role="queryresult",options="header,footer",cols="3*<m"]
@@ -169,6 +169,7 @@ More specifically, a variable imported into a `CALL` subquery will be available
169169
In the below example, the `x` variable is imported to the inside scope of a `CALL` subquery, and is successfully referenced by the `RETURN` clause even though the preceding `WITH` neglects to list it.
170170

171171
.Variables cannot be de-scoped in the inner scope of a subquery
172+
// tag::clauses_with_subquery[]
172173
[source, cypher]
173174
----
174175
WITH 11 AS x
@@ -179,6 +180,7 @@ CALL (x) {
179180
}
180181
RETURN x, a
181182
----
183+
// end::clauses_with_subquery[]
182184

183185
.Result
184186
[role="queryresult",options="header,footer",cols="2*<m"]
@@ -200,6 +202,7 @@ For more information, see xref:subqueries/call-subquery.adoc#import-variables[`C
200202
In the below query, the value of the xref:expressions/string-operators.adoc[`STRING` concatenation] expression is bound to a new variable `customerFullName`, and the value from the expression `chocolate.price * (1 - customer.discount)` is bound to `chocolateNetPrice`, both of which are then available in the `RETURN` clause.
201203

202204
.Bind values to variables
205+
// tag::clauses_with_bind_values[]
203206
[source, cypher]
204207
----
205208
MATCH (customer:Customer)-[:BUYS]->(chocolate:Product {name: 'Chocolate'})
@@ -208,6 +211,7 @@ WITH customer.firstName || ' ' || customer.lastName AS customerFullName,
208211
RETURN customerFullName,
209212
chocolateNetPrice
210213
----
214+
// end::clauses_with_bind_values[]
211215

212216
.Result
213217
[role="queryresult",options="header,footer",cols="2*<m"]
@@ -224,6 +228,7 @@ RETURN customerFullName,
224228
Because `WITH` can be used to assign variables to the values of expressions, it can be used to chain expressions.
225229

226230
.Chain expressions using `WITH`
231+
// tag::clauses_with_chain_expressions[]
227232
[source, cypher]
228233
----
229234
MATCH (p:Product)
@@ -240,6 +245,7 @@ RETURN p.name AS product,
240245
discountCategory
241246
ORDER BY price
242247
----
248+
// end::clauses_with_chain_expressions[]
243249

244250
.Result
245251
[role="queryresult",options="header,footer", cols="4*<m"]
@@ -267,6 +273,7 @@ In this example, the xref:functions/aggregating.adoc#functions-sum[`sum()`] func
267273
The xref:functions/aggregating.adoc#functions-collect[`collect()`] function is used to collect each product into `LIST` values bound to the `productsBought` variable.
268274

269275
.`WITH` performing aggregations
276+
// tag::clauses_with_aggregations[]
270277
[source, cypher]
271278
----
272279
MATCH (c:Customer)-[:BUYS]->(p:Product)
@@ -278,6 +285,8 @@ RETURN customer,
278285
productsBought
279286
ORDER BY totalSpent DESC
280287
----
288+
// end::clauses_with_aggregations[]
289+
281290

282291
.Result
283292
[role="queryresult",options="header,footer", cols="3*<m"]
@@ -303,13 +312,15 @@ ORDER BY totalSpent DESC
303312
In the below query, `WITH DISTINCT` is used to remove any duplicate `discount` property values from `Customer` nodes.
304313

305314
.`WITH DISTINCT` to remove duplicate values
315+
// tag::clauses_with_remove_duplicates[]
306316
[source, cypher]
307317
----
308318
MATCH (c:Customer)
309319
WITH DISTINCT c.discount AS discountRates
310320
RETURN discountRates
311321
ORDER BY discountRates
312322
----
323+
// end::clauses_with_remove_duplicates[]
313324

314325
.Result
315326
[role="queryresult",options="header,footer", cols="1*<m"]
@@ -395,6 +406,7 @@ In the next example, `LIMIT` is used to only retain the top 3 customers with the
395406
Then, the xref:clauses/set.adoc[`SET`] assigns a new property (`topSpender = true`) to those customers who have spent the most.
396407

397408
.Limit results with `LIMIT`
409+
// tag::clauses_with_ordering_pagination[]
398410
[source, cypher]
399411
----
400412
MATCH (c:Customer)-[:BUYS]->(p:Product)
@@ -407,6 +419,7 @@ RETURN c.firstName AS customer,
407419
totalSpent,
408420
c.topSpender AS topSpender
409421
----
422+
// end::clauses_with_ordering_pagination[]
410423

411424
[role="queryresult",options="header,footer", cols="3*<m"]
412425
|===
@@ -509,6 +522,7 @@ In the below query, `WITH` and `WHERE` are used to filter out any `Supplier` nod
509522
Note the use of `DISTINCT` inside `collect()` to remove any duplicate `Customer` nodes.
510523

511524
.Filter property values using `WITH` and `WHERE`
525+
// tag::clauses_with_filtering[]
512526
[source, cypher]
513527
----
514528
MATCH (s:Supplier)-[:SUPPLIES]->(p:Product)<-[:BUYS]-(c:Customer)
@@ -520,6 +534,7 @@ RETURN s.name AS supplier,
520534
totalSales,
521535
uniqueCustomers
522536
----
537+
// end::clauses_with_filtering[]
523538

524539
[role="queryresult",options="header,footer", cols="3*<m"]
525540
|===

0 commit comments

Comments
 (0)