【发布时间】:2015-07-31 07:44:43
【问题描述】:
在将 Neo4j 和 py2neo 更新到最新版本(分别为 2.2.3 和 2.0.7)时,我遇到了一些导入脚本的问题。
例如这里,只是一些代码。
graph = py2neo.Graph()
graph.bind("http://localhost:7474/db/data/")
batch = py2neo.batch.PushBatch(graph)
pp.pprint(batch)
relationshipmap={}
def create_go_term(line):
if(line[6]=='1'):
relationshipmap[line[0]]=line[1]
goid = line[0]
goacc = line[3]
gotype = line[2]
goname = line[1]
term = py2neo.Node.cast( {
"id": goid, "acc": goacc, "term_type": gotype, "name": goname
})
term.labels.add("GO_TERM")
pp.pprint(term)
term.push()
#batch.append( term )
return True
logging.info('creating terms')
reader = csv.reader(open(opts.termfile),delimiter="\t")
iter = 0
for row in reader:
create_go_term(row)
iter = iter + 1
if ( iter > 5000 ):
# batch.push()
iter = 0
# batch.push()
当使用批处理或不使用批处理直接推送时,我收到此错误:
py2neo.error.BindError: Local entity is not bound to a remote entity
我做错了什么?
谢谢!
【问题讨论】: