我希望在java api上使用一个或多个类/标签从一个顶点开始出边。
这是我的示例代码,它会导致NPE。 我尝试使用Edge和OrientEdge。
private Iterable<OrientEdge> queryNextEdges(OrientVertex vertex) {
OrientGraphFactory factory = new OrientGraphFactory(
"remote:127.0.0.1:2424/xyz", "admin", "admin"
).setupPool(1, 10);
OrientGraph graph = factory.getTx();
Iterable<OrientEdge> queryResult;
try {
queryResult = (Iterable<OrientEdge>) (OrientEdge) vertex.getEdges(Direction.OUT, "hierarchy");
} finally {
graph.shutdown();
}
return queryResult;
}
错误:
Caused by: java.lang.NullPointerException
at com.tinkerpop.blueprints.impls.orient.OrientVertex.getFieldNames(OrientVertex.java:1042)
at com.tinkerpop.blueprints.impls.orient.OrientVertex.getEdges(OrientVertex.java:810)
at com.tinkerpop.blueprints.impls.orient.OrientVertex.getEdges(OrientVertex.java:782)
at ebs.window.graphLayout.GraphLayoutPresenter.queryNextEdges(GraphLayoutPresenter.java:214)