將多個屬性的內容更新到節點上
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