Not able to execute delete command in Cypher Query in embedded neo4j database from java progrmming

16 views
Skip to first unread message

Abhishek Singh

unread,
Apr 21, 2014, 7:28:48 AM4/21/14
to ne...@googlegroups.com
I want to delete Relationship between two node my graphical database as:
Abhi-(Memberof)->computer,Abhi-(Memberof)->Java and Abhi-(Memberof)->English like that, means one node have same relationship with different node now i want to delete specific relationship between node like Abhi-(Memberof)->computer from java,
i use cypher query ExecutionResult result = engine.execute( “START n=node(*) MATCH n-[rel:MEMBERoF]->r WHERE (AND n.name=’Abhi’ AND r.name=’ComputerScience’) delete rel” ); but it gives error as follows:
Exception in thread “main” expected return clause
“Start n= node(*) delete n”
^
at org.neo4j.cypher.internal.parser.v1_7.CypherParserImpl.parse(CypherParserImpl.scala:66)
at org.neo4j.cypher.CypherParser.parse(CypherParser.scala:44)
at org.neo4j.cypher.ExecutionEngine$$anonfun$prepare$1.apply(ExecutionEngine.scala:61)
at org.neo4j.cypher.ExecutionEngine$$anonfun$prepare$1.apply(ExecutionEngine.scala:61)
at org.neo4j.cypher.internal.LRUCache.getOrElseUpdate(LRUCache.scala:31)
at org.neo4j.cypher.ExecutionEngine.prepare(ExecutionEngine.scala:61)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:55)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:52)
at org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:63)
but the same code working fine when i use return command as ExecutionResult result = engine.execute( “START n=node(*) MATCH n-[rel:MEMBERoF]->r WHERE (AND n.name=’Abhi’ AND r.name=’ComputerScience’) return rel” );
Please reply me how can i delete relationship using java programming.

Michael Hunger

unread,
Apr 22, 2014, 8:53:14 AM4/22/14
to ne...@googlegroups.com
As I answered on SO, you have Neo4j 1.7

Updating queries were added in 1.8

Please update your install to the latest stable and try again (2.0.2)


--
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 neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages