如何在Java中使用GremlinPipeLine sideEffect [英] How to use GremlinPipeLine sideEffect in java
本文介绍了如何在Java中使用GremlinPipeLine sideEffect的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何使用GremlinPipeLine在Java中实现以下gremlin查询g.V.has("mgrNo",T.neq,"0").sideEffect{g.V.has("empNo",it.mgrNo).next().addEdge("manages",it)}
.
I would like to know how to implement the following gremlin query g.V.has("mgrNo",T.neq,"0").sideEffect{g.V.has("empNo",it.mgrNo).next().addEdge("manages",it)}
in java using GremlinPipeLine .
从.next()开始实施时,我感到困惑.
I getting confused while implementing from the .next() onwards.
GremlinPipeline pipe = new GremlinPipeline(graph).V().has("mgrNo",T.neq,0).sideEffect(new PipeFunction<Vertex, Object>(){
@Override
public Object compute(Vertex vertex) {
@SuppressWarnings("rawtypes")
GremlinPipeline pipeline = (GremlinPipeline) new GremlinPipeline(graph).V().has("empNo", vertex.getProperty("mgrNo")).next();
//code here
return pipeline;
}
});
推荐答案
您几乎拥有了它,实际上您已经有太多的代码了.这应该为您工作:
You almost have it, actually you already have too much code. This should work for you:
new GremlinPipeline(graph).V().has("mgrNo",T.neq,0).sideEffect(new PipeFunction<Vertex, Object>(){
@Override
public Object compute(Vertex vertex) {
@SuppressWarnings("rawtypes")
Vertex mgr = (Vertex) new GremlinPipeline(graph).V().has("empNo", vertex.getProperty("mgrNo")).next();
return mgr.addEdge("manages", vertex);
}
}).iterate();
这篇关于如何在Java中使用GremlinPipeLine sideEffect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文