我有以下 Cypher 查询,它在 Neo4j 2.0.0 中运行良好。
MATCH (ab:Point { Latitude: 24.96325, Longitude: 67.11343 }),(cd:Point { Latitude: 24.95873, Longitude: 67.10335 }),
p = shortestPath((ab)-[*..150]-(cd))
RETURN p
Neo4jClient 中的以下查询给出错误:函数计算超时。
var pathsQuery =
client.Cypher
.Match("(ab:Point { Latitude: 24.96325, Longitude: 67.11343 }),(cd:Point { Latitude: 24.95873, Longitude: 67.10335 }), p = shortestPath((ab)-[*..150]-(cd))")
.Return<IEnumerable<PointEntity>>("extract(n in nodes(p) : id(n))");
并且在 Xclave 上进行了另一项类似的工作之后:
http://geekswithblogs.net/cskardon/archive/2013/07/23/neo4jclient-ndash-getting-path-results.aspx http://geekswithblogs.net/cskardon/archive/2013/07/23/neo4jclient-ndash-getting-path-results.aspx
结果值为:函数求值超时。
var pathsQuery =
client.Cypher
.Match("(ab:Point { Latitude: 24.96325, Longitude: 67.11343 }),(cd:Point { Latitude: 24.95873, Longitude: 67.10335 }), p = shortestPath((ab)-[*..150]-(cd))")
.Return(p => new PathsResult<PointEntity>
{
Nodes = Return.As<IEnumerable<Node<PointEntity>>>("nodes(p)"),
});
如何获取 C# 中查询返回的所有节点作为 PointEntity 类型列表?
EDIT :
我能够从这段代码中获取节点和关系的 URI:
var pathsQuery =
client.Cypher
.Match("(ab:Point { Latitude: 24.96325, Longitude: 67.11343 }),(cd:Point { Latitude: 24.95873, Longitude: 67.10335 }), p = shortestPath((ab)-[*..150]-(cd))")
var results = pathsQuery.Return<PathsResult>("p").Results;
关注 Craig Brett 的博客:http://craigbrettdevden.blogspot.co.uk/2013/03/retriving-paths-in-neo4jclient.html http://craigbrettdevden.blogspot.co.uk/2013/03/retrieving-paths-in-neo4jclient.html
我尝试获取 POCO 但出现错误:
var paths = pathsQuery.Returns<PathsResult>("EXTRACT(n in nodes(p) : n) AS Nodes, EXTRACT(rel in rels(p) : rel) AS Relationships", CypherResultMode.Projection).Results;
Error:
'Neo4jClient.Cypher.ICypherFluentQuery' does not contain a definition for 'Returns' and no extension method 'Returns' accepting a first argument of type 'Neo4jClient.Cypher.ICypherFluentQuery' could be found (are you missing a using directive or an assembly reference?)