如何 return 从 Neo4j Graphenedb 到 C# 的查询中的对象树
How to return the object tree from a query from Neo4j Graphenedb to C#
我在 GrapheneDB 上对 Neo4j 进行查询,但它 returns 匹配的所有组合,
所以我有这棵树:
但是当我查询它时,它returns作为所有路径组合的列表,就像组合table(即使在JSON视图中):
我需要嵌套的树对象,所以我可以很容易地在 UWP 界面上绑定它,比如:
Using Cypher to return nested, hierarchical JSON from a tree
我使用了这个命令:
MATCH (p:Pessoa)-[ev:VENDA]-(y)-[e1]-(itemdopedido)-[e2]-(itemdoestoque)
CALL apoc.convert.toTree(p) yield value
RETURN value;
但我收到此错误:
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.
在 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()
}
);
;
但我认为它变得越来越复杂,我更喜欢从服务器查询准备好对象树。
我该怎么做?
好像找不到程序,可能是因为没有安装APOC。您可以从扩展管理视图将 APOC 添加到 GrapheneDB。更多信息 here
我在 GrapheneDB 上对 Neo4j 进行查询,但它 returns 匹配的所有组合, 所以我有这棵树:
但是当我查询它时,它returns作为所有路径组合的列表,就像组合table(即使在JSON视图中):
我需要嵌套的树对象,所以我可以很容易地在 UWP 界面上绑定它,比如: Using Cypher to return nested, hierarchical JSON from a tree
我使用了这个命令:
MATCH (p:Pessoa)-[ev:VENDA]-(y)-[e1]-(itemdopedido)-[e2]-(itemdoestoque)
CALL apoc.convert.toTree(p) yield value
RETURN value;
但我收到此错误:
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.
在 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()
}
);
;
但我认为它变得越来越复杂,我更喜欢从服务器查询准备好对象树。
我该怎么做?
好像找不到程序,可能是因为没有安装APOC。您可以从扩展管理视图将 APOC 添加到 GrapheneDB。更多信息 here