我有一个 chyper 查询,它使用一个Dictionary<string, double>
对象作为 foreach 循环参数。我想访问循环内的字典键,但这似乎不起作用,我总是得到一个无效的输入错误:
输入无效 '。' {rel.Key}
我尝试了以下查询:
string query = "MATCH(c: Component) WHERE c.Name= {component}
FOREACH ( rel in {relations}| MERGE (c) -[w:WEIGHT]->(d:Component {Name={rel.Key}})
SET w.Weight={rel.Value} ))";
我的参数如下:
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("component", component); // string
parameters.Add("relations", relations); // Dictionary<string, double>
neo4jsession.Run(query, parameters);
我能想到的唯一其他版本是使用 Array 和Dictionary<string, double>
unwind ,但是有没有办法使用 Dictionary 和 foreach 循环来做到这一点?
信息:正如我在问题标题中所写,我使用 Neo4jDotNetDriver 而不是 Neo4jclient