Awesome! Thanks again! Aseem
On Wed, Sep 14, 2011 at 12:59 PM, Andres Taylor < [email protected]> wrote: > And now it's in code. > > > http://docs.neo4j.org/chunked/snapshot/query-match.html#match-optional-relationship > > Hope that helps, > > Andrés > > On Thu, Aug 25, 2011 at 10:34 PM, Andres Taylor < > [email protected]> wrote: > > > Good and valid requests, Aseem. > > > > Consider them heard. We'll see how soon we can get it to you. > > > > Andrés > > > > On Thu, Aug 25, 2011 at 12:57 PM, Aseem Kishore <[email protected] > >wrote: > > > >> Man, I am loving Cypher. Thanks so much guys for introducing it. I'm a > bit > >> stuck on one query, though, and I wanted to ask for help. I think the > >> reasons I'm stuck are related to the two feature requests I made > yesterday > >> (optional matches, and returning IDs). > >> > >> I want to fetch first- and second-degree friends in one query, in a way > >> that > >> preserves the first-degree friend(s) for each second-degree friends. > >> Assume > >> an asymmetrical friendship model, like Twitter's following, because that > >> makes things a bit easier. > >> > >> Here's a simple transitive example: > >> > >> - Alice follows Bob and Carol. > >> - Bob follows Carol and Dave. > >> - Carol follows Dave and Alice. > >> > >> > >> I want to fetch Alice's first-degree friends (Bob and Carol) and each of > >> their first-degree friends ((Carol and Dave) for Bob, and (Dave and > Alice) > >> for Carol). This example is easy enough: > >> > >> START zero=(Alice) > >> MATCH (zero) -[:FOLLOWS]-> (first) -[:FOLLOWS]-> (second) > >> RETURN first, second > >> > >> > >> I expect to get back results like: > >> > >> - Bob, Carol > >> - Bob, Dave > >> - Carol, Dave > >> - Carol, Alice > >> > >> > >> This is great because I can get Alice's first-degree friends by > >> unique()'ing > >> the first column, for each person, I know their second-degree friends > via > >> the second column. > >> > >> But this doesn't work if any of my first-degree friends don't follow > >> anyone. > >> For that, it would be great if I could specify that the second part of > >> that > >> match was "optional", and I'd get back a row like this in that case: > >> > >> - Elizabeth, <null> > >> > >> If I'm returning nodes, it also duplicates a ton of info: each > >> first-degree > >> friend's info is returned in full for each of their friends. Maybe > there's > >> no way around that, but this is also where I would find it convenient to > >> be > >> able to return IDs somehow for all but one of the results. > >> > >> Just thinking out loud here, but I'd greatly appreciate any feedback or > >> ideas for this scenario. Thanks much! > >> > >> Aseem > >> _______________________________________________ > >> Neo4j mailing list > >> [email protected] > >> https://lists.neo4j.org/mailman/listinfo/user > >> > > > > > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

