use of com.tinkerpop.pipes.util.Pipeline in project gremlin by tinkerpop.
the class GremlinGroovyScriptEngineTest method testUTF8Query.
public void testUTF8Query() throws Exception {
TinkerGraph graph = new TinkerGraph();
Index<Vertex> index = graph.createIndex("nodes", Vertex.class);
Vertex nonUtf8 = graph.addVertex("1");
nonUtf8.setProperty("name", "marko");
nonUtf8.setProperty("age", 29);
index.put("name", "marko", nonUtf8);
Vertex utf8Name = graph.addVertex("2");
utf8Name.setProperty("name", "轉注");
utf8Name.setProperty("age", 32);
index.put("name", "轉注", utf8Name);
graph.addVertex(utf8Name);
graph.addEdge("12", nonUtf8, utf8Name, "created").setProperty("weight", 0.2f);
ScriptEngine engine = new GremlinGroovyScriptEngine();
engine.put("g", graph);
Pipeline eval = (Pipeline) engine.eval("g.idx(\"nodes\")[['name' : 'marko']]");
assertEquals(nonUtf8, eval.next());
eval = (Pipeline) engine.eval("g.idx(\"nodes\")[['name' : '轉注']]");
assertEquals(utf8Name, eval.next());
}
Aggregations