-
Notifications
You must be signed in to change notification settings - Fork 64
Update MATCH page #1080
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
Update MATCH page #1080
Conversation
gem-neo4j
left a comment
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.
Very nice :D
| ---- | ||
| <1> The `Person` and `Movie` nodes matched in this step are stored in variables. | ||
| which are then passed on to the second row of the query. | ||
| <2> The `movie` variable is here implicitly imported by its occurrence in the `count()` function. |
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.
| <2> The `movie` variable is here implicitly imported by its occurrence in the `count()` function. | |
| <2> The `movies` variable here is implicitly imported by its occurrence in the `count()` function. |
| <2> The `movie` variable is here implicitly imported by its occurrence in the `count()` function. | ||
| The `WITH` clause explicitly imports the `actors` variable. | ||
| <3> An xref:clauses/order-by.adoc[`ORDER BY`] clause orders the results by `movieCount` in descending order, ensuring that the `Person` with the highest number of movies appears at the top, and xref:clauses/limit.adoc[`LIMIT] 1` ensures that all other `Person` nodes are discarded. | ||
| <4> The second MATCH clause finds all `Movie` nodes associated with the `Person` nodes currently bound to the `actors` variable. |
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.
| <4> The second MATCH clause finds all `Movie` nodes associated with the `Person` nodes currently bound to the `actors` variable. | |
| <4> The second `MATCH` clause finds all `Movie` nodes associated with the `Person` nodes currently bound to the `actors` variable. |
| [[match-on-multiple-rel-types]] | ||
| === Match on multiple relationship types | ||
| [[match-on-multiple-relationship-types]] | ||
| === Filter on multiple relationship types |
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.
for nodes, the new heading is "MATCH using label expressions"
makes me wonder if the two could be unified, "MATCH using node label expressions" and "MATCH using relationship label expressions" or something similar
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.
Yep - will do relationship type expressions
|
|
||
| For more information about how to set parameters, see xref:syntax/parameters.adoc[Syntax -> Parameters]. | ||
|
|
||
| For example, the following query creates a relationship which contains a space (`OLD FRIENDS`) between `Martin Sheen` and `Rob Reiner`. |
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.
the "OLD FRIENDS" example got dropped completely, is this intentional?
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.
Yeah - it's pretty niche and seemed better suited the CREATE page if anything.
| 2+|Rows: 1 | ||
| |=== | ||
|
|
||
| For a full list of all label expressions supported by Cypher, see xref:patterns/reference.adoc#label-expressions[Patterns -> Label expressions]. |
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.
| For a full list of all label expressions supported by Cypher, see xref:patterns/reference.adoc#label-expressions[Patterns -> Label expressions]. | |
| For a full list of label expressions supported by Cypher, see xref:patterns/reference.adoc#label-expressions[Patterns -> Label expressions]. |
alternatively, "-full"
|
|
||
| It is possible to match on multiple relationship types by using the pipe symbol (`|`). | ||
| For example: | ||
| It is possible to match for a pattern containing one out of several relationship types using the `OR` symbol, `|`. |
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.
| It is possible to match for a pattern containing one out of several relationship types using the `OR` symbol, `|`. | |
| It is possible to match a pattern containing one of several relationship types using the `OR` symbol, `|`. |
| [[where-predicates]] | ||
| == MATCH with WHERE predicates | ||
|
|
||
| The `MATCH` clause is often paired with a `WHERE` sub-clause, which adds predicates to refine the patterns, making them more specific. |
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.
on "sub-clause" - a quick look at the source files of the cypher manual reveals that we're not using "sub-clause" or "subclause" consistently (15x in 5 files for sub-clause, 7x in 7 files for subclause).
i guess it is sub-clause - but we should follow up with changing the occurrences of ""subclause".
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.
Ok, we can do that.
|
|
||
| A variable can be implicitly carried over to the following clause by being referenced in another operation. | ||
| A variable can also be explicitly passed to the following clause using the xref:clauses/with.adoc[`WITH`] clause. | ||
| If a variable is neither implicitly nor explicitly carried over to its following clause, it will be discarded and unavailable for reference later in the query. |
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.
| If a variable is neither implicitly nor explicitly carried over to its following clause, it will be discarded and unavailable for reference later in the query. | |
| If a variable is neither implicitly nor explicitly carried over to its following clause, it will be discarded and is not available for reference later in the query. |
| <1> The `Person` and `Movie` nodes matched in this step are stored in variables. | ||
| which are then passed on to the second row of the query. |
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.
| <1> The `Person` and `Movie` nodes matched in this step are stored in variables. | |
| which are then passed on to the second row of the query. | |
| <1> The `Person` and `Movie` nodes matched in this step are stored in variables, which are then passed on to the second row of the query. |
| ---- | ||
| <1> The `Person` and `Movie` nodes matched in this step are stored in variables. | ||
| which are then passed on to the second row of the query. | ||
| <2> The `movies` variable is here implicitly imported by its occurrence in the `count()` function. |
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.
| <2> The `movies` variable is here implicitly imported by its occurrence in the `count()` function. | |
| <2> The `movies` variable is implicitly imported by its occurrence in the `count()` function. |
| which are then passed on to the second row of the query. | ||
| <2> The `movies` variable is here implicitly imported by its occurrence in the `count()` function. | ||
| The `WITH` clause explicitly imports the `actors` variable. | ||
| <3> An xref:clauses/order-by.adoc[`ORDER BY`] clause orders the results by `movieCount` in descending order, ensuring that the `Person` with the highest number of movies appears at the top, and xref:clauses/limit.adoc[`LIMIT] 1` ensures that all other `Person` nodes are discarded. |
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.
| <3> An xref:clauses/order-by.adoc[`ORDER BY`] clause orders the results by `movieCount` in descending order, ensuring that the `Person` with the highest number of movies appears at the top, and xref:clauses/limit.adoc[`LIMIT] 1` ensures that all other `Person` nodes are discarded. | |
| <3> An xref:clauses/order-by.adoc[`ORDER BY`] clause orders the results by `movieCount` in descending order, ensuring that the `Person` with the highest number of movies appears at the top, and xref:clauses/limit.adoc[`LIMIT] 1` ensures that all other `Person` nodes are discarded. |
| However, there are cases where you can influence the decisions taken by the query compiler. | ||
| Read more about indexes in xref:indexes/search-performance-indexes/managing-indexes.adoc[], and more about specifying hints to force Neo4j to solve a query in a specific way in xref::indexes/search-performance-indexes/index-hints.adoc[Planner hints and the USING keyword]. | ||
|
|
||
| The `MATCH` clause enables you to define specific patterns that the database will search for within its graph structure. |
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.
general note about "will" - i think there's a style guide rule to avoid it where possible. there are many occurrences in this page, but i can also see them being warranted because a query happens at a certain point in time and then the database operations described happen later. i guess it comes down to personal preference :)
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.
I will keep it for now :)
rsill-neo4j
left a comment
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.
one more suggestion + approval
| For example: | ||
| In Cypher, the behavior of a query is defined by its clauses. | ||
| Each clause takes the current graph state and a table of intermediate results, processes them, and passes the updated graph state and results to the next clause. | ||
| The first clause starts with the graph's initial state and an empty table, while the final clause produces the query's result. |
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.
| The first clause starts with the graph's initial state and an empty table, while the final clause produces the query's result. | |
| The first clause starts with the graph's initial state and an empty table, while the final clause produces the query result. |
|
Thanks for the documentation updates. The preview documentation has now been torn down - reopening this PR will republish it. |
No description provided.