我已经加载了50k个节点,并通过talend建立了它们之间的关系。我编写了java代码来连接neo4j并尝试执行cypher查询。它连接到neo4j但显示错误的结果。我的java代码是:
package com.Neo4J;
import org.neo4j.cypher.javacompat.ExecutionEngine;
import org.neo4j.cypher.javacompat.ExecutionResult;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
public class CaseNeo4J {
private static final String Neo4J_DBPath="/neo4j-community-1.9.2/data/graph.db";
GraphDatabaseService gdb;
public void connect(){
gdb = new GraphDatabaseFactory().newEmbeddedDatabase(Neo4J_DBPath);
Transaction transaction = gdb.beginTx();
ExecutionEngine engine = new ExecutionEngine(gdb);
ExecutionResult result = engine.execute( "start n=node(*) return n");
System.out.println(result.dumpToString());
}
public static void main(String[] args) {
CaseNeo4J neoobj = new CaseNeo4J();
neoobj.connect();
}
}
outputs as :
+-----------+
| n |
+-----------+
| Node[0]{} |
+-----------+
1 row
实际上它应该显示50000个节点,但它显示的是1 ...任何想法?
答案 0 :(得分:0)
很抱歉,如果我的inswer太明显但您尝试过:MATCH(n)RETURN n作为查询?