Skip to content

Conversation

@hvub
Copy link
Contributor

@hvub hvub commented Nov 26, 2025

This adds some documentation about potential confusion of some parenthesized expression with path pattern expressions.

While doing so, I could not find documentation of the label expression predicate, so I add some too.

The new SVG, is a manually edit copy of another. I do not have an SVG editor handy, so I was a bit limited. If you have better tools feel free to adjust, of course.

Fixes SURF-165

@hvub hvub force-pushed the not-a-path-pattern-expression branch from acdd42a to 8b4efc1 Compare November 26, 2025 13:18
@neo4j-docops-agent
Copy link
Collaborator

This PR includes documentation updates
View the updated docs at https://neo4j-docs-cypher-1431.surge.sh

New pages:

Updated pages:

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.

Really nice new content, just some minor feedback

2+d|Rows: 5
|===

When '<exp>', then the label expression predicate results in `null`, e.g. if `p` is `null`, then `p:!CEO` results in `null`.
Copy link
Contributor

Choose a reason for hiding this comment

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

It feels like something is missing here, it should not say just When '<exp>' right?

Comment on lines +173 to +182
----
CYPHER 25
MATCH ()-[r]->(p:Person)
UNWIND labels(p) AS label
FILTER label <> "Person"
RETURN COLLECT(label) AS managerLabels
NEXT
MATCH (p)
RETURN p.name AS name, p:$any(managerLabels) AS isManager
----
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice query :)

2+d|Rows: 5
|===

If `r` is `null`, then the label expression predicate, e.g. `r:WORKS_FOR|REPORTS_TO` results in `null`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps you should add the sentence about using coalesce to change nulls to default values here as well. Having read the whole page it is clear, but if someone is looking at this example only it might be a bit confusing that this sentence mentions null and the result below does not

RETURN employee.name AS employee, (p:Person) AS workForAPeron
----

The above query has the same result as teh query that used `p:Person` in stead of `(p:Person)`:
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
The above query has the same result as teh query that used `p:Person` in stead of `(p:Person)`:
The above query has the same result as the query that used `p:Person` instead of `(p:Person)`:

----
MATCH (employee:Person)-[:WORKS_FOR]->(p)
WHERE p:Person
RETURN employee.name AS employee, p:Person AS workForAPeron
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
RETURN employee.name AS employee, p:Person AS workForAPeron
RETURN employee.name AS employee, p:Person AS workForAPerson

.Result
[role="queryresult",options="header,footer",cols="2*<m"]
|===
| employee | workForAPeron
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
| employee | workForAPeron
| employee | workForAPerson

Comment on lines +182 to +185
[source, error]
----
Invalid input 'Node' for `p`. Expected to be Boolean.
----
Copy link
Contributor

Choose a reason for hiding this comment

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

Not necessary for this PR, but we should maybe think about starting to use the GQL errors in the Cypher manual instead.

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.

3 participants