Wednesday, December 2, 2015

Neo4j - The Nature Way to persist data - At Future Unleashed

Very recently had the pleasure of giving a session over Neo4J at Future Unleashed, 2015 as a part of OSS (Open Source Solutions) track.

I discussed very basics of Graphs, and how RDBMS's dominated the space of Databases for 2 long decades until the NOSQL breakout happened.

Showcase was around Neo4J - The Natural way to persist data, With a number of examples I showcased how it makes perfect sense to store the relational data in form of  graphs rather than the Relational Databases, just because it doesn't sound natural as the relations in RDBMS's are not natural in one go anyways, things like traversal of relationships are not possible and you'd always need a work around for such situations.

Not that RDBMS are all crap but that Graph Databases like Neo4J are like that Needle you need when it won't work with the sword.
All of our Demos and PPT are available at Github, so do feel free to download and play with

A specific demo that I showcased was around Game of thrones, I made a small database of Game of thrones characters, basically by scrapping from different wiki sites and all using python module beautifulsoup, I included columns like Name, House, IsDead, IsCaptured, IsHurt, title, and Prefix.

PS - The information may not be absolutely correct
We all know Jon Snow isn't Dead Yet, Or at least we don't want him dead, even if he is.

This is how that csv looks like, by the name characters.csv, I can generate different nodes from this csv, you may use

There is another csv of relations by the name of characters_relations2.csv this is how it looks like

I used another python file to generate the relations between the two nodes
All these nodes and relationships are also dumped in the file GOT_Query.txt
Once we are done making these relations and everything, this is how our final GOT tree would look like

You can then do some really interesting queries like
Finding relationship between Arya stark and Margaery Tyrell

MATCH (arya:Person { name:"Arya Stark" }),(marg:Person { name:"Margaery Tyrell" }),
  p = shortestPath((arya)-[*]-(marg))

At the end, we had the pleasure of discussing with audience how to scale the Neo4J instances, particular use cases for Graph databases and Managed hosting options for Neo4J available at Azure like Graphene DB.