1
以下查詢:正確用法的CREATE UNIQUE和/或合併時,例如
MATCH (LOCALID0:Ship {ShipID: "12345", ShipName: "Phil's Yacht"})
CREATE UNIQUE (LOCALID0:Ship {ShipID: "12345", ShipName: "Phil's Yacht" }) - [LOCALID1:contains] - > (LOCALID2:container {ContainerID: "91812" }),
(LOCALID0) - [LOCALID3:contains] - > (LOCALID4:container {ContainerID: "87132" }),
(LOCALID0) - [LOCALID5:contains] - > (LOCALID6:container {ContainerID: "47490" }),
(LOCALID0) - [LOCALID7:contains] - > (LOCALID8:container {ContainerID: "13157" }),
(LOCALID0) - [LOCALID9:contains] - > (LOCALID10:container {ContainerID: "22676" })
提供了以下錯誤:
Exception in thread "main" Can't create `LOCALID0` with properties or labels here. It already exists in this context
當我重用的Cypher支架ID的一個,所以我必須繼續重複使用它的屬性?問題是它沒有意識到LOCALID0:Ship {ShipID:「12345」,ShipName:「Phil's Yacht」}與LOCALID0是同一個節點嗎?
盧安妮或許你還可以添加一個例子使用MERGE而不是CREATE UNQIUE作爲rels並解釋這兩種模式? –