[erlang-questions] Wrap my mind around NoSQL (Mnesia)
Roman Galeev
jamhedd@REDACTED
Fri Nov 24 17:00:10 CET 2017
You can think about Mnesia as a multi-table key-value store, with some
features added like transactions. And you can use Erlang terms as keys
(say, a tuple). So, just tailor lookups to your needs, and it would be
clear do you need a set or a bag.
On Fri, Nov 24, 2017 at 3:50 PM, Silas <silas@REDACTED> wrote:
> 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
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
With best regards,
Roman Galeev,
+420 702 817 968
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20171124/196b179d/attachment.htm>
More information about the erlang-questions
mailing list