1

I'm trying to populate my graph on IBM Graph service using gremlin queries. I'm using addVertex and I'm doing it in batches. The gremlin I'm using looks like this and it seems slow

{"gremlin": 
    "def g = graph.traversal(); 
    graph.addVertex(T.label, "foo")";
    .
    .
    .
}

Is there a way to speed this up

4

1 回答 1

1

The problem with this script is that it will be compiled every time and that takes time. If you have 100's of these then the time to compile each one will definitely add up. A Better way to do is to write the script once and then bind the variables in a bindings object.

{
  "gremlin": "def g = graph.traversal();graph.addVertex(T.label, name)",
  "bindings": { "name": "foo" }
}

This technique will pretty much work with any database that's built on top of Tinkerpop and uses Gremlin as a DSL

于 2016-08-25T22:29:04.233 回答