[erlang-questions] Wrap my mind around NoSQL (Mnesia)

Silas silas@REDACTED
Fri Nov 24 15:50:38 CET 2017


Hi!

(This is mainly a question about NoSQL conceptions.  If it is the wrong 
place to ask, sorry for that and, please, let me know).

After years using RDBMS (with structured and OO paradigms at the 
programming language side) I'm diving into functional programming.  When 
choosing a programming language to practice, I immediately fell in love 
with Erlang for this simplicity and beauty.

After reading some documentation, some chapters of a book and trying 
simple projects I decided to try a more complex project with Mnesia.  It 
is a social bookmarks website (something similar to what del.icio.us is) 
where user can bookmark a URL and associate one or more tags with it.  
For instance, some could bookmark "erlang.org" to tags 
"functionalprogramming", "programminglanguage" and others.  Users also 
can query other users bookmarks, see what links are associated with a 
tag and what tags are associated with a given bookmark.

In my mind, an RDBMS is a perfect solution for this problem.  I'm trying 
to fit it into the key -> value model, though.  My first question is: is 
this possible or I'm just doing the wrong thing by forcing the wrong 
solution?

For what I understood, I need to get rid of normalization rules.  So I 
devised something more or less like that:

User table: {username, {urls, [tags]}} % set
UserTag table: {user, [tags]} % set
TagUrls table: {tag, url} % bag
TagUsers table: {tag, user} % bag
Urlusers table: {url, user} %bag
UrlTags table: {url, tag} %bag

It is still a bit confusing where I'd use a set, a bag or an ordered_set 
but I think you got the whole picture.

Any help?

Thanks!

-- 
Silas



More information about the erlang-questions mailing list