title: Put a query into a foreach
body: <p>I want to use the returned shortest path between each node and the root (Main topic classification) to build my graph. I use the following query</p>
  
  <pre><code> MATCH ()-[:SUBJECT]-&gt;(c:Category)
   UNWIND NODES(c) AS nd // to get all the nodes on which I want to iterate
   FOREACH(n in nd|
   WITH n as start
   path = allShortestPaths((start)-[:SUBCAT_OF*]-&gt; (p1:Category {catName:   "Main_topic_classifications"}))
   UNWIND RELATIONSHIPS(path) AS rel
   WITH STARTNODE(rel) AS s, ENDNODE(rel) AS e
   MERGE (s)-[:NEW_SUBCAT]-&gt;(e)
  
   )
  
  </code></pre>
  
  <p>For each node c, I try to compute all shortest paths to reach the root and than I use the returned path result to create a newrelationships (NEW_SUBCAT). However, when I run the previous query, I get the follwoing error:</p>
  
  <pre><code>Neo.ClientError.Statement.SyntaxError: Invalid input '(': expected an identifier character, whitespace, NodeLabel, a property map or ')' (line 5, ...)
  </code></pre>