[Neo4j] How to delete a node when it's already deleted ?

Adam Mendlik amendlik at gmail.com
Tue Dec 7 17:51:33 CET 2010


I have the same requirements on a project I'm working on. What I did was use
an abstract wrapper class for Node that helps with deletion.

protected final Node underlyingNode;
protected boolean isDeleted;

public boolean isDeleted() {
 return isDeleted;
}

public void delete() {
    Iterable<Relationship> rels = this.underlyingNode.getRelationships();
    for ( Relationship rel : rels)
    {
  rel.delete();
    }
this.underlyingNode.delete();
this.isDeleted = true;
}
I agree that it would be nice to have similar functionality right in the
API, at least for the forced deletion operation.
-Adam


More information about the User mailing list