Tried to put quotes in a query. Because I use one procedure inside another, I need to use quotes with variable fileName.
There is the error:
"Failed to invoke procedure apoc.periodic.iterate
: Caused by: org.neo4j.cypher.ParameterNotFoundException: Expected parameter(s): fileName"
The query:
@Query("CALL apoc.periodic.iterate('\n" +
" CALL apoc.load.json(\\\"{fileName}\\\") YIELD value as v RETURN v'\n" +
" ,'\n" +
" FOREACH ( i in CASE WHEN v.cat=true THEN [1] ELSE [] END | MERGE (c:C{id:v.id, version: {version}}))\n" +
" FOREACH ( i in CASE WHEN v.dog=true THEN [1] ELSE [] END | MERGE (c:Ca{id:v.id, version: {version}}))\n" +
" WITH v\n" +
...
void p(@Param("fileName") String fileName, @Param("version") String version);
I have tried several options:
{fileName}
\"{fileName}\"
"{fileName}"
But they don't work. How could I fix it?
This query works and parameter fileName is correct:
@Query("CALL apoc.load.json({fileName} ) YIELD value as v \n" +
"MERGE(c:C{name:v.id})\n" +
"RETURN v.id")
void p(@Param("fileName") String fileName);