From: AAAI Technical Report WS-00-08. Compilation copyright © 2000, AAAI (www.aaai.org). All rights reserved. Extending the Event Calculus with Temporal Granularity Indeterminacy * and Luca Chittaro and Carlo Combi Department of Mathematics and Computer Science University of Udine via delle Scienze 206, 33100 Udine, Italy {chittaro, combi)@dimi.uniud.it has to reason about events and change in this domain must have the capability of representing and reasoning with data at different time scales and with indeterminacy. The two well-known formalisms for reasoning about actions, events and change, i.e. the Situation Calculus (McCarthy & Hayes 1986) and the Event Calculus (EC) (Kowalski & Sergot 1986), do not provide mechanisms for handling temporal indeterminacy and granularity, and very little research has been devoted to the goal of extending them with different granularities. In this paper, we provide an overview of a novel approach (TGIC, Temporal Granularity and Indeterminacy event Calculus) to represent events with imprecise location and to deal with different timelines, using the EC ontology. Wethen contrast TGIC with the wellknownapproach to the handling of granularity in ECby Montanari et al. (Montanari et al. 1992). Additional aspects of TGICare discussed elsewhere: a formalization of the presented concepts is provided in (Chittaro & Combi 1998), while a polynomial algorithm for implementing the reasoning activity of TGICis described in (Chittaro & Combi 1999). This paper is organized as follows: first, we briefly describe the ontology of EC, and we provide two motivating examples taken from our clinical domain; then we discuss the proposed representation of temporal information in TGIC, and the issues that have to be taken into account by the reasoning activity. A detailed analysis of a previous work extending ECto deal with granularities, and some concluding remarks end the paper. Abstract In manyreal-world applications, temporal information is often imprecise about the temporal location of events (indeterminacy) and comesat different granularities. Formalisms for reasoning about events and change, such as the Event Calculus (EC) and the Situation Calculus, do not usually provide mechanismsfor handling such data, and very little research has been devoted to the goal of extending themwith these capabilities. In this paper, we propose TGIC(Temporal Granularity and Indeterminacy event Calculus), an approach to represent events with imprecise location and to deal with them on different timelines, based on the EContology. Introduction In manyreal-world applications, temporal information is often imprecise about the temporal location of events (indeterminacy) and comes at different granularities (Dyreson & Snodgrass 1995). Temporal granularity and indeterminacy are thus emerging as crucial requirements for the advancement of intelligent information systems which have to store, manage, and reason about temporal data. Consider, for example, these events taken from the application - a temporal database for cardiological patients - we are considering in our research (Combi & Chittaro 1999): "between 2 p.m. and 4 p.m. on May 5, 1996, the patient suffered from a myocardial infarction", "he started the therapy with thrombolytics in July 1995", "on October 12, 1996, he had a follow-up visit". The three events happened at the hours, months, and days timelines, respectively. Moreover, the first event cannot be precisely located on its timeline. A temporal reasoning system which The Ontology of EC The notions of event, property, timepoint and time interval are the primitives of the EC ontology: events happen at timepoints and initiate and/or terminate time intervals over which some property holds. Properties are assumed to persist until the occurrence of an event interrupts them (default persistence). An event occurrence can be represented by associating the event to the timepoint at which it occurred, e.g. by means of the clause: *This workhas been partially supported by contributions from: MURSTItalian National Project COFIN’98 "An Agent-BasedArchitecture to Support Cooperative Workin Medicine", and the Department of Mathematics and Computer Science of the University of Udine. Copyright © 2000, AmericanAssociation for Artificial Intelligence (www.aaai.org).All rights reserved. 53 happens(event,timePoint) and terminates at 10:28 on October 11, 1998. Case B. On the same day (May 3, 1998), angina0nset happened at 9, and a normPar happened at 12. Moreover, a saD is reported with an indeterminacy of ten seconds: it happened between 11:59:55 and 12:00:05. This case is illustrated in Figure lb. Considering for example the hours timeline, a temporal reasoning system should be able to conclude that the property holds necessarily between 9 and 12 hours. Being unknownthe relative order of occurrence for saD and normPar, the property could also possibly hold after the saD event if the actual occurrence of saD is after normPar. While the first conclusion is certain, the second one is hypothetical. In this paper, we deal with determining necessary conclusions: this is the perspective adopted in the following sections. ECderives the maximal validity intervals (MVIs) over which properties hold. A MVIis maximal in the sense that it cannot be properly contained in any other validity interval. MVIsfor a property p are obtained in response to the query: mholds~or(p,MVI) A property has not to be valid at both endpoints of a MVI: in the following, we thus adopt the convention that time intervals are closed to the left and open to the right. Motivating Examples Representing In this section, we present two simple clinical examples concerning patients with cardiological pathologies. In particular, the examples are related to the problem of diagnosing and following up heart failure (ACC/AHA Task Force 1995). Weconcentrate here on a small fragment of expert knowledge concerning the evaluation of the property hfRisk, i.e. the presence of an heart failure risk whichrequires special surveillance by clinicians in a considered cardiological patient. Amongvarious factors, this property can be initiated by four different events: (i) smDeltaBP: a measurement of systolic and diastolic blood pressure (BP) on the patient reveals abnormal difference (too small) between the two values; (ii) saD: sudden appearance of dyspnea is detected; (iii) angina0nset: the patient starts to experience chest pain; and (iv) ~,m~esia0nset: the patient starts to experience loss of memory. The smDeltaBP event is acquired from a physiological measurement, saD from a monitoring device, while the other two events are acquired from symptoms reported by the patient. Examples of events terminating the property are a measurement of relevant physiological parameters (blood pressure, heart rate, ECGparameters) with normal values (normPar), or the administration of a specific cardiological drug (cardioDrug). Occurrences of all these events can be given at different calendric granularities (days, hours, minutes, or even seconds with some intensive care devices) and with indeterminacy, depending on what the patient remembers of the symptoms, and what is the accuracy in recording data related to therapies or to physiological measurements. Case A. An amnesia0nset happened on October 10, 1998, a smDeltaBP happened at 11:30 on October 10, 1998, and a normPar happened at 10:28 on October 11, 1998. This case is illustrated in Figure la. Considering for example the minutes timeline, a temporal reasoning system should provide a single MVIthat initiates between 0:00 and 11:30 on October 10 (indeed, after 11.30 we are sure that at least one of the two initiating events - amnesia0nset and smDeltaBP - actually happened), 54 events and MVIs In TGIC, we allow the assignment of an arbitrary interval of time (at the chosen level of granularity) to event occurrence. This interval specifies the time span over which it is certain that the (imprecise) timepoint is located. Moreformally, indeterminacy is represented by generalizing the second argument of happens. We use the clause: happens(event, I01) where IOI(Interval Of Indeterminacy) is a convex interval over which event happened, and is assumed to be closed to the left and open to the right (according to the adopted time interval convention). For example: happens(e, [tl ,t2] states that the occurrence time of event e is greater or equal than tl and lower than t2. TGIC adopts the standard calendric granularities (years, months, days, hours, ...), with the associated mappings among timelines. More generally, it allows one to use any set of granularities where mappingcontiguous timepoints from a given granularity to the finest one results in contiguous intervals. Special granularities such as business days or business months (Bettini et al. 1998), which do not meet the general requirement above, are thus not considered. Weextend the definition of MVIto accommodate the more general concept of event. A MVIhas the form: (Start, End) where Start (End) denotes at a given granularity either a specific timepoint, if it is known,or the minimalinterval over which the initiation (termination) of the property is necessarily located, in the case of indeterminacy. .....,~, amnesiaOnset anginaOnset D. DAYS 98Oct10 ¯ x 98Ma)03 98MayQ3 ¯ /smDeltaBP’, normPar ¯ : ’ o- -- D. MINUTES llh30mof 10h28m of 98Oct10 98Octl 1 normPar ~"" -- "P"HOURS 9h~0f ...... 12jh’laf ..... ¯ ~ sdD ----’P" SECONDS [11h59m55s, 12h00m05s] of 98May3 (a) Figure 1: Case A (a), Case B (b). If Start (End) is a precise instant, it is trivially the left (right) endpoint of the delimited MVI; if Start (End) is itself an interval, then the left (right) endpoint the delimited MVIis the right (left) endpoint of Start (End). Therefore, a Start (End) determines (i) the imal interval over which the initiation (termination) a property is necessarily located, and (ii) the timepoint at which the property initiates (terminates) to be necessarily valid. For example, suppose to have only two events in the database: i. the (possibly imprecise) occurrence times of events are mappedto the finest granularity level; ii. an algorithm which handles partially ordered events is applied only at the finest level to derive necessary MVIs; iii. the obtained results are mapped at the upper granularity levels required by the user. Mapping to the finest granularity happens(el,940ctlO) happens(e2, TGIC provides a granularity mapping function to map times between any pair of calendric granularities. This is simply achieved by applying standard mappings among calendric units: for example, hour k is mapped into the interval of minutes [k ¯ 60, (k + 1) ¯ 60]. These mappingsare used both for the first and the third step of MVIderivation. [12h of 94DeclO, 14h of 94DeclO]) and el initiates property p, while e2 terminates p. In this case, we knowthat the initiation of the property is necessarily located at 940ct10 and the termination is located over the interval: [12h of 94DeclO,14h of 94DeclO] Werepresent this knowledge, by saying that (940ct 10, [12hof94DeclO, 14hof94DeclO]) is a MVIfor property p. Therefore, property p is necessarily valid after 940ct10 and until 12h of 94Dec10. For conciseness, when an event e initiates (terminates) property p, we refer to the associated IOI as an initiating (terminating) IOI for In the case of the first step, the function is used to map the occurrence time of each event to the finest granularity (in our case, the granularity of seconds). For example, the predicate: happens(smDeltaBP, llh30m of 980cti0) of Case A is mapped into the predicate: Deriving Maximal Validity Intervals happens(smDeltaBP, [llh3OmOOs of 980ct10, llh31mOOs of 980ct10]) The relative ordering of a set of events with imprecise occurrence times and/or different granularities can be often only partially known(e.g., in Case B, it is not knownif saD happens before, simultaneously, or after normPar). Since we are concerned with deriving necessary MVIs, every MVIwe derive must be valid in all possible orders consistent with the partial order (Dean & Boddy 1988), resulting from imprecise locations of event occurrences. The approach we propose to derive MVIsis organized in three general steps: Handling partially ordered events Wedistinguish the three possible kinds of intersection amongIOIs the algorithm has to deal with: intersection among initiating IOIs, among terminating IOIs, and amongboth types of IOIs. Hereinafter, we refer to these three different situations, as I_ALONE,T_ALONE, and I_T_INTERSECT,respectively. 55 hfRisk h fRisk i i i i ! | o tl i o o | | , i i ’ , ’ [ t2 t3 t4 15 ca i t6 | smDeltaBP [cardioDrug I i n P normPar an~inaOnset ] o o i o I i i ," lsmDeltaBP ! ru , i ! t8 t9 tlOtll o i io i t12 ¯ tl Figure 2: Examples of I_ALONEand T_ALONE. a n t2 t3 t4 o ’ oo oo oo oo oo t5 t6 t7 t8 InormPar I t9tlO tll t12 Figure 3: Three examples of I_T_INTERSECT. Intersection among initiating IOIs. Let us consider some initiating IOIs for a property p, such that their intersection is non empty, and there are no intersections with terminating IOIs for p (I_ALONEsituation). Let us assume that there are no preceding events, which have already initiated p, so that it is important to derive one single IOI to use as a Starz in a MVI. The solution to the problem is given by the interval whose left and right endpoints are the minimumleft and right endpoints, respectively, of the given IOIs. Indeed, property p cannot initiate before the minimumleft endpoint because there are no other preceding events whichinitiate it, but it necessarily initiates after or at the minimumleft endpoint, and before the minimumright endpoint. The latter delimits the interval of necessary validity for property p, because at least one initiating event happensbefore it, and there is no lower time that guarantees the same. For example, take the three initiating IOIs (anginaOnset, saD, smDeltaBP) for property hfRisk in Figure 2. In this case, in each of the three intervals [t 1,tS], [t2,t3], and [t4,t6], an initiating event happened. The derived Start is thus [tl ,t3] : the initiation of hfR£akis necessarily located over [tl ,t3]. event can happen after or at that point. For example, considering the three terminating IOIs (normPar and the two card£oDrug) for property hfRisk in Figure 2, the derived End is [tT,t9], and ([tl,t3], [tT,t9]) is a MVIfor hfRisk. Intersection among initiating and terminating IOIs. When an initiating and a terminating IOI for the same property have a non empty intersection (I_T_INTERSECT situation), it is impossible to establish in what order the corresponding initiating and terminating events happened. As a consequence, it is not possible to conclude anything about the necessary effects of the initiating IOI (a Start could be derived only if we knew that the initiating event happened after the terminating one), while terminating IOIs maintain their capability of being used in an End with respect to previous Starts. For example, if in Figure 3 we considered only the three pairs of intersecting IOIs, nothing could be concluded about the necessary validity of h:fR±sk: there would be no derivable MVIwhich is valid in all possible orders of the six indeterminate events. Considering all the (seven) IOIs in the database, the first IOI is a Start for hfRisk, and the first terminating IOI is an End. These two IOIs delimit the only necessary MVI in the database. Intersection among terminating IOIs. Let us consider some terminating IOIs for a property p, such that their intersection is non empty, and there are no intersections with initiating IOIs for p (T_ALONE situation). Let us assume that p has been initiated by preceding events and no preceding events can terminate it, so that it is important to derive one single IOI to use as an End in a MVI. The solution to the problem is again given by the interval whose left and right endpoints are the minimumleft and right endpoints, respectively, of the given IOIs. Indeed, property p cannot terminate before the minimumleft endpoint because there are no other preceding events which can terminate it, but it necessarily terminates after or at the minimumleft endpoint, and before the minimumright endpoint (when the minimumright endpoint is reached, it is certain that at least one terminating event has occurred). The necessity of the validity for property p thus terminates at the minimumleft endpoint, because a terminating If an I_T_INTERSECT occurs when the property does not hold, it is possible (but not necessary) that the property initiates to hold. In these cases, the intersecting IOIs do not allow one to generate a Start, but they have to be considered in relation to a possible subsequent I_ALONE situation. For example, consider the events smDeltaBP and cardioDrug in Figure 4a: sincetherelative ordering between theiroccurrences is unknown, theyjustallowoneto conclude thatthe propertyhfRiskmighthavebeeninitiated. Consideringalsothesubsequent eventsaD,we can conclude thatproperty hfRisk is necessarily validaftert5,becausesaD hasno intersection withterminating IOIs (I_ALONE situation), butto determine theminimal intervalforStart,we haveto consider alsosmDeltaBP andcardioDrug. The initiating eventfor hfRiskcan be bothsmDeltaBP and saD.The IOI of saD willbe- 56 h fRisk ! I smoel BpI ism e/,aI ! I I lO t ru ’1"7~ t Pea g! ’ ! I t I I tl t2 P ~ I t i i _~diI o D~u ~ ’ ,,I I ! , t I t3 t4 t5 I OO I I tl t2 t3 t4 t5 %. Ext r % Ext r (b) (a) Figure 4: Example of convex (a) and non-convex (b) Start. long completely to Start, while only a part of IOI of smDeltaBP will be included in Start, because when smDeltaBPis the initiating event for the necessary instance of hfRisk, it is impossible for the occurrence of smDeltaBP to be located before the IOI of cardioDrug (the instance of hfRisk initiated by smDeltaBP would be terminated by cardioDrug). Therefore, the Start for hfRisk is given by IOI [tl,t5]: the initiation for the property is necessarily located in that interval. In general, we call Ext the part of Start, which is produced by considering the I_T_INTERSECTsituation preceding the I_ALONE one. The Ext interval in Figure 4a is [tl,t4]. In the general case, a Start needs not to be necessarily convex. This is exemplified in Figure 4b, where, as in the situation of Figure 4a, we can conclude that property hfRisk is necessarily valid after t5, and then we have to similarly consider smDeltaBP and cardioDrug to determine Start. Unlike the case of Figure 4a, smDeltaBPand saD currently do not overlap. Therefore, the Start for hfRisk is given by a non convex IOI which comprises [tl,t3] and [t4,tS] : property hfRisk is necessarily valid after t5, and it has been necessarily initiated over the non convex interval [[tl,t3], [t4,t5]], which is the union of [tl,t3] (the Ext interval, obtained from I_T_INTERSECT) and [t4,t5] (the interval obtained from I_ALONE). erty hfRisk at the finest level of granularity. The MVI returned by the query mholds_2or(hfRisk, MVI, minutes) is ([00h00m of 980ct10, llh31m of 980ct10], 10h28m of 980ct11) The query: mholds_~or(hfRisk, MVI, days) returns the MVI <980ct10, 980ct11) as solution. Finally, TGIC provides the predicate: msg_mholds_2or(p, (Start ,End)) which tries to automatically choose the most suitable granularity level for Start and End. The most suitable granularity for a Start (End) of an MVIis chosen as follows: starting from the Start (End) derived at the finest level, we moveto the coarser levels by using granularity mappingpredicates, stopping at the first level where the Start (End) reduces to a time point. For example, for Case A, the query: msg_mholds_for(hfRisk, MVI) returns the MVI (980ct10, 10h28m of 980ct11) as solution. Considering Case B, the latter query returns: (09h of 98May03,12h of 98May03) Related Work To the best of our knowledge, the only other approach to deal with temporal granularity in EC has been proposed by Montanari et al. and is described in (Montanari et al. 1992): hereinafter, we refer to this approach as MMCR (the initials of its authors’ surnames). MMCR introduces temporal granularity in EC by operating the following extensions. Answering queries at multiple granularities TGIC extends the query predicate mholds_for, to allow one to perform queries at different levels of granularity. The predicate: mholds_for(p,IStart, End), granlev) returns the MVIs for property p the granularity granlev. For example, in Case A (Figure la), TGIC derives the MVI: ([00h00m00s of 980ct10, llh31m00s of 980ct10], [10h28m00s of 980ct11, 10h29m00s of 980ct11]) for the prop- Multiple timelines. The single EC timeline is extended into a totally ordered set of different timelines {T1, ¯ ¯ ¯ , Tn}, such that each timeline Ti is of finer granularity than the previous timeline Ti-1. For example, one could have three timelines corresponding to hours, minutes, and seconds, respectively. In general, 57 the finest timeline is possibly allowed to be continuous, while the other ones must necessarily be discrete. is inevitably plagued by a scarce performance, due to a generate-and-test strategy which considers any possible pair of events as a possible candidate for deriving an MVI. This problem is exacerbated in MMCR,because each event has also a counterpart on each of the timelines. Granularity mapping predicates. New predicates (fine_grain_of, coarse_grain_of) are introduced into the formalism in order to map the occurrence of events from one timeline to the other ones. For example, an event that happened at 2 hrs is mapped at the finer granularity of minutes into the time interval [120 min, 179 min]; an event that happened at 170 min is mapped at the coarser granularity of hours into the time point 2 hrs. To highlight differences between TGICand MMCR, let us consider how MMCR would manage the two examples we previously provided. In Case A, MMCR returns three MVIsfor property hfRisk: (i) an MVIthat initiates at 11:30 on October 10, and terminates at 10:28 on October 11, 1998; (ii) an MVIthat initiates between 0:00 and 23:59 on October 10, and terminates at 10:28 on October 11, 1998; and (iii) an MVIthat initiates October 10 and terminates on October 11, 1998. Solution (i) is not satisfying, because the MVImight have possibly started before 11:30, due to the ~m-esiaOnset event, while solution (ii) is too vague, because it comprises also a large numberof time points following 11:30 as possible starting points for the MVI, although the property is certainly valid after 11:30. Instead of producing these two solutions, a temporal reasoning system should provide a single MVIthat initiates between 0:00 and 11:30 on October 10, and terminates at 10:28 on October 11, 1998. Solution (iii) is satisfying at the granularity of days. Reasoning strategy. Derivation of MVIs is extended in order to encompass the presence of events at multiple time scales. In particular, MMCR first mapsall the available events at all the different granularity levels, then it exploits the standard EC derivation of MVIson each of the levels in isolation. The possibility of having contradicting events happening at the same time point as a result of mapping events to coarser time scales is prohibited by means of explicit integrity constraints. Moreover, since the derivation mechanismexpects events to happen at time points, the two endpoints of intervals obtained by mapping the occurrence of an event e to a finer level of granularity are treated as two endpoints for an interval over which e has to occur (temporal indeterminacy). In Case B, MMCR is unable to handle the saD event, because it is not possible to have temporal indeterminacy unrelated to the mappings amonggranularity levels. But, even assuming that indeterminacy were handled in general, a second major problem would arise, i.e., the interval of indeterminacyfor the initiating event saD has a non empty intersection with the time of occurrence of the terminating event normPar. As previously discussed, MMCR rules out contradicting events which might possibly happen at the same time point. In this situation, a temporal reasoning system should be able to conclude that the property holds necessarily between 9 and 12 hours. We have tested MMCR on our clinical domain, and found a number of limitations which can be classified as follows. Completeness issues. MMCR is often not able to derive the expected MVIs, even for some simple cases. Situations affected by these problems typically involve the presence of intersecting intervals of indeterminacy for different events which have been mapped at finer granularities. MMCR is not able to deal with them properly, as we show below. Expressiveness issues. MMCR expects one to assign a precise time point on one of the timelines to the occurrence of an event. This is often not possible in real applications where the information available is not so precisely localizable on any available time scale. Events like "between 17:30 and 18:15 the patient had a myocardial infarction", or "between 10:23:05 and 10"23:15, a patient monitoring device detected dyspnea" cannot be handled by MMCR.Moreover, as a result of deriving MVIsin isolation on each timeline, MMCR is not able to return MVIswith starting and ending times given at different granularities. Conclusions As we have shown in the previous Section, the usefulness of the only other approach dealing with temporal granularity in EC (Montanari et al. 1992), is limited by three serious factors: (i) the possibility of having I_T_INTERSECT situations is prohibited by explicit integrity constraints (that approach is thus often unable to derive the expected MVIs, e.g. in the cases represented by Figures lb, 3, 4); (ii) the user can associate to an event only a single timepoint on a chosen timeline (indeterminacy is not allowed); and (iii) the implementation is given only in terms of a declarative logic program. Chittaro and Montanari have shown how declarative implementations of EChave significant per- Efilciency issues. The implementation of MMCR is given in terms of a declarative logic program. Chittaro and Montanari in (Chittaro & Montanari 1996) have shown how a declarative implementation of basic EC 58 formance limitations, due to a generate-and-test strategy (Chittaro ~: Montanari 1996). TGICovercomes all the above described limitations: it allows and handles I_T_INTERSECT situations; it allows the user to associate any interval of indeterminacy to any event; and an efficient procedural implementation has been provided in (Chittaro & Combi 1999). References ACC/AHATask Force. 1995. Heart Failure Guidelines, newblockJournal of American College of Cardiology 26:1376-1398. Bettini, C.; Wang, X.; and Jajodia, S. 1998. A general frameworkfor time granularity and its application to temporal reasoning. Annals of Mathematics and Artificial Intelligence, 22:29-58. Chittaro, L.; and Combi, C.; 1998. Temporal Indeterminacy in Deductive Databases: an Approach Based on the Event Calculus. In Active, Real-time and Temporal Database Systems (ARTDB-97), LNCS 1553, 212-227. Springer-Verlag. Chittaro, L.; and Combi, C.; 1999. Reasoning about Events with Imprecise Location and Multiple Granularities. In Proceedings of the lOth International Conference on Database and Expert Systems Applications (DEXA-99), LNCS1677, 1006-1017. Springer-Verlag. Chittaro, L.; and Montanari, A. 1996. Efficient temporal reasoning in the Cached Event Calculus. Computational Intelligence 12:359-382. Combi, C., and Chittaro, L. 1999. Abstraction on Clinical Data Sequences: an Object-Oriented Data Model and a Query Language Based on the Event Calculus. Artificial Intelligence in Medicine, 17:271-301. Dean, T.; and Boddy, M. 1988. Reasoning about Partially Ordered Events. Artificial Intelligence, 36:375399. Dyreson, C.E.; and Snodgrass, R.T. 1995. Temporal indeterminacy. In Snodgrass, R.T. (ed.), The TSQL2 temporal query language, 327-346. Kluwer Academic Publishers. Kowalski, R.; and Sergot, M. 1986. A logic-based calculus of events. NewGeneration Computing, 4:6795. McCarthy, J.; and Hayes, P. 1969. Somephilosophical problems from the standpoint of artificial intelligence. Machine Intelligence, 4:463-502. Montanari, A.; Maim, E.; Ciapessoni, E.; and Ratto, E. 1992. Dealing with Time Granularity in the Event Calculus. In Proc. 1992 Inter’nat. Conf. Fifth Generation Computer Systems (FGCS-92), 702-712. IOS Press. 59