Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-27-2020 12:10 AM
@Query("Match(a:Author{name:{0}})"
+ "Merge(b:Book{name:{1}})"
+ "Merge(a)-[r:{2}]->(b) return a,b,r")
public Author comprisesto(String startNode, String endNode, String relation);
controller code
@GetMapping("/createRelationship")
public String CreateRelationship(@RequestParam String startNode,@RequestParam String endNode,@RequestParam String relationship)
{
String relation=NodeMapper.getRelation(startNode, endNode);
RelationService rs = new RelationService();
rs.createRelation(startNode, endNode, relationship) ;
return relation;
}
error i got:
org.springframework.dao.InvalidDataAccessResourceUsageException: Cypher execution failed with code 'Neo.ClientError.Statement.SyntaxError': Invalid input '{': expected whitespace or a rel type name (line 1, column 80 (offset: 79))
"Match(a:Author{name:{0}}) Merge(b:Book{name:{1}}) Merge(a)-[r:{2}]->(b) return a,b,r"
^.; nested exception is org.neo4j.ogm.exception.CypherException: Cypher execution failed with code 'Neo.ClientError.Statement.SyntaxError':
Invalid input '{': expected whitespace or a rel type name (line 1, column 80 (offset: 79))
"Match(a:Author{name:{0}}) Merge(b:Book{name:{1}}) Merge(a)-[r:{2}]->(b) return a,b,r"
05-28-2020 01:19 AM
@shashireddy055,
Your query has syntax error
Visit below link
https://docs.spring.io/spring-data/data-neo4j/docs/current/reference/html/#reference
@Query("MATCH (:Actor {name:$name})-[:ACTED_IN]->(m:Movie) return m")
05-30-2020 04:25 AM
Reltypes and labels cannot be parameterized.
You could use type(r) = $type
But that’s not as efficient
Otherwise construct the query string and use the template for querying
06-01-2020 01:56 AM
can u give me an example for this. I am familiar with using template
06-03-2020 04:06 PM
See the example for SPEL (Spring Expression Language above)
05-30-2020 04:45 AM
Just learned it works with SPEL
All the sessions of the conference are now available online