Skip to content

Connect and Query Example

alexfrieden edited this page Apr 22, 2013 · 2 revisions

Here is a small example on how to connect with 1.9.M05

public class TestConnect {
  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");
    QueryResult<Map<String,Object>> result = engine.query("start n=node({id}) return n;", 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);
        System.out.println(row.get("myRow"));
    }
  }
}
Clone this wiki locally