-
Notifications
You must be signed in to change notification settings - Fork 2
Configuration of JanusGraph
Here is a guide of configuring JanusGraph, an implementation of Tinkerpop Gremlin Server.
If you try to insert FoundNode with a lot of node or link attributes, the request can fail because it contains too many variable bindings. In that case, you have to increase the max number of bound variables.
To do that, edit the config file of Gremlin Server (e.g. gremlin-server.yaml) like the following
processors:
- { className: org.apache.tinkerpop.gremlin.server.op.standard.StandardOpProcessor, config: { maxParameters: 128 }}
Pass big enough maxParameters
field to StandardOpProcessor
.
net-spider often searches the graph database by node ID. In the graph database, the node ID is stored as a vertex attribute named @node_id
by default.
We recommend making an index for the @node_id
attribute. With JanusGraph, insert the following code to your Gremlin Server script (usually located under scripts
directory).
graph.tx().rollback();
mg = graph.openManagement();
if(mg.getGraphIndex("byNodeId") == null) {
println("--- get fnode");
fnode = mg.getVertexLabel("found_node");
if(fnode == null) {
fnode = mg.makeVertexLabel("found_node");
}
println("--- get node_id");
node_id = mg.getPropertyKey("@node_id");
if(node_id == null) {
node_id = mg.makePropertyKey("@node_id").dataType(String.class).make();
}
println("--- make index");
mg.buildIndex("byNodeId", Vertex.class).addKey(node_id).buildCompositeIndex();
println("--- commit");
mg.commit();
}
Make sure to specify the script file in your gremlin-server.yaml (at scriptEngines.gremlin-groovy.scripts
field).
If you want to use a different attribute name for the node ID, you can customize it with nodeIdKey
config field in NetSpider.Spider.Config.