我有我正在尝试运行的代码示例:
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 的构建中停滞不前。知道为什么它会卡在那里吗?没有错误或异常。