Reputation: 743
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
Upvotes: 1
Views: 123
Reputation: 743
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
Upvotes: 1