I just found the Unwind
method on the .NET client from another SO answer. It works like a charm when adding nodes. But how do you add relations using it? I thought it would be straightfoward and wrote this:
client.Cypher
.Unwind(idMap, "idMap")
.Match("n1", "n2")
.Where("n1.Id=idMap.Owner")
.AndWhere("n2.Id=idMap.User")
.Create("n1-[:ONE_RELATION]->n2")
.ExecuteWithoutResults()
idMap
is a list where I have a Owner
and User
as GUIDs. I also tried to change those to string with no luck.
The error I get is
System.Threading.Tasks.TaskCanceledException: A task was canceled.
at Neo4jClient.GraphClient.Neo4jClient.IRawGraphClient.ExecuteCypher(CypherQuery query) in D:\temp\384a765\Neo4jClient\GraphClient.cs:line 1041 at Neo4jClient.Cypher.CypherFluentQuery.ExecuteWithoutResults() in D:\temp\384a765\Neo4jClient\Cypher\CypherFluentQuery.cs:line 361 at [email protected](FSharpList1 x) in C:\dev\git\Sfag\src\Sfag.GraphView\Script.fsx:line 62 at Microsoft.FSharp.Primitives.Basics.List.iter[T](FSharpFunc
2 f, FSharpList1 x) at Microsoft.FSharp.Collections.ListModule.Iterate[T](FSharpFunc
2 action, FSharpList`1 list) at FSI_0003.saveState(State state) in C:\dev\git\Sfag\src\Sfag.GraphView\Script.fsx:line 250 at .$FSI_0005.main@() in C:\dev\git\Sfag\src\Sfag.GraphView\Script.fsx:line 265
which doesn't help a lot. Anyone that know what I am doing wrong here? What I can read from the docs the actual neo4j API should allow this: http://neo4j.com/docs/stable/cypherdoc-utilizing-data-structures.html, http://neo4j.com/docs/stable/query-unwind.html
UPDATE
With larger batch size I get another error:
System.ApplicationException: Received an unexpected HTTP status when executing the request.
The response status was: 500 Server Error
The response from Neo4j (which might include useful detail!) was:
at Neo4jClient.GraphClient.Neo4jClient.IRawGraphClient.ExecuteCypher(CypherQuery query) in D:\temp\384a765\Neo4jClient\GraphClient.cs:line 1041 at Neo4jClient.Cypher.CypherFluentQuery.ExecuteWithoutResults() in D:\temp\384a765\Neo4jClient\Cypher\CypherFluentQuery.cs:line 361 at [email protected](String tag) in C:\dev\git\Sfag\src\Sfag.GraphView\Script.fsx:line 127at Microsoft.FSharp.Primitives.Basics.List.mapToFreshConsTail[a,b](FSharpList
1 cons, FSharpFunc
2 f, FSharpList1 x) at Microsoft.FSharp.Primitives.Basics.List.map[T,TResult](FSharpFunc
2 mapping, FSharpList1 x) at Microsoft.FSharp.Collections.ListModule.Map[T,TResult](FSharpFunc
2 mapping, FSharpList`1 list) at .$FSI_0003.main@() in C:\dev\git\Sfag\src\Sfag.GraphView\Script.fsx:line 142