Wozilla
Wozilla

Reputation: 61

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)

Upvotes: 0

Views: 316

Answers (1)

Alessandro Rota
Alessandro Rota

Reputation: 3570

I try to reproduce your example and it works.

enter image description here

Hope it helps.

Upvotes: 2

Related Questions