0

I doing a query on Neo4j on GrapheneDB, but it returns all combinations of match, so I have this tree:

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):

table

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?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Tony
  • 16,527
  • 15
  • 80
  • 134

1 Answers1

1

It looks like it can't find the procedure, probably because APOC is not installed. You can add APOC to GrapheneDB from the Extensions management view. More info here

Juanjo
  • 186
  • 1
  • 4
  • I did that, enabled it, restarted server, but now the server gives Internal Server Error. – Tony Apr 07 '18 at 17:28
  • Neo4j can't start because the APOC version is probably too old. Just download the latest release and try again. – Juanjo Apr 07 '18 at 17:36
  • I followed that link and I was using https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/tag/3.1.3.9 now I will try https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/download/3.3.0.2/apoc-3.3.0.2-all.jar – Tony Apr 07 '18 at 17:38
  • 1
    Yes, that version is quite old and won't work for newer versions of Neo4j. – Juanjo Apr 07 '18 at 17:53