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

Adding edges to existing nodes #36

Open
tradetree opened this issue Jan 4, 2021 · 4 comments
Open

Adding edges to existing nodes #36

tradetree opened this issue Jan 4, 2021 · 4 comments
Labels
question Further information is requested

Comments

@tradetree
Copy link

My development team noticed that there is no way in redisgraph-go to add edges to existing nodes without duplicating the nodes in the process. Please see RedisGraph/redisgraph-py#16 as a reference to this issue within Redis graph in general. The solution described here points to using MATCH (f:%s{%s:'%s'}), (t:%s{%s:'%s'}) CREATE (f)-[:in]->(t) as the way to avoid duplication of nodes. However, we do not find a way within redisgraph-go to make such a transaction? There is basically no 'update' possible to nodes, only create and delete. We can delete old nodes and create new ones with edges, but this is costly and inefficient. Is there any plan to add an UpdateEdge or something similar as AddEdge duplicates nodes?

@swilly22
Copy link
Contributor

swilly22 commented Jan 6, 2021

Hi @tradetree,
Sorry for the confusion, but the Graph, Node and Edge object are primarily used for creating an initial graph, thus to introduce a new edge between two existing nodes please use the graph.query function and provide a query which located the nodes you wish to connect.

The ability you're asking for is more likely to be found in a OGM (Object Graph Mapping) type of a solution.

@tradetree
Copy link
Author

Thanks for the info. We were able to use a query to add an edge between two existing nodes, but the concept of adding or updating relationships like edges this way is kind of confusing. Once objects are committed to a database it should be possible to update them, so I guess I'm just missing something. I searched on OGM via google and read what I could find, but it was only marginally helpful. They compare OGM to ORM, but while I understand ORM this does not quite fit in with that understanding. We are not mapping objects into the graph database, but trying to create objects directly and then update them. Anyway, it appears to make sense to you and there is no other method in redisgraph-go that would be better, so we'll stick to the query method.

@swilly22
Copy link
Contributor

swilly22 commented Jan 7, 2021

@tradetree have you looked into https://github.com/cr0hn/sqerzo ?

@tradetree
Copy link
Author

@tradetree have you looked into https://github.com/cr0hn/sqerzo ?

I will check it out, thanks! But we did get it working with the query method and we have our own mapping now.

@filipecosta90 filipecosta90 added the question Further information is requested label Jun 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants