Fork me on GitHub

Datomic seems the ideal system to reference entities at a particular point in time (ie the order was sent to the customer address as it was on Saturday 29th). I haven't seen a way of doing this in a way that feels natural - I could use the order time to get a database as of that point in time and read the address of course. Anyone discovered a better way?


@p14n I thought Datomic had a specific API for viewing the database as of a given timestamp?


It does, but not a way I know of to store that fact 'this reference is of time T'


@p14n I think what you're asking for is what bitemporal databases (e.g. are designed to model explicitly: differentiating between when information is recorded vs when that information is considered valid. The Datomic API only really concerns itself with the former (when information is actually recorded). If you want the latter, you can either model it using the same API (but then, e.g. you can't go back and easily change when something should be considered valid, since you can't change the time of recording); or you model it as additional valid-time attributes and make sure all your time sensitive queries take them into account. Valentin had a good blog post about this:

Drew Verlee23:08:19

what are we defining as valid? when i see some information is a straight forward idea, i don't have a strong understanding of what valid means in this context?

Drew Verlee01:08:44

So as-of doesn't give all attached facts past the given time? It gives just what was true as of that time.


Ah, yes, I think you're right

Joe Lane20:08:35

@p14n Isn't this just an attribute on an entity?


Yes, it could be, but then you need to pull the entity, and use the attribute to get a new dB, and pull the second entity from that

Joe Lane11:08:29

I don't understand the problem you're trying to solve here but am interested in hearing more.