Reputation: 148
When I am working with an Edge
, there is a scenario where I want to find which Node
is it, and I only have Memgraph node ID
, and not the whole object. And I would want further to make a query with those Nodes
I got from Edge
property, but I can't as I can't make a query towards database with Memgraph ID of Node
.
In other words, it would be good to return Node
instead of Node-id in Memgraph
when calling edge.start_node
or edge.end_node
Upvotes: 0
Views: 134
Reputation: 148
The reason for this kind of implementation is twofold. Since the memgraph as per bolt specification returns not nodes but nodes ID when fetching edge, the only way to tackle this issue is from the client-side.
Note there can be two solutions:
One would be to implicitly change every user's query to fetch nodes as well and to bind the nodes to edges, which would make another layer of query parsing from the client's side. That would be very complicated (you would need to return all the nodes that could be found in edges). Or make it easier but slower, for every fetched edge perform another query that would get nodes (if that didn't already happen). This solution is needlessly complex
Another solution would be to keep the graph structure in memory so that whenever a user would fetch nodes, the structure is in memory and mapped (if possible) to edges. This is how neo4j does it. The issue with this is an obvious inconsistency: sometimes you get an ID and sometimes you get a node.
Upvotes: 0