Created
August 1, 2019 09:49
-
-
Save Pablissimo/2f7e32989c61a8767b1a07849578f310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (movie: Movie { title: 'Top Gun' })<-[acted_in: ACTED_IN]-(actor: Person) | |
WITH collect(distinct actor) + movie as nodes, collect(distinct acted_in) as relationships | |
CALL apoc.export.csv.data(nodes, [], 'nodes.csv', {}) YIELD file as nodefile | |
UNWIND relationships as relationship | |
CALL apoc.create.vRelationship(startNode(relationship), type(relationship), { title: relationship.title }, endNode(relationship)) YIELD rel | |
WITH collect(rel) as relationshipsAmended, nodefile | |
CALL apoc.export.csv.data([], relationshipsAmended, 'edges.csv', {}) YIELD file as edgefile | |
RETURN edgefile, nodefile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment