I am passing into a Cypher query a List<Map<String, Object>>
, which I am using to create a series of nodes based on the key-value pairs contained in the Map<String, Object>
.
I now want to be able to link those nodes together, in the order they were unwound.
Current cypher/java code:
public static void doMergeAndLink(List<Map<String, Object>> nodeProperties)
{
try (Session session = driver.session())
{
session.run("UNWIND $nodeProperties AS np " +
"MERGE (n:Event {name:np.name, location: np.location, eventDate:np.eventDate}) "
, parameters("nodeProperties",nodeProperties));
}
catch(Exception e){}
}
What I want now is to be able to add MERGE (n)-[:NEXT_EVENT]->(n+1)
but I don't know the Cypher to do that