0

I have a Neptune DB with a graph representation of my test network. I’m using bulk loader to generate the files and updating the graph. Now let’s say a device moved from one switch to another. And when I reload the graph, the edge is retained between the device and old switch. Is there a way to drop all the edges for updated vertices before load to deal with that?

Kelvin Lawrence
  • 14,674
  • 2
  • 16
  • 38
ak97
  • 15
  • 1
  • 6

1 Answers1

1

Neptune's bulk loader is either append-only or can update properties of single-cardinality in Property Graph. It doesn't have a means to delete data. If you need to remove edges, you'll need to do this via the query languages. Using Gremlin, you could do:

updatedNodeList = [<your list of vertex IDs>]

g.V(updatedNodeList).bothE().drop()

This would drop all edges related to the vertices you want to update. If you want to be more specific, you can add filters to select specific edges based on label or properties:

g.V(updatedNodeList).bothE("label1","label2").
     has("propertyKey1","propertyValue1").drop()

If the updatedNodeList is large (more than a few thousand), you want to split these up into separate batches and issue separate drop() queries. In Neptune, you can take advantage of concurrency and use threading/multi-processing to issue parallel queries in batches to drive faster drops.

Taylor Riggan
  • 1,963
  • 6
  • 12