1
나는 의원에 관한 정보를 담고있는 Neo4j 데이터베이스를 가지고있다. 내가 가지고있는 문제는 빈 자리가 있다면입니다. 이 문제가 발생하면 "의원"색인의 값과 동일한 키를 사용합니다. py2neo 문서에서 내가 코드를 3 번이나 중복 노드가 실행 후 인터페이스를 선택하면 추가 기능이 py2neo create duplicate nodes를 만드는 함수
#Check if we have any vacancies and if so if they match the one that we currently want to add
query="start n=node:Congressmen('website:N/A') return n"
result= cypher.execute(graph_db, query.encode('utf-8', errors='ignore'))
#Match what we already have
if str(result[0]) != "[]":
#create is idempotent so will only create a new node if properties are different
rep, = graph_db.create({"name" : userName, "website" : web, "district" : int(district), "state" : child[2].text, "party" : child[4].text, "office" : child[5].text, "phone" : child[6].text, "house" : "House of Representatives"})
cong = graph_db.get_or_create_index(neo4j.Node, "Congressmen")
# add the node to the index
cong.add("website", web, rep)
을 멱등 중임 때문에 나는 아래의 코드를 시도했다.
노드가 복제되지 않도록하고 동일한 키/값을 사용하여 색인을 생성 할 수 있습니까?