Reputation: 17637
I doing a query on Neo4j on GrapheneDB, but it returns all combinations of match, so I have this tree:
But when I query it, it returns as a list of combinations of all paths, like a combinational table (even in the JSON view):
I need the nested tree objects, so I can bind it easily on UWP interface, something like: Using Cypher to return nested, hierarchical JSON from a tree
I used this command:
MATCH (p:Pessoa)-[ev:VENDA]-(y)-[e1]-(itemdopedido)-[e2]-(itemdoestoque)
CALL apoc.convert.toTree(p) yield value
RETURN value;
but I get this error:
ERROR Neo.ClientError.Procedure.ProcedureNotFound There is no procedure with the name
apoc.convert.toTree
registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.
On C# I created my Classes for the Vertexes and Edges:
public class Pedido
{
public string since { get; set; }
}
public class ItemDoPedido
{
public double ValorUnitario { get; set; }
}
public class ItemDoEstoque
{
public string Nome { get; set; }
public string UnidadeDeMedida { get; set; }
}
public class Pessoa
{
public string Nome { get; set; }
//public string Telefone { get; set; }
public string Facebook { get; set; }
}
Then I tried to use some Grouping:
var results = query.Results.GroupBy(
q => new { q.Pessoa, q.Pedido, q.ItemDoPedido, q.ItemDoEstoque }
)
.Select(y => new
{
Pessoa = y.Key.Pessoa,
Venda = y.Key.Pedido//,
//Children = y.ToList()
}
);
;
but I think it is getting complicated, I prefer that the Object tree comes ready from the Server Query.
How can I do this?
Upvotes: 0
Views: 412