简体   繁体   中英

Import Graphml file into neo4j using Python and export it to CSV

I have a lot of graphml files and I'm trying to create separate neo4j database using each file.

Right now I'm using Gephi to export graphml to neo4j database but that it would take me to much time for so many files.

I've found this import-graphml [-i in.xml] [-r REL_TYPE] [-b 20000] [-c] [-t]

Is it possible somehow to import this using Python and then export complete neo4j database?

I could not write in to "comment" section due to my low amount reputation so please assume this is not a clear answer but a comment..

I didn't experience so much, but I don't suggest exporting Neo4j db via a pythonic way. For my case, it took so much time. Instead I run an AJAX code and it was quite fast. Or you can run any cypher query with py2neo. To import data, I can refer the networkx which can read graphml files. To push into the Neo4j, there is another library here . I don't have a comparison in terms of performance, but good to have a look. Check this answer as well.

Why do you need it in python?

You can use neo4j-shell tools to import the graphml and also export it to csv with

import-cypher -o file.csv MATCH (m)-[r]-(n) return id(m),id(r),id(n); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM