|
|
| Author |
Message |
|
| dsmith |
Posted: Mon Feb 04, 2008 12:02 pm |
|
|
|
User
Joined: 08 Aug 2007
Posts: 41
Location: Toronto
|
Is there an application that provides a temporal DB management layer on top of mnesia. Supporting valid-time and transaction-time intervals as well as read/write/delete functions to manipulate them should be fairly easy.
Does anyone know if there has been any contribution like this?
This may not have a lot of uses for soft real-time system for which mnesia was created, but I thought Id ask if there might be interest in such an application. |
|
|
| Back to top |
|
| dsmith |
Posted: Mon Feb 04, 2008 12:15 pm |
|
|
|
User
Joined: 08 Aug 2007
Posts: 41
Location: Toronto
|
Where I'm coming from is this...
I write business applications and am looking at Erlang as as possible framework language. Whereas valid-time state management may not have many uses in soft real-time systems, they are central to business applications. (And transaction-time state management is central to auditing)
I recognize mnesia would not be appropriate for storing business records of the type that would benefit from VT state management. However, I do find mnesia an exceptional tool for prototyping business applications. Providing temporal management would make it even easier. |
|
|
| Back to top |
|
| francesco |
Posted: Tue Feb 05, 2008 7:37 pm |
|
|
|
User
Joined: 07 Jul 2006
Posts: 249
Location: London
|
Hi,
I have never heard of anyone writing a temporal DB management layer/application for Mnesia. What would the requirements be? Using time stamps generated from now() when entering the data and ordered sets might be a step in the right direction.
Francesco
--
http://www.erlang-consulting.com |
|
|
| Back to top |
|
| dsmith |
Posted: Wed Feb 06, 2008 6:13 am |
|
|
|
User
Joined: 08 Aug 2007
Posts: 41
Location: Toronto
|
That's still unclear -- what does the underlying mnesia table look like?
I envision an interface that is a subset of the mnesia interface with a create_table that transforms the TabDef arguments to mnesia arguments.
So there would be a exported function:
tmnesia:create_table(Name, TabDef)
where TabDef is defined the same as mnesia except that the {type, Type} argument is one of vtime, ttime, or bitemporal.
This function would transform the list argument and call the mnesia:create_table/2 with a type of set, ordered_set, or bag. In any case temporal integrity and continuity would have to be ensured by the library. It could be done with a bag, keeping a time intervals outside of the key, but some queries may perform poorly if a large number of time-state changes are recorded for one key.
My feeling that an ordered_set where the Key is transformed to {TTInterval, VTInterval, Key} would be best. Where the interval() -> {TEnd, TStart} and the TEnd and TStart are probably not date() as defined in stdlib. The most common queries would benefit from ordering in reverse time order so that the most recent is first. (ie. a query for the currently valid record in the current trans-state is very common.)
I would add Key as an secondary attribute as well and apply an index to it to improve other queries.
Some of the most common queries would look like this:
Code:
tmnesia:read(current, {Tab, Key}).
tmnesia:read({valid, VDate}, {Tab, Key}).
tmnesia:read({valid, VInterval}, {Tab, key}).
tmnesia:read(valid, {Tab, key}).
|
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|