C# Net中Neo4j查询的等效语法

C# Net中Neo4j查询的等效语法,c#,asp.net,neo4j,neo4jclient,C#,Asp.net,Neo4j,Neo4jclient,这是一个在Neo4j浏览器中运行良好的查询,但在转换为等效的.Net查询时会引发异常 密码查询是 Match (c:Template)-[r1:Temp_Reffered_DIM_SEG1]->(dim1:Natural_Account), (c)-[r2:Temp_Reffered_DIM_SEG2]->(dim2:Legal_Entity_123), (c)-[r3:Temp_Reffered_DIM_SEG3]->(dim3:ICSegme

这是一个在Neo4j浏览器中运行良好的查询,但在转换为等效的.Net查询时会引发异常 密码查询是

Match (c:Template)-[r1:Temp_Reffered_DIM_SEG1]->(dim1:Natural_Account),
        (c)-[r2:Temp_Reffered_DIM_SEG2]->(dim2:Legal_Entity_123),
        (c)-[r3:Temp_Reffered_DIM_SEG3]->(dim3:ICSegment), 
        (c)-[r4:Temp_Reffered_DIM_SEG4]->(dim4:Department_123), 
        (c)-[r5:Temp_Reffered_DIM_SEG5]->(dim5:Project_123),
        (b:Template) <-[r6:DEPENDS_ON]-(c)
        where dim1.Id in [-1,277] AND dim2.Id in [-1,115] AND dim3.Id in [103,-1] AND dim4.Id in [101,-1] AND dim5.Id in [-1,102] and 
        b.Id = 227 and b.ScenarioId = 200 and c.ScenarioId = 200
        with collect(DISTINCT(r1.LineIds)) as L1, collect(DISTINCT(r2.LineIds)) as L2,collect(DISTINCT(r3.LineIds)) as L3, collect(DISTINCT(r4.LineIds)) as L4, collect(DISTINCT(r5.LineIds)) as L5, collect(DISTINCT(r6.LineIds)) as L6 
        With REDUCE(output = [], r IN L1 | output + r) AS l1, REDUCE(output = [], r IN L2 | output + r) AS l2,REDUCE(output = [], r IN L3 | output + r) AS l3,REDUCE(output = [], r IN L4 | output + r) AS l4
        ,REDUCE(output = [], r IN L5 | output + r) AS l5
        ,REDUCE(output = [], r IN L6 | output + r) AS l6
        where size(filter(x in l1 where x in l2 and x in l3 and x in l4 and x in l5 and x in l6))>0
        return c
匹配(c:模板)-[r1:临时参考值\u DIM\u SEG1]->(dim1:自然账户),
(c) -[r2:Temp\u Reffered\u DIM\u SEG2]->(dim2:Legal\u Entity\u 123),
(c) -[r3:温度参考尺寸SEG3]->(dim3:ICSegment),
(c) -[r4:Temp\u Reffered\u DIM\u SEG4]->(dim4:Department\u 123),
(c) -[r5:Temp\U REFERED\U DIM\U SEG5]->(dim5:Project\U 123),
(b:模板)0
返回c
Net中的等效查询如下所示:

 var match = @"(c:Template)-[r1:Temp_Reffered_DIM_SEG1]->(dim1:Natural_Account),
(c)-[r2:Temp_Reffered_DIM_SEG2]->(dim2:Legal_Entity_123),
(c)-[r3:Temp_Reffered_DIM_SEG3]->(dim3:ICSegment), 
(c)-[r4:Temp_Reffered_DIM_SEG4]->(dim4:Department_123), 
(c)-[r5:Temp_Reffered_DIM_SEG5]->(dim5:Project_123),
(b:Template) <-[r6:DEPENDS_ON]-(c)";
var query = client.Cypher
                        .Match(match)
                        .Where("dim1.Id in [277,1]")
                        .AndWhere("dim2.Id in [115,1]")
                        .AndWhere("dim3.Id in [102,1]")
                        .AndWhere("dim4.Id in [101,1]")
                        .AndWhere("dim5.Id in [101,1]")
                        .AndWhere("b.Id = 227 and b.ScenarioId = 200")
                        .AndWhere("c.ScenarioId = 200")
                        .With("collect(DISTINCT(r1.LineIds)) as L1, collect(DISTINCT(r2.LineIds)) as L2,collect(DISTINCT(r3.LineIds)) as L3, collect(DISTINCT(r4.LineIds)) as L4, collect(DISTINCT(r5.LineIds)) as L5, collect(DISTINCT(r6.LineIds)) as L6,c")
                       .With("REDUCE(output = [], r IN L1 | output + r) AS l1, REDUCE(output = [], r IN L2 | output + r) AS l2,REDUCE(output = [], r IN L3 | output + r) AS l3,REDUCE(output = [], r IN L4 | output + r) AS l4, REDUCE(output = [], r IN L5 | output + r) AS l5, REDUCE(output = [], r IN L6 | output + r) AS l6, c")
                       .AndWhere("size(filter(x in l1 where x in l2 and x in l3 and x in l4 and x in l5 and x in l6))>0")
                       .ReturnDistinct((c) => c.As<Template>()).Results;
var match=@“(c:模板)-[r1:临时参照的维度SEG1]->(dim1:自然账户),
(c) -[r2:Temp\u Reffered\u DIM\u SEG2]->(dim2:Legal\u Entity\u 123),
(c) -[r3:温度参考尺寸SEG3]->(dim3:ICSegment),
(c) -[r4:Temp\u Reffered\u DIM\u SEG4]->(dim4:Department\u 123),
(c) -[r5:Temp\U REFERED\U DIM\U SEG5]->(dim5:Project\U 123),
(b:模板)0“
.ReturnDistinct((c)=>c.As())。结果;
这似乎在语法上有一些问题。有人能帮忙吗?

我找到了解决办法

.AndWhere("size(filter(x in l1 where x in l2 and x in l3 and x in l4 and x in l5 and x in l6))>0")
需要改成

.Where("size(filter(x in l1 where x in l2 and x in l3 and x in l4 and x in l5 and x in l6))>0")
因为,我最后只有一个Where条件,使用AndWhere()会产生问题