-
Notifications
You must be signed in to change notification settings - Fork 22
Editorial review #661
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
Editorial review #661
Changes from 7 commits
17ab0bf
cd817be
34906f9
e0fc095
83eaa71
0dc042d
6f021ae
8f1d322
922d188
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,7 @@ | |
|
|
||
| This page describes how to add a link:https://neo4j.com/docs/cypher-manual/current/clauses/create/[`CREATE`] clause with the `Cypher.Create` class. | ||
|
|
||
| To make a `CREATE` clause, first create a valid pattern using the xref:/patterns.adoc[Pattern] class: | ||
|
|
||
| To add the clause, first create a valid pattern using the xref:/patterns.adoc[Pattern] class: | ||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
@@ -39,8 +38,8 @@ This generates the following `CREATE` clause: | |
| CREATE (this:Movie {title: "The Matrix"}) | ||
| ---- | ||
|
|
||
| == Relationships | ||
|
|
||
| == Relationships | ||
|
|
||
| Relationships can be used in a match clause by creating the relevant xref:/patterns.adoc[Pattern]: | ||
|
|
||
|
|
@@ -62,9 +61,9 @@ CREATE (this1:`Person`)-[this0:ACTED_IN]->(this2:`Movie`) | |
|
|
||
| == Update properties | ||
|
|
||
| The clauses `SET` and `REMOVE` can be added with the methods `.set` and `.remove` respectively. | ||
| Add the `SET` and `REMOVE` clauses with the methods `.set` and `.remove` respectively. | ||
|
|
||
| `.set` take tuples of 2 elements, the first being the property to update and the second the value: | ||
| `.set` takes a tuple of two elements - a property to update and a new value: | ||
|
||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
@@ -82,7 +81,6 @@ SET this0.title = $param0 | |
|
|
||
| Multiple properties can be updated by passing multiple tuples. | ||
|
|
||
|
|
||
| `.remove` takes the properties to remove: | ||
rsill-neo4j marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| [source, javascript] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
|
|
||
| This page describes how to create a link:https://neo4j.com/docs/cypher-manual/current/clauses/match/[`MATCH`] clause with the `Cypher.Match` class. | ||
|
|
||
| To create a `MATCH` clause, first create a valid pattern using the xref:/patterns.adoc[Pattern] class and pass it to `Match` constructor: | ||
| To add the clause, first create a valid pattern using the xref:/patterns.adoc[Pattern] class and pass it to the `Match` constructor: | ||
|
||
|
|
||
|
|
||
| [source, javascript] | ||
|
|
@@ -23,7 +23,8 @@ This generates the following `MATCH` clause: | |
| MATCH (this:Movie) | ||
| ---- | ||
|
|
||
| Afterwards, other clauses can be added. For example: | ||
| Afterwards, other clauses can be added. | ||
| For example: | ||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
@@ -32,16 +33,17 @@ const matchQuery = new Cypher.Match(pattern) | |
| .return(movie); | ||
| ---- | ||
|
|
||
| Extra match clauses can also be chained: | ||
| You can also chain extra match clauses: | ||
|
|
||
| [source, javascript] | ||
| ---- | ||
| const matchQuery = new Cypher.Match(pattern).match(pattern2).return(movie) | ||
| ---- | ||
|
|
||
|
|
||
| == Relationships | ||
|
|
||
| Relationships can be used in a match clause by creating the relevant xref:/patterns.adoc[Pattern]: | ||
| You can use relationships in a match clause by creating the relevant xref:/patterns.adoc[Pattern]: | ||
|
|
||
|
|
||
| [source, javascript] | ||
|
|
@@ -58,6 +60,7 @@ const matchQuery = new Cypher.Match(actedInPattern) | |
| MATCH (this0:Person)-[:ACTED_IN]->(this1:Movie) | ||
| ---- | ||
|
|
||
|
|
||
| == Filtering with `WHERE` | ||
|
|
||
| A `WHERE` clause can be appended with the `.where` method, this accepts any predicate: | ||
|
|
@@ -74,7 +77,7 @@ MATCH (this0:Movie) | |
| WHERE title = $param0 | ||
| ---- | ||
|
|
||
| Multiple predicates can be chained by using the `.and` or `.where` method after `.where`: | ||
| You can chain multiple predicates by using the `.and` or `.where` method after `.where`: | ||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
@@ -90,9 +93,10 @@ WHERE this0.title = $param0 | |
| AND this0.year <> $param1 | ||
| ---- | ||
|
|
||
|
|
||
| === Logical filters | ||
|
|
||
| For more complex logical filters, the predicates `Cypher.and`, `Cypher.or`, `Cypher.not` and `Cypher.xor` can be used inside `where`: | ||
| For more complex logical filters, use the `Cypher.and`, `Cypher.or`, `Cypher.not` and `Cypher.xor` predicates inside `where`: | ||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
@@ -111,6 +115,7 @@ MATCH (this0:Movie) | |
| WHERE ((this0.title = $param0 OR this0.year > $param1) AND this0.year <> $param2) | ||
| ---- | ||
|
|
||
|
|
||
| === Filtering properties shorthand | ||
|
|
||
| `.where` also supports passing a variable and an object with variables to check for equality of multiple values in a more concise way: | ||
|
|
@@ -130,7 +135,7 @@ WHERE (this0.id = $param0 AND this0.name = $param1) | |
|
|
||
| == Optional match | ||
|
|
||
| The clause link:https://neo4j.com/docs/cypher-manual/current/clauses/optional-match/[`OPTIONAL MATCH`] can be created in the same manner as `MATCH` by using the class `Cypher.OptionalMatch`: | ||
| You can create the clause link:https://neo4j.com/docs/cypher-manual/current/clauses/optional-match/[`OPTIONAL MATCH`] similarly to `MATCH` by using the class `Cypher.OptionalMatch`: | ||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
@@ -140,7 +145,7 @@ const pattern = new Cypher.Pattern(movie, { labels: ["Movie"] }); | |
| const matchQuery = new Cypher.OptionalMatch(pattern); | ||
| ---- | ||
|
|
||
| Alternatively, an existing `Match` instance can be transformed into an `OptionalMatch` with the method `.optional()`: | ||
| Alternatively, you can transform an existing `Match` instance into an `OptionalMatch` with the method `.optional()`: | ||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
@@ -150,9 +155,10 @@ const pattern = new Cypher.Pattern(movie, { labels: ["Movie"] }); | |
| const matchQuery = new Cypher.Match(pattern).optional(); | ||
| ---- | ||
|
|
||
|
|
||
| == Shortest paths | ||
|
|
||
| link:https://neo4j.com/docs/cypher-manual/current/patterns/shortest-paths/#shortest[Shortest paths] and its variations can be added in a Match clause with the following methods in `Cypher.Match`: | ||
| You can add link:https://neo4j.com/docs/cypher-manual/current/patterns/shortest-paths/#shortest[Shortest paths] and its variations in a Match clause with the following methods in `Cypher.Match`: | ||
|
|
||
| * `.shortest(k)` | ||
| * `.shortestGroups(k)` | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
|
|
||
| This page describes how to create a link:https://neo4j.com/docs/cypher-manual/current/clauses/merge/[`MERGE`] clause with the `Cypher.Merge` class. | ||
|
|
||
| To create a `Merge` clause, first create a valid pattern using the xref:/patterns.adoc[Pattern] class and pass it to `Merge` constructor: | ||
| To add a `Merge` clause, first create a valid pattern using the xref:/patterns.adoc[Pattern] class and pass it to `Merge` constructor: | ||
|
|
||
|
|
||
| [source, javascript] | ||
|
|
@@ -24,7 +24,8 @@ This generates the following `MERGE` clause: | |
| MERGE (this:Movie)-[:ACTED_IN]->(this1) | ||
| ---- | ||
|
|
||
| Afterwards, other clauses can be added. For example: | ||
| Afterwards, you can add other clauses. | ||
| For example: | ||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
@@ -40,9 +41,10 @@ WHERE this.name = $param1 | |
| return this | ||
| ---- | ||
|
|
||
| == On Create / On Match | ||
| == `ON CREATE` and `ON MATCH` | ||
|
|
||
| A `MERGE` statement can be followed by `ON CREATE SET` and `ON MATCH SET`, this can be achieved with the methods `onCreateSet` and `onMatchSet` respectively: | ||
| `ON CREATE SET` and `ON MATCH SET` can follow a `MERGE` statement. | ||
| You can achieve this with the methods `onCreateSet` and `onMatchSet` respectively: | ||
|
||
|
|
||
| [source, javascript] | ||
| ---- | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This page relates to
CREATEclause, but I feel it may still be confusing to just refer to it as "the clause". In many places we need to either use multiple clauses or we may reference other clauses, so even at the risk of it being a bit verbose, I'd prefer for the create to be explicitly referenced