-
Notifications
You must be signed in to change notification settings - Fork 5
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
Specific structural types #42
Conversation
As per the documentation, https://neo4j.com/docs/cypher-manual/4.4/clauses/delete/ there is only variables in there.
It does break some stuff. How will you build this example? MATCH (x:Node)
WITH x
MATCH (x) - [] -> (y:Node)
RETURN x, y Do we have to build a new Query node with the name of the variable but no label instead of just passing the variable? That seems counterintuitive to me. Also, why should the StructuralType be handled differently from a MapType? You can request properties on a name, but not a relationship? Continuing this logic in PHP userland, In my opinion as an end user, one of the main advantages of the query builder is reuse of common objects and patterns between clauses instead of having to keep track of the details such as names etc ourselves. That advantage is now lost for Variables and Structural types. |
You make a good point, I never thought of passing variables as nodes. I indeed always made new nodes instead of using the variables. I think something like class Variable {
protected/private function toNode(): Node {
return Query::node()->named($this);
}
public function relationship(....) {
return $this->toNode()->relationship(...);
}
/*....*/
withProperties(...) {
return $this->toNode()->withProperties(...);
}
/*etc*/
} Do you agree? |
That sounds like a great compromise to me! Thanks |
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 see nothing strange, but I think it would be good if @transistive also looked at it.
How should be release this version? There are some very minor BC-breaks, but do they warrant a MAJOR release?
I believe the only BC break that might hinder end-users is the renaming All other changes only break things that users should not do in the first place. See also this funny comic |
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.
Looks great to me! 🥳
EDIT: This pr does the following:
HasRelationshipsType
andHasPropertiesType
interfaces that extend theStructuralType
interface.DeleteClause
to be only variables, similar to how the documentation of CYPHER writes delete clauses. (Note thatDELETE (n:LABEL {property: 'value'})
etc. do not work, onlyDELETE n
orDELETE (n)
, where the latter is functionally the same as the former.)RelationshipType
andNodeType
to be more specific.END OF EDIT
Make more specific structural types (HasPropertiesType and HasRelationsType) and let all three structural types implement StructuralType.
Also some codestyle fixes.
I also removed the structural types from
Variable
because I thought these did not make much sense. In my opinion, a variable can be the name of a structural type, but it is not itself a structural type. Maybe this does break some stuff of @transistive ? I am open for suggestions (as always).