Hi all,

I just wanted to strongly give my vote for including self-relationships into
the next Neo4j release.

I'm the developer of Bio4j project <http://www.bio4j.com/> and I have to say
that I really miss the lack of this feature.
There are several cases where not having self-relationships leads to
"artificial" and sometimes
misleading domain models for people who just get in contact with the
project.

One of them would be protein interactions; in which a protein can interact
both with different
proteins and itself. For that I had to create a special node where I link
proteins which interact with themselves.
This is done by means of a relationship (let's call it
'interacts_with_itself") different than the 'normal' one ('interacts_with')
so when you need to retrieve all interactions with a protein you have to
take into account both of them.

This example alone can seem not really important but when more of these are
combined the code
starts to get bigger (and thus error prone) with lots of 'special cases';
which in addition are weird from the domain
point of view for someone who just want to use it without much
knowledge/interest of how things
are implemented and/or why are done that way.

Cheers,

On Tue, Apr 26, 2011 at 10:07 PM, Rick Otten <rot...@windfish.net> wrote:

> In my case I wasn't looking to retrace a specific user's path, but rather
> trying to identify popular paths.  It was 'quick and easy' to do with a
> graph model (except for some confusion about counting self referencing
> relationships).
>
> I was, in fact, adding user nodes so I could see the types of things
> certain groups of users did (within my data sample), but that was simply
> leveraging the graph to answer two classes of questions at the same time,
> rather than directly relevant to the "popular path" problem.
>
> I think I also created "event 1", "event 2", nodes and linked them to the
> button nodes.  These didn't really tell me if someone was likely to jump
> from button B to button E (since they could get to button B at any event
> number) but they did tell me whether certain buttons were more likely to
> be selected early in the user experience or later.
>
> There were lots of graph based explorations possible in that quick study.
> I barely cracked the surface in the time I had to work on it...
>
>
>
> > I've wanted to do similar tracking of paths within a graph, but am not
> > clear about your approach. Were you creating new relationships between
> > each node directly to represent an event? I suppose you'd have to add the
> > user id and a sequence number into each relationship to keep the tracking
> > distinct and preserver order. Which would work, except for repeats to the
> > same node. Instead of sequence numbers in the relationships, you could
> > just use a sequence of events.
> >
> > I tend to try to keep distinct concepts within the graph separate. Like
> > possible paths (a graph of possibilities) vs actual paths (which are
> trees
> > because they are a sequence of events). With buttons, I would first
> create
> > the graph of buttons with possible paths:
> >
> > A -> B -> C -> {wherever}
> >
> > Then track each user traversal by referencing those nodes in sequence:
> >
> > User1 --> event1
> > event1 -clicked-> A
> > event1 -next-> event2
> > event2 -clicked-> B
> > event2 -next-> event 3
> > event3 -clicked-> B
> > event3 -next-> event4
> > event4 -clicked-> C
> > etc...
> >
> > Subsequent users would either increment counts along that path or create
> > new branches when they diverge.
> >
> > Cheers,
> > Andreas
> >
> > On Apr 26, 2011, at 12:57 PM, Rick Otten wrote:
> >
> >> Where I've wanted self referencing nodes is when mapping a sequence of
> >> user actions:
> >>
> >> user clicks button A -> [then clicks] -> button B -> [then clicks] ->
> >> button B (again) -> [then clicks] -> button C -> [then ...
> >>
> >> Run this over a few 10's of thousands of users (incrementing counts),
> >> and
> >> a few dozen buttons, and you can start to find things like:
> >>
> >> "This sequence of button presses is the most common path for users
> >> through
> >> our prouduct."
> >>
> >> "If a user is on button B, it is pretty likely they'll click it again."
> >>
> >> "The group of users who are based in California tend to click buttons on
> >> the left side of the screen, while the ones in Massachusetts tend to
> >> click
> >> buttons on the right side of the screen."
> >>
> >> There may have been other ways to do this modeling, but the way I
> >> implemented it really needed self referencing relationships to count all
> >> the [then clicks] relationships, not just the ones that move to new
> >> buttons.
> >>
> >>
> >>
> >>> Hi Shaunak,
> >>>
> >>> As you've noticed, self-referencing nodes have been considered before,
> >>> and
> >>> I remember being perplexed by the lack when I first became a Neo4j
> >>> user.
> >>> Changing the support is simple enough, but there was obviously a
> >>> conscious
> >>> design decision. Why?
> >>>
> >>> Anecdotally (and wiser, longer memoried minds should correct me),
> >>> self-referencing nodes lead to more trouble than they're worth. So
> >>> they're
> >>> considered an error because there is more value in being alerted that
> >>> you
> >>> just related a node to itself, then there is value in the few cases
> >>> where
> >>> you absolutely must have them. Being a database, the decision has been
> >>> to
> >>> err on the side of avoiding problems, even at the cost of some
> >>> convenience.
> >>>
> >>> An approach that could allow for intentional self-referencing, while
> >>> still
> >>> protecting against accidental self-references, would be implement an
> >>> explicit Node.relateToSelfAs(RelationshipType type).
> >>>
> >>> What does you model look like, that you expect to require
> >>> self-referencing?
> >>>
> >>> Best,
> >>> Andreas
> >>>
> >>> On Apr 26, 2011, at 11:15 AM, Shaunak Kashyap wrote:
> >>>
> >>>> I know this topic has been discussed before[1] and that a trac issue
> >>>> was
> >>>> also created[2]. I see that a patch was submitted as part of the issue
> >>>> but from browsing the source code[3] it appears that self-referencing
> >>>> relationships are still a no-go in Neo4J.
> >>>>
> >>>> Are there any plans to apply the patch submitted by tobias OR, in
> >>>> general, to provide for self-referencing relationships in Neo4J?
> >>>>
> >>>> We are evaluating Neo4J against OrientDB for an internal tool at
> >>>> Yahoo.
> >>>> While Neo4J looks like a far more mature product overall, the lack of
> >>>> self-referencing relationships might become a sticking point (yes, I
> >>>> understand they can be worked around with a middle node but that
> >>>> requires the application to handle special cases which we would like
> >>>> to
> >>>> avoid).
> >>>>
> >>>> References:
> >>>> [1] http://www.mail-archive.com/user@lists.neo4j.org/msg03996.html
> >>>> [2] https://trac.neo4j.org/ticket/239
> >>>> [3]
> >>>>
> https://github.com/neo4j/community/blob/master/kernel/src/main/java/org/neo4j/kernel/impl/core/RelationshipImpl.java#L45
> >>>>
> >>>> Thank you,
> >>>>
> >>>> shaunak
> >>>> kashyap
> >>>> technical yahoo
> >>>>
> >>>> shau...@yahoo-inc.com
> >>>> direct 408-349-4024    mobile 408-203-2450
> >>>>
> >>>> 701 first avenue, sunnyvale, ca, 94089-0703, us
> >>>> phone (408) 349 3300    fax (408) 349 3301
> >>>>
> >>>> _______________________________________________
> >>>> 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
> >>>
> >>
> >>
> >> --
> >> Rick Otten
> >> rot...@windfish.net
> >> O=='=+
> >>
> >>
> >> _______________________________________________
> >> 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
> >
>
>
> --
> Rick Otten
> rot...@windfish.net
> O=='=+
>
>
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Pablo Pareja Tobes
LinkedIn    http://www.linkedin.com/in/pabloparejatobes
Twitter       http://www.twitter.com/pablopareja

http://about.me/pablopareja
http://www.ohnosequences.com
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to