A logical framework for temporal deductive S. M. Sripada Departmentof Computing Imperial College of Science& Technology 180 Queen’sGate, London SW7 2BZ

Abstract researchers have incorporated into conventional databasesusing various schemes Temporal deductive databases are deductive providing different capabilities for handling databaseswith an ability to representboth valid temporal information. In particular, work has time and transaction time. The work is basedon been done on adding temporal information to the Calculus of Kowalski & Sergot. Event conventionaldatabases to turn them into temporal Calculus is a treatment of time, based on the databases. However, no work is done on notion of events, in first-order classical logic handling both transaction time and valid time in augmentedwith negation as failure. It formalizes deductive databases.In this paper we propose a the semanticsof valid time in deductivedatabases framework for dealing with time in temporal and offers capability for the semantic validation deductivedatabases. of updates and default reasoning. In this paper, the Event Calculus is extended to include the Snodgrass dz Ahn [16,17] describe a concept of transaction time. The resulting classification of databasesdepending on their framework is capable of handling both proactive ability to represent temporal information. They and retroactive updates symmetrically. Error identify three different concepts of time - valid correction is achievedwithout deletionsby means time, transaction time and user-defined time. Of of negation as failure. The semantics of these, user-defined time is temporal transaction time is formalised and the axioms of information of some kind that is of interest to the the Event Calculus are modified to cater for user but does not concern a DBMS. It is just temporal databases. Given a description of treated as any other non-temporal attribute. events, axioms are presented for deducing Valid time is the time for which information relationships and the time periods for which they models reality and correspondsto the actual time hold with respect to any /presentstate of the for which a relationship holds in the real world. . Transaction time, on the other hand, is the time at which information is stored in the (1) Introduction database. Databases which represent only the latest snapshotof the world being modelled are Interest in researchconcerning the study of time called snapshot databases. All conventional in databaseshas been growing steadily over the databasescome under this category, for example, past few years. The study of time has attracted INGRES[20]. Databases which represent transaction time alone and therefore treat valid researchersfrom various fields such as artificial time and transaction time as identical are called intelligence, databases, natural language rollback databases since it is possible to processing,logic and concurrent systems.Many rollback to a past state of the databaseand pose a query with respect to that state. The POSTGRES[21] model is a database in this Permission to copy without fee alI or put of this mat&l is category. The problem with representing granted provided tht the copies are not made cr distributed for transaction time alone is that a of the direct axnmexcial advantage, the VIDB copyright notice and database activities is recorded (since every the title of the publication end its date appca, end notice is given databasestate is stored, in effect), rather than the chat copying is by permission of the Very Large Data Bose history of the world being modelled. Thus it is Endowment. To copy o&wise, or to republish. requires a fee not possibleto make proactive/retroactiveupdates and/or special permission from the Endowmcnt. and errors in a past statecannot be corrected.

Proceedingsof the 14thVLDB Conference Los Angeles,California 1988 171 Databases which store the history of the real primitive. Various relationships and the time world as is best known are called historical periods for which they hold are derived from a databases[2,4,5,9,10,12].These databaseshave description of events that occur in the real the concept of valid time alone but it is possible world. The approach is closely related to Lee et to make changes to the history of each tuple. al.‘s[10,14] treatment of time in deductive Thus changescould be made to reflect the past as databasesand Allen’s interval temporal logic[ 11. is best known. Finally, databaseswhich store all In his paper, Kowalski[9] deals with database the past history as is best known at every stateof updates using the Event Calculus and compares the databaseare called temporal databases[191. this approach with updates in a conventional These databasesinvolve a representationof both relational databaseand the use of modal temporal valid time and transactiontime for eachtuple. An logic, situation calculus and case semanticsfor extensive bibliography of research concerning storing and updating information in a database.It time in databasesis given in [13,18]. is argued that the Event Calculus combines the expressive power of both case semantics and Temporal databasesare especially useful when situation calculus, derives the computational updates have retrospective effect. For example, power of logic programming and overcomesthe in [ 151, Sergot et al. discuss the representation frame problem of the situation calculus. Schemes of the British Nationality Act as a logic program. for specializing the Event Calculus so as to make A databasemight be used to record the details of it comparable in efficiency to that of relational a person. The logic program can then be used to databaseswith destructive assignment are also deduce whether or not that person is, according presented in Kowalski[9]. In the following, we to the act, a British citizen. As the person’s give an outline of the treatment of time in the details change, their status can change Event Calculus. accordingly. It is possible for a personto become a British citizen and for this statusto have effect In the Event Calculus, event descriptions are from the date of their birth. A used to deduce the existence as well as the preserves the distinction between what was initiation and termination of time periods. Each previously considered to be their status at the time period is uniquely identified by a time of their birth and what is now considered combination of the relationship that holds during to be their status at that time. This capability is the time period and the event which initiates or achieved by an explicit storage of the time at terminates the period. This is so, because,each which information becomesavailable. In the case eventmay initiate or terminatemore than one time of databases, this time is referred to as the period and there may be several different time transactiontime. periods in which the same relationship holds. The term[7,11] after(e r) is used to denote a In this paper, we extend the Event Calculus of time period started by an event e in which the Kowalski & Sergot[8] to formalize the semantics relationship r holds. Similarly, the term of time for temporal deductive databases.In the before(e r) is used to denote a time period following section, we outline the treatment of terminated by the event e in which the time in the Event Calculus. In section 3, we relationship r holds. The atom[7,11] outline the framework, in section 4 we formalize Holds(after(e r)) is a shorthand version for the the semantics of transaction time in temporal atom Holds(r after(e r)) and means that the databases and, in section 5, we modify the relationship r holds in the time period after(e r). axioms of the Event Calculusto accommodatethe Similarly, the atom Holds(before(e r)) asserts concept of transaction time thereby forming a the fact that the relationship r holds in the period theory of time for temporal deductivedatabases. before(e r). For example, let El be an event in which John (2) Event Calculus gave a book to Mary and E2 be an event in which Mary gave the book to Bob. Assume that The Event Calculus of Kowalski & Sergot[8] is a E2 occurred after El. Then, given these event treatment of time formalized in first-order descriptions, we could deduce that there is a classical logic augmented with negation as period started by the event El in which Mary failure[3]. It is basedon the notion of an event as possessesthe book and that there is a period

172 terminated by El in which John possessesthe Start(after(e r) e) EC3 book. This is representedpictorially in Fig 1. End(before(e r) e) EC4 Start(before(e’ r) e) if 1” after(e r) = before(e’ r) EC5 End(after(e r) e’) if after(e r) = before(e’ r) EC6 Theseaxioms allow us to deducethat Fig 1 (i)the period after(E1 possesses(Mary Book)) is started by the event E 1 (using axiom EC3 ) (ii)the period before(E1 possesses(John The axioms of the Event Calculus for deducing Book)) is terminated by the event El (axiom suchtime periods are as follows: EC4) (iii)the period before(E2 possesses(Mary Holds(before(e r)) if Terminates(e r) EC1 Book)) is startedby the event El if the periods afer(EI possesses(Mary Book)) and Holds(after(e r)) if Initiates(e r) EC2 before(E2 possesses(Mary Book)) are identical (axiom EC5) and These axioms are used along with application (iv)the period after(E1 possesses(Mary Book)) specific rules such as is terminated by the event E2 if the periods ajler(El possesses(Mary Book)) and Initiates(e possesses(xy)) if before(E2 possesses(Mary Book)) are identical Act(e give) and (axiom EC6). Recipient(e x) and Object(e y) However, deducing that two time periods are and identical involves somedefault reasoningsince it dependson the assumption that there is no event Terminates(e possesses(xy)) if in between which initiates or terminates a Act(e give) and conflicting time period. This is captured in the Donor(e x) and following axioms(readersare referred to [8] for Object(e y) detailedexplanation and examples): These rules state the relationships that each kind after(e r) = before(e’ r) if of event initiates and terminates.The types of Holds(after(e r)) and events for which such rules are given depends Holds(before(e’ r)) and upon the domain of application. It is then e c e’ and possibleto deducethat the following are true: NOT Broken(e r e’) EC7 Holds(after(E1 possesses(MatyBook))) Holds(before(E1 possesses(JohnBook))) Here, the relation < is a chronological ordering Holds(after(E2 possesses(BobBook))) on events. e < e’ means that theevent eoccurs Holds(before(E2 possesses(MaryBook))). chronologically earlier than the event e’. The relation s has a similar meaning. The NOT is interpretedas negation as failure. Having deduced the existence of time periods, there is a need to deduce the Start and End of each time period. The axioms for this are the Broken(e r e’) if Holds(after(e* r*)) and following: Exclusive(r r*) and (The atom Start(x y) denotesthat the start of the e c e* and time period x is the event y.) e* c e’ EC8

173 Broken(e r e’) if Holds(before(e* r*)) and relationship. This case is shown in Fig 3. The Exclusive(r r*) and relationship r’ in Fig 3 can be either e

after(e possesses(Maty Book)) after(e possesses(Mary Book)) 0 b 0 b e after(e’ r’) e 0 b bsfore(e’ possesses(Mary Book)) e’ 4 0 e’

Fig 2 Fig 4 When we know of two events which terminate The case shown in Fig 4 is symmetric to that of relationships that are mutually exclusive but with Fig 3 but with the terminating event unknown. no known event initiating the later of these Again, the relationship r’ is mutually exclusive to relationships, it is possible to deduce,by default, the relationship possesses(Mary Book). This is the existence of an event initiating that formalized by the following axiom:

174 tinx if Start(x e’) and [ End(after(er)dfin(after(e r))) Time(e’ t’) and NOT End(x e”) and fin(after(e r)) s e’ ] if t’ < t EC16 Holds(after(e r)) and Holds(after(e’ r’)) and The axiom EC16 is valid only for the specialcase Exclusive(r r’) and where events are recorded in the order in which e < e’ and they occur and the databasecontains a complete NOT Broken(e r e’) EC11 record of all the relevant past events. For the caseshown in Fig 5 the following axiom (3) Overview of the framework is needed: One way to use the Event Calculus for database [ fin(after(e r)) ;nit(before(e r’)) applications would be to record all the eventsof interestthat have taken place in the real world in a Start(before(ei,rd) init(before(e’ r’))) database.The axioms of the Event Calculus can then be used to deduce relationships along with End(after(e r) fin(after(e r))) ] if the time periods for which they hold. Thus the Holds(after(e r)) and Event Calculus gives a treatment of valid time in Holds(before(e’ r’)) and databases.Event Calculus, applied to databases, Exclusive(r r’) and formalizes a historical database[9,10,17]without NOT r= r’ and a facility for correcting errors. e c e’ and NOT Broken(e r e’) EC12 In addition to the above, temporal databases need to be able to deal with transaction time as well. Transactiontime is concernedwith the time at which information is stored in a database. after@ possesses(Mary Book)) Every event is enteredinto the databasethrough a 0 b transaction. Thus a transaction is a meta-event. e When information regarding an event e is entered before(e’ possesses(Bob Book)) into a databasethrough a transaction tr, a belief period(also called transaction time period) is I 0 started in which the information regarding the e’ event e is believed. The predicate Basis(tr e) is used to express the fact that the basis for Fig 5 believing in the event e is the transaction tr. However, such a belief period ends when Finally, knowing that a particular relationship another event e’ is entered into the databaseand holds for a certain time period, the axioms for e’ revises(corrects)the information given by the deducing that the relationship holds at a given event e. point in time are as follows: With the aid of belief periods, it is possible to HoldsAt(r t) if Holds(after(e r)) and find out what are all the events that are believed t in after(e r) EC13 to be true at a given point in transaction time(altematively, in any given databasestate). HoldsAt(r t) if Holds(before(e r)) and Once the set of such events is known, it is EC14 t in before(e r) possible to deduce the relationships that are tinx if Start(x e’) and implied by these events using the axioms of the End(x e”) and Event Calculus(in a modified form). Time(e’ t’) and Time(e” t”) and Since the history of the world as representedin t’< t and the databasemay contain some errors, there is a t c t” EC15 need for the ability to revise some of the

175 information. In our scheme, we achieve this by transaction cannot be greater than the current means of an additional relation Revises(e e’) time. which statesthat the information given by event e overrides the information given by the event e’. With the above scheme it is possible to answer Thus corrections to history are always achieved temporal queries. Before that we need to by assertingthe existenceof a new event which formalize the conceptof transactiontime which is revises an earlier event. No event description is done in the following section. ever deleted. (4) Transaction time From an application point of view, the schemeis implementedas follows: Transaction time represents the time at which information is stored in a database.The addition (i) Record an event e (occurring in the real world) of the concept of transaction time to a database in the database through a transaction tr. The enablesone to answerqueries such as “What was relationsthat are addedto the databaseare Mary’s rank on 5 January as per the databaseof Basis@ e) and Time(tr t). For example, if the 10 January?“. The reasoning involved in event El0 is entered in the databasethrough a answering this query can be split into two parts: transaction TR5, the following relations are (i) what are the eventsthat are believed to be true addedto the database: as per the databaseof 10 January? and (ii)what are the inferences that can be drawn from this Basis(TR5 ElO) subsetof eventsregarding the rank of Mary on 5 Time(TR5 SJanuary). January? The second of these is handled to a large extent by the treatment of time in the Event (ii) Enter the information regarding the event Calculus. The reasoning involved in solving the itself. For example, first part needs to be formalized. In this section we formalize the deduction of belief periods so Act(El0 Give) that theserules could be used in conjunction with Donor@10 Bob) the axioms of the Event Calculus, modified Recipient@0 Mary) suitably, to form a framework for the treatment Object(E10 Bookl) of time in temporal databases. Consider the Time(El0 2January). following example which involves a correction as well as belief periods: (iii) If the newly entered event e is supposedto be a correction to the information given by Examnle 1 another event e’, add the relation Revises(e e’) to the database.For example, E3 is an event in which John was hired as a lecturer on I January. The information regarding Revises(El0 E8). E3 was entered into the databaseon 3 January, through a transaction TRl. It was discovered Note that subsequently that John was hired as a lecturer (a)both past and eventscan be enteredinto on 5 January and this information was entered the database.It does not matter whether an event into the databaseby anothertransaction TR2 on 8 is yet to occur in the future i.e. the time of January. occurrenceof the event is greater than now, the current time. This provides an ability to handle Transaction TRl adds the following information proactiveupdates to the database: (b)every event has a basis(for belief) which is the databasetransaction through which it was entered (c)information regarding events may be entered Basis(TR1 E3) into the databasein any order with respectto their Time(TR1 3Januar-y) actualorder/time of occurrencein the real world Act(E3 hire) (d)transactions, of course, can only be entered Object(E3 John) into the database in the order in which they NewRank(E3 lecturer) actually take place. Obviously, the time of a Time(E3 1January)

