2

I ran this query by using py2neo

 myQuery = "MATCH p=(:Task {activity: 'Start'})-[:RELATIONSHIP*]->(:Task {activity: 'Finish'}) "\
       "WITH p, REDUCE(x=0, a IN NODES(p) | x + a.duration) AS cum_duration ORDER BY cum_duration DESC "\
       "LIMIT 1 RETURN p AS CritPath WITH p, REDUCE(x=0, a IN NODES(p) | x + a.durata) AS cum_duration ORDER BY cum_duration DESC LIMIT 1 "\
       "RETURN p AS CritPath"


myGraph.run(myQuery).dump()

But it prints

(cd885ed)-[:RELATIONSHIP]->(a94c38f)

If I wanted to print the name of "activity" instead of memory address "cd885ed" (such as in the above example), how should I do?

for example:

(start)-[:RELATIONSHIP]->(finish)

Thank you very much

1 Answers1

0

Any myGraph.run() command returns a cursor with the results that you can process. Since you return paths that is what you'll have to process, if you need no more than the activity-properties, why not just return those ?

Anyway ...

theCursor = myGraph.run(myQuery)
for theRecord in theCursor:
    # do something with the theRecord

Hope this helps.

Regards, Tom

Tom Geudens
  • 2,638
  • 9
  • 15