자바 콘솔에서 두 정점 사이의 가장 짧은 경로에 인쇄하고 싶습니다. 나는 아무것도 인쇄 할 수 없거나 그렇게 할 수있는 방법이 있다면 감사 할 것입니다.orientdb를 사용하여 자바 콘솔에 최단 경로 인쇄
String subquery = "Select shortestpath(17:10, 17:14, BOTH) ";
Iterable<OrientVertex> result = orientDBGraph.command(new OSQLSynchQuery<OrientVertex>(subquery)).execute();
Assert.assertTrue(result.iterator().hasNext());
System.out.println(result);
for (OrientVertex d : result) {
System.out.println("Shortest path from " + ((OrientVertex) d.getProperty("$current")).getProperty("name") + " and "
+ ((Iterable<OrientVertex>) d.getProperty("$target")).iterator().next().getProperty("name") + " is: "
+ d.getProperty("path"));
}
사용중인 버전은 무엇? 전체 코드와 출력을 게시 할 수 있습니까? 오류가 있습니까? –