Yes, use getRelationships(), which returns Iterable<Relationship>.  You can
delete the relationship as you're iterating through them, then delete the
node.

function deleteNode(Node node) throws Exception {
        if(node == null)
                return;

        Iterable<Relationship> relationships = node.getRelationships();
        for(Relationship rel : relationships) {
                rel.delete();
        }

        node.delete();
}

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Rick Whitesel (rwhitese)
Sent: Tuesday, February 15, 2011 1:32 PM
To: [email protected]
Subject: [Neo4j] Finding relationships

Hi:

 

Is there a way to find the relationships on a node in a generic manner
so that a common method could be used to delete all relationships and
then delete the node?

 

-Rick

 

 

Simplify, Standardize and Conserve

 

_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to