Hi,
I would like to try playing around with and expanding upon the neo4j.py
wrapper; however, I've run into a few issues.
(1) I can't seem to find a way to return helpful information about a node
(ie. it's depth). Does anyone have a working example or even an explanation
of how to obtain the depth (and perhaps other node information) during a
traversal? I've been playing with the examples and documention on the
neo4j.py website, but it's not been extremely helpful.
(2) Is there a better way to initialize the traversal? It uses lazy
imports, so Python seems to crap out when the code is run because neo4j
doesn't have properties like (Traversal) until NeoService is called. I've
gotten around the problem as follows:
-- main.py ------------------------------
-
import neo4j
if __name__ == '__main__':
neo = neo4j.NeoService("./db/")
with neo.transaction:
###
index = neo.index("NodeIndex")
p1 = index[1]
from people import People #
************ THIS IS HOW I HACKED IT TO WORK ***************
for person in People(p1):
print person['name']
###
neo.shutdown()
-----------------------------------------------
-- people.py -----------------------------
import neo4j
class People(neo4j.Traversal):
types = [
neo4j.Undirected.Knows,
]
order = neo4j.BREADTH_FIRST
stop = neo4j.STOP_AT_END_OF_GRAPH
returnable = neo4j.RETURN_ALL_NODES
-----------------------------------------------
Thanks in advance!
Andrew
_______________________________________________
Neo mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user