I am trying to write a program that generates a list of Days of the Week that are all linked together. in the form (Monday)-> (Tuesday)-> (Wednesday)... Although I am able to do this by writing the Cypher queries directly through the web interface, I cannot seem to do this programmatically in C# using GraphDatabase.Driver. The query to create Day 1 seems to work, but for some reason my second query is not working. Here is the code
string[] days = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
using (var driver = GraphDatabase.Driver("bolt://localhost:7687", AuthTokens.Basic(<my_username>, <my_password>)))
using (var session = driver.Session())
{
session.Run("CREATE (d1: Day {day: {Day1}}) ", new Dictionary<string, object> { { "Day1", days[0] }});
for (int i = 1; i < days.Length-2; i++)
{
session.Run("" +
"Match (d :Day {day:'{day1} '}) " +
"WITH d " +
" CREATE (d)-[:before] -> (d2 :Day {day:'{day2}'}) ", new Dictionary<string, object> { { "day1", days[i-1] }, { "day2", days[i] } });
}
}