APOC Lib for AWS Neptune

0

I am looking for a simple way in AWS Neptune to clone a sub-graph (including relationships). In neo4j this can be done used with the convenience library APOC.

已提问 1 年前314 查看次数
2 回答
0

The method for cloning a subgraph in Neptune will depend on the size of the subgraph. Smaller subgraphs can be duplicated using a method similar to what is detailed in this StackOverflow post: https://stackoverflow.com/questions/51900116/gremlin-clone-a-node-and-its-edges

Larger subgraphs may require using Neptune's Export utility [1], along with the method to provide a traversal to filter all of the relevant vertices and edges for export. This would provide the exported data in Neptune's bulk load CSV format that could then be modified and loaded back into Neptune using the bulk loader feature.

[1] https://docs.aws.amazon.com/neptune/latest/userguide/neptune-export.html

profile pictureAWS
已回答 1 年前
-1

In AWS Neptune, you can use the Gremlin traversal language to clone a sub-graph (including relationships).

Here's an example of how you can do this:


// Define the starting vertex for the sub-graph you want to clone
g.V().has('vertex_id', '12345').as('original')

// Use the `clone` step to create a copy of the original vertex
.clone().as('clone')

// Use the `addE` step to add edges from the original vertex to the clone
.addE('relationship_label').from('original').to('clone')

You can also use the store step to save the cloned sub-graph to a variable for further processing or to persist it to a new location in the graph.

g.V().has('vertex_id', '12345').as('original').clone().store('cloned_subgraph')
已回答 1 年前
  • clone() is not a step in TinkerPop Gremlin, but an internal method used primarily when building VertexProgram classes for OLAP computation. It should not be used when writing Gremlin queries, as all of the non-JVM clients will not support it. Instead, opt for the other methods suggested in this post.

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则