Skip to content

Commit e49a21f

Browse files
committed
escaped tags, added tags for LOAD CSV
1 parent d932269 commit e49a21f

File tree

8 files changed

+49
-35
lines changed

8 files changed

+49
-35
lines changed

modules/ROOT/pages/clauses/finish.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ A query ending in `FINISH` -- instead of `RETURN` -- has no result but executes
99
The following read query successfully executes but has no results:
1010

1111
.Query
12-
tag::clauses_finish_match[]
12+
// tag::clauses_finish_match[]
1313
[source, cypher]
1414
----
1515
MATCH (p:Person)
1616
FINISH
1717
----
18-
end::clauses_finish_match[]
18+
// end::clauses_finish_match[]
1919

2020
The following query has no result but creates one node with the label `Person`:
2121

2222
.Query
23-
tag::clauses_finish_create[]
23+
// tag::clauses_finish_create[]
2424
[source, cypher]
2525
----
2626
CREATE (p:Person)
2727
FINISH
2828
----
29-
end::clauses_finish_create[]
29+
// end::clauses_finish_create[]
3030

3131
It is equivalent to the following query:
3232

modules/ROOT/pages/clauses/foreach.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ CREATE
3636
This query will set the property `marked` to `true` on all nodes along a path.
3737

3838
.Query
39-
tag::clauses_foreach[]
39+
// tag::clauses_foreach[]
4040
[source, cypher, indent=0]
4141
----
4242
MATCH p=(start)-[*]->(finish)
4343
WHERE start.name = 'A' AND finish.name = 'D'
4444
FOREACH (n IN nodes(p) | SET n.marked = true)
4545
----
46-
end::clauses_foreach[]
46+
// end::clauses_foreach[]
4747

4848
.Result
4949
[role="queryresult",options="footer",cols="1*<m"]

modules/ROOT/pages/clauses/limit.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ Properties set: 1
166166
`LIMIT` can be used as a standalone clause, or in conjunction with xref:clauses/order-by.adoc[`ORDER BY`] or xref:clauses/skip.adoc[`SKIP`]/xref:clauses/skip.adoc#offset-synonym[`OFFSET`].
167167

168168
.Standalone use of `LIMIT`
169-
tag::clauses_limit_standalone[]
169+
// tag::clauses_limit_standalone[]
170170
[source, cypher]
171171
----
172172
MATCH (n)
173173
LIMIT 2
174174
RETURN collect(n.name) AS names
175175
----
176-
tag::clauses_limit_standalone[]
176+
// end::clauses_limit_standalone[]
177177

178178
.Result
179179
[role="queryresult",options="header,footer",cols="1*<m"]
@@ -187,7 +187,7 @@ The following query orders all nodes by `name` descending, skips the two first r
187187
It then xref:functions/aggregating.adoc#functions-collect[collects] the results in a list.
188188

189189
.`LIMIT` used in conjunction with `ORDER BY` and `SKIP`
190-
tag::clauses_limit[]
190+
// tag::clauses_limit[]
191191
[source, cypher]
192192
----
193193
MATCH (n)
@@ -196,7 +196,7 @@ SKIP 2
196196
LIMIT 2
197197
RETURN collect(n.name) AS names
198198
----
199-
end::clauses_limit[]
199+
// end::clauses_limit[]
200200

