I'm running Neo4J on Heroku and accessing it through the REST API (node.js client).
I can't figure out how to delete all nodes and all relationships in the database except for node 0.
Basically I want to clear all the data out of my database and repopulate it several times during development - is this possible through a cypher query or through the REST API???
On Wed, Jul 18, 2012 at 11:49 AM, Aidan Casey <aidanca...@gmail.com> wrote:
> I'm running Neo4J on Heroku and accessing it through the REST API (node.js
> client).
> I can't figure out how to delete all nodes and all relationships in the
> database except for node 0.
> Basically I want to clear all the data out of my database and repopulate
> it several times during development - is this possible through a cypher
> query or through the REST API???
Here's what I've been using (for the exact same reasons as you):
START n=node(*)
MATCH n-[r?]-()
WHERE ID(n) <> 0
DELETE n,r
Best
Julian.
> thanks
> Aidan
-- *Julian Simpson* *
**Software Engineer | Neo Technology*
+447967189579 | @builddoctor
*As a friend of Neo, register for GraphConnect <http://graphconnect.com/> and
get a 20% discount. Code: GCFON*
On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
> I'm running Neo4J on Heroku and accessing it through the REST API (node.js > client).
> I can't figure out how to delete all nodes and all relationships in the > database except for node 0.
> Basically I want to clear all the data out of my database and repopulate > it several times during development - is this possible through a cypher > query or through the REST API???
Since a complete clear down of the graph (except ref node) seems to be a
very common requirement, I've just added a helper method to py2neo to do
this, called "clear":
> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>> I'm running Neo4J on Heroku and accessing it through the REST API
>> (node.js client).
>> I can't figure out how to delete all nodes and all relationships in the
>> database except for node 0.
>> Basically I want to clear all the data out of my database and repopulate
>> it several times during development - is this possible through a cypher
>> query or through the REST API???
Nigel, I would add a 'force=False' in the prototype of the function just to make sure that people really know what they are doing. If you are just fiddling with the library and trying the functions you might create disaster.
On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
> Since a complete clear down of the graph (except ref node) seems to be a > very common requirement, I've just added a helper method to py2neo to do > this, called "clear":
> On 21 July 2012 10:26, Aidan Casey <aidanca...@gmail.com> wrote:
>> Fantastico !!! >> thanks for the swift reply!
>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>> I'm running Neo4J on Heroku and accessing it through the REST API >>> (node.js client).
>>> I can't figure out how to delete all nodes and all relationships in the >>> database except for node 0.
>>> Basically I want to clear all the data out of my database and repopulate >>> it several times during development - is this possible through a cypher >>> query or through the REST API???
I'm afraid I have to disagree on this point. If someone is testing out the
library, I would hope that they wouldn't be doing so against a production
database. Also, the mechanism that you suggest would also not create any
real kind of barrier to accidental damage and would merely introduce
unnecessary noise into the function signature.
Nige
On 7 August 2012 09:47, S B <stefan.ber...@rechaoss.com> wrote:
> Nigel,
> I would add a 'force=False' in the prototype of the function just to make
> sure that people really know what they are doing. If you are just fiddling
> with the library and trying the functions you might create disaster.
> Stefan
> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>> Since a complete clear down of the graph (except ref node) seems to be a
>> very common requirement, I've just added a helper method to py2neo to do
>> this, called "clear":
>> On 21 July 2012 10:26, Aidan Casey <aidanca...@gmail.com> wrote:
>>> Fantastico !!!
>>> thanks for the swift reply!
>>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>>> I'm running Neo4J on Heroku and accessing it through the REST API
>>>> (node.js client).
>>>> I can't figure out how to delete all nodes and all relationships in the
>>>> database except for node 0.
>>>> Basically I want to clear all the data out of my database and
>>>> repopulate it several times during development - is this possible through a
>>>> cypher query or through the REST API???
That method did not work for me. I'm accessing neo (1.7.2) through the shell and all it gives me is this error message: *SyntaxException: expected return clause*
On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
> Hi Stefan
> I'm afraid I have to disagree on this point. If someone is testing out the > library, I would hope that they wouldn't be doing so against a production > database. Also, the mechanism that you suggest would also not create any > real kind of barrier to accidental damage and would merely introduce > unnecessary noise into the function signature.
> Nige
> On 7 August 2012 09:47, S B <stefan...@rechaoss.com <javascript:>> wrote:
>> Nigel, >> I would add a 'force=False' in the prototype of the function just to make >> sure that people really know what they are doing. If you are just fiddling >> with the library and trying the functions you might create disaster.
>> Stefan
>> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>>> Since a complete clear down of the graph (except ref node) seems to be a >>> very common requirement, I've just added a helper method to py2neo to do >>> this, called "clear":
>>> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com <javascript:>>wrote:
>>>> Fantastico !!! >>>> thanks for the swift reply!
>>>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>>>> I'm running Neo4J on Heroku and accessing it through the REST API >>>>> (node.js client).
>>>>> I can't figure out how to delete all nodes and all relationships in >>>>> the database except for node 0.
>>>>> Basically I want to clear all the data out of my database and >>>>> repopulate it several times during development - is this possible through a >>>>> cypher query or through the REST API???
> That method did not work for me. I'm accessing neo (1.7.2) through the shell and all it gives me is this error message:
> SyntaxException: expected return clause
> Does 1.7.2 not support DELETE?
> On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
> Hi Stefan
> I'm afraid I have to disagree on this point. If someone is testing out the library, I would hope that they wouldn't be doing so against a production database. Also, the mechanism that you suggest would also not create any real kind of barrier to accidental damage and would merely introduce unnecessary noise into the function signature.
> Nige
> On 7 August 2012 09:47, S B <stefan...@rechaoss.com> wrote:
> Nigel,
> I would add a 'force=False' in the prototype of the function just to make sure that people really know what they are doing. If you are just fiddling with the library and trying the functions you might create disaster.
> Stefan
> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
> Since a complete clear down of the graph (except ref node) seems to be a very common requirement, I've just added a helper method to py2neo to do this, called "clear":
> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com> wrote:
> Fantastico !!!
> thanks for the swift reply!
> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
> I'm running Neo4J on Heroku and accessing it through the REST API (node.js client).
> I can't figure out how to delete all nodes and all relationships in the database except for node 0.
> Basically I want to clear all the data out of my database and repopulate it several times during development - is this possible through a cypher query or through the REST API???
> Am 20.09.2012 um 20:43 schrieb Christopher Hydak:
> That method did not work for me. I'm accessing neo (1.7.2) through the > shell and all it gives me is this error message: > *SyntaxException: expected return clause*
> Does 1.7.2 not support DELETE?
> On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
>> Hi Stefan
>> I'm afraid I have to disagree on this point. If someone is testing out >> the library, I would hope that they wouldn't be doing so against a >> production database. Also, the mechanism that you suggest would also not >> create any real kind of barrier to accidental damage and would merely >> introduce unnecessary noise into the function signature.
>> Nige
>> On 7 August 2012 09:47, S B <stefan...@rechaoss.com> wrote:
>>> Nigel, >>> I would add a 'force=False' in the prototype of the function just to >>> make sure that people really know what they are doing. If you are just >>> fiddling with the library and trying the functions you might create >>> disaster.
>>> Stefan
>>> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>>>> Since a complete clear down of the graph (except ref node) seems to be >>>> a very common requirement, I've just added a helper method to py2neo to do >>>> this, called "clear":
>>>> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com> wrote:
>>>>> Fantastico !!! >>>>> thanks for the swift reply!
>>>>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>>>>> I'm running Neo4J on Heroku and accessing it through the REST API >>>>>> (node.js client).
>>>>>> I can't figure out how to delete all nodes and all relationships in >>>>>> the database except for node 0.
>>>>>> Basically I want to clear all the data out of my database and >>>>>> repopulate it several times during development - is this possible through a >>>>>> cypher query or through the REST API???
> Am 20.09.2012 um 20:43 schrieb Christopher Hydak:
>> That method did not work for me. I'm accessing neo (1.7.2) through the shell and all it gives me is this error message:
>> SyntaxException: expected return clause
>> Does 1.7.2 not support DELETE?
>> On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
>> Hi Stefan
>> I'm afraid I have to disagree on this point. If someone is testing out the library, I would hope that they wouldn't be doing so against a production database. Also, the mechanism that you suggest would also not create any real kind of barrier to accidental damage and would merely introduce unnecessary noise into the function signature.
>> Nige
>> On 7 August 2012 09:47, S B <stefan...@rechaoss.com> wrote:
>> Nigel,
>> I would add a 'force=False' in the prototype of the function just to make sure that people really know what they are doing. If you are just fiddling with the library and trying the functions you might create disaster.
>> Stefan
>> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>> Since a complete clear down of the graph (except ref node) seems to be a very common requirement, I've just added a helper method to py2neo to do this, called "clear":
>> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com> wrote:
>> Fantastico !!!
>> thanks for the swift reply!
>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>> I'm running Neo4J on Heroku and accessing it through the REST API (node.js client).
>> I can't figure out how to delete all nodes and all relationships in the database except for node 0.
>> Basically I want to clear all the data out of my database and repopulate it several times during development - is this possible through a cypher query or through the REST API???
> Am 20.09.2012 um 20:43 schrieb Christopher Hydak:
> That method did not work for me. I'm accessing neo (1.7.2) through the > shell and all it gives me is this error message: > *SyntaxException: expected return clause*
> Does 1.7.2 not support DELETE?
> On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
>> Hi Stefan
>> I'm afraid I have to disagree on this point. If someone is testing out >> the library, I would hope that they wouldn't be doing so against a >> production database. Also, the mechanism that you suggest would also not >> create any real kind of barrier to accidental damage and would merely >> introduce unnecessary noise into the function signature.
>> Nige
>> On 7 August 2012 09:47, S B <stefan...@rechaoss.com> wrote:
>>> Nigel, >>> I would add a 'force=False' in the prototype of the function just to >>> make sure that people really know what they are doing. If you are just >>> fiddling with the library and trying the functions you might create >>> disaster.
>>> Stefan
>>> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>>>> Since a complete clear down of the graph (except ref node) seems to be >>>> a very common requirement, I've just added a helper method to py2neo to do >>>> this, called "clear":
>>>> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com> wrote:
>>>>> Fantastico !!! >>>>> thanks for the swift reply!
>>>>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>>>>> I'm running Neo4J on Heroku and accessing it through the REST API >>>>>> (node.js client).
>>>>>> I can't figure out how to delete all nodes and all relationships in >>>>>> the database except for node 0.
>>>>>> Basically I want to clear all the data out of my database and >>>>>> repopulate it several times during development - is this possible through a >>>>>> cypher query or through the REST API???
>> Am 20.09.2012 um 20:43 schrieb Christopher Hydak:
>> That method did not work for me. I'm accessing neo (1.7.2) through the >> shell and all it gives me is this error message: >> *SyntaxException: expected return clause*
>> Does 1.7.2 not support DELETE?
>> On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
>>> Hi Stefan
>>> I'm afraid I have to disagree on this point. If someone is testing out >>> the library, I would hope that they wouldn't be doing so against a >>> production database. Also, the mechanism that you suggest would also not >>> create any real kind of barrier to accidental damage and would merely >>> introduce unnecessary noise into the function signature.
>>> Nige
>>> On 7 August 2012 09:47, S B <stefan...@rechaoss.com> wrote:
>>>> Nigel, >>>> I would add a 'force=False' in the prototype of the function just to >>>> make sure that people really know what they are doing. If you are just >>>> fiddling with the library and trying the functions you might create >>>> disaster.
>>>> Stefan
>>>> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>>>>> Since a complete clear down of the graph (except ref node) seems to be >>>>> a very common requirement, I've just added a helper method to py2neo to do >>>>> this, called "clear":
>>>>> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com> wrote:
>>>>>> Fantastico !!! >>>>>> thanks for the swift reply!
>>>>>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>>>>>> I'm running Neo4J on Heroku and accessing it through the REST API >>>>>>> (node.js client).
>>>>>>> I can't figure out how to delete all nodes and all relationships in >>>>>>> the database except for node 0.
>>>>>>> Basically I want to clear all the data out of my database and >>>>>>> repopulate it several times during development - is this possible through a >>>>>>> cypher query or through the REST API???
> On Thursday, September 20, 2012 3:22:16 PM UTC-5, Christopher Hydak wrote:
> Thanks. It's still not working though. I've double-checked each line but still no dice.
> On Thursday, September 20, 2012 2:29:38 PM UTC-5, Michael Hunger wrote:
> Uploaded one for 1.7
> Michael
> Am 20.09.2012 um 21:05 schrieb Michael Hunger:
>> Christopher,
>> if you just need it in a testing environment, perhaps my test-delete-db extension helps you.
>> Am 20.09.2012 um 20:43 schrieb Christopher Hydak:
>>> That method did not work for me. I'm accessing neo (1.7.2) through the shell and all it gives me is this error message:
>>> SyntaxException: expected return clause
>>> Does 1.7.2 not support DELETE?
>>> On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
>>> Hi Stefan
>>> I'm afraid I have to disagree on this point. If someone is testing out the library, I would hope that they wouldn't be doing so against a production database. Also, the mechanism that you suggest would also not create any real kind of barrier to accidental damage and would merely introduce unnecessary noise into the function signature.
>>> Nige
>>> On 7 August 2012 09:47, S B <stefan...@rechaoss.com> wrote:
>>> Nigel,
>>> I would add a 'force=False' in the prototype of the function just to make sure that people really know what they are doing. If you are just fiddling with the library and trying the functions you might create disaster.
>>> Stefan
>>> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>>> Since a complete clear down of the graph (except ref node) seems to be a very common requirement, I've just added a helper method to py2neo to do this, called "clear":
>>> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com> wrote:
>>> Fantastico !!!
>>> thanks for the swift reply!
>>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>> I'm running Neo4J on Heroku and accessing it through the REST API (node.js client).
>>> I can't figure out how to delete all nodes and all relationships in the database except for node 0.
>>> Basically I want to clear all the data out of my database and repopulate it several times during development - is this possible through a cypher query or through the REST API???
I think your code works, but there was something peculiar about my data that I was trying to delete. So, I completely deleted my database and had neo4j recreate it. Now, when I create nodes (1-6) I can run your command and I'm back to 1. Previously, I was never able to delete all of my data for some reason. There must have been something funky going on.
Just an FYI, I do not believe the statement you said is accurate about the webadmin-monitoring. After I created the 6 nodes (webadmin showed 7), I deleted nodes 2-4 and webadmin showed 4.
>>> Am 20.09.2012 um 20:43 schrieb Christopher Hydak:
>>> That method did not work for me. I'm accessing neo (1.7.2) through the >>> shell and all it gives me is this error message: >>> *SyntaxException: expected return clause*
>>> Does 1.7.2 not support DELETE?
>>> On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
>>>> Hi Stefan
>>>> I'm afraid I have to disagree on this point. If someone is testing out >>>> the library, I would hope that they wouldn't be doing so against a >>>> production database. Also, the mechanism that you suggest would also not >>>> create any real kind of barrier to accidental damage and would merely >>>> introduce unnecessary noise into the function signature.
>>>> Nige
>>>> On 7 August 2012 09:47, S B <stefan...@rechaoss.com> wrote:
>>>>> Nigel, >>>>> I would add a 'force=False' in the prototype of the function just to >>>>> make sure that people really know what they are doing. If you are just >>>>> fiddling with the library and trying the functions you might create >>>>> disaster.
>>>>> Stefan
>>>>> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>>>>>> Since a complete clear down of the graph (except ref node) seems to >>>>>> be a very common requirement, I've just added a helper method to py2neo to >>>>>> do this, called "clear":
>>>>>> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com> wrote:
>>>>>>> Fantastico !!! >>>>>>> thanks for the swift reply!
>>>>>>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>>>>>>> I'm running Neo4J on Heroku and accessing it through the REST API >>>>>>>> (node.js client).
>>>>>>>> I can't figure out how to delete all nodes and all relationships in >>>>>>>> the database except for node 0.
>>>>>>>> Basically I want to clear all the data out of my database and >>>>>>>> repopulate it several times during development - is this possible through a >>>>>>>> cypher query or through the REST API???
> I think your code works, but there was something peculiar about my data that I was trying to delete. So, I completely deleted my database and had neo4j recreate it. Now, when I create nodes (1-6) I can run your command and I'm back to 1. Previously, I was never able to delete all of my data for some reason. There must have been something funky going on.
> Just an FYI, I do not believe the statement you said is accurate about the webadmin-monitoring. After I created the 6 nodes (webadmin showed 7), I deleted nodes 2-4 and webadmin showed 4.
> Thanks for all of your help.
> On Thursday, September 20, 2012 3:36:50 PM UTC-5, Michael Hunger wrote:
> The display in the webadmin-monitoring is actually the "highest-id in use". Not the actual number of nodes & rels.
> You can check with a cypher read query that they are gone.
> Michael
> Am 20.09.2012 um 22:24 schrieb Christopher Hydak:
>> Here is the command and the output I'm getting:
>> On Thursday, September 20, 2012 3:22:16 PM UTC-5, Christopher Hydak wrote:
>> Thanks. It's still not working though. I've double-checked each line but still no dice.
>> On Thursday, September 20, 2012 2:29:38 PM UTC-5, Michael Hunger wrote:
>> Uploaded one for 1.7
>> Michael
>> Am 20.09.2012 um 21:05 schrieb Michael Hunger:
>>> Christopher,
>>> if you just need it in a testing environment, perhaps my test-delete-db extension helps you.
>>> Am 20.09.2012 um 20:43 schrieb Christopher Hydak:
>>>> That method did not work for me. I'm accessing neo (1.7.2) through the shell and all it gives me is this error message:
>>>> SyntaxException: expected return clause
>>>> Does 1.7.2 not support DELETE?
>>>> On Tuesday, August 7, 2012 2:54:01 PM UTC-5, Nigel Small wrote:
>>>> Hi Stefan
>>>> I'm afraid I have to disagree on this point. If someone is testing out the library, I would hope that they wouldn't be doing so against a production database. Also, the mechanism that you suggest would also not create any real kind of barrier to accidental damage and would merely introduce unnecessary noise into the function signature.
>>>> Nige
>>>> On 7 August 2012 09:47, S B <stefan...@rechaoss.com> wrote:
>>>> Nigel,
>>>> I would add a 'force=False' in the prototype of the function just to make sure that people really know what they are doing. If you are just fiddling with the library and trying the functions you might create disaster.
>>>> Stefan
>>>> On Saturday, July 21, 2012 6:48:08 PM UTC+8, Nigel Small wrote:
>>>> Since a complete clear down of the graph (except ref node) seems to be a very common requirement, I've just added a helper method to py2neo to do this, called "clear":
>>>> On 21 July 2012 10:26, Aidan Casey <aidan...@gmail.com> wrote:
>>>> Fantastico !!!
>>>> thanks for the swift reply!
>>>> On Wednesday, July 18, 2012 8:49:36 PM UTC+10, Aidan Casey wrote:
>>>> I'm running Neo4J on Heroku and accessing it through the REST API (node.js client).
>>>> I can't figure out how to delete all nodes and all relationships in the database except for node 0.
>>>> Basically I want to clear all the data out of my database and repopulate it several times during development - is this possible through a cypher query or through the REST API???