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.

asked a year ago303 views
2 Answers
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
answered a year ago
-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')
answered a year ago
  • 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.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions