-
Notifications
You must be signed in to change notification settings - Fork 49
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
Question re deleting relationships #112
Comments
Andy2003
added a commit
to Andy2003/neo4j-graphql-java
that referenced
this issue
Nov 12, 2020
The generated Cypher for your issue is correct: Schema type User
{
name: String!
uuid: ID!
associates: [User!] @relation(name:"ASSOCIATES_WITH", direction:BOTH)
} Data: CREATE
(pete:User{ name: 'Pete', uuid: '1' }),
(fred:User{ name: 'Fred', uuid: '2' }),
(harry:User{ name: 'Harry', uuid: '3' }),
(pete)<-[:ASSOCIATES_WITH]-(fred),
(fred)<-[:ASSOCIATES_WITH]-(harry) Mutation mutation {
deleteUserAssociates(uuid: "2", associates: ["1", "3"]) {
name
associates { name uuid }
}
} Generated Cypher: MATCH (from: User { uuid: $fromUuid })
MATCH (to: User) WHERE to.uuid IN $toAssociates
MATCH (from)-[r: ASSOCIATES_WITH]-(to)
DELETE r
WITH DISTINCT from AS deleteUserAssociates
RETURN deleteUserAssociates {
.name,
associates: [(deleteUserAssociates)-[: ASSOCIATES_WITH]-(deleteUserAssociatesAssociates: User) | deleteUserAssociatesAssociates {
.name,
.uuid
}]
} AS deleteUserAssociates |
Andy2003
added a commit
to Andy2003/neo4j-graphql-java
that referenced
this issue
Nov 12, 2020
Andy2003
added a commit
that referenced
this issue
Apr 13, 2021
Andy2003
added a commit
that referenced
this issue
Apr 13, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a simplified schema of:
specifically the direction is BOTH, meaning I'm attempting a "symmetrical" relationship.
This is working fine in so much as when I create a graph like:
the query like
query { user(uuid: $uuid) { uuid, name, associates { name uuid } } }
for the uuid for "Fred" will return both "Pete" and "Harry", which are out and in links respectively.The mutation for deleting
deletePersonAssociates
is still "directional", in that it takes the ID (uuid in my case) of the "from" side of a link, and the list of IDs of associates to delete. In order to use this I must know the direction still. ie from the ID (uuid) of "Fred" in my graph I can not delete the link to "Harry". In order to delete the link between Fred and Harry I need to do deletePersonAssociates using the ID of the "from" side, so Harry to Fred.Not sure if this is deliberate, but it means that my "application" layer still needs to understand the directionality of the links.
Have I missed something here?
Cheers,
Michael
The text was updated successfully, but these errors were encountered: