Cannot delete relationship with cypher

458 views
Skip to first unread message

Tomas Teicher

unread,
Apr 28, 2012, 12:47:57 PM4/28/12
to ne...@googlegroups.com
I have tried to delete one of relationships. I am using cypher with syntax from this tutorial

start n = node(21) match n-[r]->()  delete r

but it doesn't work. It got me this error: "expected return clause". The error message is pointed to the word "match"

When I change query to return relationships  instead of delete them, it works: 

start n = node(21) match n-[r]->()  return r

This query return me two rows.
I am using cypher version 1.8

Can anybody help, what can be problem?

thanks
Tomas

Andres Taylor

unread,
Apr 28, 2012, 1:50:29 PM4/28/12
to ne...@googlegroups.com
It sure sounds like you are not using 1.8 syntax. Apart from this, I don't know why that query wouldn't work. 

It works fine here.

Andrés

Tomas Teicher

unread,
Apr 29, 2012, 12:21:22 AM4/29/12
to ne...@googlegroups.com
I am using cypher 1.8. When I create or update node, it works. I just cannot delete them

Here is my code and  whole error message:

String query = "START n = node(5) MATCH n-[r:HAS_SUBTASK]->subtask delete r";
        ExecutionResult result = Neo4jAPI.engine.execute(query);

Exception in thread "main" expected return clause
at org.neo4j.cypher.internal.parser.v1_8.CypherParserImpl.parse(CypherParserImpl.scala:43)
    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)


When I change the query so it would return relationship instead of delete it, it returns one row, so data are ok.

thanks for any help
Tomas

Tomáš Teicher

unread,
Apr 29, 2012, 12:20:02 AM4/29/12
to ne...@googlegroups.com
I am using cypher 1.8. When I create or update node, it works. I just cannot delete them

Here is my code and� whole error message:


String query = "START n = node(5) MATCH n-[r:HAS_SUBTASK]->subtask delete r";
������� ExecutionResult result = Neo4jAPI.engine.execute(query);

Exception in thread "main" expected return clause
at org.neo4j.cypher.internal.parser.v1_8.CypherParserImpl.parse(CypherParserImpl.scala:43)
��� 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)


When I change the query so it would return relationship instead of delete it, it returns one row, so data are ok.

thanks for any help
Tomas

Dňa 28. 4. 2012 19:50, Andres Taylor� wrote / nap�sal(a):
On Sat, Apr 28, 2012 at 6:47 PM, Tomas Teicher <tomast...@gmail.com> wrote:
I have tried to delete one of relationships. I am using cypher with syntax from this tutorial

start n = node(21) match n-[r]->() �delete r

but it doesn't work. It got me this error: "expected return clause". The error message is pointed to the word "match"

When I change query to return relationships �instead of delete them, it works:�

start n = node(21) match n-[r]->() �return r

This query return me two rows.
I am using cypher version 1.8

Can anybody help, what can be problem?

It sure sounds like you are not using 1.8 syntax. Apart from this, I don't know why that query wouldn't work.�

It works fine here.

Andr�s

Michael Hunger

unread,
Apr 29, 2012, 4:23:10 AM4/29/12
to ne...@googlegroups.com
Did you update your snapshot libs?

Sent from mobile device

Am 29.04.2012 um 06:20 schrieb Tomáš Teicher <tomast...@gmail.com>:

I am using cypher 1.8. When I create or update node, it works. I just cannot delete them

Here is my code and  whole error message:


String query = "START n = node(5) MATCH n-[r:HAS_SUBTASK]->subtask delete r";
        ExecutionResult result = Neo4jAPI.engine.execute(query);

Exception in thread "main" expected return clause
at org.neo4j.cypher.internal.parser.v1_8.CypherParserImpl.parse(CypherParserImpl.scala:43)
    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)


When I change the query so it would return relationship instead of delete it, it returns one row, so data are ok.

thanks for any help
Tomas

Dňa 28. 4. 2012 19:50, Andres Taylor  wrote / napísal(a):
On Sat, Apr 28, 2012 at 6:47 PM, Tomas Teicher <tomast...@gmail.com> wrote:
I have tried to delete one of relationships. I am using cypher with syntax from this tutorial

start n = node(21) match n-[r]->()  delete r

but it doesn't work. It got me this error: "expected return clause". The error message is pointed to the word "match"

When I change query to return relationships  instead of delete them, it works: 

start n = node(21) match n-[r]->()  return r

This query return me two rows.
I am using cypher version 1.8

Can anybody help, what can be problem?

Tomáš Teicher

unread,
Apr 28, 2012, 1:57:06 PM4/28/12
to ne...@googlegroups.com
I am using 1.8 library. I can update and create nodes with cypher successfully. I think it is not possible with 1.7 or earlier. As I know, mutating is possible only in 1.8
Maybe I am not using just 1.8 syntax, as you wrote. But then, where can I find current syntax?

thanks for answer
Tomas

Dňa 28. 4. 2012 19:50, Andres Taylor� wrote / nap�sal(a):
On Sat, Apr 28, 2012 at 6:47 PM, Tomas Teicher <tomast...@gmail.com> wrote:
I have tried to delete one of relationships. I am using cypher with syntax from this tutorial

start n = node(21) match n-[r]->() �delete r

but it doesn't work. It got me this error: "expected return clause". The error message is pointed to the word "match"

When I change query to return relationships �instead of delete them, it works:�

start n = node(21) match n-[r]->() �return r

This query return me two rows.
I am using cypher version 1.8

Can anybody help, what can be problem?

Michael Hunger

unread,
Apr 29, 2012, 6:38:11 PM4/29/12
to ne...@googlegroups.com
Did you update your snapshot libraries? The syntax changed in between.

Have you tried it in the Neo4j-console (which has the latest version of 1.8-SNAPSHOT running) http://console.neo4j.org

Michael

Am 28.04.2012 um 19:57 schrieb Tomáš Teicher:

I am using 1.8 library. I can update and create nodes with cypher successfully. I think it is not possible with 1.7 or earlier. As I know, mutating is possible only in 1.8
Maybe I am not using just 1.8 syntax, as you wrote. But then, where can I find current syntax?

thanks for answer
Tomas

Dňa 28. 4. 2012 19:50, Andres Taylor  wrote / napísal(a):
On Sat, Apr 28, 2012 at 6:47 PM, Tomas Teicher <tomast...@gmail.com> wrote:
I have tried to delete one of relationships. I am using cypher with syntax from this tutorial

start n = node(21) match n-[r]->()  delete r

but it doesn't work. It got me this error: "expected return clause". The error message is pointed to the word "match"

When I change query to return relationships  instead of delete them, it works: 

start n = node(21) match n-[r]->()  return r

This query return me two rows.
I am using cypher version 1.8

Can anybody help, what can be problem?

Tomas Teicher

unread,
Apr 30, 2012, 12:03:29 AM4/30/12
to ne...@googlegroups.com
than you
yes, I have update ted libraries and now it works

Tomas

Dňa sobota, 28. apríla 2012 18:47:57 UTC+2 Tomas Teicher napísal(-a):
Reply all
Reply to author
Forward
0 new messages