我想使用neo4jclient创建一个图形,我有一个包含2种对象的字典(文档,列表),
Dictionary<Document, List<Concept>>
如你所见,每个文件都有一个概念列表,它们之间必须存在关系(文件)&lt; - [:IN] - (概念)
public void LoadNode(Dictionary<Document, List<Concept>> dictionary, GraphClient _client)
{
var d = dictionary.ToList();
var t = dictionary.Values;
string merge1 = string.Format
("MERGE (source:{0} {{ {1}:row.Key.Id_Doc }})", "Document", "Name");
string strForEachDoc = " FOREACH( concept in row.Value | ";
string merge2 = string.Format
("MERGE (target:{0} {{ {1} : concept.Name }})", "Concept", "Name");
string merge3 = string.Format
(" MERGE (source)-[ r:{0} ]->(target)", "Exist");
{_client.Cypher
.WithParam("coll", d)
.ForEach("(row in {coll} | " +
merge1 + " " +
strForEachDoc + " " +
merge2 + " " +
merge3 + "))")
.ExecuteWithoutResults();
}
}
需要时间,Visual Studio遇到了一个奇怪的错误
“Une exceptiondepremièremexde type'System.AggregateException' s'est produite dans mscorlib.dll“