6. Diagrams and Other Notations
Contents
The Asserted Version Table120
The Temporal Primary Key122
The Temporal Foreign Key123
The Effective Time Period124
The Episode Begin Date124
The Assertion Time Period124
The Row Creation Date125
The Basic Asserted Versioning Diagram125
Additional Diagrams and Notations130
Viewing the Asserted Version Table132
The Conventional Table View133
The Version Table View134
The Assertion Table View135
Views and Mental Images137
Glossary References138
In the first section of this chapter, we present the schema common to all asserted version tables, using a table of health insurance policies as an example. All of the concepts introduced in the last chapter, such as objects, episodes, versions and assertions, and the two principal semantic constraints of temporal entity integrity and temporal referential integrity, are physically realized as rows in tables which are all based on this schema.
In the next two sections, we present several diagrams which will be used in the rest of this book. The basic diagram consists of a sample table and, above it, graphics which position that data in both effective time and assertion time. As well as additional diagrams which focus more on effective time than assertion time, we also present an in-line notation for single asserted version rows so we don't have to use diagrams when the discussion concerns single rows.
The final section contains our initial reflections on how asserted version tables should be accessed, and how the syntactic complexities of our approach to temporal data management may be hidden from those issuing queries to such data.
The Asserted Version Table
All asserted version tables have the same non-business-data columns. Figure 6.1 shows an asserted version table of health insurance policies which has two business data columns: type and copay. All the other columns are part of the syntax common to all asserted version tables, part of the bi-temporal machinery of Asserted Versioning. We will learn how to read these diagrams in the next section. For now, let's examine each column, and the roles that various columns and pairs of columns play.
B9780123750419000066/f06-01-9780123750419.jpg is missing
Figure 6.1
The Asserted Versioning Table.
Row #. Row number. This column is not part of the table. Row numbers are tags we place on asserted version rows in these diagrams. We will sometimes use these tags in our discussions to indicate which rows we are talking about. Note that if this column were included as part of the table, it could be used as a single-column surrogate primary key.
Oid. Object identifier. A surrogate-valued unique identifier of the persistent object for which the row is a bi-temporally located description, i.e. a description located in both a specific effective time period and also a specific assertion time period. If an asserted version table were a conventional table instead, the oid would be the full primary key of that table.
Eff-beg. Effective begin date. The date on which the business data in a row goes into effect, i.e. on which it first becomes a description of what that object is like, beginning on that date. As we have pointed out before, these columns which implement Asserted Versioning are all shown as date columns in this book, but they could as well be timestamps.
Also note that although this column heading is eff-beg, all SQL statements or predicates which reference this column will refer to it as eff_beg_dt. We use hyphens in these column headings because underscores do not stand out as well, particularly when a column heading is underlined, as it is for all primary key columns. When these columns names are used in the text, they will be italicized, although usually we will replace them with their full spelling equivalents. For example, when referring, in the text, to the column heading eff-beg, we will either use eff_beg_dt or the full name, as for example, in saying that the effective begin date is the temporal delimiter of the start of an effective time period.
Eff-end. Effective end date. The date on which the business data in a row is no longer in effect. In other words, the date which is one clock tick past the last date on which the business data in a row is in effect.
Asr-beg. Assertion begin date. The date on which the business data in a row is first asserted as being a true and/or actionable description of what that object is like, during its effective time period.
Asr-end. Assertion end date. The date on which the business data in a row is no longer asserted to be a true and/or actionable statement of what that object is like, during its effective time period. In other words, the date which is one clock tick past the last date on which that assertion is made.
Epis-beg. Episode begin date. The date on which the episode which contains the version begins. The begin date of an episode is always the same as the effective begin date of the first version in the episode.
Temporal Foreign Key: Client. The object identifier of the client who owns the policy, functioning as a temporal foreign key to an asserted version Client table.
Business data: Type. The type of the insurance policy. Types used in these examples are: HMO (Health Maintenance Organization); PPO (Preferred Provider Organization); and POS (point of service).
Business data: Copay. The copay amount that the policy holder is obligated to pay for each covered healthcare product or service.
Row-crt. Row creation date. The date on which the row is physically inserted into the table.
The Temporal Primary Key
Together, the object identifier, the effective begin date and the assertion begin date make up the primary key of an asserted version table. Note that in our diagrams we do not show all three primary key columns left-most, although that is the normal convention. Instead, we keep the two effective dates together, followed by the two assertion dates, to emphasize that each pair of dates goes together, each pair delimiting a different period of time.
The object identifier in an asserted version table is a surrogate-valued single-column unique identifier for an object—in this case, for a policy. When unique identifiers based on business data are used as primary keys, those keys can contain any number of columns. This would make it very difficult to build an enterprise framework for implementing Asserted Versioning, a framework that supports the maintenance and querying of any asserted version table, in any database, and that enforces the integrity constraints that give bi-temporal data the semantics that it has. An enterprise implementation of Asserted Versioning therefore requires that all asserted version tables use a single-column identifier, of the same datatype and length, for the persistent objects they represent.
When surrogate keys are used in an asserted version table, the primary key columns for the corresponding entity in the logical data model must be included as non-primary key columns in the asserted version table. These columns make up what we call the business key of an asserted version table.
In order to be able to show sample tables across the width of a page, we have not included business keys in our examples. Instead, we have used values for our surrogate keys which suggest that they could be business keys as well. But this convention, forced on us because of page width considerations, should not obscure the fact that business data is never used in surrogate keys, and that Asserted Versioning object identifiers are surrogate-valued.
Semantically, the unique identifier of any bi-temporal table consists of (i) a unique identifier of the object represented; (ii) a unique identifier of the effective time period of the business data on that row; and (iii) a unique identifier of the assertion time period of that version. In the Asserted Versioning implementation of bi-temporality, the effective and assertion begin dates each represent their full time periods in the table's primary key.
But how can each of these dates represent an entire time period? For example, in Figure 6.1, the effective time period extends from March 2010 into the indefinite future. What is to prevent us from inserting another row for policy P861, with an effective begin date of, let's say, April 2010?
The answer is that Asserted Versioning explicitly recognizes and enforces temporal entity integrity, a concept we introduced in the preceding chapter. As we said there, any Asserted Versioning implementation must reject a transaction that would create a version whose effective time period [intersects], within shared assertion time, even a single effective-time clock tick included in another version of that object already in the table.
Most physical transactions against bi-temporal tables are inserts. When we distinguish inserts from updates, as we have done here, we are talking about logical transactions against bi-temporal tables, transactions we call temporal transactions.
The Temporal Foreign Key
A temporal foreign key (TFK) is analogous to a normal foreign key, and serves much the same purpose; but it is one which the DBMS does not know how to use. A foreign key, at the schema level, points from one table to a table it is dependent on. At the row level, a foreign key value points from one row in the former table to one row in the latter table.
At the schema level, a TFK also points from one table to a table it is dependent on. But at the row level, it points from one row, which is a version, to a group of one or more rows which make up an episode of the object whose oid matches the oid in the temporal foreign key.
So a TFK does not point to a specific row in its referenced table. But it also does not point to the episode which the version containing it is dependent on. It points only to an object. In our example, it says only that this version of policy P861 belongs to client C882. But since no row in particular represents a client, i.e. since clients are themselves versioned, and since their versions are also asserted, the TFK points to no row in particular. Since there may be multiple episodes for any object, the TFK points to no episode of that object in particular.
The very existence of a TFK instance does make the claim, however, that there is an episode of the designated object in the referenced table, and that the effective time period of that episode in the referenced table includes, i.e. is filled by ([fills−1]), the effective time period of the version which contains the referring TFK. And it is one of the responsibilities of the Asserted Versioning Framework to insure that for every TFK instance in a database, there is exactly one such episode. Although the TFK, by itself, does not designate this parent episode, the TFK together with the assertion and effective time periods on the child row does designate it.
The Effective Time Period
A pair of dates defines the effective time period for each version. As we explained in Chapter 3, we use the closed-open convention, for both effective dates and assertion dates, in which a time period starts on its begin date, and ends one clock tick prior to its end date. Effective begin and end dates, of course, indicate when the version began and ceased to be effective. They delimit the period of time during which the object was as that row in the table describes it to be.
With non-temporal tables, we create a version of an object by the act of inserting a row into its table. But because there are no dates to delimit the effective time period of the row, the row goes into effect when it is physically created, and remains in effect until it is physically deleted. And while it exists in the table, no other versions of that object may co-exist with it. For if they did, there would be two or more statements each claiming to be the true description of the object during the entire time that all of them co-existed in the table.
The Episode Begin Date
Just as versions have effective time periods, episodes do too. An episode's begin date is an effective begin date, and it is the same as the effective begin date of its earliest version. An episode's end date, although not explicitly represented in the Asserted Versioning schema, is the same as the effective end date of its latest version.
The episode begin date is repeated on every row so that by looking at an episode's latest version we can determine the entire effective time period for the episode itself. By the same token, we can also look at any version and know that from its episode begin date to its own effective end date, its object was continuously represented in effective time. The ability to do this without retrieving and looking at multiple rows will be important, later on, when we see how temporal referential integrity is enforced.
The Assertion Time Period
Using the same closed-open convention, this pair of dates indicates when we began to assert a version as true and when, if ever, we stopped asserting that it is true. Even when a version ceases to be in effect, i.e. even when it has an effective end date in the past, we will usually continue to assert that, during its effective time period, it was a true description of what its object was like at that time.
However, and this is a very important point, there are exceptions. With both the Asserted Versioning and the standard temporal models, assertions may end even though the rows that made them remain in the table. We terminate assertions if and when we learn that they are mistaken, that the statement they make is not true. In addition, with Asserted Versioning, but not with the standard temporal model, rows can also be created whose assertion is postponed until some later point in time.
With non-temporal tables, we assert a row to be true by the act of inserting it into its table, and we cease to assert that it is true by deleting it from its table. With non-temporal tables, the assertion time period of a row coincides with the row's physical presence in the table. In these cases, the assertion begin date is the same as the row creation date. Also, in most cases, once we assert a row to be true, we continue to do so “until further notice”.
The Row Creation Date
The row creation date is the date the row is physically inserted into its table. In most cases, the row creation date will be identical with the assertion begin date. In the standard temporal model, it always is, and consequently, in that model, the two dates are not distinguished. However, in our Asserted Versioning implementation of bi-temporal data management, it is valid to create a row with an assertion begin date in the future. Thus, for Asserted Versioning, it is necessary to have a row creation date which is distinct from the assertion begin date.
The Basic Asserted Versioning Diagram
Figure 6.2 is an example of the basic diagram we will use to illustrate Asserted Versioning. The schema in this diagram was explained in the previous section. Now it's time to explain how to read the diagram itself. Figure 6.2 shows us the state of an asserted version table after a temporal insert transaction which took place on January 2010, and a temporal update transaction which took place on May 2010.
B9780123750419000066/f06-02-9780123750419.jpg is missing
Figure 6.2
The Basic Asserted Versioning Diagram.
On January 2010, a temporal insert transaction was processed for policy P861. 1 It said that policy P861 was to become effective on that date, and that, as is almost always the case when a temporal transaction is processed, was to be immediately asserted.
1The format for showing bi-temporal dates, in the text itself, is slightly different from the format used in the sample tables. For example, a date shown as “Jan10” in any of the tables will be written as “January 2010” in the text. Time periods are shown in the text as date pairs with the month still shortened but the century added to the year. Thus “[Feb 2010 – Oct 2012]” designates the time period beginning on February 2010 and ending one clock tick before October 2012, but would be represented in the diagram by “Feb10” and “Oct12”.
Then in May, a temporal update transaction for that policy was processed. The transaction changed the copay amount from $15 to $20, effective immediately. But this invalidated row 1 because row 1 asserted that a copay of $15 would continue to be in effect after May. So as part of carrying out the directives specified by that temporal transaction, we withdrew the assertion made by row 1, by overwriting the original assertion end date of 12/31/9999 on row 1 with the date May 2010.
When a row is withdrawn, it is given a non-12/31/9999 assertion end date. Withdrawn rows, in these diagrams, are graphically indicated by shading them. In addition, every row is represented by a numbered rectangular box on a horizontal row of all versions whose assertions begin on the same date. We will call these horizontal rows assertion time snapshots. These snapshots are located above the calendar timeline, and when their rectangular boxes represent withdrawn rows, those boxes are also shaded. So in Figure 6.2, the box for row 1 is shaded.
After row 1 was withdrawn, the update whose results are reflected in Figure 6.2 was then completed by inserting two rows which together represent our new knowledge about the policy, namely that it had a copay of $15 from January 2010 to May 2010, and had a copay of $20 thereafter.
The clock tick box is located to the left of the transaction, at the top of the diagram. It tells us that it is currently May 2010, in this example. This is graphically indicated by the solid vertical bar representing that month on the calendar timeline above the sample table. In this example, rows 2 and 3 have just been created. We can tell this because their row create date is May 2010.
The first row is no longer asserted. It has been withdrawn. It was first asserted on January 2010, but it stopped being asserted as part of the process of being replaced as a current assertion by row 2, and then superceded by row 3. This is indicated by the May 2010 value in row 1's assertion end date and the May 2010 value in the assertion begin dates of rows 2 and 3. It is graphically indicated by the two assertion time snapshots above and to the left of the timeline. Each snapshot shows the rows of the table that were currently asserted starting on that date. So from January 2010 to May 2010, row 1 is what we asserted about policy P861. From May 2010 forwards, rows 2 and 3 began to be asserted instead.
We say “instead” because rows 2 and 3 together replace and supercede row 1, in the following sense. First of all, they describe the same object that row 1 describes, that object being policy P861. Second, rows 2 and 3 together [equal] the effective time period of row 1, the period [Jan 2010 – 12/31/9999]. Row 2's effective time period is [Jan 2010 – May 2010]. Then, without skipping a clock tick, row 3's effective time period is [May 2010 – 12/31/9999]. Row 2 includes the part of row 1's effective time whose business data is not changed by the update; so we will say that row 2 replaces that part of row 1. Row 3 includes the part of row 1's effective time whose business data is changed by the update; so we will say that row 3 supercedes that part of row 1.
In our illustrations, 9999 represents the latest date that the DBMS can represent. In the case of SQL Server, for example, that date is 12/31/9999. This date does not represent a New Year's Eve some 8000 years hence. But it is a date as far as the DBMS is concerned. The importance of this “dual semantics” will become important later on when we explain how Asserted Versioning queries work.
Notice that all three rows in this example have assertion begin dates that are identical to their corresponding row creation dates. In the standard temporal model, a transaction time period is used instead of an assertion time period; and with transaction time periods, the begin date is always identical to the row creation date, and so a separate row creation date is not necessary.
But in the Asserted Versioning model, assertion begin dates and row creation dates are not semantically identical, and they do not necessarily have the same value in every row in which they appear. With Asserted Versioning, while no assertion begin date can be earlier than the corresponding row creation date, it can be later. If it is later, the transaction which creates the row is said to be a deferred transaction, not a current one. The row it creates in an asserted version table is said to be a deferred assertion, not a current one. Such rows are rows that we may eventually claim or assert are true, but that we are not yet willing to.
In this example, both before and after May 2010, the effective end date for policy P861 is not known. But sometimes effective end dates are known. Perhaps in another insurance company, all policies stop being in effect at the end of each calendar year. In that case, instead of an effective end date of 12/31/9999 in rows 1 and 3, the example would show a date of January 2011 (meaning, because of the closed-open convention, that the last date of effectivity for these policies is one clock tick prior to January 2011, that being December 2010).
We turn now to the graphics, the part of Figure 6.2 above the sample table. The purpose of these graphics is to abstract from the business details in the sample table and focus attention exclusively on the temporal features of the example.
Above a calendar which runs from January 2010 to February 2014, there are two horizontal rows of rectangular boxes. These rows are what we have already referred to as assertion time snapshots, with each rectangular box representing one version of the associated table. The lowest snapshot in a series of them contains a representation of the most recently asserted row or rows. These most recently asserted rows are almost always currently asserted and usually will continue to be asserted until further notice.
There are, however, two exceptions. Neither of them is part of the standard temporal model, but both of them support useful semantics. One exception is created by the presence of deferred assertions in the table which are, by definition, assertions whose begin dates, at the time the transaction is processed, lie in the future. The other exception is created when assertions are withdrawn without being replaced or superceded, i.e. when after a certain point in time we no longer wish to claim that those assertions ever were, are or will be a true description of what their object was, is or might be like during some stretch of effective time. But as we said earlier, we will not discuss deferred assertions until several chapters from now, at which time we will also discuss withdrawn assertions that are not replaced and/or superceded by other assertions.
Each of these assertion time snapshots consists of one or more boxes. As we said, each box contains the row number of the row it represents. The vertical line on the left-hand side of each box corresponds to the effective begin date of the row it represents. In this illustration, only one of the boxes is closed, in the sense of having a line on its right-hand side. The other two are open both graphically and, as we will see, semantically.
Let's consider these boxes, one at a time. The box for row 1 is open-ended. This always means that the corresponding row has an effective end date of 12/31/9999. The box directly below the box for row 1 represents row 2. Because that box is closed on its right-hand side, we know that the row it represents has a known effective end date which, in this case, is May 2010.
In these boxes that line up one under the other, the business data in the rows may or may not be identical. If the business data is identical, then the box underneath the other represents a replacement, and we will indicate that it has the same business data as the row it replaces by using the row number of the row it replaces as a superscript. But if the business data in two rows for the same object, during the same effective time period, is not identical, then the row represented by the lower box supercedes the row represented by the upper box, and in that case we will not include a superscript. This convention is illustrated in Figure 6.2, in which the box for row 2 has a superscript designating row 1, whereas the box for row 3 has no superscript.
The box directly to the right of the box for row 2 represents row 3. We can tell that the two rows are temporally adjacent along their effectivity timelines because the same vertical line which ends row 2's effective time period also begins row 3's effective time period. So this diagram shows us that there is an unbroken effective time period for policy P861, which began to be asserted on May 2010, and which extends from row 2's effective begin date of January 2010 to row 3's effective end date of 12/31/9999, this being exactly the same effective time period previously (in assertion time) represented by row 1 alone.
This description of Asserted Versioning's basic diagram has focused on a sample table whose contents reflect one temporal insert transaction, and one temporal update transaction.
Additional Diagrams and Notations
Before proceeding, we need a more flexible way to supplement English in our discussions of Asserted Versioning. In the last section, we used what we called the “basic diagram” of an asserted version table. That diagram contains five main components. They are:
(i) The current clock tick, which indicates what time it is in the example;
(ii) A temporal insert, update or delete transaction;
(iii) A calendar timeline covering approximately four years, in monthly increments;
(iv) A stacked series of assertion time snapshots of the table used in the example; and
(v) The table itself, including all rows across all effective and assertion times.
We will still need to use this basic diagram to illustrate many points. But for the most part, discussions in the next several chapters will focus on effective time. So we will often use a diagram in which rows in past assertion time are not shown in the sample table, and in which there are no assertion time snapshots either.
So, leaving assertion time snapshots out of the picture, we will often use the kind of diagram shown in Figure 6.3. And sometimes we will simply show a few rows from a sample table, as in Figure 6.4.
B9780123750419000066/f06-03-9780123750419.jpg is missing
Figure 6.3
The Effective Time Diagram.
B9780123750419000066/f06-04-9780123750419.jpg is missing
Figure 6.4
A Sample Asserted Version Table.
While illustrations are essential to understanding the complexities of bi-temporal data management, it will also be useful to have a notation that we can embed in-line with the text. In this notation, we will use capital letters to represent our sample tables. So far we have concentrated on the Policy table, and we will use “P” to represent it.
Almost always, what we will have to say involves rows and transactions that all contain data about the same object. For example, we will often be concerned with whether time periods for rows representing the same policy do or do not [meet]. But for the most part we will not be concerned with whether or not time periods for rows representing different policies [meet]. So the notation “P[X]” will indicate all rows in the Policy table that represent policy X.
In the next several chapters, we will be primarily concerned with the effective time periods of asserted version rows. So for example, the notation P[P861[Jun12-Mar14]] stands for the row (or possibly multiple rows) in the Policy table for the one or more versions of P861 that are in effect from June 2012 to March 2014. With this notation, we could point out that there is exactly one clock tick between P[P861[Jun12-Mar14]] and P[P861[Apr14-9999]]. If we needed to include assertion time as well, the notation would be, for example, P[P861[Jun12-Mar14][Jun12-9999]]. If we were concerned with assertion time but not with effective time, we would refer to the row(s) P[P861[][Jun12-9999]].
An example of the notation describing a complete asserted version row is:
P[P861[Jun12-Mar14][Jun12-9999][Jun12][C882, HMO, $15][Jun12]]
We will use abbreviated forms of the notation wherever possible. For one thing, we will seldom refer to the row creation date, until Chapter 12, because until we discuss deferred assertions, the row creation date will always be the same as the assertion begin date. Also, the episode begin date is always identical to the effective begin date of the first version of an episode, so we will often leave it out of our in-line representation of an asserted version row unless it is relevant to the example at hand.
What is lost with this in-line notation is context. What is gained is focus. Diagrams also present us with a graphical representation of a timeline and a snapshot of effective time periods, grouped by common assertion times along that timeline. With the in-line notation, that context, too, is not represented.
Viewing the Asserted Version Table
We can already see that asserted version tables are more complex than non-temporal tables. For one thing, they have about half a dozen columns that are not present in non-temporal tables; and the semantics of these columns, the rules governing their correct use and interpretation, are sometimes subtle. For another thing, the fact that there are now multiple rows representing a single object adds another level of complexity to an asserted version table. Some of those rows represent what those objects used to be like, others what they are like right now, and yet others what they may, at some time in the future, be like. In addition, and quite distinctly, some of those rows represent what we used to say those objects were, are, or will be like; others what we currently say they were, are, or will be like; and yet others what we may, at some time in the future, say they were, are, or will be like.
All in all, the sum and interplay of these factors make asserted version tables quite complex. They can be complex to maintain in the sense that they can be easy to update in ways whose results do not reflect what the person writing the updates intended to do. And they can be difficult to interpret, as we just said.
Asserted Versioning attempts to eliminate this maintenance complexity, as far as possible, by making it seem to the user who writes temporal transactions which utilize default values for their temporal parameters that the insert she writes creates a single row, that the updates she writes update that single row, and that the delete she writes removes it. In this way, by providing a set of transactions that conform to the paradigm she is already familiar with, the possibility of misinterpretation, on the maintenance side of things, is minimized.
But what about the query side of things? What about looking at the data in an asserted version table? How can this data be presented so as to hide the mechanisms by which it is managed—those extras columns and extra rows we referred to a moment ago—leaving what looks like a non-temporal or a uni-temporal table?
It is particularly important to hide the complexity of asserted version tables from query authors who are not IT professionals, from query authors who may be business analysts, scientists or researchers. For these query authors, the solution is to query asserted version tables through views. And no matter how much history is contained in an asserted version table, and no matter how much conjecture about or anticipation of the future may be contained in an asserted version table, we are still going to be primarily interested in what we believe, right now, things are like right now. That is, our most frequent view of an asserted version table will be the view that makes it look like a non-temporal table containing current data.
The Conventional Table View
So let's create that view. Its DDL looks something like this:
CREATE VIEW V_Policy_Curr AS
SELECT oid, client, type, copay
FROM Policy_AV
WHERE eff_beg_dt <= Now()
AND Now() < eff_end_dt
AND asr_beg_dt <= Now()
AND Now() < asr_end_dt
Now() may be replaced with CURRENT TIMESTAMP, CURRENT_DATE or getdate(), depending on the granularity and the DBMS.
This statement will result in a view that is current whenever it is run. So, for example, run any time prior to January 2010, against a table containing just the three rows shown in Figure 6.4, it would return an empty result set. Run on January 2010, or on any date after that, up to but not including April 2010, it would return the result set shown in Figure 6.5.
B9780123750419000066/f06-05-9780123750419.jpg is missing
Figure 6.5
The Current Non-Temporal View from January to April.
And if run on April 2010, or on any date after that, up to but not including July 2010, it would return the result set shown in Figure 6.6.
B9780123750419000066/f06-06-9780123750419.jpg is missing
Figure 6.6
The Current Non-Temporal View from April to July.
The Version Table View
Next, let's create a view which looks like the best of our best practice versioning methods, the one we called effective time versioning, in Chapter 4. As a version table view, it knows nothing about assertions. But because the table the view is based on is a bi-temporal table, there may be multiple assertions about the same set of one or more effective time clock ticks. So in order to filter out any past assertions, those being rows which contain data we no longer think is correct, this view will present only currently asserted versions, versions that we currently believe make true statements about the objects they represent.
CREATE VIEW V_Policy_Ver AS
SELECT oid, eff_beg_dt, eff_end_dt, client, type, copay
FROM Policy_AV
WHERE asr_beg_dt <= Now()
AND Now() < asr_end_dt
This statement does not include effective begin or end dates in its WHERE clause because we are selecting all versions, across all effective time. It does include an assertion time WHERE clause predicate to guarantee that all versions in the view represent our current assertions about what those things are like, during those periods of effective time. If any data was originally entered incorrectly, and later corrected by means of a temporal transaction, this predicate guarantees that we will get the correction, not the error.
This statement does include effective begin and end dates in its projection of the table. This is because this view is a view of versions, and the two effective dates are needed to specify the effective time period of each version. Without these two dates, multiple versions of the same object would have the same oid, and could have the same business data as well. Without these two dates, multiple versions of the same object could be indistinguishable.
We also point out that without the AVF code to enforce temporal entity integrity, these two dates could not prevent overlapping versions. For example, P[P861[Mar10-Nov10]] and P[P861[Mar10-Sep10]] are different sets of three values each. A unique index on them would find nothing wrong. But as far as versions are concerned, these two rows should not both be in the table. As far as versions are concerned, there is something very wrong.
Semantically, these are not two pairs of dates. They are the delimiters of a PERIOD datatype, and in this case, there is a 6-month overlap of these two time periods. The AVF enforces temporal entity integrity on the basis of an interpretation of these date pairs as time period delimiters. As far as integrity constraints are concerned, the AVF is code which implements, in a middleware layer located between temporal transactions and the DBMS, a user-defined PERIOD datatype, and which then uses that PERIOD datatype in its enforcement of both temporal entity integrity and temporal referential integrity.
This SQL creates a view that is current whenever it is run. That is, whenever it is run, it will show all currently asserted versions about the past, the present and the future. For example, run any time prior to January 2010, against a table containing just the three rows used in this example, it would return an empty result set. Run on January 2010, or on any date after that, up to but not including April 2010, it would return the result shown in Figure 6.7.
B9780123750419000066/f06-07-9780123750419.jpg is missing
Figure 6.7
The Current Version Table View as of April 2010.
And if run on July 2010 or any date after that and prior to any further changes to the table, it would return the result shown in Figure 6.8.
B9780123750419000066/f06-08-9780123750419.jpg is missing
Figure 6.8
The Current Version Table View from July Forwards.
The Assertion Table View
While there are several best practices supporting versions, there are none that we know of supporting assertions. Future-dated assertions are something no one other than ourselves appears to have thought of. Past-dated assertions are just errors that we keep around, probably for auditing purposes. And we have logfiles to take care of that.
The value of assertion table views on bi-temporal tables will become clearer as this book progresses. As we will see, assertion table views are of particular interest to auditors.
For now, let's look at the SQL which will provide a view of all assertions in our bi-temporal Policy table that have anything to do with currently effective data. The version table view was a view of all currently asserted versions. This assertion table view is a view of all currently effective assertions.
CREATE VIEW V_Policy_Asr AS
SELECT oid, asr_beg_dt, asr_end_dt, eff_beg_dt,
eff_end_dt, client, type, copay
FROM Policy_AV
WHERE eff_beg_dt <= Now()
AND Now() < eff_end_dt
This view filters out all rows that are not about what things are like currently. It excludes past versions and future versions. But this does not mean that the view is restricted to one row per object. If this table ever contained erroneous data about what things are currently like, that data will no longer be asserted. It will be a past assertion about a current state of affairs, and this view will include it. In addition, as we will see in Chapter 12, an asserted version table may contain anticipated data about what things are currently like. These will be future assertions about a current state of affairs, and this view will include those assertions as well.
Another aspect of the asymmetry between assertion time and effective time is that two or more effective-time [intersecting] versions of the same object, in shared assertion time, would violate temporal entity integrity, making conflicting truth claims wherever they shared an effective-time clock tick. Consequently, the AVF includes code to prevent that from happening. But two or more effective-time [intersecting] versions of the same object, whose assertion time periods [exclude] one another, do not violate temporal entity integrity. In fact, they violate no integrity constraints, nor do they make conflicting truth claims. Rows which share no clock ticks in assertion time are semantically and truth-functionally isolated from one another. They are what philosophers call incommensurable.
This is why this assertion table view must include both assertion dates and effective dates in its projection.
In general, any asymmetry in what is otherwise a profoundly symmetric set of concepts points to something important. Understanding why such asymmetries exist almost always deepens one's understanding of the underlying theory. This particular asymmetry is important in this way, and we will have more to say about it in later chapters.
Like the version table view, this assertion table view is also current whenever it is run. Whenever this view is run, it will show all assertions, past, present or future, that reference even a single clock tick in current effective time. Our sample database, shown in Figures 6.3 and 6.4, does not contain data that will illustrate this view which presents a current assertion table. But we will discuss assertion table views in depth in Chapters 12 and 13.
Views and Mental Images
Assuming (until Chapter 12) that temporal transactions never specify assertion dates, we can have three kinds of temporal transactions against asserted version tables, for example against our Policy table. With the first kind, no effective dates are specified. To authors of these transactions, they appear to be doing normal maintenance to a conventional Policy table, one that looks like the table shown in Figures 6.5 and 6.6. They have, or need have, no idea that the table they are actually maintaining is the table shown in Figures 6.3 and 6.4.
With the second kind of temporal transaction, effective begin and end dates may be specified, but neither of them can be a date which is already past at the time of the transaction. This is the way maintenance is done to version tables. Normally, current versions are created whenever they are needed to reflect a change in the object they represent. The version that was current at the time of the transaction is given an end date, and the transaction creates the new current version.
But Asserted Versioning, and the two most complete best practice forms of versioning, also permit transactions to create future versions. To authors of these transactions, they appear to be doing normal maintenance to a uni-temporal versioned Policy table, one that looks like the table shown in Figures 6.7 and 6.8. They have, or need have, no idea that the table they are actually maintaining is the table shown in Figures 6.3 and 6.4.
With the third kind of temporal transaction, effective begin and end dates may be specified, and either or both of them may be dates which are already past at the time of the transaction. This is the way maintenance is done to tables which support assertions of versions. But to authors whose mandate is to maintain either conventional or uni-temporal versioned tables, this kind of maintenance is impossible. A conventional table has no way of recognizing effective time. And it is semantically illegitimate to create past versions in uni-temporal version tables.
Here's why. If a past version were created in a version table, let's say one with an effective begin date of a week ago, it would be a lie. For all that week, the database would have said that the object represented by that version was not in effect during that week. Then, after the transaction, the database would say that the object was in effect during that same week. One or the other of those claims must be false. In fact, the latter one is.
But in a chapter whose purpose is to introduce notation that will be used in the rest of this book, much of what we have just said anticipates more detailed discussions that will occur later, particularly in Part 3.
Glossary References
Glossary entries whose definitions form strong inter-dependencies are grouped together in the following list. The same glossary entries may be grouped together in different ways at the end of different chapters, each grouping reflecting the semantic perspective of each chapter. There will usually be several other, and often many other, glossary entries that are not included in the list, and we recommend that the Glossary be consulted whenever an unfamiliar term is encountered.
12/31/9999
until further notice
asserted version table
Asserted Versioning Framework (AVF)
assertion begin date
assertion end date
assertion table
assertion time period
transaction time period
bi-temporal data
business data
business key
clock tick
closed-open
conventional table
conventional transaction
non-temporal table
deferred assertion
deferred transaction
episode
episode begin date
episode end date
include
incommensurable
maintenance encapsulation
query encapsulation
object
object identifier
oid
persistent object
PERIOD datatype
physical transaction
temporal transaction
replace
supercede
withdraw
row creation date
statement
temporal foreign key (TFK)
temporal primary key (TPK)
temporal referential integrity (TRI)
version
effective begin date
effective end date
effective time period
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset