检索尚未插入数据库的 NodePointer.properties

Retrieve NodePointer.properties that was not inserted into DB yet

我正在使用 py2neo 将一些数据插入到我的 neo4j 数据库中。

我创建了节点指针和关系数组,并用

插入它们
for i in rels:
    test_graph.create(i)

处理后。

在创建数组的过程中,我想检查是否已将特定的 NodePointer 添加到数组中(不想创建两个同名的 NodePointer)。

寻找检查 NodePointer 属性的方法,我在 py2neo 文档中找到了这个:

>>> alice.properties["name"]
'Alice'

但是当我尝试这样做时:

def isThereAThisInHere(this, here):
    for i in here:
        if (i.properties["name"] == this):
            return i
    return False    

mVar = isThereAThisInHere(defWord.wordVar[0],tempVar)
if (mVar == False):
    mVar = Node("Variable",name=defWord.wordVar[0])
    tempVar.append(mVar)    

我得到:'NodePointer' object has no attribute 'labels'

有人对我的问题有解决方案或建议吗?谢谢。

问题出在 (mVar == False) 比较中。即使在 .properties["name"] 行出现错误。