[英]Neo4j cypher transform query to c#
I need to transform this query to use with the graphclient inside c#: 我需要转换此查询以与C#中的graphclient一起使用:
MATCH p=(n)-[r*2..10]-(m)
WHERE n.Id = 94 and m.Id = 94
AND NONE (node IN NODES(p) WHERE SIZE(
FILTER(x IN NODES(p) WHERE node = x AND x.Id <> 94)
) > 1
)
RETURN EXTRACT(n IN NODES(p)| n.Id) AS Paths, length(p), r
order by length(p)
the closest solution that I could put together is: 我可以放在一起的最接近的解决方案是:
var results = neoDB.Cypher
.Match("p=(n:JUNCTIONS)-[r*2..10]-(m:JUNCTIONS)")
.Where("n.Id={startNodeId} and m.Id={endNodeId}")
.WithParam("startNodeId", 92)
.WithParam("endNodeId", 92)
.Return((p, n, m, r) => new
{
path = p.CollectAs<Neo4jClient.ApiModels.Cypher.PathsResult>(),
node1 = n.As<cNode>(),
node2 = m.As<cNode>(),
Relation = r.As<IEnumerable<cNode>>()
}).Results;
the filter for lengths greater than one was unnecessary, this solution is good for me 长度大于1的过滤器是不必要的,此解决方案对我有好处
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.