I have tested my query in the Neo4j web interface, and now I want to add it to my Java program. I have tried this (in a @NodeEntity class called Track):
@Query("START n=({self}) MATCH (n)-->(x)<--(y) RETURN y")
private Iterable<Track> alternativeTracks;
And also this (in a GraphRepository extending interface):
@Query("START n={track} MATCH (n)-->(x)<--(y) RETURN y")
public Iterable<Track> findAlternativeTracks(@Param("track") Track track);
And the position version too:
@Query("START n={0} MATCH (n)-->(x)<--(y) RETURN y")
public Iterable<Track> findAlternativeTracks(Track track);
But every time I get this exception and trace:
Exception in thread "main" org.neo4j.rest.graphdb.RestResultException: expected either node or relationship here
"START n=({self}) MATCH (n)-->(x)<--(y) RETURN y"
^ at
SyntaxException
org.neo4j.cypher.internal.parser.v1_8.CypherParserImpl.parse(CypherParserImpl.scala:45)
org.neo4j.cypher.CypherParser.parse(CypherParser.scala:42)
org.neo4j.cypher.ExecutionEngine$$anonfun$prepare$1.apply(ExecutionEngine.scala:67)
org.neo4j.cypher.ExecutionEngine$$anonfun$prepare$1.apply(ExecutionEngine.scala:67)
org.neo4j.cypher.internal.LRUCache.getOrElseUpdate(LRUCache.scala:37)
org.neo4j.cypher.ExecutionEngine.prepare(ExecutionEngine.scala:67)
org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:59)
org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:63)
org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:79)
org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:67)
java.lang.reflect.Method.invoke(Method.java:597)
with 'self' replaced by 'track' or '0' depending on which version I'm trying.
I've been over and over the documentation and examples but I can't seem to figure out what I'm missing here. Can anyone enlighten me?
(I'm on spring-data-neo4j version 2.2.1.RELEASE)