2013-05-12 44 views
0

嗨,我是neo4j和cypher的新手。我已經構建了我的數據庫,以便可以從圖形中創建多個深度。在我的例子中,圖形是一棵樹,根節點是一個索引,級別4的節點是索引。我使用py2neo開發的圖形,我使用get_or_create_indexed_node方法按照:py2neo documentationNeo4j:在密碼查詢中獲取索引屬性'name'作爲返回值

patient_node = graph_db.get_or_create_indexed_node('patients', 'name', 
patients[patient_id]) 

但是當我跑我的暗號查詢,這樣我土地上的索引節點上,我只能得到ID。例如,當我這樣做:

​​

我得到錯誤說: 屬性「名」上不存在節點[84361]

我到底做錯了什麼?

回答

1

您還沒有提到您將從get_or_create_indexed_node返回的節點添加任何屬性。該函數爲get_or_create_indexed_node(index, key, value, properties=None),因此您提供的值僅爲索引名稱,鍵和值。

您需要創建這樣的節點:

node = graph_db.get_or_create_indexed_node('patients', 
              'name', patients[patient_id], 
              patient_properties)