201201
.Result
202202
[role="queryresult",options="header,footer",cols="1*<m"]

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ By default, paths are resolved relative to the Neo4j import directory.
4646
----
4747
4848
.Query
49+
// tag::clauses_load_csv_local_files[]
4950
[source, cypher]
5051
----
5152
LOAD CSV FROM 'file:///artists.csv' AS row
5253
MERGE (a:Artist {name: row[1], year: toInteger(row[2])})
5354
RETURN a.name, a.year
5455
----
56+
// end::clauses_load_csv_local_files[]
5557
5658
.Result
5759
[role="queryresult",options="header,footer",cols="2*<m"]
@@ -112,12 +114,14 @@ However, this means that insecure URLs on virtual hosts will not function unless
112114
----
113115
114116
.Query
117+
// tag::clauses_load_csv_remote_locations[]
115118
[source, cypher]
116119
----
117120
LOAD CSV FROM 'https://data.neo4j.com/bands/artists.csv' AS row
118121
MERGE (a:Artist {name: row[1], year: toInteger(row[2])})
119122
RETURN a.name, a.year
120123
----
124+
// end::clauses_load_csv_remote_locations[]
121125
122126
.Result
123127
[role="queryresult",options="header,footer",cols="2*<m"]
@@ -700,10 +704,11 @@ person_tmdbId,bio,born,bornIn,died,person_imdbId,name,person_poster,person_url
700704
----
701705
702706
[NOTE]
703-
The below query 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.
707+
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.
704708
If you are using an older version of Neo4j, use an xref:subqueries/call-subquery.adoc#importing-with[importing `WITH` clause] instead.
705709
706710
.Query
711+
// tag::clauses_load_csv_transactions[]
707712
[source, cypher]
708713
----
709714
LOAD CSV WITH HEADERS FROM 'https://data.neo4j.com/importing-cypher/persons.csv' AS row
@@ -712,6 +717,7 @@ CALL (row) {
712717
SET p.name = row.name, p.born = row.born
713718
} IN TRANSACTIONS OF 200 ROWS
714719
----
720+
// end::clauses_load_csv_transactions[]
715721
716722
.Result
717723
[source, role="queryresult"]
@@ -746,11 +752,13 @@ A common use case for this function is to generate sequential unique IDs for CSV
746752
----
747753
748754
.Query
755+
// tag::clauses_load_csv_linenumber[]
749756
[source, cypher]
750757
----
751758
LOAD CSV FROM 'file:///artists.csv' AS row
752759
RETURN linenumber() AS number, row
753760
----
761+
// end::clauses_load_csv_linenumber[]
754762
755763
.Result
756764
[role="queryresult",options="header,footer",cols="2*<m"]
@@ -781,11 +789,13 @@ The xref:functions/load-csv.adoc#functions-file[`file()`] function provides the
781789
----
782790
783791
.Query
792+
// tag::clauses_load_csv_file[]
784793
[source, cypher, role=test-result-skip]
785794
----
786795
LOAD CSV FROM 'file:///artists.csv' AS row
787796
RETURN DISTINCT file() AS path
788797
----
798+
// end::clauses_load_csv_file[]
789799
790800
.Result
791801
[role="queryresult",options="header,footer",cols="1*<m"]
@@ -832,6 +842,7 @@ Id,Name,Year
832842
----
833843
834844
.Query
845+
// tag::clauses_load_csv_headers[]
835846
[source, cypher]
836847
----
837848
LOAD CSV WITH HEADERS FROM 'file:///artists-with-headers.csv' AS row
@@ -840,6 +851,7 @@ RETURN
840851
a.name AS name,
841852
a.year AS year
842853
----
854+
// end::clauses_load_csv_headers[]
843855
844856
.Result
845857
[role="queryresult",options="header,footer",cols="2*<m"]
@@ -875,11 +887,13 @@ If you try to import a file that doesn't use `,` as field delimiter and you also
875887
----
876888
877889
.Query
890+
// tag::clauses_load_csv_field_terminator[]
878891
[source, cypher]
879892
----
880893
LOAD CSV FROM 'file:///artists-fieldterminator.csv' AS row FIELDTERMINATOR ';'
881894
MERGE (:Artist {name: row[1], year: toInteger(row[2])})
882895
----
896+
// end::clauses_load_csv_field_terminator[]
883897
884898
.Result
885899
[source, role="queryresult"]

modules/ROOT/pages/clauses/order-by.adoc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ CREATE
4040
`ORDER BY` is used to sort the output.
4141

4242
.Query
43-
tag::clauses_order_by[]
43+
// tag::clauses_order_by[]
4444
[source, cypher]
4545
----
4646
MATCH (n)
4747
RETURN n.name, n.age
4848
ORDER BY n.name
4949
----
50-
end::clauses_order_by[]
50+
// end::clauses_order_by[]
5151

