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