Neo4j(py2neo)中索引和标签的混淆

Neo4j(py2neo)中索引和标签的混淆,neo4j,py2neo,Neo4j,Py2neo,我一直在努力理解Neo4j中旧索引和当前索引方案之间的区别,但我很难理解是否需要使用graph_db.get_或_create_index_node。我有一个例子,如果有人能指出两种方法之间的区别,我将不胜感激 使用索引: patients = graph_db.get_or_create_index(neo4j.Node,"patients") doctors=graph_db.get_or_create_index(neo4j.Node,"doctors") p1 = graph_db.g

我一直在努力理解Neo4j中旧索引和当前索引方案之间的区别,但我很难理解是否需要使用graph_db.get_或_create_index_node。我有一个例子,如果有人能指出两种方法之间的区别,我将不胜感激

使用索引:

patients = graph_db.get_or_create_index(neo4j.Node,"patients")
doctors=graph_db.get_or_create_index(neo4j.Node,"doctors")

p1 = graph_db.get_or_create_indexed_node("patients", "p1", "disease1", {"p1":"disease1", "gender" : "F"})

p2 = graph_db.get_or_create_indexed_node("patients", "p2", "disease2", {"p2":"disease2", "gender" : "M"})

p3 = graph_db.get_or_create_indexed_node("patients", "p3", "disease3", {"p3":"disease3", "gender" : "M","return":'yes'})

d1=graph_db.get_or_create_indexed_node("doctors","d1",{"years_experience":"20","re-admission_rate":"20%"})
d2=graph_db.get_or_create_indexed_node("doctors","d2",{"years_experience":"2","re-admission_rate":"40%"})
使用标签

patients=[{"patients", "p1", "disease1", {"p1":"disease1", "gender" : "F"}},{"patients", "p2", "disease2", {"p2":"disease2", "gender" : "M"}}]
doctors=[{"doctors","d1",{"years_experience":"20","re-admission_rate":"20%"}}]

for patient in patients:
    t=batch.create(patient)
    batch.add_labels(t,'Patient')
batch.submit()
batch.clear()

另外,如果我想批量添加关系,比如说patient1在今天和一个月内访问doctor1,我该怎么做?我是否添加以时间戳作为标签的新关系

这会有帮助:我已经读过了。但是,如果有人能告诉我上述两种方法在对创建的数据执行密码查询的意义上是否不同,以及为什么不同,这将对我有很大帮助。对于第二个问题,我可能会将访问建模为一个节点,因为您也可以将其他信息附加到它。但是是的,否则你会在上面加上一个timestamp属性。