title: neo4j: List of ints from plain string representation
body: <h2>Context</h2>
  
  <p>I would like to read from a csv-file into my database and create nodes and connections. For the to be created order nodes, one of the fields to read is a stuffed list of Products (relational key), i.e. looks like this <code>"[123,456,789]"</code> where the numbers are the product ids.</p>
  
  <p>Now reading the data into the db I have no problem to create nodes for the Orders and the Products; going over another iteration I now want to create the edges by kind of unwinding the list of products in the Order and linking to the according products.</p>
  
  <p>Best would be if I could at creation time of the Order-nodes convert the string containing the list into a list of ints, so that a simple loop over these values and matching the Product-nodes would do the trick (also for storage efficiency this would be better).</p>
  
  <h2>Problem</h2>
  
  <p>However I cannot figure out how to convert the said string into the said format of a list containing ints. All my attempts with coming up with a cypher for this failed miserably. I will post some of them below, starting from the string <code>l</code>:</p>
  
  <pre><code>WITH '[123,456,789]' as l
  WITH split(replace(replace(l,'[',''),']',''),',') as s
  UNWIND s as ss
  COLLECT(toInteger(ss) ) as k 
  return k
  
  WITH '[123,456,789]' as l
  WITH split(replace(replace(l,'[',''),']',''),',') as s, [] as k
  FOREACH(ss IN s| SET k = k + toInteger(ss) )
  return k
  </code></pre>
  
  <p>both statements failing.</p>
  
  <h2>EDIT</h2>
  
  <p>I have found a partial solution, I am however not quite satisfied with as it applied only to my task at hand, but is not a solution to the more general problem of this list conversion.</p>
  
  <p>I found out that one can create an empty list as an property of a node, which can be successively updated:</p>
  
  <pre><code>CREATE (o:Order {k: []})
  WITH o, '[123,456]' as l
  WITH o, split(replace(replace(l,'[',''),']',''),',') as s
  FOREACH(ss IN s | SET o.k= o.k + toInteger(ss) )
  RETURN o.k
  </code></pre>
  
  <p>strangly this will only work on properties of nodes, but not on bound variables (see above)</p>