我在 GrapheneDB 上对 Neo4j 进行查询,但它返回匹配的所有组合,所以我有这棵树:
但是当我查询它时,它会作为所有路径的组合列表返回,例如组合表(即使在 JSON 视图中):
我需要嵌套的树对象,所以我可以在 UWP 界面上轻松绑定它,例如: Using Cypher to return nested, hierarchy JSON from a tree
我使用了这个命令:
MATCH (p:Pessoa)-[ev:VENDA]-(y)-[e1]-(itemdopedido)-[e2]-(itemdoestoque)
CALL apoc.convert.toTree(p) yield value
RETURN value;
但我收到此错误:
错误 Neo.ClientError.Procedure.ProcedureNotFound 没有
apoc.convert.toTree
为此数据库实例注册的名称的过程。请确保您正确拼写了过程名称并且该过程已正确部署。
在 C# 上,我为顶点和边创建了类:
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; }
}
然后我尝试使用一些分组:
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()
}
);
;
但我认为它变得复杂了,我更喜欢从服务器查询中准备好对象树。
我怎样才能做到这一点?