On Tue, Aug 30, 2011 at 1:20 PM, Benjamin Gustafsson <
benjamingustafs...@gmail.com> wrote:

> >
> > If an item can only be "had" by one user at a time, then the "display",
> or
> > "visible_to", relationship could originate from the item.
> >
>
>
>
> > > 9. "owesItemTo" -relation between User, Item, User/Group. (A triple, Do
> I
> > > need a node?)
> > >
> >
> > Same here.
> >
>
>
> Thanks
>
> I will rename "have" to "owner_of".
> Then use the relations
>
> item "visible_to" user/group
> item "currently_held_by" user/group
>
> Why would you need two relationships? Can you let a single relationship
> > represent the mutual credit line between two users?
> >
>
> If I use a single directed relationship, how could I prepare the data for
> the traversal to be fast?
> I know the traversal is equally fast in both directions, but the
> calculation
> "remaining_credits" can be made in advance or while traversing.
> I can't really decide if the pre calculated properties "remaining_credits"
> will make traversal faster or if it just introduces the unnecessary risk of
> inconsistency.
>
> I could have 5 properties:
> long balance
> long end_node_limit
> long start_node_limit
> long end_node_remaining_credits
> long start_node_remaining_credits
>
> My thoughts are something like this to make a faster traversal:
>
> If the traversal finds a "incoming" mutual_credit-relation it could check
> property
> "end_node_remaining_credits" to decide if it is enough for the transaction.
>
> And if the traversal finds a "outgoing" mutual_credit-relation it could
> check property
> "start_node_remaining_credits" to decide if it is enough for the
> transaction.
>

Exactly. The direction would multiplex to two properties. That being said,
it is OK to have two relationships as well. Since all modifications are in a
transactional context, it will always be consistent. It will however require
you to find two relationships instead of one, which, depending on how you
implement it, may or may not require more time.

David


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



-- 
David Montag <david.mon...@neotechnology.com>
Neo Technology, www.neotechnology.com
Cell: 650.556.4411
Skype: ddmontag
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to