原来的Cypher:
select distinct on (src, dest) i.*
from init 8
order by src, dest, cost_to_here;
类似的东西:
MATCH (user)
WHERE user.name IN ['Joe', 'John', 'Sara', 'Maria', 'Steve']
RETURN user
当Neo4jClient的完整文档可用时?)
答案 0 :(得分:1)
要更改代码,您可以这样做:
public Nodes Parse(string[] str)
{
var query = graphClient.Cypher
.Match("(a)-[]-?(b)")
.Where("a.Name IN $namesParam")
.WithParam("namesParam", str)
.Return((a,b) => new Nodes {
Source = a.As<Vertex>(),
Peers = b.CollectAs<Vertex>()
});
var result = query.Results.FirstOrDefault();
return result;
}
要在顶部执行您的查询,您可以这样做:
var names = new [] {"Joe", "John", "Sara", "Maria", "Steve"};
var users = graphClient
.Match("(user)")
.Where("user.name IN $names")
.WithParam("names", names)
.Return(user => user.As<User>())
.Results;
我担心可能永远不会有客户的完整文档,除非其他人想要贡献。
答案 1 :(得分:0)
var names = new [] {"Joe", "John", "Sara", "Maria", "Steve"};
var users = graphClient
.Unwind(names, "name")
.Match("(user)")
.Where("user.name = name")
.Return(user => user.As<User>())
.Results;