Sunday, March 24, 2013

Neo4j: A graph database engine

While browsing for intersting database techniques - I came across this one: Neo4j. It's a graph database engine from Sweden.

On the website, there's a video from Emil Eifrem who explains what possible applications of the database are. Neo4j exposes a REST API that typically servers and takes JSON objects making it cross platform. There is a C# client NuGet package available as well - here.

To give a quick idea - setting up graphs and querying is done using Cypher. Here's a snippet from their website:

Graph Setup:
start root=node(0)
create (Neo {name:'Neo'}), (Morpheus {name: 'Morpheus'}), (Trinity {name: 'Trinity'}), (Cypher {name: 'Cypher'}), (Smith {name: 'Agent Smith'}), (Architect {name:'The Architect'}),
root-[:ROOT]->Neo, Neo-[:KNOWS]->Morpheus, Neo-[:LOVES]->Trinity, Morpheus-[:KNOWS]->Trinity,
Morpheus-[:KNOWS]->Cypher, Cypher-[:KNOWS]->Smith, Smith-[:CODED_BY]->Architect

start n=node:node_auto_index(name='Neo') 
match n-[r:KNOWS*]-m 
return n as Neo,r,m

All in all, this is some really exciting stuff, check it out!

No comments:

Post a Comment