Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-08-2021 02:07 PM
I am just starting out with cypher but I must say I could use more examples in the documentation but that's just how I learn
I have a "tree-like" database :
A->B1/B2 (several) -> C(several) -> D(several). I am trying to aggregate several properties at different levels. For example, how many B1 and B2 does A have, how many Cs does A have and so on. I would ideally expand this later on to show what is the average count of Cs for all B1s in A.
The output would ideally look like:
A.name, #B1s, #C, average(#C) per B1 for A
My cypher-fu is still quite limited but I can for example get the first level counts and averages, ie, how many B1s or B2s I have per A. Where I start to struggle is how to count total number of Cs and average number of Cs per B1 in A, or both B1s, B2s, etc.
I hope this makes sense!
07-13-2021 08:56 AM
I imagine you can query it directly, for specific limited questions that you have started to describe. In order to help with that it would be very helpful if you could provide a simple example graph (e.g. CREATE statements), and describe some specific query(s). For clarity, providing the right answer (hand calculated) would be ideal.
07-13-2021 09:22 AM
One typical kind of aggregation is the calculation of cost up a bill of material
see Bill of Materials in Neo4j | Max De Marzi
Actually not exactly a tree because some components can be built into different sub assembly.
07-15-2021 07:25 AM
Thanks everyone. I ended up going with something very simple, basically doing several subqueries/CALL {} for the time being. It actually works well because the "tree" is stereotyped enough I don't need to think recurrently!
All the sessions of the conference are now available online