This guide explains how to export a graph from Neo4j* and import it into OrientDB in 3 easy steps. If you want to know more about the differences between OrientDB and Neo4j, take a look at OrientDB vs Neo4j.
In order to export the database in GraphML format, you need the additional neo4j-shell-tools plugin:
Now launch the Neo4j-Shell tool located in the
bin directory and execute the following command:
export-graphml -o /tmp/out.graphml
/tmp/out.graphml is the location to save the file in GraphML format.
$ bin/neo4j-shell Welcome to the Neo4j Shell! Enter 'help' for a list of commands NOTE: Remote Neo4j graph database service 'shell' at port 1337 neo4j-sh (0)$ export-graphml -o /tmp/out.graphml Wrote to GraphML-file /tmp/out.graphml 0. 100%: nodes = 302 rels = 834 properties = 4221 time 59 sec total 59 sec
To import the GraphML file into OrientDB complete the following steps:
g = new OrientGraph("plocal:/tmp/db/test");specifying the path of your new OrientDB Graph Database,
/tmp/db/testin this case
/tmp/out.graphmlis the path of the exported file
$ cd $ORIENTDB_HOME/bin $ ./gremlin.sh \,,,/ (o o) -----oOOo-(_)-oOOo----- gremlin> g = new OrientGraph("plocal:/tmp/db/test"); ==>orientgraph[plocal:/db/test] gremlin> g.loadGraphML('/tmp/out.graphml'); ==>null gremlin> quit
Congratulations! The database has been imported into OrientDB.
*Neo4j is a registered trademark of Neo Technology Inc.