我已经加载了 50k 个节点并通过 talend 建立了它们之间的关系。我编写了java代码来连接neo4j并尝试执行密码查询。它正在连接到 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
Actully 它应该显示 50000 个节点,但它只显示 1...任何想法?