2013-04-04 26 views
0

我有我嘗試運行此代碼示例:Neo4j的java的查詢攤上了

import org.neo4j.rest.graphdb.RestAPI; 
import org.neo4j.rest.graphdb.RestAPIFacade; 
import org.neo4j.rest.graphdb.query.RestCypherQueryEngine; 
import org.neo4j.rest.graphdb.util.QueryResult; 
import java.util.Map; 
import static org.neo4j.helpers.collection.MapUtil.map; 

public class TestRun { 
    public static void main(String[] args) { 
    System.out.println("starting test"); 
    final RestAPI api = new RestAPIFacade("http://localhost:7474/db/data"); 
    System.out.println("API created"); 
    final RestCypherQueryEngine engine = new RestCypherQueryEngine(api); 
    System.out.println("engine created"); 
    final QueryResult<Map<String,Object>> result = engine.query("start n=node({id}) return n, id(n) as id;", map("id", 0)); 
    System.out.println("query created"); 
    for (Map<String, Object> row : result) { 
     long id=((Number)row.get("id")).longValue(); 
     System.out.println("id is " + id); 
    } 
    } 
} 

而且它似乎只是在QueryResult中的建築被拖延。任何想法爲什麼它會卡在那裏?沒有錯誤或例外。

+0

您是否嘗試過運行鍼對與Neo4j的殼數據庫此查詢? – 2013-04-04 16:04:51

+0

我有,當我用值(即id = 0)替換地圖時,它返回一個結果(即節點[0]和0)。我不知道爲什麼它在現階段停滯不前。 – Badmiral 2013-04-04 16:05:55

+0

是否有任何查詢通過電線?如果沒有,這看起來像一個錯誤,你可以提出一個問題在https://github.com/neo4j/java-rest-binding – 2013-04-08 13:02:33

回答

0

您需要升級到的Neo4j API的最新版本(1.9此刻)

+0

我還必須添加一個適當的maven pom.xml – Badmiral 2013-04-14 15:14:02