2017-08-17 85 views
-1

我是新來的Neo4j,我被困在一個簡單的問題:neo4j的這個創建語句語法有什麼問題?

create (machine1:host); 
match (n) where n.host='machine1' return n; 

匹配失敗。當使用解釋我看到這個:

The provided property key is not in the database 
One of the property names in your query is not available in the database, make sure you didn't misspell it or that the label is available when you run this statement in your application (the missing property name is: host) 

我做錯了什麼?感謝大家的時間。

+0

我要注意:我使用的是社區版,版本3.2.1上述行作爲在原本空白的新數據庫所使用的前兩行。 – ewm

回答

3

您應該知道標籤和屬性之間的區別。 標籤是Node的分組工具,所有具有標籤的節點都是同一組的一部分。 我認爲你應該使用機器標籤來表示機器的節點。 而你應該使用主機屬性來存儲它的名字值。

create (:Machine {host:'machine1'}); 
    match (n) where n.host='machine1' return n; 

甚至更​​好:

match (n:Machine) where n.host='machine1' return n; 
+0

現在我明白了!謝謝! – ewm

+0

這與數學圖不同,其中標籤唯一地應用於單個頂點。此外,neo4j的術語頁面(https://neo4j.com/docs/developer-manual/current/terminology/)對於屬性也很模糊:「存儲在節點或關係中的屬性 - 名稱值,屬性的同義詞」。和「屬性 - 屬性的同義詞」。 – ewm