Skip to content

Clauses and subclauses #1272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: dev
Choose a base branch
from
85 changes: 59 additions & 26 deletions modules/ROOT/content-nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,65 @@

* xref:clauses/index.adoc[]
** xref:clauses/clause-composition.adoc[]
** xref:clauses/call.adoc[]
** xref:clauses/create.adoc[]
** xref:clauses/delete.adoc[]
** xref:clauses/filter.adoc[]
** xref:clauses/finish.adoc[]
** xref:clauses/foreach.adoc[]
** xref:clauses/let.adoc[]
** xref:clauses/limit.adoc[]
** xref:clauses/load-csv.adoc[]
** xref:clauses/match.adoc[]
** xref:clauses/merge.adoc[]
** xref:clauses/optional-match.adoc[]
** xref:clauses/order-by.adoc[]
** xref:clauses/remove.adoc[]
** xref:clauses/return.adoc[]
** xref:clauses/set.adoc[]
** xref:clauses/listing-functions.adoc[]
** xref:clauses/listing-procedures.adoc[]
** xref:clauses/listing-settings.adoc[]
** xref:clauses/transaction-clauses.adoc#query-listing-transactions[SHOW TRANSACTIONS]
** xref:clauses/skip.adoc[]
** xref:clauses/transaction-clauses.adoc#query-terminate-transactions[TERMINATE TRANSACTIONS]
** xref:clauses/unwind.adoc[]
** xref:clauses/use.adoc[]
** xref:clauses/where.adoc[]
** xref:clauses/with.adoc[]

** xref:clauses/read.adoc[]
*** xref:clauses/filter.adoc[]
*** xref:clauses/match.adoc[]
*** xref:clauses/optional-match.adoc[]

** xref:clauses/projection.adoc[]
*** xref:clauses/finish.adoc[]
*** xref:clauses/let.adoc[]
*** xref:clauses/return.adoc[]
*** xref:clauses/unwind.adoc[]
*** xref:clauses/with.adoc[]

** xref:clauses/projection-read-subclauses.adoc[]
*** xref:clauses/limit.adoc[]
*** xref:clauses/order-by.adoc[]
*** xref:clauses/skip.adoc[]
*** xref:clauses/where.adoc[]

** xref:clauses/write.adoc[]
*** xref:clauses/create.adoc[]
*** xref:clauses/delete.adoc[]
*** xref::clauses/delete.adoc#delete-all-nodes-and-relationships[DETACH DELETE]
*** xref:clauses/foreach.adoc[]
*** xref:clauses/remove.adoc[]
*** xref:clauses/set.adoc[]

** xref:clauses/read-write.adoc[]
*** xref:clauses/merge.adoc[]

** xref:clauses/invocation.adoc[]
*** xref:clauses/call.adoc[CALL (procedure)]
*** xref:clauses/call.adoc#optional-call[OPTIONAL CALL (procedure)]
*** xref:subqueries/call-subquery.adoc[CALL (subquery)]
*** xref:subqueries/call-subquery.adoc#optional-call[OPTIONAL CALL (subquery)]
*** xref:subqueries/subqueries-in-transactions.adoc[]

** xref:clauses/import.adoc[]
*** xref:clauses/load-csv.adoc[]

** xref:clauses/graph-selection.adoc[]
*** xref:clauses/use.adoc[]

** xref:clauses/schema.adoc[]
*** xref:constraints/managing-constraints.adoc#create-constraint[CREATE CONSTRAINT]
*** xref:constraints/managing-constraints.adoc#list-constraints[SHOW CONSTRAINTS]
*** xref:constraints/managing-constraints.adoc#drop-constraint[DROP CONSTRAINTS]
*** xref:indexes/search-performance-indexes/managing-indexes.adoc#create-range-index[CREATE INDEX]
*** xref:indexes/search-performance-indexes/managing-indexes.adoc#list-indexes[SHOW INDEXES]
*** xref:indexes/search-performance-indexes/managing-indexes.adoc#drop-indexes[DROP INDEX]


** xref:clauses/metadata.adoc[]
*** xref:clauses/listing-functions.adoc[]
*** xref:clauses/listing-procedures.adoc[]
*** xref:clauses/listing-settings.adoc[]
*** xref:clauses/transaction-clauses.adoc#query-listing-transactions[SHOW TRANSACTIONS]
*** xref:clauses/transaction-clauses.adoc#query-terminate-transactions[TERMINATE TRANSACTIONS]


* xref:subqueries/index.adoc[]
** xref:subqueries/call-subquery.adoc[]
Expand Down
2 changes: 1 addition & 1 deletion modules/ROOT/pages/appendix/gql-conformance/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For example, the following query is valid in both languages:
[source, cypher]
----
MATCH (a:Actor)-[:ACTED_IN]->(m:Movie)
WHERE a.name = 'Tom Hanks'
WHERE a.name = 'Tom Hanks'
RETURN m.title
----

