Get a Taste of Graph Databases: InfoGrid and Neo4j
As I said in MongoDB MapReduce tutorial, the best way to validate that you’ve got the basics right about a system is to use some basic code. And this is exactly the idea behind this post: to take a look at a very (very) basic tagging app in InfoGrid and Neo4j.
InfoGrid version
The code with more details can be found ☞ here.
Neo4j version
The Neo4j code was contributed by Mattias Persson from Neo Technology (thanks Mattias).
Note: I couldn’t figure out a way to make the code more readable that this. But you can hover over the code snippets and you’ll get the option to see the original source code.
Here are my notes about the two code snippets above:
- everything in Neo4j must happen inside a transaction even if it’s a graph traversal operation (this gives a very strong Isolation level). The InfoGrid traversal code seem to happen outside the transaction, so it sounds like it supports a more relaxed isolation level (interesting question here is: if traversal would happen inside a transaction, would that isolate it from seeing possible external modifications?)
- InfoGrid’s central element is
MeshObject, while Neo4j hasNodeandRelationship. Generally speaking I have found the terminology in InfoGrid a bit more unusual (f.e.MeshObject,relateAndBless, etc.) - the Neo4j uses also the
LuceneIndexServicefor indexing both the tag and web resources nodes, but that’s only becaus e the code there makes sure not to duplicate either tags or web resources (i.e. this functionality is not present in the InfoGrid code and I don’t know how that would look like) - in both cases a relationship gives you access at both its ends. While both InfoGrid and Neo4j documentation speak about bidirectional arcs
If someone would contribute the code for ☞ HyperGraphDB and/or ☞ VertexDB I think this post would get even more interesting!
Update: The guys from Sones picked up my challenge and they show up their C# implementation on this ☞ post. I have included below the code for reference
Sones version
Update: I’ve just got another submission from Filament. Code is included below and their original post is ☞ here
Filament version
InfiniteGraph version
Update: Thanks to ☞ Todd Stavish we now have a version of this sample code for InfiniteGraph