java neo4j,通过Java访问neo4j节点和关系

I have already loaded 50k nodes and established relationships between them through talend. I wrote java code to connect to neo4j and try to execute cypher query. It is connecting to neo4j but showing wrong results. My java code is:

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 it should show 50000 nodes but it is showing ony 1... Any idea?

解决方案

Sorry if my inswer is too obvious but have you tried with: MATCH(n) RETURN n as the query?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值