176 The predicate Basis(tr e) indicates that tr is the BHolds(e after@ e)) if Basis(tr e) Al transaction which is the basis for believing the information regarding event e. The transaction BHolds(e before(tr e)) if Basis@ e’) and TRl initiates a belief period in which it is Revises(e’ e) A2 believed that John was hired as a lecturer on 1 January. Transaction TR2 introduces a correction (a revision) to the data already existing in the There are two main differences between the database. Since old data is not deleted, the concepts of transaction time and valid time. The correct information is entered as a new event, first is that transactions are entered into databases say E4, along with the relation Revises(E4 E3). strictly in a chronologically ascending order The database contains the following additional (transaction time moves only into the future) information after transaction TR2: whereas events themselves may be entered in any order in relation to their actual time of occurrence Basis(TR2 E4) in the real world. In other words, at any point in Time(TR2 8January) time, the database contains a complete record of Act(E4 hire) all the transactions that have taken place, whereas Object(E4 John) the database may not contain a complete record of NewRank(E4 lecturer) all the events that occurred in the world. The Time(E4 SJanuary) second difference is that for a belief period to be Revises(E4 E3) terminated by a transaction, it must have been started earlier by another transaction. Otherwise, Since all the information, old and new, is now it means that there is an event in the database in the database, it should be possible to which is believed to be true but there is no reason that after 3 January and before 8 January transaction which is responsible for entering the it was believed that John was hired as lecturer on event in the database - a contradiction. However, 1 January. After 8 January, however, it is the database might be informed of an event believed that John was hired as a lecturer on 5 signalling the end of a valid time period without January. If the information regarding the event any prior information regarding its beginning as E4 is not revised by any subsequent transactions, emphasized in the Event Calculus. For these we continue to believe that John was hired as a reasons, it is sufficient to consider belief periods lecturer on 5 January. Note that this belief will in the forward direction alone (i.e. into the not be affected by normal updates, such as, John future). Therefore rule A2 is redundant. getting promoted to the rank of professor at a later date. The rule Al is not valid for all cases as is illustrated by the following example: Thus, as a result of transaction TR2, the belief period in which it is believed that John was hired Examde 2 as a lecturer on 1 January was terminated. TR2 involves the revision of information given by Same as Example 1 except for the transaction another event. We now proceed to formalize the which are as follows: reasoning involved in deducing belief periods. Time(TR1 lOJanuary) Since each transaction may start and/or terminate Time(TR2 8January). more than one belief period, we use a notation similar to that of the Event Calculus to identify In other words, information regarding event E3 belief periods. The term after(tr e) denotes a is entered into the database on 10 January even time period started by the transaction tr in which though it is known that event E4 revises event the information regarding the event e is believed E3, and E4 is already in the database. Since it is to be true. The term before(tr e) has a similar known on 10 January that E4 revises E3, the meaning. The predicate BHolds(e p) expresses information regarding E3 is not believed in at any the relationship that event e is believed to be true time for deducing relationships. in the period p. The above reasoning can be However, rule Al allows one to deduce that expressed by the following rules: BHolds(E3 after(TR2 E3)) is true. The rule Al therefore needs to be modified as follows:

