如果我通過執行此查詢有一個圖,那麼我想刪除一箇中間節點說'和',並連接它的前一個節點說'圖「其子節點說'基於相同的通過使用其對應的出關系‘SEQID分貝’neo4j cypher查詢刪除一箇中間節點,並將其所有父節點連接到子節點
MERGE (n:Person { name: 'graph'})
MERGE (n:Person { name: 'and'})
MERGE (n:Person { name: 'relational' })
MERGE (n:Person { name: 'nosql'})
MERGE (n:Person { name: 'server'})
MERGE (n:Person { name: 'db'})
MERGE (a:Person { name: 'graph'}) MERGE (b:Person { name: 'and' }) MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (a:Person { name: 'and' }) MERGE (b:Person { name: 'db'}) MERGE (a)-[:NEXT{seqid:1 , caps: 'true'}]->(b)
MERGE (a:Person { name: 'relational'}) MERGE (b:Person { name: 'db'}) MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (a:Person { name: 'nosql'}) MERGE (b:Person { name: 'db' }) MERGE (a)-[:NEXT{seqid:2, caps: 'true'}]->(b)
MERGE (a:Person { name: 'server'}) MERGE (b:Person { name: 'and' }) MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (a:Person { name: 'and' }) MERGE (b:Person { name: 'db'}) MERGE (a)-[:NEXT{seqid:1}]->(b)
MERGE (a:Person { name: 'server'}) MERGE (b:Person { name: 'and'}) MERGE (a)-[:CONNECTS{seqid:2}]->(b)
MERGE (a:Person { name: 'and' }) MERGE (b:Person { name: 'db'}) MERGE (a)-[:CONNECTS{seqid:2, caps: 'true'}]->(b)
即
(graph)-[:NEXT{seqid:1 , caps: 'true'}]->(db)
(relational)-[:NEXT{seqid:1}]->(db)
(nosql)-[:NEXT{seqid:2, caps: 'true'}]->(db)
(server)-[:NEXT{seqid:1}]->(db)
(server)-[:CONNECTS{seqid:2, caps: 'true'}]->(db)
請幫助我解決這個........ .....
(我是使用的Neo4j 2.3.6通過在嵌入式模式的Java API社區版。)
謝謝您的回覆........ –
請幫忙.........這個查詢只捕獲兩個新連接的節點之間的最後一個關係,如果存在多個具有不同屬性的相同類型的關係時。我想捕捉所有的關係... –
當創建新的NEXT關係時,我錯誤地使用了MERGE而不是CREATE。嘗試新的查詢。 – InverseFalcon