Can you print out the node-ids and rel-ids that it iterates over?

Did you use the correct label name

Michael

Am 30.08.2014 um 00:22 schrieb Alireza Rezaei Mahdiraji <[email protected]>:

> 
> Hi Stefan, 
> 
> I tied the Java code, it seems running but the nodes and relationships are 
> not getting deleted. 
> Also, there is no error. Any idea?
> 
> Thanks,
> Alireza
> 
> On Friday, August 29, 2014 4:59:32 PM UTC+2, Stefan Armbruster wrote:
> Since you can run cypher from java the following would be a valid (but 
> probably not expected) answer: 
> new ExecutionEngine(graphDb).execute("match (n:MyLabel) optional 
> match(n)-[r]-() delete r,n"); 
> 
> In pure Java: 
> 
> try (Transaction tx=graphDb.beginTx()) { 
>    for (Node n: 
> GlobalGraphOperations.at(graphDb).getAllNodesWithLabel(DynamicLabel.label("MyLabel")))
>  
> { 
>       for (Relationship r: n.getRelationships()) { 
>           r.delete(); 
>       } 
>       n.delete(); 
>    } 
> 
>    tx.success(); 
> } 
> 
> NB: didn't test code above it's more a dump from /dev/brain ;-) 
> 
> /Stefan 
> 
> 
> 2014-08-29 12:35 GMT+02:00 Alireza Rezaei Mahdiraji <[email protected]>: 
> > 
> > Hi All, 
> > 
> > How can I remove all nodes (and their relationships) with a given label 
> > using Java? 
> > 
> > Thanks, 
> > Alireza 
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Neo4j" group. 
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to [email protected]. 
> > For more options, visit https://groups.google.com/d/optout. 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to