Sunday, September 29, 2013

Neo4j - a very brief overview

Hello, guys!

Since 2010, I have been tracking the development of a very nice NoSQL database: Neo4j, a very nice graph database. This short article will not talk about when you should or not use NoSQL databases, so take a look at this link to have more information about scenarios.

As we mentioned before, Neo4j is  a graph database. As the description suggests, a graph database is a structure that stores information into a graph. It means that the data will be available in nodes and relationships between nodes. More technically speaking, database elements have a kind of pointer to an adjacent element, and an index, such as MySQL indexes, become unnecessary. There are several graph databases projects, not only Neo4j. We can mention on this list AllegroGraph, Filament and GraphBase.

Developed in Java language, Neo4j has several nice tools and resources. Following graph databases model, it has Nodes and nodes may have Properties. Properties are similar to attributes for classes - they describe node's information. A node can communicate with another node trough  Relationships. Take  a look at the image below to have a better understanding of these concepts:

At the image above, "Pokémon Trainer", "Pokémon" and "Badge" are nodes. Each node has is own properties set. "Captures" and "collects" are examples of relationships.

You can navigate among the data stored into Neo4j using an operation called Traversal. Traversal is responsible for enabling searches like "What Pokémon Ash does have that I do not have" (supposing you are a Pokémon trainer like me). Neo4j let's you do more, you can search for a node given a specific property, or even a specific relationship.This would let you create queries like "Find the Pokémon trainer which has more Charizards on the team" or "list Pokémon that did not collect Saffron Badge".

This was a quick intro post about Neo4j. I'll publish a sequence of posts with more practical examples. If you can't wait for them, take a look at Neo4j learning material here, or take a look at Jim Webber's book about Graph databases. If you are worried about using Neo4j on the cloud, don't be. Big PaaS, such as Heroku, already have add-ons for it.

This is it! Let's start graphing! =)

No comments:

Post a Comment