177 BHolds(e after(tr e)) if Basis@ e) and NOT [ Revises(e’ e) and Basis@’ e’) and Mary was hired as a lecturer on 5 April, tr’ I tr ] TIT 1985(event El). This data was entered into a database on 7 April, 1985(transaction TRl). Again, the information regarding an event e is Mary was then promoted to the rank of a believed to be true at transaction time t if t is a professor on 12 November, 1987 with effect time instant within the belief period of e. This is from 1 October, 1987(event E2). This given by the following rules: information was entered into the databaseon 15 November, 1987(transactionTR2). BHoldsAt(e t) if BHolds(e after& e)) and t within after@ e) TI2 The relations of interest that are added to the databaseas a result of thesetwo transactionsare t within p if BStart@ tr’) and BEnd(p tr”) and Basis(TR1 El) Time(tr’ t’) and Time(TR1 7April1985) Time(tr” t”) and %ne&5A~rill985) t’ c t and t c t” Basis(TR2 E2) Time(TR2 15November1987) The predicates BStart and BEnd denote the start Act(E2 promote) and end of a belief period respectively and are Time(E2 lOctober1987) analogous to the Start and End predicates of section 2.In the casewhere a belief period is not Notice that there is no need for the revision of terminated by any transaction, it extends into any past event. The time 12November1987 and requiresthe following axiom: comes under the category of user-defined time which does not contribute to the reasoning t within p if BStart@ tr’) and involved. It could just be assertedlike any other Time(tr’ t’) and non-temporal information. t’c t and NOT BEnd@ tr”) ‘IT4 Axioms TI’l-TI’6 then imply that the following are true: The startsand endsof belief periods are given by the axioms ITS and TT6. It can be argued that BHolds(E I after(TR 1 E 1)) these definitions of BStart and BEnd are BHolds(E2 after(TR2 E2)) complete. BStart(after(TR1 El) TRl) (Thereforewe believe in event E 1 from 7 April onwards} BStart(after(tr e) tr) IT5 BStart(after(TR2 E2) TR2) {Therefore we believe in event E2 from 15 November onwards) BEnd( after(tr e) tr’) if Basis&’ e’) and Revises(e’ e) ‘IT6 Hence, after 15 November we believe in the occurrence of both the events El and E2. This situation is analogousto the one shown in Fig 4. . ve & retroactive. lar>dates. . The use of Event Calculus axioms on the event descriptionsEl and E2 then allow us to conclude Both proactive and retroactive updates are that: handled symmetrically. All that needsto be done Mary was hired as a lecturer on 5 April 1985, to record suchan updateis to enter information in Mary was promoted to the rank of professoron 1 the form of new events in the usual way and October 1987, and assertrelationships regarding the revision of Mary was a professor on 2 October 1987. eventspreviously entered, if any. The following However, on 14 November 1987, the belief examplemakes the procedureclear: period after(TR2 E2) has not started yet.

