使用cypher的neo4j批量插入物

使用cypher的neo4j批量插入物,neo4j,Neo4j,如何将以下内容插入neo4j create (st:serviceticket {name:'SRT_519'}) with st as st match (st:serviceticket) where st.name='SRT_519' match (d:ProductID) where d.name ='PRD_1014' with st as st , d as d merge (d)-[:SERVICE_TICKETID]->(st); create (st:serv

如何将以下内容插入neo4j

create (st:serviceticket {name:'SRT_519'}) 
with st as st 
match (st:serviceticket) where st.name='SRT_519' 
match (d:ProductID) where d.name ='PRD_1014'
with st as st , d as d 
merge (d)-[:SERVICE_TICKETID]->(st);


create (st:serviceticket {name:'SRT_520'}) 
with st as st 
match (st:serviceticket) where st.name='SRT_520'
match (d:ProductID) where d.name ='PRD_1004'
with st as st , d as d 
merge (d)-[:SERVICE_TICKETID]->(st);

如果我要插入多个这样的记录,如何一次插入所有记录。请帮助我。

我假设您的产品的节点已经存在

请记住,您的“st”是一个引用,您正试图在一批中分配同一引用两次。 第一步是为您的服务票提供单独的参考

match (d:ProductID), (e:ProductID)
where d.name ='PRD_1014'and
e.name ='PRD_1004'
create (st519:serviceticket {name:'SRT_519'}) 
create (st520:serviceticket {name:'SRT_520'}) 


merge (d)-[:SERVICE_TICKETID]->(st519)
merge (e)-[:SERVICE_TICKETID]->(st520)

如果使用参数,则可以提供一个对数组:

您应该对:ServiceTicket(名称)和:ProductID(名称)具有索引或约束


您的数据(SRT_519、PRD_1014)来自哪里?我已经创建了一个文件或另一个db或?PRD_1014节点,现在我需要将这些节点(如SRT_519)与
WITH [['SRT_519','PRD_1014']] as data
FOREACH (pair in data |
    MERGE (st:ServiceTicket {name:data[0]}),(d:ProductID {name:data[1]})
    MERGE (d)-[:SERVICE_TICKETID]->(st);
)