py2neo graph.node(ID)抛出“不支持的URI方案”

时间:2016-03-17 10:04:22

标签: neo4j cypher nodes py2neo

我正在迭代cypher.execute()返回的这条记录:

   | p                         
---+----------------------------
 1 | (:A)-[:r]->(:B)-[:r]->(:C)

我用来迭代它的代码是:

recordList = graph.cypher.execute(<some query>)
for record in recordList:
    for rel in record[0]:
        print self.graph.node(rel.start_node)

但是我收到以下错误:

  File "/usr/local/lib/python2.7/dist-packages/py2neo/packages/httpstream/http.py", line 943, in __get_or_head
    return rq.submit(redirect_limit=redirect_limit, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/py2neo/packages/httpstream/http.py", line 433, in submit
    http, rs = submit(self.method, uri, self.body, self.headers)
  File "/usr/local/lib/python2.7/dist-packages/py2neo/packages/httpstream/http.py", line 302, in submit
    raise ValueError("Unsupported URI scheme " + repr(uri.scheme))
ValueError: Unsupported URI scheme 'node/(n4979'

我在这里做错了什么?

2 个答案:

答案 0 :(得分:1)

为什么不

print(rel.start_node)

您的代码接受一个节点,然后使用该节点从图中选择完全相同的节点。这显然是多余的。

答案 1 :(得分:0)

self.graph.node(rel.start_node.ref)是正确的访问权限