Sorry if this is a silly question! I modelled the following query on something from SO and I just can't see the problem - I have narrowed the issue down to using the nodes from the unwound collection in the MERGE statement as the issue. If I run this:
MATCH (e:EngineFamily {brand:"Norton", name:"Dominator"})-[:HAS_DERIVATIVE]->(d:Derivative)
WITH e, COLLECT (d) AS derivs
UNWIND range(1, size(derivs))AS i
MATCH (c:Component {name:"crankcase"})
WITH derivs[i] AS a1, c
MERGE (a1)-[:HAS_COMPONENT]->(c)
RETURN a1,c
I get: org.neo4j.values.storable.NoValue cannot be cast to org.neo4j.values.virtual.VirtualNodeValue
If I put a dummy node in place of the (a1) node, it works, if I delete the merge altogether it works - so the unwinding and iterating over the "i" value works....
If I use create instead of merge the query just runs and runs.
I used the following from SO as a start point and that seems to use nodes processed in the same way in the MERGE statement.... I have been trying to sort this for hours and fear that either I am missing something obvious or I am just taking the wrong approach altogether...