GSQL implementation of Time Tree Pattern

Does anyone have a TigerGraph implementation of the TimeTrees pattern?

Here is a blog that describes this pattern:

It is a way to roll-up time-series information as you might find in log files or IoT data.

Thanks!

I do not think we have a pre-packaged solution for this, but this pattern is/was used in many places (e.g. in our COVID-19 demo/solution on TigerGraph Cloud). I think it would be fairly simple to create it.

But we have (since 3.0) secondary indices, that work with DATETIME, and I believe that in many situation they are a better choice. For start, they are maintained by the database engine.

Blog post on indices.

Hi @danmccreary,
the level and partitioning of the date vertices can be customized to best suit your use case.

You can have the structure like with the example above (year → month → day) but like Szilard wrote, an easier way would be to have flattened DATE vertex and using an index on the DATE attribute. Then you can select all the dates you need in a 1st step and traverse from that result to the connected vertices. Here a small example:

CREATE QUERY test_date(DATETIME minDate, DATETIME maxDate) FOR GRAPH testgraph {

SetAccum @@dateList;
SetAccum @@transList;
MapAccum<Vertex, DATETIME> @@controlList;

// get the dates from a Dates vertex
Start = {Dates.*};
MyDates = SELECT s FROM Start:s
WHERE s.Date_attr >= minDate
AND s.Date_attr <= maxDate
ACCUM @@dateList += s;

// loop all the dates and get the transactions
FOREACH singleDate IN @@dateList DO
Seed = {singleDate};
Transactions = SELECT t FROM Seed:s-(date_on:e)->Transaction:t
ACCUM @@controlList += (t → s.Date_attr);

END;

PRINT @@controlList;
}

Also, please check our docs on time series: