I'm developing an application where users can tag resources and it's also important to know who tagged the resource with a specific tag.

A graph database seems like a good fit for this and the rest of the application but having only previously used traditonal RDBMSs I'm struggling to see how to model this scenario.

I a relational database I would have a "PersonResourceTag" join table to identify which user applied a particular tag, but with a graph database I can't work out how to associate the person with a tag for a specific resource. Would I need some kind of "PersonTaggedResource" vertex or is there a better way? ...or is this simply not a good fit for a graph database?

enter image description here


Graph Databases are in general, a superset of what an RDBMS can do. The implementations are completely different and you have to forget all the RDBMS idioms when you approach using a Graph Database. The relationships are not modeled with a join table, they are modeled directly into the node with a *relationship". This is called index free adjacency, which is the exact opposite of a join table in an RDBMS.

Person -> Tags[Tag] -> Resource

Where Tag is a Property and the above syntax is very close to the actual GraphQL syntax to query the graph with.

You can get a free copy of Graph Databases from O'reilly, it is a great read.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.