0

I am iterating over this record returned by cypher.execute():

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

The code I use to iterate over it is this:

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

But I get the following error:

  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'

What am i doing wrong here?

lo tolmencre
  • 3,804
  • 3
  • 30
  • 60

2 Answers2

1

Why not just

print(rel.start_node)

Your code takes a node and then uses that node to select exactly the same node from the graph. Which is clearly redundant.

Nigel Small
  • 4,475
  • 1
  • 17
  • 15
0

self.graph.node(rel.start_node.ref) is the correct access

lo tolmencre
  • 3,804
  • 3
  • 30
  • 60
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/11666200) – Luca Detomi Mar 17 '16 at 11:54
  • I am the author. I answered my own question. And it is the exact answer to my question :D – lo tolmencre Mar 17 '16 at 12:26
  • Yes but your answer was flagged as too short. Generally answers should provide details to let other users understand "why" proposed solution is a good one or maybe the best one. Adding details will help other users with the same problem to better understand how to adapt proposed solution to their specific case – Luca Detomi Mar 17 '16 at 13:28
  • ok, I have no idea though *why*. I just found that attribute in the documentation and tried it out, because the description of `ref` in the documentation did first not sound like what I needed, when I looked in the docu before asking the question. – lo tolmencre Mar 17 '16 at 16:31
  • Maybe you could add link to specific documentation topic that inspired you – Luca Detomi Mar 22 '16 at 08:11