178 Therefore, there is only one event El in which OldRank(E4 lecturer) the database believes. The axioms of the Event NewRank(E4 professor) Calculus applied to the event El alone would Time(E4 May1985) allow us to conclude that: Revise@4 E2) Mary was hired as a lecturer on 5 April 1985 and Revises(E4 E3) Mary was a lecturer on 2 October 1987 (axiom EC13). Belief periods and the relationships that hold are This is how the inferences that follow from any then deduced using the axioms TTl-IT6 and state of the database are deduced. ECl-EC16 as explained in Example 3.

We now give another example wherein the need for a revision of some of the events arises in a (5) Modification of the Event Calculus proactive/retroactive update. Explanatory comments are enclosed in ( ). Since the belief in an event and the corresponding inferences may change with time, the belief that a Example 4 relationship r holds in the period after(e r) is valid only when the time at which that belief is Mary was hired as a lecturer in April 1985(event held is specified. In the case of databases, this El ,transaction TR 1) (simple update). A decision time will be along the transaction time axis. was taken in June 1985 to promote Mary to the Therefore, it is necessary to augment the Holds rank of assistant professor for a period of 2 years predicate with an additional parameter starting from August 1985 (event E2, representing the transaction time. This is also true transaction TR2) and then to promote her to the of all the other predicates of the Event Calculus. rank of professor at the end of that period(event The set of augmented predicates and their E3, transaction TR2) (proactive updates}. Mary definitions are as follows : turned out to be extremely brilliant and was therefore promoted to the rank of professor in The axiom EC1 yields two new rules in the October 1985 with effect from May context of a temporal database. One rule is 1985(event E4, transaction TR3)( a retroactive required for inferring that a valid time period update affecting earlier proactive updates, some before(e r) was believed to exist for a of which have already taken effect]. transaction time period p (rule TDl). A second rule is required for inferring that a valid time The relations of interest that are added to the period before(e r) was believed to exist at a database as a result of these three transactions are transaction time z (rule TD2). Basis(TR1 El) Time(TR1 Apri11985) Act(E1 hire) PHolds(before(e r) p) if Terminates(e r) and NewRank(E1 lecturer) TDl Time(E1 April 1985) BHolds(e p) Basis(TR2 E2) Basis(TR2 E3) The predicate PHolds(before(e r) p) means that Time(TR2 June 1985) there is a belief period(transaction time period) p Act(E2 promote) in which it is believed that the relationship r holds OldRank(E2 lecturer) in the valid time period before(e r). NewRank(E2 assistantProfessor) Time(E2 August1985) PHoldsAt(before(e r) 2) if Act(E3 promote) PHolds(before(e r) P) and OldRank(E3 assistantProfessor) z within p TD2 NewRank(E3 professor) Time(E3 August1987) Basis(TR3 E4) Time(TR3 October1985) Alternatively, this could be reformulated as Act(E4 promote)

