Let’s consider the structure:
(parent) –[:HAS_CHILD]-> (child) –[:HAS_DOG]-> (dog)
Right now I would use the following cypher query to return a sort of hierarchy:
MATCH (p:Parent) -[:HAS_CHILD]-> (c:Child) -[:HAS_DOG]-> (d: Dog)
WITH p, collect(distinct(c)) as children, d
RETURN p, children, collect(distinct(d))
However, it would be much easier if I could have the same mapping as in the Entity Framework (with a list of Children in the Parent class):
public class Parent
{
public string Id { get; set; }
public string Name { get; set; }
public List<Child> Children { get; set; }
}
public class Child
{
public string Id { get; set; }
public string Name { get; set; }
public List<Dog> Dogs { get; set; }
}
public class Dog
{
public string Id { get; set; }
public string Name { get; set; }
}
Is there a way to do so?