Neo4J Meetup – Thinking in graphs

Stress. It eats energy. For the last few months, I’ve been rather busy winding down my responsibilities at the Rabobank, preparing myself for interviews with prospective new clients and finally getting a new contract with a new client that I was 100% satisfied with. When it was all over I found myself with a good deal of extra energy and since I had been neglecting my Sourcelabs crew I decided to find something to contribute to.

As luck would have it a colleague of mine had just volunteered to prepare the material for a 1-day Sourcelabs workshop on Neo4J but wanted to do it with a partner. I volunteered myself and that morning before my day job I dipped my toes into the waters of Neo4J.

Well, I missed the start of my stand-up that day (a cardinal sin in my scrum team) and I fully blame Neo4J’s stunningly good set of demos, tutorials and documentation.

…. I mean look at this: an interactive tutorial that’s integrated, rather smoothly I might add, into the Neo4J browser. You just keep clicking through the steps and seeing those auto-organising graphs bounce into existence just get’s you hooked.

Neo4J is high quality, fun and easy to learn…. but what is it?

Neo4J is a graph database. A graph database is a database that stores nodes, their relationships and each of their properties. Graph databases specialise in querying a graph of objects (i.e. a web of nodes with relationships connecting them).

The key to working with a graph database is to stop the decades-old habit of thinking in SQL and relational tables and to really make the switch to thinking of it as a graph, a map, a web, etc.

The use cases of Neo4J are what you’d expect:

  • social networks
  • communication networks
  • dependency management
  • fraud detection
  • business intelligence

But really it’s all about being able to invent and answer complex questions concerning relationships between data.

One of the most common use cases of Neo4J is to use it as a sort of index of relational data that has been extracted from an RDBMS (which often remains the single source of truth). The Northwind example, packaged with Neo4J, shows how we can transform our relational tables into a graph which can then be queried in a way that would be, at least, a lot harder to accomplish using SQL. It also demonstrates how we can use Neo4J in places where you may not even realise you have a graph of data that can reveal valuable insights.

`

The workshop itself was a success. After an intro to graph databases and a few practical examples we held a quiz where each of my colleagues had to come up with an appropriate Cypher query to answer a question concerning the MovieDB (also packaged with Neo4J).

For instance (and if you have a better answer let me know):

Q: How many Actors have only acted?
A: 96

The rest of the day was spent experimenting with Neo4J in whatever form we pleased. I toyed around with the Spring Neo4J reactive client and one of us even made a custom Cypher language extension function which I thought was pretty cool.

I forgot how much I used to enjoy the data science and “Information Computer Technology” side of being a software engineer. If you’re ever sometimes feeling like a feature-factory-REST-API-microservice-monkey then I implore you to download Neo4J and get excited about learning something new again.

Resources:

Old-ish, long-ish but pretty good intro to Neo4J both functionally and technically Intro to Neo4j

Neo4j Desktop Download – Launch and Manage Neo4j Databases

Spring Data Neo4j – Developer Guides

Neo4j GraphGists

Leave a Reply

Your email address will not be published. Required fields are marked *