179 PHoldsAt(before(e r) 2) if TD9). Note that an event E5 may be enteredat a Terminates(e r) and later time making the above conclusion incorrect in the new state of the database.Thus the rule BHoldsAt(e 2) EC7 is modified as The predicate PHoldsAt(before(e r) 2) means after(e r) =z before(e’ r) if that the relationship r holds for the time period before(e r) according to the state of the database PHoldsAt(after(e r) 2) and attimez. PHoldsAt(before(e’ r) 2) and e c e’ and Similarly, the axiom EC2 of the Event Calculus NOT Broken(e r e’ 2) TD9 yields

PHolds(after(e r) p) if The predicate Broken takes in an additional term Initiates(e r) and to allow for the effect of events such as E5 BHolds(e p) TD3 mentioned above. Note that the ordering relation on events, <, is not subject to change with time PHoldsAt(after(e r) 2) if since changes are affected only by asserting a PHolds(after(e r) p) and new event along with an appropriate Revises z within p relation. The exclusivity relation is also invariant in time. The axioms for Start and End also need to be modified. In the general case,inferring the Start Broken(e r e’ z) if and End of a time period involves default PHoldsAt(after(e* r*) 2) and reasoning and therefore depends upon the Exclusive(r r*) and amount of information that is present in the e < e* and databaseat that time 2. (The casewhere the Start e* c e’ TDlO and End of a valid time period are inferred to hold over a transaction time period is more involved and is not considered in this paper Broken(e r e’ 2) if becauseof limitations of .) PHoldsAt(before(e* r*) 2) and Axioms EC3 to EC6 are modified to TD5 - TD8 Exclusive(r r*) and e c e* and e* c e’ TDll Start(after(e r) e 2) TDS End(before(e r) e 2)

Start(before(e’ r) e z) if The rest of the rules for deducing the Start and End are obtained by modifying EClO-EC12 as after(e r) =z before(e’ r) shown below: End(after(e r) e’ 2) if after(e r) =z before(e’ r) TD8 [ Start(before(e’ r’) init(before(e’ r’)) 2) and In the example of Fig 1, the conclusion that the e s init(before(e’ r’))] if valid time periods PHoldsAt(before(e r) z ) and after(E1 possesses(MaryBook)) and before(E2 possesses(MaryBook)) are identical is PHoldsAt(before(e’ r’) z ) and correct only if the database at time z does not Exclusive(r r’) and contain any information to the contrary (this is e < e’ and taken care of by the use of negation as failure in NOT Broken(e r’ e’ z ) TD12

180 [ End(after(e r) fin(after(e r)) z ) t in p at z if Start(p e’ 2) and and End(p e” 2) and fin(after(e r)) < e’ ] if Time(e’ t’) and PHoldsAt(after(e r) z ) and Time(e” t”) and PHoldsAt(after(e’ r’) z ) and t’ c t and Exclusive(r r’) and t < t” TD17 e < e’ and NOT Broken(e r e’ z ) TD13 t in p at z if Star@ e’ z) and Time(e’ t’) and t’ c t and [ Start(before(e’ r’) init(before(e’ r’)) z ) NOT End@ e” Z) TD18 and Fin(after(e r))a2d init(before(e’ r’)) TD18 is correct only for the special case in which the databasecontains a complete record of all relevantpast events. End(after(e r) fin(after(e r)) z ) ] if PHoldsAt(after(e r) z ) and The axioms TDl -TD 18 along with the axioms TTl-‘IT6 form a logical framework for treatment PHoldsAt(before(e’ r’) z ) and of time in temporal deductivedatabases. Exclusive(r r’) and NOT r =r’ and (6) Conclusions e < e’ and NOT Broken(e r e’ z ) TD14 We described a framework for representing and dealing with the concepts of valid time and transaction time in the context of temporal Again, the truth of the statement that a deductivedatabases. The formalization is done in relationship holds at point in time(valid time) is the Horn clause subset of first-order classical subject to the state of a database.In Example 1, logic augmented with negation as failure and is John was a lecturer on 2 January as per the executableas a logic program. database of 6 January but not as per that of 9 January. Therefore EC13-EC16 are to be We have restricted our attention to ground unit modified as clauses as the relationships that are derivable from a description of events. However, the formalization may be extended for sentencesof HoldsAt(r t 2) if fmt-order logic. When extended thus, the sytem PHoldsAt(after(e r) 2) and will be capable of reasoning with rules that are t in after(e r) at z TD15 effective only for certain periods of time and then generatethe corresponding inferences. Domains suchas legislation require such a capability. HoldsAt(r t 2) if PHoldsAt(before(e r) 2) and The framework is capable of handling both proactive and retroactive updatessymmetrically. t in before(e r) at Z TD16 Historical and rollback databases may be obtained as special cases. Since the Start and End of time periods are subject to change with transaction time, that a Acknowledgements point in valid time is in the period before(e r) or after(e r) is meaningful only when the state of I would like to thank Robert Kowalski, Marek the database(transactiontime) is specified. Thus Sergot, Fariba Sadri and Murray Shanahanfor we have many helpful discussions.I am grateful to Fariba Sadri for many useful comments on an earler

