0
我有這種方法來查找所有來自起始節點的路徑,並且爲每個路徑返回每個節點中Score值總和的路徑。Neo4j總結路徑中的節點值
public List<PathScore> GetHighScorePath(string nodeName)
{
try
{
List<PathScore> result =
this.client.Cypher.Match("p=(n)-[*]->(leaf)")
.Where((LogEvent n) => n.Name == nodeName)
.AndWhere("Not ((leaf)-->(n))")
.ReturnDistinct(p => new PathScore
{
Nodes = Return.As<IEnumerable<Node<LogEvent>>>("nodes(p)"),
Relationships = Return.As<IEnumerable<RelationshipInstance<Pivot>>>("rels(p)"),
pScore = Return.As<int>("REDUCE(total = 0, n IN nodes(p) | total + n.Score)")
})
.Results.ToList();
return result;
}}
這是我的路結果類
public class PathScore
{
public IEnumerable<Node<LogEvent>> Nodes { get; set; }
public IEnumerable<RelationshipInstance<Pivot>> Relationships { get; set; }
public int pScore;
}
但我從Neo4j的得到這個錯誤味精
Neo4j returned a valid response, however Neo4jClient was unable to deserialize into the object structure you supplied.
我認爲錯誤在於其中i返回分數作爲部分的部分返回的對象。這是導致該錯誤的行:
pScore = Return.As<int>("REDUCE(total = 0, n IN nodes(p) | total + n.Score)")
確定愚蠢的我。我遺漏了我的pScore屬性的獲取設置訪問方法 – Koh
那麼這是否意味着它*現在正在工作? –
是的。這實際上是我的一個愚蠢的錯誤。將發佈一個答案爲此關閉此 – Koh