Perhaps it is really best to model the "bookmark" as node as well. Which is how 
you would model a hypergraph in Neo4j.

Then it is natural to have tag nodes pointing to the bookmark node.

For instance you want to store when user bookmarked the link, so that you can 
order his bookmarks (recent first). 
(This can be done by property + indexing on the relationship, or by having 
timeline nodes, which connect bookmarks that were added on a given day/hour).
Or you want him to be able to have a comment thread on the bookmark (not the 
link). And more.

Cheers

Michael

Am 09.06.2011 um 08:21 schrieb Max De Marzi Jr.:

> Aseem,
> 
> Which users tagged what? SELECT DISTINCT user_id FROM USER_TAGS WHERE
> bookmark_id = x
> Which bookmarks did a user tag? SELECT DISTINCT bookmark_id FROM
> USER_TAGS WHERE user_id = x
> Which bookmarks were tagged with x? SELECT DISTINCT bookmark_id FROM
> USER_TAGS WHERE tag_id = x
> 
> What question are you trying to answer that you can't get from a
> relational table?
> 
> I think it's better to make your model depending on the questions you
> are trying to answer.
> 
> I have a similar model (users tagging users) and I needed to answer:
> Which users have been tagged by me or my network 6 degrees out?
> What is the tagged distance a user is away from another user?
> 
> Turns out, all I needed was User nodes with Tagged links.  User ->
> tagged -> User -> tagged -> User
> Everything else I get from the relational db.
> 
> When I start to care about which users have been tagged for by me or
> my network 6 degrees out for this KEYWORD, then I'll create a more
> complex model:
> User -> UserKeyword -> tagged -> UserKeyword -> User
>    Keyword  ---/                        Keyword  ---/
> 
> Regards,
> Max
> 
> On Thu, Jun 9, 2011 at 12:33 AM, Aseem Kishore <aseem.kish...@gmail.com> 
> wrote:
>> Also forgot to add: now if you want to show all links (globally) for a given
>> tag, how do you do that? Are you indexing each tag-link (as a key-value
>> pair) every time a tag is added? Removing from the index every time a tag is
>> deleted?
>> 
>> Thanks,
>> 
>> Aseem
>> 
>> On Wed, Jun 8, 2011 at 10:31 PM, Aseem Kishore 
>> <aseem.kish...@gmail.com>wrote:
>> 
>>> I forgot to state this, but a key requirement of tags of course is that you
>>> can apply multiple of them to the same link.
>>> 
>>> Would you still go that route then?
>>> 
>>> If you want to delete a link from your bookmarks, it's a matter then of
>>> deleting each tag edge?
>>> 
>>> Aseem
>>> 
>>> 
>>> On Wed, Jun 8, 2011 at 10:28 PM, Siddhartha Kasivajhula <
>>> countvajh...@gmail.com> wrote:
>>> 
>>>> Couldn't you use edges for "tags" instead of nodes?
>>>> 
>>>> user1 --tag--> link1
>>>> user2 --tag--> link1
>>>> user1 --tag--> link2
>>>> 
>>>> 
>>>> On Wed, Jun 8, 2011 at 10:23 PM, Aseem Kishore <aseem.kish...@gmail.com
>>>>> wrote:
>>>> 
>>>>> Hi guys,
>>>>> 
>>>>> We're thinking about implementing tags in our system, and we're
>>>> pondering a
>>>>> few ideas for how we'd go about it, and none of them seem perfect. I'd
>>>> like
>>>>> to ask you guys: how would you design an analogous case: Del.icio.us?
>>>>> 
>>>>> At the core, *users bookmark links*, so it makes sense to have "users"
>>>> and
>>>>> "links" as types of nodes, and "bookmark" as the type of edge that
>>>> connects
>>>>> them. Now, you can see all the links a given user has bookmarked, and
>>>> all
>>>>> the users that have bookmarked a given link.
>>>>> 
>>>>> Now users can also *tag* links, of course, but the most interesting
>>>>> requirement is that, when I'm looking at *my links*, I only want to see
>>>> *my
>>>>> tags*. Thus, tags can't be tied just to links; they have to be tied to
>>>>> users
>>>>> too. But most importantly, you have to maintain *which* user and *which*
>>>>> link *each* tag is for.
>>>>> 
>>>>> Thus, it seems most intuitive to us if we could have "tags" be nodes
>>>>> that *point
>>>>> to the "bookmark" edges*. Unfortunately, that's a hypergraph, which
>>>> Neo4j
>>>>> doesn't support.
>>>>> 
>>>>> We could use intermediate nodes for bookmarks maybe, but that sort of
>>>> sucks
>>>>> to lose the intuitiveness of the graph and introduce redundant edges,
>>>> more
>>>>> complexity which makes consistency harder, etc.
>>>>> 
>>>>> We have some other ideas, but I'm curious if any of you guys have
>>>> thought
>>>>> about this already or have done it, or if you guys have thoughts. Thanks
>>>> in
>>>>> advance!
>>>>> 
>>>>> Aseem
>>>>> _______________________________________________
>>>>> Neo4j mailing list
>>>>> User@lists.neo4j.org
>>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>>> 
>>>> _______________________________________________
>>>> Neo4j mailing list
>>>> User@lists.neo4j.org
>>>> https://lists.neo4j.org/mailman/listinfo/user
>>>> 
>>> 
>>> 
>> _______________________________________________
>> Neo4j mailing list
>> User@lists.neo4j.org
>> https://lists.neo4j.org/mailman/listinfo/user
>> 
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to