Skip to content
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

Return Node/Relationship from where method #870

Open
zakjan opened this issue Dec 3, 2023 · 2 comments
Open

Return Node/Relationship from where method #870

zakjan opened this issue Dec 3, 2023 · 2 comments

Comments

@zakjan
Copy link

zakjan commented Dec 3, 2023

Hi,

Currently Node/Relationship.where method is implemented returning PatternElement. Can it return Node/Relationship, similar to Node/Relationship.withProperties?

This is to allow constructing such Node/Relationship in a separate method, to be able to use it where Node/Relationship is expected, not only in match clause.

The simplest way to do this seems to be moving PatternElement.where to ExposesProperties.

@michael-simons
Copy link
Collaborator

But conceptionaly it is the PatternElement that spots the (Inner) where clause.
You can safely cast it.

@zakjan
Copy link
Author

zakjan commented Dec 8, 2023

Ok, it's possible to cast it in the current version.

My point is that users could expect the same behavior for both withProperties and where, because both specify where conditions. Although with a different Cypher syntax.

withProperties and where are almost the same, with a slight conceptual difference that node.where(node...) requires a named node already. Potentially there could be another overloaded where method with lambda (Consumer) argument. Or it could even be the only method, to prevent devs from the mistake of passing another node instance or an arbitrary condition irrelevant to the node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants