[Neo4j] Finding orphaned nodes...

2011-04-12 Thread Rick Bullotta
Is there any recommended technique for scanning a Neo database for orphaned 
nodes (e.g. nodes with no relationships)?
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Finding orphaned nodes...

2011-04-12 Thread Axel Morgner
Maybe slow, but easy and and working:

 for (Node n : graphDb.getAllNodes()) {
 if (!n.hasRelationship()) {
 n.delete();
 }
 }




On 12.04.2011 20:19, Rick Bullotta wrote:
 Is there any recommended technique for scanning a Neo database for orphaned 
 nodes (e.g. nodes with no relationships)?
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user


___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Finding orphaned nodes...

2011-04-12 Thread Michael Hunger
If you need more high performant variants of that, you can partition the 
node-id-space, read them in multiple threads and collect them in a concurrent 
queue for deletion, using a thread pool with a suitable transaction size for 
the parallel deletion.

I think it is also possible to read the store format (see Chris Gioran's blog 
series on http://digitalstain.blogspot.com/) to find nodes w/o relationships in 
the node-store and then delete them transactionally (deletion will fail anyway 
if a node got a new relationship in the meantime).

Cheers

Michael

Am 12.04.2011 um 20:27 schrieb Axel Morgner:

 Maybe slow, but easy and and working:
 
 for (Node n : graphDb.getAllNodes()) {
 if (!n.hasRelationship()) {
 n.delete();
 }
 }
 
 
 
 
 On 12.04.2011 20:19, Rick Bullotta wrote:
 Is there any recommended technique for scanning a Neo database for orphaned 
 nodes (e.g. nodes with no relationships)?
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user
 
 
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user

___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user