Expand Down
13 changes: 6 additions & 7 deletions modules/ROOT/pages/appendix/tutorials/advanced-query-tuning.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ In this example you want to write a query to find persons with the name 'Tom' th
[source, cypher, indent=0]
----
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE p.name STARTS WITH 'Tom'
WHERE p.name STARTS WITH 'Tom'
RETURN
p.name AS name,
count(m) AS count
Expand Down Expand Up @@ -656,7 +656,7 @@ We can also see that the `OrderedAggregation` has no `DB Hits`, which means it d
----
PROFILE
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE p.name STARTS WITH 'Tom'
WHERE p.name STARTS WITH 'Tom'
RETURN
p.name AS name,
count(m) AS count
Expand Down Expand Up @@ -808,11 +808,10 @@ Now consider the following refinement to the query:
----
PROFILE
MATCH (p:Person)-[:ACTED_IN]->(m:Movie)
WHERE p.name STARTS WITH 'Tom'
RETURN
p.name AS name,
count(m) AS count
ORDER BY name
WHERE p.name STARTS WITH 'Tom'
RETURN p.name AS name,
count(m) AS count
ORDER BY name
----

.Query Plan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ MATCH
(KevinB:Person {name: 'Kevin Bacon'}),
(Al:Person {name: 'Al Pacino'}),
p = shortestPath((KevinB)-[:ACTED_IN*]-(Al))
WHERE all(r IN relationships(p) WHERE r.role IS NOT NULL)
WHERE all(r IN relationships(p) WHERE r.role IS NOT NULL)
RETURN p
----

Expand Down Expand Up @@ -145,7 +145,7 @@ MATCH
(KevinB:Person {name: 'Kevin Bacon'}),
(Al:Person {name: 'Al Pacino'}),
p = shortestPath((KevinB)-[*]-(Al))
WHERE length(p) > 1
WHERE length(p) > 1
RETURN p
----

Expand Down Expand Up @@ -246,7 +246,7 @@ MATCH
(Al:Person {name: 'Al Pacino'}),
p = shortestPath((KevinB)-[*]-(Al))
WITH p
WHERE length(p) > 1
WHERE length(p) > 1
RETURN p
----

Expand Down
4 changes: 2 additions & 2 deletions modules/ROOT/pages/clauses/call.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ This requires knowing the names of the arguments within a procedure's signature,
[source, cypher]
----
SHOW PROCEDURES YIELD name, signature
WHERE name = 'db.propertyKeys'
WHERE name = 'db.propertyKeys'
RETURN signature
----

Expand All @@ -235,7 +235,7 @@ In the below example, `propertyKey` is aliased as `prop` and then used later in
----
CALL db.propertyKeys() YIELD propertyKey AS prop
MATCH (n)
WHERE n[prop] IS NOT NULL
WHERE n[prop] IS NOT NULL
RETURN prop, count(n) AS numNodes
----

Expand Down
6 changes: 3 additions & 3 deletions modules/ROOT/pages/clauses/filter.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ This `OPTIONAL MATCH` example highlights the differences between the `WHERE` sub
----
UNWIND [32,37,40] AS ageValue
OPTIONAL MATCH (p:Person)
WHERE p.age = ageValue
WHERE p.age = ageValue
RETURN p.name AS name, p.age AS age
----

Expand Down Expand Up @@ -241,7 +241,7 @@ For example, the following two queries are equivalent:
----
UNWIND [1, 2, 3, 4, 5, 6] AS x
WITH x
WHERE x > 2
WHERE x > 2
RETURN x
----

Expand Down Expand Up @@ -275,7 +275,7 @@ Id,Name,Location,Email,BusinessType
----
LOAD CSV WITH HEADERS FROM 'file:///companies.csv' AS row
WITH row
WHERE row.Id IS NOT NULL
WHERE row.Id IS NOT NULL
MERGE (c:Company {id: row.Id})
----

Expand Down
2 changes: 1 addition & 1 deletion modules/ROOT/pages/clauses/foreach.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ This query sets the property `marked` to `true` on all nodes along a path.
[source, cypher, indent=0]
----
MATCH p=(start)-[*]->(finish)
WHERE start.name = 'A' AND finish.name = 'D'
WHERE start.name = 'A' AND finish.name = 'D'
FOREACH (n IN nodes(p) | SET n.marked = true)
----
// end::clauses_foreach_node[]
Expand Down
7 changes: 7 additions & 0 deletions modules/ROOT/pages/clauses/graph-selection.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
= Graph selection clauses
:description: Information about Cypher's graph selection clauses.

Cypher's contains one graph selection clause -- `USE` -- which allows you to select which graph a query, or query part, is executed against.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Cypher's contains one graph selection clause -- `USE` -- which allows you to select which graph a query, or query part, is executed against.
Cypher contains one graph selection clause -- `USE` -- which allows you to select which graph a query, or query part, is executed against.

i'd say it's preference, but maybe "a" (or even "a single") instead of "one"?

For more information, see:

* xref:clauses/use.adoc[`USE`]
12 changes: 12 additions & 0 deletions modules/ROOT/pages/clauses/import.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
= Import clauses
:description: Information about Cypher's import clauses.

Cypher's contains one clause to import data -- `LOAD CSV` -- which allows you to load csv into a graph.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Cypher's contains one clause to import data -- `LOAD CSV` -- which allows you to load csv into a graph.
Cypher contains one clause to import data -- `LOAD CSV` -- which allows you to load csv into a graph.

same here (a vs a single vs one)

For more information, see:

* xref:clauses/load-csv.adoc[`LOAD CSV`]

[NOTE]
There are several ways to import data into your Neo4j instance.
For a comparison of all available methods, see the link:https://neo4j.com/docs/getting-started/data-import/#_methods_comparison[Getting Started Guide -> Import data into Neo4j -> Methods comparison].

Loading