I initialize gremlin-script-engine with janus-plugin in this way:
GremlinScriptEngineManager engineManager = new DefaultGremlinScriptEngineManager();
engineManager.addPlugin(JanusGraphGremlinPlugin.instance());
engine = engineManager.getEngineByName("gremlin-groovy");
Engine normally evaluates queries with some janus elements (e.g. Multiplicity.ONE2MANY
):
qu = "mgmt.makeEdgeLabel('"+ TEST_EDGE_LABEL+"').multiplicity(ONE2MANY).make();";
engine.evalWithManagementTransaction(qu);
... but for the query:
qu = "mgmt.makePropertyKey('"+TEST_PROPERTY_KEY+"')"
+ ".dataType(String.class).cardinality(Cardinality.SINGLE).make();";
I get:
MissingPropertyException: No such property: SINGLE for class: org.apache.tinkerpop.gremlin.structure.VertexProperty$Cardinality
It seems that the script-engine tries to use org.apache.tinkerpop.gremlin.structure.VertexProperty$Cardinality
and not janus one org.janusgraph.core.Cardinality
.
PS: If I use full name of class org.janusgraph.core.Cardinality.SINGLE
or only value of Cardinality
enum (e.g. just SINGLE
) in query then all works fine.
How could I remove tinkerpop imports or force script-engine to use janus imports from plugin... or it makes sense to change gremlin-queries?