neo4j/python-embedded — Issue #17: Inconsistent behaviour when iterating over a node's relationships
Author: ducky427
Created: 2012-02-17 16:57:12+00:00
State: open

Hi,
I am using the python-embedded v1.6 on a windows 7 64 bit machine. When I am iterating over a nodes relationships , I getting non-intuitive results. For example,for the following simple program,

from neo4j import GraphDatabase

def create(db):
secondNode_id = None
with db.transaction:
firstNode = db.node(name='Hello')
secondNode = db.node(name='world!')
# Create a relationship with type 'knows'
relationship = firstNode.knows(secondNode, name='graphy')
secondNode_id = secondNode.id
return secondNode_id

def read(db, secondNode_id):
node = db.nodes[secondNode_id]
relationships_1 = [ ]
for i in node.relationships.incoming:
relationships_1.append(i)
relationships_2 = list(node.relationships.incoming)
print len(relationships_1), len(relationships_2)

if __name__ == '__main__':
db = GraphDatabase('test')
secondNode_id = create(db)
read(db, secondNode_id)

The output for this program is `1 0`.

Is that expected? Or am I missing something?

Cheers