【问题标题】:dijkstra function of orientdb is not working with tinkerpop APIorientdb 的 dijkstra 函数不适用于 tinkerpop API
【发布时间】:2016-09-01 09:18:37
【问题描述】:

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

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

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

【问题讨论】:

  • 你用的是什么版本的orientDb?
  • orientdb-community-2.2.7

标签: orientdb tinkerpop tinkerpop-blueprint


【解决方案1】:

我使用了这段代码,它成功了

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

希望对你有帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多