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.

Michela Bonizzi
  • 2,622
  • 1
  • 9
  • 16
Chinnadurai_V
  • 90
  • 1
  • 10

1 Answers1

3

I used this code and it worked

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

Hope it helps

Alessandro Rota
  • 3,560
  • 1
  • 8
  • 10