Some more comments:
you should also add other indexes like :Year(year)
to make the load scripts fast.
For your months, you can also use a local MERGE
like where the month is created uniquely within the scope of the year.
MERGE (y:Year {year: toInteger(row.Year)})
MERGE (m:Month {month: toInteger(row.Month)})-[:OF_YEAR]->(y)
You can combine the ON CREATE / ON MATCH
for measures with SET m.xxx = coalesce(m.xxx,0) + toFloat(row.xxx)
For your updates of Measures, can't you just MERGE on the measure-id as you did before and then use the expression above? Instead of the two FOREACH
.
For some reason I couldn't explain, existing measures were never detected, leading to systematic measure node creation (i.e. last part of the script was never executed).
Do you have a reproducible example for the above?
The aggregate approach is definitely something that could be encoded in a procedure, both for writing/updating and reading.
I wonder if it would make sense to have a more Human-readable bitmask? Like Aggregate_PT_X_LP
with a letter combination for each level and the levels separated by, e.g. an _
. We could also use-multi-labels for aggregates, .e.g. :Aggregate:1_Product:1_Time
to indicate where the aggregation happened. I like that even more.
Also it would be interesting to see at which data sizes the performance of regular neo4j (enterprise with slotted runtime) for aggregation across a sub-tree drops off to have non-realtime answers.
I'd love to see on-the-fly generation of aggregates based on needs, perhaps even combined with TTL (like materialized view).
And the use of other aggregation functions like min/max/avg/stdev/percentiles
. But also computation of other sales measures like reach
etc.
What do you plan to use for visualization? There is GitHub - jexp/spoon-neo4j: Augment Neo4j Browser with Zoom, DataTable and Charts for quick ones or Jupyter notebooks, or something like: GitHub - softvis-research/jqa-dashboard: Dashboard for analyzing and visualizing software artifacts' data scanned with jQAssistant and stored in a Neo4j graph database. (Which I plan to generalize as a "dashboard" - graph-app.)