简体   繁体   English

如何列出 <string> 通过Neo4jClient访问Neo4j?

[英]How to a list<string> to Neo4j Through Neo4jClient?

I am trying to send a list of strings to Neo4j using Neo4jClient to be used in a FOREACH cypher loop. 我正在尝试使用Neo4jClient将字符串列表发送到Neo4j,以在FOREACH密码循环中使用。 The problem I am facing is that instead to creating different nodes for each string , the program creates just one node with the property Name set as the complete comma separated list. 我面临的问题是,该程序不是为每个字符串创建不同的节点,而是仅创建一个节点,并将属性Name设置为完整的逗号分隔列表。

The Code I am Using : 我正在使用的代码:

GraphClient graphClient = new GraphClient(new Uri("http://neo4j:a@localhost:7474/db/data"));
        graphClient.Connect();
        graphClient.Cypher
          .With("[{listTags}] AS T1")
          .ForEach("( n in T1| Merge (p: NPT {Name: n})")
          .OnCreate().Set("p.Mod =0")
          .OnMatch().Set("p.Mod = 0)")
           .WithParams(new { listTags = ResultString })
          .ExecuteWithoutResults();

I have found the solution. 我找到了解决方案。 Instead of using .With("[{listTags}] AS T1") I changed it to .With("{listTags} AS T1") . 我没有使用.With("[{listTags}] AS T1")而是将其更改为.With("{listTags} AS T1") ( Dropped the Square Brackets). (放下方括号)。 It Works Now. 现在可以使用。 Thanks anyways. 不管怎么说,多谢拉。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM