Bulk/Batch updating/inserting using bulbs and rexster?

866 views Asked by At

I'm using python bulbs with Rexster and OrientDB.

Is there a way to bulk/batch update/insert multiple vertices or edges at the same time?

1

There are 1 answers

1
espeed On

For batch operations, it's usually best to use the Gremlin REPL.

See Marko's blog post on building a A Graph-Based Movie Recommender Engine for examples of how do use the Gremlin REPL for batch loading (note it uses Gremlin 1.x code so you'll need to adapt it for Gremlin 2.x).

Here's Gremlin 2.x code for batch loading from the Gremlin REPL:

gremlin> g = new Neo4jGraph('/tmp/neo4j-test')
==>neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j-test]]
gremlin> bg = new BatchGraph(g, 5)  
==>batchgraph[neo4jgraph[EmbeddedGraphDatabase [/tmp/neo4j-test]]]
gremlin> l = null
==>
gremlin> "abcdefghijklmnopqrstuvwxyz".each { letter ->
gremlin>   v = bg.addVertex(it,[letter:it])
gremlin    if (l != null) bg.addEdge(v, bg.getVertex(l), 'isAfter')
gremlin>   l = letter;};
==>abcdefghijklmnopqrstuvwxyz
gremlin> bg.commit()