How do we do this?

When you export the database from OrientDB, you get a huge JSON file packed with data. Getting OrientDB to play nice with that file is tricky business, so we’ll work around that.

Instead, we’re going to:

  1. Export OrientDB database to a JSON file
  2. Convert the JSON file to a GraphML file using the odb2graphml library
  3. Import the GraphML file into Neo4j using the APOC library
  4. Run some Cypher scripts to simplify our Neo4j database’s schema

Getting started

1️⃣ Converting our OrientDB database into a GraphML file

Note: I wasn’t able to get local file paths to work (like file:///Users/example/out.graphml), so you’ll have to upload your GraphML file to the interwebs somewhere (I just uploaded mine to the GitHub repo)

  1. Export database from OrientDB (by starting the OrientDB database and visiting HOST:PORT/studio/index.html#/database/StudentResource/db/import-export)
  2. gunzip StudentResource.gz to extract the archive
  3. mv StudentResource orient-db-export.json to rename it to a JSON file

Next, let’s convert the JSON file to a GraphML file (called out.graphml):

time npx odb2graphml orient-db-export.json -v Concept,Construct,Data,Discussion,Entity,Error,Example,FullExample,Lecture,Module,Python,Resource,Theme,V -e CSError,CSExample,CoreError,CoreExample,DesignExample,E,HasCode,MTError,MTExample,Related,appear,contain,exRelated,explain,implements,produce,require,teaches

You should see an output like:

Success! Converted 1210 edges and 1104 vertices. Pruned 1 edge. Written to out.graphmlodb2graphml orient-db-export.json -v  -e   0.80s user 0.07s system 125% cpu 0.694 total

Success!

⏰ Note that the time command above is optional - it just tells you how long the command took

2️⃣ Importing our GraphML file into a Neo4j database