2
我想使用的Neo4j的Java API下面简单的例子:为什么Neo4j创建节点[0]?
public void createDB(String datasetRoot) {
GraphDatabaseService graphDb = new GraphDatabaseFactory().newEmbeddedDatabase("data/Neo4jTest1");
registerShutdownHook(graphDb);
Transaction tx = graphDb.beginTx();
try {
// Database operations go here
Node firstNode = graphDb.createNode();
firstNode.setProperty("nodeId", "1");
Node secondNode = graphDb.createNode();
secondNode.setProperty("nodeId", "2");
Relationship relationship = firstNode.createRelationshipTo(secondNode, RelTypes.SIMILAR);
tx.success();
}
finally {
tx.finish();
}
当我试图打印所有创建的节点,我注意到了一个节点,没有财产产生了[0]。这是为什么发生?
它将在Neo4j的2.0 –
感谢@MichaelHunger消失。 –
@MichaelHunger你确定吗?因为我使用Neo4j 2.0,所以我有这个问题 – salvador