i have this method to to find all paths from a starting node, and return the paths with the sum of the Score value in each node, for each path.
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;
}}
this is my path result class
public class PathScore
{
public IEnumerable<Node<LogEvent>> Nodes { get; set; }
public IEnumerable<RelationshipInstance<Pivot>> Relationships { get; set; }
public int pScore;
}
But i get this error msg from neo4j
Neo4j returned a valid response, however Neo4jClient was unable to deserialize into the object structure you supplied.
i believe the error lies with the part where i return the score as part of the returned object. This is the line that is causing the error:
pScore = Return.As<int>("REDUCE(total = 0, n IN nodes(p) | total + n.Score)")
ok so its just a mistake where i left out the get/set accessors.
this is the edited version
public class PathScore
{
public IEnumerable<Node<LogEvent>> Nodes { get; set; }
public IEnumerable<RelationshipInstance<Pivot>> Relationships { get; set; }
public int pScore { get; set; }
}