On Mon, Apr 26, 2010 at 7:38 AM, Rick Bullotta <
rick.bullo...@burningskysoftware.com> wrote:

> Hi, Tobias.  I was only referring to the case when it was the intent to
> delete the node also.  In that case, you *have* to delete all the
> relationships to the node in order to delete the node.  No worries, it is
> easy enough to implement!
>

Yes, I understood that. But I think you should be explicit about which
relationship types you *expect* to remove. This means that if the node had
relationships of types that you didn't expect those will not be removed and
an exception will be thrown when you commit the transaction. This is a good
thing, since it helps you detect errors in your code. If for example the
node is part of an in-graph data structure, it would probably have to be
gracefully removed from that data structure, just removing all of the
relationships from the node would probably break the data structure. I would
much prefer the utility methods to aid you by signaling that you forgot to
remove the node, by throwing an exception, than to silently break your data
structures.

On Mon, Apr 26, 2010 at 12:08 AM, Niels Hoogeveen <pd_aficion...@hotmail.com
> wrote:

>
> The moment there is a utility class SomeUtilityClass.delete( Node node,
> RelationshipType... expectedTypes ), the following "unsafe" construct is
> easily written:
> for(RelationshipType rt : graphDb.getRelationshipTypes()){
>  SomeUtilityClass.delete( node, rt );}
>
>
Yes, and I will not stop you, I just think that the utilities we endorse
should be utilities that encourage good code (see above).

-- 
Tobias Ivarsson <tobias.ivars...@neotechnology.com>
Hacker, Neo Technology
www.neotechnology.com
Cellphone: +46 706 534857
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to