2015-04-01 30 views
0

正如here所述,如果我將[*]in_*:-2 out_*:-2定義爲fetchplan,那麼查詢應該只返回屬性而沒有關於邊的信息。如何在Java API中使用fetchplan?

OrientGraph graph = new OrientGraph(URL, USER, USER); 
    try { 
     Iterable resultList = graph.command(new OSQLSynchQuery("select from #11:0")).setFetchPlan("[*]in_*:-2 out_*:-2").execute(); 
     OrientVertex user = (OrientVertex) resultList.iterator().next(); 
     for (String s : user.getRecord().fieldNames()) { 
      System.out.println(s); 
     } 

     Iterable resultList2 = graph.command(new OSQLSynchQuery("select from #11:0")).execute(); 
     OrientVertex user2 = (OrientVertex) resultList2.iterator().next(); 
     for (String s : user2.getRecord().fieldNames()) { 
      System.out.println(s); 
     } 
    } finally { 
     graph.shutdown(); 
    } 

我有相同的輸出(其包括關於邊緣信息),有和沒有fetchplan。我究竟做錯了什麼?

回答

0

使用網絡協議,Fetch計劃是優化網絡傳輸,而不是排除連接。在上述情況下,OrientDB客戶端將獲取連接的邊緣(如果通過提取計劃排除)。

+0

Hi @Lvca。有沒有一種方法可以查看查詢所提取的內容,而無需獲取連接的邊? – vitorenesduarte 2015-04-02 08:02:53

+1

僅當您啓用二進制協議的跟蹤時:'-Dnetwork.binary.debug = true' – Lvca 2015-04-06 18:17:25