将多个属性的内容更新到节点上
def update_by_id(id,graph,**kwargs): """ 更新节点的属性 根据节点的ID来更新节点的属性,如果存在该属性,则更新,如果不存在该属性,则添加 """ if graph is None: graph = get_graph() if kwargs is None: return None match = "match (x) where id(x)=%s " % (id) fields_str='' for k,v in kwargs: if v is not None: temp = " set x.%s = '%s' " % (k,v) fields_str += temp match = match + fields_str match = match + " return id(x) as x_id" result = graph.run(match).data() if result is not None and len(result > 0): id = result[0]["x_id"] return id return None