I am playing with some graph databases right now, for a fun project I may write about later. When I first started out I was using Neo4j, which has an excellent local development story, a lovely web based UI for visualizing your data and CYPHER, which is a pretty easy to grasp graph language.
All great marks in its favor.
However, since the rest of the project was going to be a series of lambdas and api gateways, and it was going to be hosted in AWS I got curious about Neptune. Oh, and because I know less about scaling and maintaining graph DB infrastructure than I would like. Using Neptune, a hosted graph DB, freed me from lots of the infrastructure knowledge for now.
But there was seemingly no good local development story for it.
Then I remembered that in the world of Graph DBs the thing that matters most is finding a match for the query language your target DB uses.
Neptune uses Gremlin as its primary query language which happens to be the primary language of Apache TinkerPop. So I got a docker based instance of TinkerPop running. That got me the DB server at least. Let me tell you, I bashed my head on gremlin for a lot longer than I’d like to admit. You may do better than me, but take time to read the docs and intro. The querying concepts are likely different than what you’ve dealt with in the past. And gremlin feels more alien than CYPHER does.
So the second thing that I wanted was a way to easily visualize the data I was writing into the graph. It’s handy when you are trying to figure out how the query language works to be able to see if your query returns nothing because there is nothing, or if you’ve written it wrong.
In looking for what to use I stumbled on https://github.com/bricaud/graphexp which provides a simple UI for gremlin based DBs. Not the most beautiful in the world, but it is functional and lets you see everything I was looking for quickly.
Wiring all this up was pretty straightforward with docker-compose. My docker file for graphexp and docker-compose for the whole thing are on github for easy reuse.
Once I had it running locally it started to be a matter of reading through the TinkerPop gremlin documentation. There is a lot of it. But it is reasonably good. I also started reading Kevin Lawrence’s Practical Gremlin which was very helpful.
Hopefully some of this helps you on your way to using gremlin based graph databases!