orientdb 的 dijkstra 函数不适用于 tinkerpop API

dijkstra function of orientdb is not working with tinkerpop API

下面的代码没有给出正确的结果,我做错了吗..?

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());
                    }

当我直接执行查询时,我得到了正确的结果。谢谢

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

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());     
}

希望对您有所帮助