Okay I started tinkering with this the console (http://console.neo4j.org/r/glfxa4) more and came up with this:
START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
It returns the starting node and the desired result node. Is there something obvious I'm missing?
Chris
--- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com> wrote:
From: Chris Bolton <iknewthis...@yahoo.com>
Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:26 PM
Afternoon all,
I'm looking for some help writing a query.
I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
Any help would be greatly appreciated.
Thanks.Chris
> START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
> It returns the starting node and the desired result node. Is there something obvious I'm missing?
> Chris
> --- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com> wrote:
> From: Chris Bolton <iknewthis...@yahoo.com>
> Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
> To: neo4j@googlegroups.com
> Date: Tuesday, July 31, 2012, 2:26 PM
> Afternoon all,
> I'm looking for some help writing a query.
> I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
> START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
> I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
> I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
What about removing the initial node in my results?
That's the depth I need. Thanks Michael.
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:41 PM
No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
Is this the depth you need in the end?
Michael
Am 31.07.2012 um 23:34 schrieb Chris Bolton:
Okay I started tinkering with this the console (http://console.neo4j.org/r/glfxa4) more and came up with this:
START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
It returns the starting node and the desired result node. Is there something obvious I'm missing?
Chris
--- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com>
wrote:
From: Chris Bolton <iknewthis...@yahoo.com>
Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:26 PM
Afternoon all,
I'm looking for some help writing a query.
I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
Any help would be greatly appreciated.
Thanks.Chris
> I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
> What about removing the initial node in my results?
> That's the depth I need. Thanks Michael.
> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
> From: Michael Hunger <michael.hun...@neotechnology.com>
> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
> To: neo4j@googlegroups.com
> Date: Tuesday, July 31, 2012, 2:41 PM
> No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
>> START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
>> It returns the starting node and the desired result node. Is there something obvious I'm missing?
>> Chris
>> --- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com> wrote:
>> From: Chris Bolton <iknewthis...@yahoo.com>
>> Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>> To: neo4j@googlegroups.com
>> Date: Tuesday, July 31, 2012, 2:26 PM
>> Afternoon all,
>> I'm looking for some help writing a query.
>> I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
>> START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
>> I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
>> I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
http://console.neo4j.org/?id=elexsz This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:24 PM
What do you mean by removing the initial node?
Michael
Am 31.07.2012 um 23:43 schrieb Chris Bolton:
I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
What about removing the initial node in my results?
That's the depth I need. Thanks Michael.
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:41 PM
No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
Is this the depth you need in the end?
Michael
Am 31.07.2012 um 23:34 schrieb Chris Bolton:
Okay I started tinkering with this the console (http://console.neo4j.org/r/glfxa4) more and came up with this:
START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
It returns the starting node and the desired result node. Is there something obvious I'm missing?
Chris
--- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com>
wrote:
From: Chris Bolton <iknewthis...@yahoo.com>
Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:26 PM
Afternoon all,
I'm looking for some help writing a query.
I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
Any help would be greatly appreciated.
Thanks.Chris
> This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
> From: Michael Hunger <michael.hun...@neotechnology.com>
> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
> To: neo4j@googlegroups.com
> Date: Tuesday, July 31, 2012, 3:24 PM
> What do you mean by removing the initial node?
> Michael
> Am 31.07.2012 um 23:43 schrieb Chris Bolton:
>> I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
>> What about removing the initial node in my results?
>> That's the depth I need. Thanks Michael.
>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>> From: Michael Hunger <michael.hun...@neotechnology.com>
>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>> To: neo4j@googlegroups.com
>> Date: Tuesday, July 31, 2012, 2:41 PM
>> No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
>>> START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
>>> It returns the starting node and the desired result node. Is there something obvious I'm missing?
>>> Chris
>>> --- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com> wrote:
>>> From: Chris Bolton <iknewthis...@yahoo.com>
>>> Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>> To: neo4j@googlegroups.com
>>> Date: Tuesday, July 31, 2012, 2:26 PM
>>> Afternoon all,
>>> I'm looking for some help writing a query.
>>> I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
>>> START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
>>> I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
>>> I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:36 PM
add an
AND z<>n
in your where clause.
Michael
Am 01.08.2012 um 00:26 schrieb Chris Bolton:
http://console.neo4j.org/?id=elexsz This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:24 PM
What do you mean by removing the initial node?
Michael
Am 31.07.2012 um 23:43 schrieb Chris Bolton:
I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
What about removing the initial node in my results?
That's the depth I need. Thanks Michael.
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:41 PM
No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
Is this the depth you need in the end?
Michael
Am 31.07.2012 um 23:34 schrieb Chris Bolton:
Okay I started tinkering with this the console (http://console.neo4j.org/r/glfxa4) more and came up with this:
START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
It returns the starting node and the desired result node. Is there something obvious I'm missing?
Chris
--- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com>
wrote:
From: Chris Bolton <iknewthis...@yahoo.com>
Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:26 PM
Afternoon all,
I'm looking for some help writing a query.
I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
Any help would be greatly appreciated.
Thanks.Chris
Michael (or anyone else who might be able to help),
I added the z<>n and now it only returns the reference node...twice.
In the console it works perfectly but in my Neo4j shell it's breaking (http://console.neo4j.org/?id=elexsz).
START n=node(4) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) AND z<>n RETURN z
I'm using Neo4j - Graph Database Kernel 1.7
Any help would be appreciated.
Chris
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:36 PM
add an
AND z<>n
in your where clause.
Michael
Am 01.08.2012 um 00:26 schrieb Chris Bolton:
http://console.neo4j.org/?id=elexsz This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:24 PM
What do you mean by removing the initial node?
Michael
Am 31.07.2012 um 23:43 schrieb Chris Bolton:
I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
What about removing the initial node in my results?
That's the depth I need. Thanks Michael.
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:41 PM
No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
Is this the depth you need in the end?
Michael
Am 31.07.2012 um 23:34 schrieb Chris Bolton:
Okay I started tinkering with this the console (http://console.neo4j.org/r/glfxa4) more and came up with this:
START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
It returns the starting node and the desired result node. Is there something obvious I'm missing?
Chris
--- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com>
wrote:
From: Chris Bolton <iknewthis...@yahoo.com>
Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:26 PM
Afternoon all,
I'm looking for some help writing a query.
I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
Any help would be greatly appreciated.
Thanks.Chris
> START n=node(4) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) AND z<>n RETURN z
> I'm using Neo4j - Graph Database Kernel 1.7
> Any help would be appreciated.
> Chris
> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
> From: Michael Hunger <michael.hun...@neotechnology.com>
> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
> To: neo4j@googlegroups.com
> Date: Tuesday, July 31, 2012, 3:36 PM
>> This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>> From: Michael Hunger <michael.hun...@neotechnology.com>
>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>> To: neo4j@googlegroups.com
>> Date: Tuesday, July 31, 2012, 3:24 PM
>> What do you mean by removing the initial node?
>> Michael
>> Am 31.07.2012 um 23:43 schrieb Chris Bolton:
>>> I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
>>> What about removing the initial node in my results?
>>> That's the depth I need. Thanks Michael.
>>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>>> From: Michael Hunger <michael.hun...@neotechnology.com>
>>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>> To: neo4j@googlegroups.com
>>> Date: Tuesday, July 31, 2012, 2:41 PM
>>> No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
>>>> START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
>>>> It returns the starting node and the desired result node. Is there something obvious I'm missing?
>>>> Chris
>>>> --- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com> wrote:
>>>> From: Chris Bolton <iknewthis...@yahoo.com>
>>>> Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>>> To: neo4j@googlegroups.com
>>>> Date: Tuesday, July 31, 2012, 2:26 PM
>>>> Afternoon all,
>>>> I'm looking for some help writing a query.
>>>> I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
>>>> START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
>>>> I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
>>>> I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
Michael,
Okay the z <> n is working but I realized my blocked_friends is not working. I tried re-writing the query with your original suggestion of using WITH but I don't think it's supported in 1.7. Mind taking a look. Again it works in the play console but in the shell it breaks.
START n=node(4) MATCH (n)-[:friends]->(x)-[:friends]->(z) WHERE n <>z AND (x-[:friends]->n AND z-[:friends]->x) AND NOT(n-[:blocked_friends]->x OR x-[:blocked_friends]->z) RETURN z
Chris
--- On Wed, 8/1/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Wednesday, August 1, 2012, 12:57 PM
can you put n<>z at the beginning of the where
in 1.7 there was an issue with NOT and parentheses which grabbed too much of an expression.
Michael
Am 01.08.2012 um 19:35 schrieb Chris Bolton:
Michael (or anyone else who might be able to help),
I added the z<>n and now it only returns the reference node...twice.
In the console it works perfectly but in my Neo4j shell it's breaking (http://console.neo4j.org/?id=elexsz).
START n=node(4) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) AND z<>n RETURN z
I'm using Neo4j - Graph Database Kernel 1.7
Any help would be appreciated.
Chris
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:36 PM
add an
AND z<>n
in your where clause.
Michael
Am 01.08.2012 um 00:26 schrieb Chris Bolton:
http://console.neo4j.org/?id=elexsz This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:24 PM
What do you mean by removing the initial node?
Michael
Am 31.07.2012 um 23:43 schrieb Chris Bolton:
I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
What about removing the initial node in my results?
That's the depth I need. Thanks Michael.
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:41 PM
No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
Is this the depth you need in the end?
Michael
Am 31.07.2012 um 23:34 schrieb Chris Bolton:
Okay I started tinkering with this the console (http://console.neo4j.org/r/glfxa4) more and came up with this:
START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
It returns the starting node and the desired result node. Is there something obvious I'm missing?
Chris
--- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com>
wrote:
From: Chris Bolton <iknewthis...@yahoo.com>
Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:26 PM
Afternoon all,
I'm looking for some help writing a query.
I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
Any help would be greatly appreciated.
Thanks.Chris
> Okay the z <> n is working but I realized my blocked_friends is not working. I tried re-writing the query with your original suggestion of using WITH but I don't think it's supported in 1.7. Mind taking a look. Again it works in the play console but in the shell it breaks.
> START n=node(4) MATCH (n)-[:friends]->(x)-[:friends]->(z) WHERE n <>z AND (x-[:friends]->n AND z-[:friends]->x) AND NOT(n-[:blocked_friends]->x OR x-[:blocked_friends]->z) RETURN z
> Chris
> --- On Wed, 8/1/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
> From: Michael Hunger <michael.hun...@neotechnology.com>
> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
> To: neo4j@googlegroups.com
> Date: Wednesday, August 1, 2012, 12:57 PM
> can you put n<>z at the beginning of the where
> in 1.7 there was an issue with NOT and parentheses which grabbed too much of an expression.
> Michael
> Am 01.08.2012 um 19:35 schrieb Chris Bolton:
>> Michael (or anyone else who might be able to help),
>> I added the z<>n and now it only returns the reference node...twice.
>> START n=node(4) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) AND z<>n RETURN z
>> I'm using Neo4j - Graph Database Kernel 1.7
>> Any help would be appreciated.
>> Chris
>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>> From: Michael Hunger <michael.hun...@neotechnology.com>
>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>> To: neo4j@googlegroups.com
>> Date: Tuesday, July 31, 2012, 3:36 PM
>>> This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
>>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>>> From: Michael Hunger <michael.hun...@neotechnology.com>
>>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>> To: neo4j@googlegroups.com
>>> Date: Tuesday, July 31, 2012, 3:24 PM
>>> What do you mean by removing the initial node?
>>> Michael
>>> Am 31.07.2012 um 23:43 schrieb Chris Bolton:
>>>> I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
>>>> What about removing the initial node in my results?
>>>> That's the depth I need. Thanks Michael.
>>>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>>>> From: Michael Hunger <michael.hun...@neotechnology.com>
>>>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>>> To: neo4j@googlegroups.com
>>>> Date: Tuesday, July 31, 2012, 2:41 PM
>>>> No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
>>>>> START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
>>>>> It returns the starting node and the desired result node. Is there something obvious I'm missing?
>>>>> Chris
>>>>> --- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com> wrote:
>>>>> From: Chris Bolton <iknewthis...@yahoo.com>
>>>>> Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>>>> To: neo4j@googlegroups.com
>>>>> Date: Tuesday, July 31, 2012, 2:26 PM
>>>>> Afternoon all,
>>>>> I'm looking for some help writing a query.
>>>>> I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
>>>>> START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
>>>>> I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
>>>>> I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
> Okay the z <> n is working but I realized my blocked_friends is not working. I tried re-writing the query with your original suggestion of using WITH but I don't think it's supported in 1.7. Mind taking a look. Again it works in the play console but in the shell it breaks.
> START n=node(4) MATCH (n)-[:friends]->(x)-[:friends]->(z) WHERE n <>z AND (x-[:friends]->n AND z-[:friends]->x) AND NOT(n-[:blocked_friends]->x OR x-[:blocked_friends]->z) RETURN z
> Chris
> --- On Wed, 8/1/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
> From: Michael Hunger <michael.hun...@neotechnology.com>
> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
> To: neo4j@googlegroups.com
> Date: Wednesday, August 1, 2012, 12:57 PM
> can you put n<>z at the beginning of the where
> in 1.7 there was an issue with NOT and parentheses which grabbed too much of an expression.
> Michael
> Am 01.08.2012 um 19:35 schrieb Chris Bolton:
>> Michael (or anyone else who might be able to help),
>> I added the z<>n and now it only returns the reference node...twice.
>> START n=node(4) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) AND z<>n RETURN z
>> I'm using Neo4j - Graph Database Kernel 1.7
>> Any help would be appreciated.
>> Chris
>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>> From: Michael Hunger <michael.hun...@neotechnology.com>
>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>> To: neo4j@googlegroups.com
>> Date: Tuesday, July 31, 2012, 3:36 PM
>>> This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
>>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>>> From: Michael Hunger <michael.hun...@neotechnology.com>
>>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>> To: neo4j@googlegroups.com
>>> Date: Tuesday, July 31, 2012, 3:24 PM
>>> What do you mean by removing the initial node?
>>> Michael
>>> Am 31.07.2012 um 23:43 schrieb Chris Bolton:
>>>> I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
>>>> What about removing the initial node in my results?
>>>> That's the depth I need. Thanks Michael.
>>>> --- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
>>>> From: Michael Hunger <michael.hun...@neotechnology.com>
>>>> Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>>> To: neo4j@googlegroups.com
>>>> Date: Tuesday, July 31, 2012, 2:41 PM
>>>> No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
>>>>> START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
>>>>> It returns the starting node and the desired result node. Is there something obvious I'm missing?
>>>>> Chris
>>>>> --- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com> wrote:
>>>>> From: Chris Bolton <iknewthis...@yahoo.com>
>>>>> Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
>>>>> To: neo4j@googlegroups.com
>>>>> Date: Tuesday, July 31, 2012, 2:26 PM
>>>>> Afternoon all,
>>>>> I'm looking for some help writing a query.
>>>>> I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
>>>>> START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
>>>>> I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
>>>>> I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
--- On Wed, 8/1/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Wednesday, August 1, 2012, 2:02 PM
Btw. you can set the console to a certain version in the upper right corner.
Michael
Am 01.08.2012 um 22:20 schrieb Chris Bolton:
Michael,
Okay the z <> n is working but I realized my blocked_friends is not working. I tried re-writing the query with your original suggestion of using WITH but I don't think it's supported in 1.7. Mind taking a look. Again it works in the play console but in the shell it breaks.
START n=node(4) MATCH (n)-[:friends]->(x)-[:friends]->(z) WHERE n <>z AND (x-[:friends]->n AND z-[:friends]->x) AND NOT(n-[:blocked_friends]->x OR x-[:blocked_friends]->z) RETURN z
Chris
--- On Wed, 8/1/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Wednesday, August 1, 2012, 12:57 PM
can you put n<>z at the beginning of the where
in 1.7 there was an issue with NOT and parentheses which grabbed too much of an expression.
Michael
Am 01.08.2012 um 19:35 schrieb Chris Bolton:
Michael (or anyone else who might be able to help),
I added the z<>n and now it only returns the reference node...twice.
In the console it works perfectly but in my Neo4j shell it's breaking (http://console.neo4j.org/?id=elexsz).
START n=node(4) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) AND z<>n RETURN z
I'm using Neo4j - Graph Database Kernel 1.7
Any help would be appreciated.
Chris
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:36 PM
add an
AND z<>n
in your where clause.
Michael
Am 01.08.2012 um 00:26 schrieb Chris Bolton:
http://console.neo4j.org/?id=elexsz This returns z, which results in two rows, the reference node and the result node. How do I get it to omit the reference node?
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 3:24 PM
What do you mean by removing the initial node?
Michael
Am 31.07.2012 um 23:43 schrieb Chris Bolton:
I realized after I sent the initial email that I copied my query from my code into the email which uses lower case as opposed to the console where I used upper case (don't ask me why). Sorry about that.
What about removing the initial node in my results?
That's the depth I need. Thanks Michael.
--- On Tue, 7/31/12, Michael Hunger <michael.hun...@neotechnology.com> wrote:
From: Michael Hunger <michael.hun...@neotechnology.com>
Subject: Re: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:41 PM
No, thats pretty good, until cypher gets some more functiions/operators to work with paths.
Is this the depth you need in the end?
Michael
Am 31.07.2012 um 23:34 schrieb Chris Bolton:
Okay I started tinkering with this the console (http://console.neo4j.org/r/glfxa4) more and came up with this:
START n=node(1) MATCH (n)-[:FRIENDS]->(x)-[:FRIENDS]->(z) WHERE (x-[:FRIENDS]->n AND z-[:FRIENDS]->x) AND NOT(n-[:BLOCKED_FRIENDS]->x AND x-[:BLOCKED_FRIENDS]->z) RETURN z
It returns the starting node and the desired result node. Is there something obvious I'm missing?
Chris
--- On Tue, 7/31/12, Chris Bolton <iknewthis...@yahoo.com>
wrote:
From: Chris Bolton <iknewthis...@yahoo.com>
Subject: [Neo4j] Cypher Query Filtering Friends of Friends nodes
To: neo4j@googlegroups.com
Date: Tuesday, July 31, 2012, 2:26 PM
Afternoon all,
I'm looking for some help writing a query.
I've built this query so that it finds all friends that have a reciprocated relationship and are not blocked friends.
START n=node(1) MATCH (n)-[:friends]->(x) WHERE (x-[:friends]->n) AND NOT(n<-[:blocked_friends]-x) RETURN x
I'm now trying to go one layer deeper and pull the friends of friends filtered by the same criteria on the first level and the second level.
I set up the Neo4j console (http://console.neo4j.org/?id=j6cyp4) in hopes that it would be easier to visualize. I am trying to return just Mike starting with Bob.
Any help would be greatly appreciated.
Thanks.Chris