0

The below code is not giving the correct result, am I doing something wrong..?

OrientGraph graph = factory.getTx();

for (OrientVertex v : (Iterable<OrientVertex>) graph.command(
                new OCommandSQL("SELECT dijkstra(#97:1334, #97:1335, 'calculated_length') FROM STRUCTURE")).execute()) {
                      System.out.println("Path " + (ORID)v.getId());
                    }

When I execute the query directly, I am getting correct result. Thanks.

4

1 回答 1

3

我使用了这段代码并且它有效

String query = "select expand(dijkstra) from (SELECT dijkstra(#21:0, #24:0, 'calculated_length') FROM STRUCTURE limit 1)";
Iterable<OrientVertex> it = g.command( new OCommandSQL(query)).execute();
for (OrientVertex v : it) { 
    System.out.println("Path " + (ORID)v.getId());     
}

希望能帮助到你

于 2016-09-01T10:06:09.093 回答