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
'cutting of' a node with all subnodes
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
 
wujek  
View profile  
 More options Oct 2 2012, 3:25 am
From: wujek <wujek.sru...@gmail.com>
Date: Tue, 2 Oct 2012 00:25:46 -0700 (PDT)
Local: Tues, Oct 2 2012 3:25 am
Subject: 'cutting of' a node with all subnodes

Hi. I have the following structure:

REF_NODE
    |
    |
    |
some node
|    |    |    |
a  b   c   d

Nodes a, b, c and d also have other nodes. The point is - there is only a
single reference to 'some node' from REF_NODE and for each of its children.
I would like to be able to delete 'some node' with all nodes that are
'under it' - that's what I mean by cutting off, for lack of a better,
scientific word ;d There can, however, be references between all other
nodes below 'some node' (for example, a references c, and grandchildren of
d reference b and the other way round). For the delete operation, it's all
the same as long as there are no references to the 'top level' 'some node'.
The Node.delete() method will not allow me to delete it as there are other
references. The way I can see it work is to have some complex algorithm to
'disintegrate' the graph somehow, which I think would be difficult and time
consuming - the subgraph below 'some node' might be very big indeed.
How can I do it best?

Regards,
wujek


 
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.
Mattias Persson  
View profile  
 More options Oct 2 2012, 3:49 am
From: Mattias Persson <matt...@neotechnology.com>
Date: Tue, 2 Oct 2012 09:49:31 +0200
Local: Tues, Oct 2 2012 3:49 am
Subject: Re: [Neo4j] 'cutting of' a node with all subnodes

I don't quite understand as your sentences seem to contradict each other.

On the one hand you'd like to delete "some node" and "all nodes under it".

On the other hand you'd just like to cut it off, which I interpret as just
remove all its relationships.

Can you elaborate?

Best,
Mattias

2012/10/2 wujek <wujek.sru...@gmail.com>

--
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com

 
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.
Wujek Srujek  
View profile  
 More options Oct 2 2012, 3:55 am
From: Wujek Srujek <wujek.sru...@gmail.com>
Date: Tue, 2 Oct 2012 09:55:39 +0200
Local: Tues, Oct 2 2012 3:55 am
Subject: Re: [Neo4j] 'cutting of' a node with all subnodes

Sorry for the poor wording and confusion.
By cutting off I mean: wipe out 'some node', a, b, c, d, all other nodes
below, all relationships... I would like to say:
node.wipeOut()
and have the whole subgraph deleted - after this operation, the graph looks
like the following:

REF_NODE

Of course, if the graph looks like this:

REF_NODE
|                |
|                |
some        another
node         node

and I invoke

'some node'.wipeOut()

the graph looks like this:

REF_NODE
                 |
                 |
               another
               node

(again, with no trace of orphaned 'some node', a, b, c, or d).

Regards,
wujek

On Tue, Oct 2, 2012 at 9:49 AM, Mattias Persson
<matt...@neotechnology.com>wrote:


 
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.
Wes Freeman  
View profile  
 More options Oct 2 2012, 3:55 am
From: Wes Freeman <freeman....@gmail.com>
Date: Tue, 2 Oct 2012 03:55:24 -0400
Local: Tues, Oct 2 2012 3:55 am
Subject: Re: [Neo4j] 'cutting of' a node with all subnodes

I think he wants to prune the tree starting at a node, but not including
that node. I'm also interested in this ability (it would be nice not to
have to traverse and prune). Is there syntax that allows for this already?

I opened a ticket:
https://github.com/neo4j/community/issues/901

Wes

On Tue, Oct 2, 2012 at 3:49 AM, Mattias Persson
<matt...@neotechnology.com>wrote:


 
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.
Wujek Srujek  
View profile  
 More options Oct 2 2012, 3:57 am
From: Wujek Srujek <wujek.sru...@gmail.com>
Date: Tue, 2 Oct 2012 09:57:09 +0200
Local: Tues, Oct 2 2012 3:57 am
Subject: Re: [Neo4j] 'cutting of' a node with all subnodes

Thank you! Yes, 'prune' would be the better word.

With the difference that when I prune starting with a node, I also want to
remove the node itself. But that should be a simple change?

wujek


 
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.
Wes Freeman  
View profile  
 More options Oct 2 2012, 4:00 am
From: Wes Freeman <freeman....@gmail.com>
Date: Tue, 2 Oct 2012 04:00:23 -0400
Local: Tues, Oct 2 2012 4:00 am
Subject: Re: [Neo4j] 'cutting of' a node with all subnodes

I think the syntax to delete collections of relationships in cypher would
make this trivial (either deleting the starting node or not), as I
mentioned in my ticket. I don't think there's another way to do it without
doing multiple calls and traversing.

Wes


 
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.
Wujek Srujek  
View profile  
 More options Oct 2 2012, 4:17 am
From: Wujek Srujek <wujek.sru...@gmail.com>
Date: Tue, 2 Oct 2012 10:17:11 +0200
Local: Tues, Oct 2 2012 4:17 am
Subject: Re: [Neo4j] 'cutting of' a node with all subnodes

Great, I will test it. Thank you for your help.
One question - you said no traversal is done - how does this work then?
Does cypher don't do traversal in this case?
Sorry for this potentially dumb question, I am just starting with neo4j,
and haven't looked at cypher yet!

Regards,
wujek


 
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 Oct 2 2012, 5:05 am
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Tue, 2 Oct 2012 11:05:02 +0200
Local: Tues, Oct 2 2012 5:05 am
Subject: Re: [Neo4j] 'cutting of' a node with all subnodes

Wes was almost right on the syntax, the only difference is that "r" is an collection. So you have to use foreach to delete it.

start n=node({lookup})
match n-[r*]->m
where not(m-[*]->n)
foreach (rel in r: delete rel)
delete m;

Am 02.10.2012 um 10:17 schrieb Wujek Srujek:


 
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 »