【发布时间】:2015-10-12 06:33:51
【问题描述】:
我首先尝试检查图形中是否存在特定顶点,如果它不存在,那么我正在创建一个新顶点,检查器基于属性,这是以下代码:
public Vertex addVertex(Enum label, Map properties){
Vertex x = null;int fl=0,f=0;
if(properties.size()==0)
return null;
GraphTraversalSource g = graph.traversal();
Set<Enum> keys = properties.keySet();
for(Enum key: keys){
f++;
properties.get(key);
System.out.println("enter");
if(g.V().hasLabel(label.toString()).has(key.toString(),properties.get(key)).next()!=null ){
fl++;
System.out.println("exit");
x= g.V().hasLabel(label.toString()).has(key.toString(),properties.get(key)).next();
System.out.println("exit2");
}
}
if(fl==f){
return x;
}
x=graph.addVertex(T.label,label.toString(),properties);
return x;
}
但我收到以下错误。
Exception in thread "main" org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException
如何解决,任何线索将不胜感激
【问题讨论】:
-
这个问题在 Titan 邮件列表groups.google.com/d/msg/aureliusgraphs/voshQUP2Fbw/QYI6Jx5-AwAJ 上被交叉发布和回答