Skip to content

Conversation

@gem-neo4j
Copy link
Contributor

No description provided.

@neo-technology-commit-status-publisher
Copy link
Collaborator

Looks like you've updated the documentation!

Check out your changes at https://neo4j-docs-cypher-182.surge.sh

@JPryce-Aklundh JPryce-Aklundh self-assigned this Nov 15, 2022
@Lojjs Lojjs self-assigned this Nov 15, 2022
@gem-neo4j
Copy link
Contributor Author

@gem-neo4j gem-neo4j force-pushed the 5.x_exists_and_count_documentation branch from 5f771e9 to f4de44c Compare November 17, 2022 14:22
@gem-neo4j gem-neo4j marked this pull request as draft November 17, 2022 14:32
@gem-neo4j
Copy link
Contributor Author

Turned it into a draft as this is targeting 5.3 release :)

Copy link
Contributor

@Lojjs Lojjs left a comment

Choose a reason for hiding this comment

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

Overall good, but there are some additional things I think would be good to include/clarify.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not your fault, but I noticed that the Subquery expressions (and some other Expressions sections as well) are missing from this menu: https://neo4j-docs-cypher-182.surge.sh/cypher-manual/5.0/syntax/. In the published docs it is also broken, but in a different way. Perhaps something we should do a card to the docs team for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice spotting :) Easy enough for me to add the links, what is broken though? I can make a card reporting that

Copy link
Contributor

@Lojjs Lojjs Nov 18, 2022

Choose a reason for hiding this comment

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

In the published docs here https://neo4j.com/docs/cypher-manual/current/syntax/ there are another subset of the links under Expressions that are missing, weirdly enough

Copy link
Contributor

@Lojjs Lojjs left a comment

Choose a reason for hiding this comment

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

Looks good now :)

@gem-neo4j gem-neo4j force-pushed the 5.x_exists_and_count_documentation branch 2 times, most recently from 91688c4 to 25b4a97 Compare November 24, 2022 09:56
@gem-neo4j gem-neo4j marked this pull request as ready for review November 24, 2022 09:57
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Any non-writing query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted
Any non-writing query is allowed. `EXISTS` subqueries differ from regular queries in that the final `RETURN` clause may be omitted,

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `EXISTS` consists of only
It is worth noting that the `MATCH` keyword can be omitted in subqueries in cases where the `EXISTS` consists of only

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
unlike the case for `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[where they require importing].
In this regard, `EXISTS` subqueries are different from `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[which do require importing].

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the "at least" part necessary here?

Suggested change
Here is the result that shows if at least one row is returned from the union of 2 queries.
The result of returning one row from a union of two queries is shown below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, this one doesn't make sense either, it isn't the result of returning one row, it is that if one of the union branches was to return at least one row, the entire exists evaluates to true

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a different way to say "will not go out of scope" here? I am a little confused by the sentence. Maybe it could be rephrased like this:

Suggested change
Variables from the outside scope will not go out of scope when using a `WITH`, they are visible for the entirety of the subquery,
Variables from the outside scope are visible for the entirety of the subquery when using a `WITH` clause.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't quite what I meant, so variables are visible for the entire subquery, even if you were to use a WITH clause

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Shadowing of an outside scope variable is when a newly introduced variable inside the inner scope is defined with the same name as one from the outside scope.
An outside scope variable is shadowed when a newly introduced variable within the inner scope is defined with the same variable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Here is an example where a `WITH` clause introduces a new variable,
In the below example, a `WITH` clause introduces a new variable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
and the outer scope variable person being referenced is still available after:
The outer scope variable `person` referenced in the main query is still available after the subquery.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It isn't available "after" the subquery, but after the WITH clause though 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
`COUNT` subqueries do not require a `RETURN` clause at the end of the subquery, but if one is present, it does not
`COUNT` subqueries do not require a `RETURN` clause at the end of the subquery. If one is present, it does not need to be aliased.```

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
need to be aliased, a difference from xref::clauses/call-subquery.adoc[`CALL` subqueries].
This is a difference compared to from xref::clauses/call-subquery.adoc[`CALL` subqueries].

@gem-neo4j gem-neo4j force-pushed the 5.x_exists_and_count_documentation branch from 6229b45 to 34fd359 Compare November 25, 2022 09:32
Copy link
Collaborator

@JPryce-Aklundh JPryce-Aklundh left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@JPryce-Aklundh JPryce-Aklundh merged commit 00fa04a into neo4j:dev Nov 25, 2022
@JPryce-Aklundh JPryce-Aklundh deleted the 5.x_exists_and_count_documentation branch November 25, 2022 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants