<div dir="ltr"><div>Separate (and postpone) the data representation (i.e. tables) concerns from the data access (CRUD). <br></div><div><br></div><div>The access needs of the application will determine the tables (whether set or bag or ordered) and objects & attributes (keys and values).<br></div><div><br></div><div>That is, form follows the function.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 24, 2017 at 8:20 PM, Silas <span dir="ltr"><<a href="mailto:silas@nocafe.net" target="_blank">silas@nocafe.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi!<br>
<br>
(This is mainly a question about NoSQL conceptions. If it is the wrong place to ask, sorry for that and, please, let me know).<br>
<br>
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.<br>
<br>
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 <a href="http://del.icio.us" rel="noreferrer" target="_blank">del.icio.us</a> is) where user can bookmark a URL and associate one or more tags with it. For instance, some could bookmark "<a href="http://erlang.org" rel="noreferrer" target="_blank">erlang.org</a>" 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.<br>
<br>
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?<br>
<br>
For what I understood, I need to get rid of normalization rules. So I devised something more or less like that:<br>
<br>
User table: {username, {urls, [tags]}} % set<br>
UserTag table: {user, [tags]} % set<br>
TagUrls table: {tag, url} % bag<br>
TagUsers table: {tag, user} % bag<br>
Urlusers table: {url, user} %bag<br>
UrlTags table: {url, tag} %bag<br>
<br>
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.<br>
<br>
Any help?<br>
<br>
Thanks!<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
Silas<br>
______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a><br>
</font></span></blockquote></div><br></div>