181 draft of this paper. Special thanks to Cheryl [12]Martin, N. Navathe, S. & Ahmed, R. Andersonfor her help in typesetting the paper. Dealing with Temporal Schema Anomolies in History Databases in Proceedings of the The research is sponsored by the Jawaharlal thirteenth international conferenceon Very Large Nehru Memorial Trust(UK). The work is also Data Bases,Brighton, 1987, pp.177-184 supportedby an ORS(UK) award. [ 13]McKenzie, E. Bibliography: Temporal References Databases. ACM SIGMOD Record, Vol. 15, No. 4, December 1986 [l]Allen, J. F. Maintaining Knowledge about Temporal Intervals. CACM, November 1983, [14]Sadri, F. Three recent approaches to Vol. 26, No. 11, pp.832-843 temporal reasoning.Research Report DoC 86/23, Revised November, 1986, Department of [2]Ariav, G. Clifford, J. & Jarke, M. Panel on Computing, Imperial College, London Time and Databases. ACM SIGMOD Record, Vol. 13, No. 4, Sanjose, 1983 [lS]Sergot, M.J. Sadri, F. Kowalski, R.A. Kriwaczek, F. Hammond, P. & Cory, H.T. The [3]Clark, K.L. Negation as Failure, in Logic and British Nationality Act as a Logic Program. Databases,Eds. Gallaire, H. Minker, J. Plenum CACM, Vol. 29, No. 5, May 1986, pp. 370-386 Press,NY 1978 [16]Snodgrass, R. & Ahn, I. A Taxonomy of [4]Clifford, J. & Warren, D. S. Formal time in databases, in Proceedings of ACM Semantics for Time in Databases. ACM SIGMOD International Conference on Transactionson DatabaseSystems, Vo1.8, No.2, Management of Data, Ed. S. Navathe. 1983 Association for Computing Machinery. Austin, Texas, May 1985, pp. 236-246 [SIDean, T. L. & McDermott, D. V. Temporal Data BaseManagement. Artificial Intelligence 32, [ 17]Snodgrass, R. & Ahn, I. Temporal No.1 (1987), pp. l-55 Databases. IEEE Computer, 19, No.9, Sep. 1986, pp. 35-42 [6]Gallaire, H. Minker, J. & Nicolas J. M. Logic and Databases: A Deductive Approach. [ 18]Snodgrass, R. (Ed.) Research Concerning Computing Surveys, June 1984, pp. 153-185 Time in DatabasesProject Summaries.SIGMOD Record, Vol. 15, No. 4, December 1986 [7]KowaIski, R. A. Logic for Problem Solving. Elsevier North Holland. 1979 [ 19]Snodgrass, R. The Temporal Query LanguageTQuel. ACM Transactionson Database [8]Kowalski, R.A. & Sergot, M.J. A Logic- Systems, Vo1.12, No.2, June 1987, pp.247-298 based Calculus of Events. New Generation Computing, 4, No. 1 (1986), pp. 67-95 [20]Stonebraker, M. Wong, E. & Kreps, P. The Design and Implementation of INGRES. ACM [9]Kowalski, R.A. Databaseupdates in the Event Transactionson DatabaseSystems, Vol.1, No.3, Calculus. Research Report DoC 86/12, September 1976, pp. 189-222 Department of Computing, Imperial College, London [21] Stonebraker, M. The Design of the POSTGRES Storage System in Proceedings of [lO]Lee, R. M. Coelho, H. & Cotta, J. C. the thirteenth international conference on Very Temporal Inferencing on Administrative Large Data Bases,Brighton, 1987, pp.289-300 Databases. Information Systems, Vol. 10, No. 2, pp. 197-206 [l l]Lloyd, J. W. Foundations of Logic Programming. Springer Verlag. 1984

182