-
Jul 18th, 2012, 05:24 AM
#1
Are parameters supported in Cypher MATCH clause like -[:{type}]->?
Hi,
I think I found a problem - it looks that Cypher cannot substitute relationship type in the MATCH clause with external parameters passed in format {param} like the following:
START n1=node({self}) MATCH n1-[rel:{type}]->n2 RETURN n2
The following code which refers to {type} parameter generates an exception:
Hashtable<String, Object> params = new Hashtable<String, Object>();
params.put("res", nodeId);
params.put("type", type);
String cypherQuery = "START n=node({res}) MATCH n-[rel:{type}]->result RETURN rel";
Result<Map<String, Object>> rows = template.query(cypherQuery, params);
the exception:
Error executing statement START n=node({res}) MATCH n-[rel:{type}]->result RETURN rel; nested exception is string matching regex ``(``|[^`])*`' expected but `{' found
at org.springframework.data.neo4j.support.query.Cyphe rQueryEngine.parseAndExecuteQuery(CypherQueryEngin e.java:67)
at org.springframework.data.neo4j.support.query.Cyphe rQueryEngine.query(CypherQueryEngine.java:53)
... 39 more
Caused by: string matching regex ``(``|[^`])*`' expected but `{' found
Is it a bug or I am doing something wrong?
-
Jul 19th, 2012, 02:20 AM
#2
I'm no expert in this, but I remember I found somewhere in Neo4j server's documentation (not Spring data Neo4j docs) explanation where parametrizing is exactly allowed (not anywhere in query), so I assume that's your problem here.
-
Jul 19th, 2012, 05:46 AM
#3
hsherlock, vmarcinko,
Parameterised relationship types are indeed not supported. Details of what is supported is here: http://docs.neo4j.org/chunked/milest...arameters.html
Regards,
Lasse
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules