Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-24-2020 10:04 AM
Hi,
I am running this code and the first parameter is getting passed but the number in the reursive depth $n gives the error:
CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: Parameter maps cannot be used in MATCH patterns (use a literal map instead, eg. "{id: {param}.id}")
Here is my code. If I put any number like 2 instead of $n it works:
params = {"prot": 'C', "n": 2}
with session.begin_transaction() as tx:
result = tx.run("MATCH p = (n:Protein { name:$prot })<-[:REGULATES*1..$n]->(b:Protein) \
WITH *, relationships(p) AS rs \
RETURN \
startNode(last(rs)).name AS Protein1, \
last(rs).direction AS Regulates, \
endNode(last(rs)).name AS Protein2, \
length(p) AS pathLength",
params)
10-25-2020 06:07 PM
I'm not at my computer with neo4j, but have you tried renaming either your 'n' parameter or the 'n' variable in your first Protein node? Using the same name in both places might be confusing Cypher.
All the sessions of the conference are now available online