5252
The nodes are returned, sorted by their name.
5353

@@ -69,14 +69,14 @@ You can order by multiple properties by stating each variable in the `ORDER BY`
6969
Cypher will sort the result by the first variable listed, and for equals values, go to the next property in the `ORDER BY` clause, and so on.
7070

7171
.Query
72-
tag::clauses_order_by_multiple[]
72+
// tag::clauses_order_by_multiple[]
7373
[source, cypher]
7474
----
7575
MATCH (n)
7676
RETURN n.name, n.age
7777
ORDER BY n.age, n.name
7878
----
79-
end::clauses_order_by_multiple[]
79+
// end::clauses_order_by_multiple[]
8080

8181
This returns the nodes, sorted first by their age, and then by their name.
8282

@@ -250,14 +250,14 @@ Read more about this capability in xref::indexes/search-performance-indexes/usin
250250

251251

252252
.Standalone use of `ORDER BY`
253-
tag::clauses_order_by_standalone[]
253+
// tag::clauses_order_by_standalone[]
254254
[source, cypher]
255255
----
256256
MATCH (n)
257257
ORDER BY n.name
258258
RETURN collect(n.name) AS names
259259
----
260-
end::clauses_order_by_standalone[]
260+
// end::clauses_order_by_standalone[]
261261

262262
.Result
263263
[role="queryresult",options="header,footer",cols="1*<m"]
@@ -270,7 +270,7 @@ end::clauses_order_by_standalone[]
270270
The following query orders all nodes by `name` descending, skips the first row and limits the results to one row.
271271

272272
.`ORDER BY` used in conjunction with `SKIP` and `LIMIT`
273-
tag::clauses_order_by_descending[]
273+
// tag::clauses_order_by_descending[]
274274
[source, cypher]
275275
----
276276
MATCH (n)
@@ -279,7 +279,7 @@ SKIP 1
279279
LIMIT 1
280280
RETURN n.name AS name
281281
----
282-
end::clauses_order_by_descending[]
282+
// end::clauses_order_by_descending[]
283283

284284
.Result
285285
[role="queryresult",options="header,footer",cols="1*<m"]

modules/ROOT/pages/clauses/skip.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ d|Rows: 2
6969
The following query returns the middle two rows, with `SKIP` skipping the first and xref:clauses/limit.adoc[`LIMIT`] removing the final two.
7070
7171
.Query
72+
// tag::clauses_skip[]
7273
[source, cypher]
73-
tag::clauses_skip[]
7474
----
7575
MATCH (n)
7676
RETURN n.name
7777
ORDER BY n.name
7878
SKIP 1
7979
LIMIT 2
8080
----
81-
end::clauses_skip[]
81+
// end::clauses_skip[]
8282
8383
.Result
8484
[role="queryresult",options="header,footer",cols="1*<m"]
@@ -128,14 +128,14 @@ d|Rows: 4
128128
`SKIP` can be used as a standalone clause, or in conjunction with xref:clauses/order-by.adoc[`ORDER BY`] or xref:clauses/limit.adoc[`LIMIT`].
129129

130130
.Standalone use of `SKIP`
131-
tag::clauses_skip_standalone[]
131+
// tag::clauses_skip_standalone[]
132132
[source, cypher]
133133
----
134134
MATCH (n)
135135
SKIP 2
136136
RETURN collect(n.name) AS names
137137
----
138-
end::clauses_skip_standalone[]
138+
// end::clauses_skip_standalone[]
139139

140140
.Result
141141
[role="queryresult",options="header,footer",cols="1*<m"]
@@ -173,7 +173,7 @@ RETURN collect(n.name) AS names
173173
`OFFSET` was introduced as part of Cypher's xref:appendix/gql-conformance/index.adoc[] and can be used as a synonym to `SKIP`.
174174

175175
.Query
176-
tag::clauses_skip_offset[]
176+
// tag::clauses_skip_offset[]
177177
[source, cypher]
178178
----
179179
MATCH (n)
@@ -182,7 +182,7 @@ OFFSET 2
182182
LIMIT 2
183183
RETURN collect(n.name) AS names
184184
----
185-
end::clauses_skip_offset[]
185+
// end::clauses_skip_offset[]
186186

187187
.Result
188188
[role="queryresult",options="header,footer",cols="1*<m"]

modules/ROOT/pages/clauses/unwind.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ The `UNWIND` clause requires you to specify a new name for the inner values.
2929
We want to transform the literal list into rows named `x` and return them.
3030

3131
.Query
32-
tag::clauses_unwind_list[]
32+
// tag::clauses_unwind_list[]
3333
[source, cypher]
3434
----
3535
UNWIND [1, 2, 3, null] AS x
3636
RETURN x, 'val' AS y
3737
----
38-
end::clauses_unwind_list[]
38+
// end::clauses_unwind_list[]
3939

4040
Each value of the original list -- including `null` -- is returned as an individual row.
4141

@@ -111,15 +111,15 @@ The two lists -- _a_ and _b_ -- are concatenated to form a new list, which is th
111111
Multiple `UNWIND` clauses can be chained to unwind nested list elements.
112112

113113
.Query
114-
tag::clauses_unwind_nested_list[]
114+
// tag::clauses_unwind_nested_list[]
115115
[source, cypher]
116116
----
117117
WITH [[1, 2], [3, 4], 5] AS nested
118118
UNWIND nested AS x
119119
UNWIND x AS y
120120
RETURN y
121121
----
122-
end::clauses_unwind_nested_list[]
122+
// end::clauses_unwind_nested_list[]
123123

124124
The first `UNWIND` results in three rows for `x`, each of which contains an element of the original list (two of which are also lists); namely, `[1, 2]`, `[3, 4]`, and `5`.
125125
The second `UNWIND` then operates on each of these rows in turn, resulting in five rows for `y`.
@@ -216,15 +216,15 @@ Create a number of nodes and relationships from a parameter-list without using `
216216
----
217217

218218
.Query
219-
tag::clauses_unwind_create_nodes[]
219+
// tag::clauses_unwind_create_nodes[]
220220
[source, cypher]
221221
----
222222
UNWIND $events AS event
223223
MERGE (y:Year {year: event.year})
224224
MERGE (y)<-[:IN]-(e:Event {id: event.id})
225225
RETURN e.id AS x ORDER BY x
226226
----
227-
end::clauses_unwind_create_nodes[]
227+
// end::clauses_unwind_create_nodes[]
228228

229229
Each value of the original list is unwound and passed through `MERGE` to find or create the nodes and relationships.
230230

modules/ROOT/pages/clauses/use.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,27 @@ CREATE ALIAS `myComposite`.`myConstituent` FOR DATABASE `myDatabase`;
7171
This example assumes that the DBMS contains a database named `myDatabase`:
7272

7373
.Query
74-
tag::clauses_use[]
74+
// tag::clauses_use[]
7575
[source, cypher]
7676
----
7777
USE myDatabase
7878
MATCH (n) RETURN n
7979
----
80-
end::clauses_use[]
80+
// end::clauses_use[]
8181

8282
[[query-use-examples-query-composite-database-constituent-graph]]
8383
=== Query a composite database constituent graph
8484

8585
In this example it is assumed that the DBMS contains a composite database named `myComposite`, which includes an alias named `myConstituent`:
8686

8787
.Query
88-
tag::clauses_use_composite[]
88+
// tag::clauses_use_composite[]
8989
[source, cypher]
9090
----
9191
USE myComposite.myConstituent
9292
MATCH (n) RETURN n
9393
----
94-
end::clauses_use_composite[]
94+
// end::clauses_use_composite[]
9595

9696

9797
[[query-use-examples-query-composite-database-constituent-graph-dynamically]]

0 commit comments

Comments
 (0)