我在Neo4j的新的,我努力學習,當創建一個節點從Neo4j的java的,我不能看到節點的Neo4j
我有創造的Neo4j的節點,然後我下面的Java代碼閱讀在java中創建的節點的屬性名稱,我的代碼如下:
String DB_PATH = "C:/hamed";
public static void main(String[] args)
{
JavaQuery javaQuery = new JavaQuery();
javaQuery.run();
}
void run()
{
// START SNIPPET: addData
GraphDatabaseService db = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH);
db.beginTx();
try (Transaction tx = db.beginTx();)
{
Node myNode = db.createNode();
myNode.addLabel( DynamicLabel.label("11"));
myNode.setProperty("name", "qq");
tx.success();
}
// END SNIPPET: addData
// START SNIPPET: execute
ExecutionEngine engine = new ExecutionEngine(db);
ExecutionResult result;
try (Transaction ignored = db.beginTx())
{
result = engine.execute("match (n) return n, n.name");
// END SNIPPET: execute
// START SNIPPET: items
Iterator<Node> n_column = result.columnAs("n");
for (Node node : IteratorUtil.asIterable(n_column))
{
// note: we're grabbing the name property from the node,
// not from the n.name in this case.
nodeResult = node + ": " + node.getProperty("name");
System.out.println("ss : "+nodeResult);
}
// END SNIPPET: items
db.shutdown();
}
和System.out的...打印SS:節點1:QQ這是很好的,
現在,當我運行neo4j如下:
然後我去這個鏈接:
http://localhost:7474/webadmin/
,然後當我寫的查詢,以檢查節點沒有返回:
但我希望看到一個節點與qq的名稱屬性
任何人都可以幫助我嗎?我究竟做錯了什麼?
更新:
我undersood代碼只從數據庫中刪除所有節點。例如我創建了一個節點,並使用neo4j控制檯進行檢查:match(n)返回n和返回的節點,但運行代碼後沒有任何返回,這非常奇怪!!!!!!!!!!
是的,你是真棒夥計:) –