[Neo] [Neo tickets] #93: IMDB application 1.1

Tobias Ivarsson tobias.ivarsson at neotechnology.com
Sun Jan 25 20:30:20 CET 2009

I would like raise the questions in this ticket comment to the mailing list.
I think these are excellent questions, especially since they are questions
that many developers find themselves asking. These are indeed something that
we should make sure to include in examples and in an FAQ.

On Sat, Jan 24, 2009 at 5:51 AM, neo4j.org <noreply at neo4j.org> wrote:

> #93: IMDB application 1.1
> ---------------------------+------------------------------------------------
>  Reporter:  andersn        |        Owner:  andersn
>      Type:  task           |       Status:  assigned
>  Priority:  major          |    Milestone:
> Component:  documentation  |   Resolution:
>  Keywords:                 |
> ---------------------------+------------------------------------------------
> Comment(by anonymous):

Too bad that we don't know who posted this question, there is now way of
telling if (s)he receives this response now.

>  I would like to request an example of removing nodes and how to deal with
>  their relationships:
>  * finding and removing a specific node based on a specific property value

Finding a node is the same as in the usual case, regardless of whether you
are removing or not. The IMDB example application demonstrates this already.

>  * iterating through  a custom traversal and removing all nodes

This is a good question. If you remove a node with it's relationships as
part of a traversal, does that influence the traversal? or will the removed
relationships still be traversed? If it influences the traversal - what is
the recommended pattern for structurally safe removal?

>  I know that there's delete() on both nodes and relationships but I can't
>  figure out whether I need to call both or calling delete() on node will
>  handle the deletion of its relationships as well.  I can still retrieve
>  either node or relationship by their ID even after calling their delete
>  methods!

Before the transaction where the node/relationship was removed is committed
it is very possible to retrieve them. And it should be, they are still alive
in other threads.

It is important to notice that a node that has relationships cannot be
removed, so the relationships need to be removed first.

>  There should be a mention of what happens to island graphs, are they lost
>  in Neo forever?

You can still access these by ID. So if they have references stored in an
index they are very much accessible, this is also a very common case.

It should be noticed however that removal for the sake of removal is an
uncommon case in actual applications. Removal for the sake of restructuring
is much more common. These questions are still very much relevant, and
including them in our examples would be a great idea.

Tobias Ivarsson <tobias.ivarsson at neotechnology.com>
Hacker, Neo Technology
Cellphone: +46 706 534857

More information about the User mailing list