How to represent days in timeline tree for Neo4j/g

2019-09-10 16:45发布

问题:

In reading this blog, this reference, and reviewing the answer to this question, I'm confused as to how one can represent distinct days in a timeline tree. In both cases they show a limited number of days on the example database and my thought is that this model cannot hold if you wanted to model an entire year or an unbounded temporal calendar period.

I am reading these examples such that the 'day' nodes are merely just the number of the day '1', '2', .. '31'. As every month has a day labeled '1', '2', etc, how do you traverse the path when you connect all days to months?

For example, in the attached modified drawing, month 12 and month 1 BOTH have days 1, 2 and 31 in them. When I look at event 2, how do I know if this took place on 12/31 or 1/31? I'd like to model all days for all months and using the template (as I understand it) creates ambiguous paths on the graph that do not allow for discrete temporal queries.

Or should a 'days' entity be a more unique number that represents the number of the day for that YEAR where the attribute for that number is the number of the day in the month?

As it stands I do not understand how you can create a complete timeline tree for an entire year as it is modeled in the above links.

回答1:

The modified drawing shares the day nodes between months and that's why it's difficult to know whether event 2 took place on 12/31/2010 or 1/1/2011

The timetree for a single year, with a resolution of Day, will have 365/366 day nodes. So the Day node with value 31 is not shared by both January and December, but January and December have their own Day 31 nodes. In other words a day node relates to exactly one month, and a month node relates to exactly one year.

Then you can follow the path from the event back up to the root without having it diverge at month.

Peter's blog post referenced above shows the crossing of December into January but does not share the Day node 31- you can see that he's able to answer all your queries above.

To create the timeline, GraphAware has a module that maintains the timeline for you and helps you attach events as well- http://graphaware.com/neo4j/2014/08/20/graphaware-neo4j-timetree.html

Disclaimer: I work at GraphAware