批量插入结点:
UNWIND [{name:"zhangSan", age:22},{name:"liSi", age:42},{name:"wangWu", age:12}] AS a
create (:person{name:a.name,age:a.age})
批量更新结点:
UNWIND [{name:"zhangSan", age:32},{name:"liSi", age:52}] AS a
MATCH (b:person{name:a.name})
set b.age = a.age
批量插入关系:
UNWIND [{source_name:"zhangSan",target_name:"wangWu"},{source_name:"wangWu",target_name:"liSi"}] as a
MATCH (from:person{name:a.source_name})
MATCH (to:person{name:a.target_name})
CREATE (from)-[rel:KNOWS{source_name:a.source_name,target_name:a.target_name}]->(to)
批量更新关系:
UNWIND [{source_name:"zhangSan",target_name:"wangWu",knowTime:3},{source_name:"wangWu",target_name:"liSi",knowTime:2}] as a
MATCH (from:person{name:a.source_name})
MATCH (to:person{name:a.target_name})
MATCH (from)-[rel:KNOWS{source_name:a.source_name,target_name:a.target_name}]->(to)
set rel.knowTime = a.knowTime