简体   繁体   中英

How to get out edges with label/class over OrientDB java api

I want to get the out edges starting with one vertex using one or multiple classes/labels over the java api.

This is my example code, which causes NPE. I tried using Edge and 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;
}

Error:

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)

I try to reproduce your example and it works.

在此处输入图片说明

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM