Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
[Cypher] Retrieve all nodes which are not related to a specific node
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marc de Verdelhan  
View profile  
 More options May 7 2012, 12:04 pm
From: Marc de Verdelhan <marc.deverdel...@yahoo.com>
Date: Mon, 7 May 2012 18:04:02 +0200
Local: Mon, May 7 2012 12:04 pm
Subject: [Neo4j] [Cypher] Retrieve all nodes which are not related to a specific node

Hello,

I have the following graph: http://tinyurl.com/893tzu5

Then when I execute this query: START gp=node(6) MATCH
gp-[:B]->c<-[:B]-mp<-[:SW|G]-u WHERE u.name <> "u1" RETURN mp
... it returns p1 and p2.

Could you explain why I'm getting "p1"?
Or in other terms: I would like to remove p1 from these results because
this node is related to a node whose "name" property is "u1".

Cheers,

Marc


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options May 7 2012, 12:19 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Mon, 7 May 2012 18:19:37 +0200
Local: Mon, May 7 2012 12:19 pm
Subject: Re: [Neo4j] [Cypher] Retrieve all nodes which are not related to a specific node

b/c there are two paths along which you can reach u1 and you output all the paths.

Michael

Am 07.05.2012 um 18:04 schrieb Marc de Verdelhan:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc de Verdelhan  
View profile  
 More options May 7 2012, 3:26 pm
From: Marc de Verdelhan <marc.deverdel...@yahoo.com>
Date: Mon, 7 May 2012 21:26:46 +0200
Local: Mon, May 7 2012 3:26 pm
Subject: Re: [Neo4j] [Cypher] Retrieve all nodes which are not related to a specific node

Ok. I wasn't thinking in graph traversal way.

So now, as I tried to do with my query: starting from gw1, I want to
retrieve all the nodes which are related to c1 except those which are
related to at least one node whose the "name" property equals "u1". What
would be the query for that?

Cheers,

Marc

On Mon, May 7, 2012 at 6:19 PM, Michael Hunger <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Michael Hunger  
View profile  
 More options May 7 2012, 5:50 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Mon, 7 May 2012 23:50:02 +0200
Local: Mon, May 7 2012 5:50 pm
Subject: Re: [Neo4j] [Cypher] Retrieve all nodes which are not related to a specific node

Marc,

the best I came up with is:
START gp=node(6) MATCH gp-[:B]->c<-[:B]-mp<-[:SW|G]-u with mp, collect(u) as us where NONE(n in us where n.name ='u1') return mp

http://tinyurl.com/7x8t3cb

But perhaps Andrés has better insights.

Michael

Am 07.05.2012 um 21:26 schrieb Marc de Verdelhan:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andres Taylor  
View profile  
 More options May 8 2012, 2:28 am
From: Andres Taylor <andres.tay...@neotechnology.com>
Date: Tue, 8 May 2012 08:28:44 +0200
Local: Tues, May 8 2012 2:28 am
Subject: Re: [Neo4j] [Cypher] Retrieve all nodes which are not related to a specific node

On Mon, May 7, 2012 at 11:50 PM, Michael Hunger <

michael.hun...@neotechnology.com> wrote:
> Marc,

> the best I came up with is:
> START gp=node(6) MATCH gp-[:B]->c<-[:B]-mp<-[:SW|G]-u with mp, collect(u)
> as us where NONE(n in us where n.name ='u1') return mp

> http://tinyurl.com/7x8t3cb

This is my shot at it. There are plans to make this nicer - I'd like to
skip the last part of the match (mp-[?]-p) and move that entirely to the
WHERE, but not yet.

START gw1=node(6)
MATCH gw1-[:B]->c<-[:B]-mp-[?:B]-p
WHERE p is null or p.name!="u1"
RETURN mp

http://tinyurl.com/d9mayxf

HTH,

Andrés


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc de Verdelhan  
View profile  
 More options May 8 2012, 3:28 am
From: Marc de Verdelhan <marc.deverdel...@yahoo.com>
Date: Tue, 8 May 2012 09:28:20 +0200
Local: Tues, May 8 2012 3:28 am
Subject: Re: [Neo4j] [Cypher] Retrieve all nodes which are not related to a specific node

Andrés,

It seems you misunderstood what I'd like to do. I don't want to keep p1 but
to remove it. Michael's solution works on this little graph. I'll test it
on a bigger one tomorrow. However there should be a more elegant way to do
this.

BTW you're right: moving the last part of the MATCH clause to the WHERE
would be nicer.

Thank you guys.

Marc

On Tue, May 8, 2012 at 8:28 AM, Andres Taylor <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marc de Verdelhan  
View profile  
 More options May 9 2012, 4:12 am
From: Marc de Verdelhan <marc.deverdel...@yahoo.com>
Date: Wed, 9 May 2012 10:12:47 +0200
Local: Wed, May 9 2012 4:12 am
Subject: Re: [Neo4j] [Cypher] Retrieve all nodes which are not related to a specific node

Just for saying I found simpler: start gp=node(6) match
gp-[:B]->c<-[:B]-mp<-[:SW|G]-u with mp, collect(u.name) as uns where
not('u1' in uns) return mp
Works well.

Cheers,

Marc

On Tue, May 8, 2012 at 9:28 AM, Marc de Verdelhan <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peter Neubauer  
View profile  
 More options May 9 2012, 4:18 am
From: Peter Neubauer <peter.neuba...@neotechnology.com>
Date: Wed, 9 May 2012 10:18:14 +0200
Local: Wed, May 9 2012 4:18 am
Subject: Re: [Neo4j] [Cypher] Retrieve all nodes which are not related to a specific node
Cool,
thanks for sharing Marc!

Cheers,

/peter neubauer

G:  neubauer.peter
S:  peter.neubauer
P:  +46 704 106975
L:   http://www.linkedin.com/in/neubauer
T:   @peterneubauer

If you can write, you can code - @coderdojomalmo
If you can sketch, you can use a graph database - @neo4j

On Wed, May 9, 2012 at 10:12 AM, Marc de Verdelhan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »