<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">Towards A Simple Event Calculus for Run-Time Reasoning</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>
							<persName><forename type="first">Christos</forename><surname>Vlassopoulos</surname></persName>
							<affiliation key="aff0">
								<orgName type="department">Institute of Informatics and Telecommunications</orgName>
								<orgName type="institution">NCSR &quot;Demokritos&quot;</orgName>
								<address>
									<settlement>Athens</settlement>
									<country key="GR">Greece</country>
								</address>
							</affiliation>
							<affiliation key="aff1">
								<orgName type="department">Department of Informatics and Telecommunications</orgName>
								<orgName type="institution">National and Kapodistrian University of Athens</orgName>
								<address>
									<country key="GR">Greece</country>
								</address>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Alexander</forename><surname>Artikis</surname></persName>
							<affiliation key="aff0">
								<orgName type="department">Institute of Informatics and Telecommunications</orgName>
								<orgName type="institution">NCSR &quot;Demokritos&quot;</orgName>
								<address>
									<settlement>Athens</settlement>
									<country key="GR">Greece</country>
								</address>
							</affiliation>
							<affiliation key="aff2">
								<orgName type="department">Department of Maritime Studies</orgName>
								<orgName type="institution">University of Piraeus</orgName>
								<address>
									<country key="GR">Greece</country>
								</address>
							</affiliation>
						</author>
						<title level="a" type="main">Towards A Simple Event Calculus for Run-Time Reasoning</title>
					</analytic>
					<monogr>
						<imprint>
							<date/>
						</imprint>
					</monogr>
					<idno type="MD5">E6A22B6EC450429F4F553664D250E3C7</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-23T20:59+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<abstract>
<div xmlns="http://www.tei-c.org/ns/1.0"><p>The Event Calculus for Run-Time reasoning (RTEC) is a logic programming implementation of the Event Calculus, designed to compute continuous narrative assimilation queries on data streams. RTEC has been used for complex event recognition in various applications domains, such as maritime monitoring, city transport management and human activity recognition. The construction of the complex event definitions has proven a time-consuming process, since it requires several interactions with domain experts (e.g. transport engineers). To address this issue, we present a simple language for RTEC, with the aim of supporting people who are not familiar with the Event Calculus or (logic) programming. A compiler translates, in a process transparent to the user, a specification in the simple language to an RTEC event description that may be subsequently used for continuous query computation.</p></div>
			</abstract>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Introduction</head><p>Today's organisations need to act upon high-velocity data streams in order to capitalise on opportunities and detect threats. Towards this, event recognition systems have been particularly helpful, as they support the detection of 'complex events' (CE) of special significance, given streams of 'simple, derived events' (SDE) arriving from various types of sensor <ref type="bibr" target="#b1">(Artikis et al. 2012)</ref>. The 'definition' of a CE imposes temporal and, possibly, atemporal constraints on its subevents, i.e. SDEs or other CEs. In the maritime domain, for example, CE recognition systems have been used to make sense of position streams emitted from thousands of vessels, in order to detect, in real-time, suspicious and illegal activity that may have dire effects in the maritime ecosystem and passenger safety.</p><p>Several CE recognition frameworks have been proposed, supporting data streams by means of various optimisation techniques <ref type="bibr" target="#b4">(Cugola and Margara 2012;</ref><ref type="bibr" target="#b2">Bicocchi et al. 2014)</ref>. One such framework is the Event Calculus for Run-Time reasoning (RTEC), a logic programming implementation of the Event Calculus <ref type="bibr" target="#b4">(Kowalski and Sergot 1986)</ref>, designed to compute continuous narrative assimilation queries on data streams <ref type="bibr" target="#b2">(Artikis, Sergot, and Paliouras 2015)</ref>. RTEC includes novel implementation techniques for efficient CE recognition. A form of caching stores the results of subcomputations in the computer memory to avoid unnecessary re-computations. A set of interval manipulation constructs simplify CE definitions and improve reasoning efficiency. An indexing mechanism makes RTEC robust to SDEs that are irrelevant to the CEs we want to recognise and so RTEC can operate without SDE filtering modules. Finally, a 'windowing' mechanism supports real-time CE recognition.</p><p>RTEC has been used for CE recognition in various applications domains, including human activity recognition from video content, city transport management, and maritime monitoring <ref type="bibr" target="#b7">(Patroumpas et al. 2017)</ref>. The construction of CE definitions was performed manually, since annotated data were insufficient for employing machine learning techniques. This was a time-consuming process that required several interactions with domain experts. To address this issue, we have been developing a simpler language for RTEC, with the aim of supporting people who are not familiar with the Event Calculus or (logic) programming. A compiler translates, in a process transparent to the user, a specification in the simpler language to an RTEC event description that may be subsequently used for query computation.</p><p>The remainder of the paper is structured as follows. First, we present RTEC. Then, we discuss the simple language and illustrate its use through various examples. In the section that follows, we describe the functionality of the compiler that translates the statements of the simple language to RTEC. Subsequently, we present the empirical evaluation of our approach, and briefly discuss related and further work.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>RTEC</head><p>The Event Calculus for Run-Time reasoning (RTEC) is a logic programming implementation of the Event Calculus, designed to compute continuous narrative assimilation queries on data streams for complex event (CE) recognition. The time model is linear and includes integer time-points. Following Prolog, variables start with an upper-case letter, while predicates and constants start with a lower-case letter. Where F is a fluent-a property that is allowed to have different values at different points in time-the term F = V denotes that fluent F has value V . Boolean fluents are a special case in which the possible values are true and false. Informally, F = V holds at a particular time-point if F = V has been initiated by an event at some earlier time-point, and not terminated by another event in the meantime.</p><p>An event description in RTEC includes rules that define</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Predicate</head><p>Meaning</p><formula xml:id="formula_0">happensAt(E, T ) Event E occurs at time T holdsAt(F = V, T )</formula><p>The value of fluent F is V at time T holdsFor(F = V, I) I is the list of the maximal intervals for which F = V holds continuously initiatedAt(F = V, T )</p><p>At time T a period of time for which</p><formula xml:id="formula_1">F = V is initiated terminatedAt(F = V, T )</formula><p>At time T a period of time for which F = V is terminated union all(L, I )</p><p>I is the list of maximal intervals produced by the union of the lists of maximal intervals of list L intersect all(L, I )</p><p>I is the list of maximal intervals produced by the intersection of the lists of maximal intervals of list L relative complement all (I , L, I ) I is the list of maximal intervals produced by the relative complement of the list of maximal intervals I with respect to every list of maximal intervals of list L Table <ref type="table" target="#tab_0">1</ref>: Main predicates of RTEC.</p><p>the event instances with the use of the happensAt predicate, the effects of events with the use of the initiatedAt and terminatedAt predicates, and the values of the fluents with the use of the holdsAt and holdsFor predicates, as well as other, possibly atemporal, constraints. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Fluents</head><p>holdsFor(F = V, I) represents that I is the list of the maximal intervals for which fluent F has value V continuously. holdsAt(F = V, T ) represents that fluent F has value V at a particular time-point T . holdsAt and holdsFor are defined in such a way that, for any fluent F , holdsAt(F = V, T ) if and only if time-point T belongs to one of the maximal intervals of I for which holdsFor(F = V, I). Fluents in RTEC are of two kinds: simple and statically determined. We assume, without loss of generality, that these types are disjoint.</p><p>Simple fluents For a simple fluent F , F = V holds at a time-point T if F = V has been initiated by an event at some time-point earlier than T , and has not been terminated at some other time-point in the meantime. This is an implementation of the law of inertia. The time-points at which F = V is initiated are computed with the use of initiatedAt rules, which have the following form (terminatedAt are defined similarly):</p><formula xml:id="formula_2">initiatedAt(F = V, T ) :− happensAt(E, T ), conditions[T ]</formula><p>The conditions[T ] set includes further constraints on timepoint T , expressed as follows:</p><p>• a possibly empty set of happensAt predicates expressing constraints on the (non-)occurrence of events; • a possibly empty set of holdsAt predicates expressing constraints on fluents; and • a possibly empty set of atemporal constraints.</p><p>Consider the following example from human activity recognition on video content: initiatedAt(moving(P 1 , P 2 ) = true, T ) :− happensAt(start(walking(P 1 ) = true), T ), holdsAt(walking(P 2 ) = true, T ), holdsAt(close(P 1 , P 2 ) = true, T ). initiatedAt(moving(P 1 , P 2 ) = true, T ) :− happensAt(start(walking(P 2 ) = true), T ), holdsAt(walking(P 1 ) = true, T ), holdsAt(close(P 1 , P 2 ) = true, T ). initiatedAt(moving(P 1 , P 2 ) = true, T ) :− happensAt(start(close(P 1 , P 2 ) = true), T ), holdsAt(walking(P 1 ) = true, T ), holdsAt(walking(P 2 ) = true, T ). terminatedAt(moving(P 1 , P 2 ) = true, T ) :− happensAt(end(walking(P 1 ) = true), T ). terminatedAt(moving(P 1 , P 2 ) = true, T ) :− happensAt(end(walking(P 2 ) = true), T ). terminatedAt(moving(P 1 , P 2 ) = true, T ) :− happensAt(end(close(P 1 , P 2 ) = true), T ).</p><p>(1)</p><p>walking is a durative SDE detected on video frames. (Recall that SDEs are given as input to RTEC.</p><formula xml:id="formula_3">) start(F = V ) (resp. end(F = V )</formula><p>) is a built-in RTEC event taking place at each starting (ending) point of each maximal interval for which F = V holds continuously. close(A, B ) = true when the distance between tracked entities (people and/or objects) A and B does not exceed some threshold of pixel positions. The above formalisation states that P 1 is moving with P 2 when they are walking close to each other. Note that in this formulation of the Event Calculus, terminatedAt(F = V, T ) does not necessarily imply that</p><formula xml:id="formula_4">F = V at T . Similarly, initiatedAt(F = V, T ) does not nec- essarily imply that F = V at T . time I 1 I 2 (a) Union. time I 1 I 2 (b) Intersection. time I 1 I 2 (c) Relative Complement.</formula><p>Figure <ref type="figure">1</ref>: A visual illustration of the three interval manipulation constructs of RTEC. In this example, there are two input fluent streams, I 1 and I 2 . The output of each interval manipulation construct is colored light blue.</p><p>To compute holdsFor(moving(P 1 , P 2 ) = true, I), that is, to compute the maximal intervals for which moving(P 1 , P 2 ) = true holds continuously, we find all time-points T s at which moving(P 1 , P 2 ) = true is initiated, and then, for each T s , we compute the first time-point T e after T s at which moving(P 1 , P 2 ) = true is 'broken'. The time-points at which F = V is broken are computed as follows:</p><p>broken</p><formula xml:id="formula_5">(F = V, T s , T ) :− terminatedAt(F = V, T e ), T s &lt; T e ≤ T.</formula><p>(</p><formula xml:id="formula_6">) broken(F = V 1 , T s , T ) :− initiatedAt(F = V 2 , T e ), T s &lt; T e ≤ T, V 1 = V 2 .<label>2</label></formula><p>(3) <ref type="formula">3</ref>) ensures, therefore, that a fluent cannot have more than one value at any time. We do not insist that a fluent must have a value at every time-point. In RTEC there is a difference between initiating a Boolean fluent F = false and terminating F = true: the first implies, but is not implied by, the second. Consider another example, this time from city transport management. In this application domain, transport officials are interested in computing the maximal intervals for which passenger density in buses and trams is high. This may indicate low passenger satisfaction, among others. Consider the formalisation below: We call such a fluent F statically determined. holdsFor rules of this kind make use of interval manipulation constructssee the last three items of Table <ref type="table" target="#tab_0">1</ref>. Consider, e.g. moving as in rules (1) but defined instead as a statically determined fluent:</p><formula xml:id="formula_7">According to rule (3), if F = V 2 is initiated at T e then effec- tively F = V 1 is terminated at time T e , for all other possible values V 1 of F . Rule (</formula><p>holdsFor(moving(P 1 , P 2 ) = true, I ) :− holdsFor(walking(P 1 ) = true, I 1 ), holdsFor(walking(P 2 ) = true, I 2 ), holdsFor(close(P 1 , P 2 ) = true, I 3 ), intersect all([I 1 , I 2 , I 3 ], I ).</p><p>(5)</p><p>According to the above rule, the list I of maximal intervals during which P 1 is moving with P 2 is computed by determining the list I 1 of maximal intervals during which P 1 is walking, the list I 2 of maximal intervals during which P 2 is walking, the list I 3 of maximal intervals during which P 1 is close to P 2 , and then calculating the list I representing the intersections of the maximal intervals in I 1 , I 2 and I 3 . RTEC provides three interval manipulation constructs: union all, intersect all and relative complement all. These are illustrated in Figure <ref type="figure">1</ref>. The interval manipulation constructs of RTEC support the following type of definition: for all time-points T , F = V holds at T if and only if some Boolean combination of fluent-value pairs holds at T . For a wide range of fluents, this is a much more concise definition than the traditional style of Event Calculus representation, i.e. identifying the various conditions under which the fluent is initiated and terminated so that maximal intervals can then be computed using the domain-independent holdsFor. Compare, e.g. the statically determined and simple fluent representations of moving in rules ( <ref type="formula">5</ref>) and (1) respectively.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Semantics</head><p>CE definitions in RTEC are (locally) stratified logic programs (Przymusinski 1987). We restrict attention to hierarchical definitions, those where it is possible to define a function level that maps all fluent-values F = V and all events to the non-negative integers as follows. Events and statically determined fluent-values F = V of level 0 are those whose happensAt and holdsFor definitions do not depend on any other events or fluents. In CE recognition, they represent the input SDEs. There are no fluent-values F = V of simple fluents F in level 0. Events and simple fluent-values of level n are defined in terms of at least one event or fluent-value of level n−1 and a possibly empty set of events and fluentvalues from levels lower than n−1. Statically determined fluent-values of level n are defined in terms of at least one fluent-value of level n−1 and a possibly empty set of fluentvalues from levels lower than n−1. Note that fluent-values F = V i and F = V j for V i =V j could be mapped to different levels. For simplicity however, and without loss of generality, a fluent F itself is either simple or statically determined but not both.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A Simple Language</head><p>Addressing an event recognition problem in RTEC requires knowledge of Prolog, familiarisation with the Event Calculus in general, as well as understanding and memorisation of the syntactical details of RTEC in particular. In this section, we present a simple Event Calculus dialect with a highlevel notation, abstracting away from technical details. This simplified Event Calculus (SimplEC) aims at supporting domain experts, such as city transport engineers and maritime patrol officials, that are not familiar with (logic) programming. SimplEC is designed to resemble simple statements in English, with some pseudo-code and mathematical elements. It does not contain obscure symbols like :-, or \+. Instead, it contains simple words like if, or, not, as well as the comma operator that indicates conjunction. There are also a few special tokens, like initiate that stem from the Event Calculus. In what follows, we illustrate the use of SimplEC through a series of examples from three real-world applications. A full account of the SimplEC statements for all these applications, as well as the grammar of SimplEC, is available at the GitHub repository of RTEC.</p><p>Recall the formalisation of passenger density from city transport management-see rule (4). This may be expressed in SimplEC as follows: </p><p>'happensAt' may be omitted since the first condition of an initiate statement is always an event. Moreover, in the absence of long-term temporal relations, the variables expressing time-points may be omitted, and 'initiatedAt' may be simply written as initiate.</p><p>The definition of moving in human activity recognition, given by rule-set (1), may be written in SimplEC as follows: </p><p>In addition to 'happensAt', 'holdsAt' is also omitted from the above statements, since after the first condition, constraints on fluents are expected (recall that walking and close are fluents). If more constraints on events were required, then these would have to be prefixed by 'happens'. The value of true Boolean fluents can also be omitted. To make the above formalisation even more succinct, the last three statements may be replaced by the following one:</p><p>terminate moving(P 1 , P 2 ) iff end walking(P 1 ) or end walking(P 2 ) or end close(P 1 , P 2 ).</p><p>(8)</p><p>In datasets used for human activity recognition, there is no explicit information that a tracked entity is a person or an inanimate object. Therefore, in the activity definitions we try to deduce whether a tracked entity is a person or an object given, among others, the detected SDEs. We defined the fluent person(P ) to have value true if P has been walking, active, running or moving abruptly since P 'appeared', that is, since P was first tracked: initiate person(P ) iff (start walking(P ) or start active(P ) or start running(P ) or start abrupt(P )), not disappear (P ). terminate person(P ) iff disappear (P ).</p><p>The value of person(P ) is time-dependent because the identifier P of a tracked entity that 'disappears' (is no longer tracked) at some point may be used later to refer to another entity that 'appears' (becomes tracked), and that other entity may not necessarily be a person. Note that disappear is an event; however, we did not have to use the 'happens' prefix in the initiate statement. The compiler of SimplEC may deduce that disappear is an event since it is used as the first condition of the 'terminate' statement.</p><p>The compiled RTEC rules are the following:</p><p>initiatedAt(person(P ) = true, T ) :− happensAt(start(walking(P ) = true), T ), not happensAt(disappear (P ), T ). initiatedAt(person(P ) = true, T ) :− happensAt(start(active(P ) = true), T ), not happensAt(disappear (P ), T ). initiatedAt(person(P ) = true, T ) :− happensAt(start(running(P ) = true), T ), not happensAt(disappear (P ), T ). initiatedAt(person(P ) = true, T ) :− happensAt(start(abrupt (P ) = true), T ), not happensAt(disappear (P ), T ). terminatedAt(person(P ) = true, T ) :− happensAt(disappear (P ), T ).</p><p>(10)</p><p>In SimplEC, statically determined fluents are defined via statements that begin with the fluent itself. The body of the statement consists of a number of conjunctions, disjunctions, and negations of other fluents, expressing, respectively, the intersect all, union all and relative complement all interval manipulation constructs of RTEC (see Figure <ref type="figure">1</ref>). As an illustration, consider the statement below expressing moving, from the domain of activity recognition, as a statically determined fluent: moving(P 1 , P 2 ) iff walking(P 1 ), walking(P 2 ), close(P 1 , P 2 ).</p><p>(11)</p><p>Recall that the corresponding definition in RTEC is given by rule (5). Note that the above statement does not include 'holdsFor' and the corresponding variables for intervals.</p><p>Another example illustrating the compactness of the statically determined fluent definitions is again taken from activity recognition. In this domain, fighting between two persons may be defined in the following way:</p><formula xml:id="formula_11">fighting(P 1 , P 2 ) iff</formula><p>(abrupt(P 1 ) or abrupt(P 2 )), close(P 1 , P 2 ), not (inactive(P 1 ) or inactive(P 2 )).</p><p>(</p><formula xml:id="formula_12">)<label>12</label></formula><p>This statement declares that when two persons stand close to each other and at least one of them appears to be moving abruptly while none of them is inactive, then a fight is inferred to be taking place. Translating this statement into the RTEC syntax yields the following rule:</p><p>holdsFor(fighting(P 1 , P 2 ) = true, I ) :− holdsFor(abrupt (P 1 ) = true, I 1 ), holdsFor(abrupt (P 2 ) = true, I 2 ), union all([I 1 , I 2 ], I 3 ), holdsFor(close(P 1 , P 2 ) = true, I 4 ), intersect all([I 3 , I 4 ], I 5 ), holdsFor(inactive(P 1 ) = true, I 6 ), holdsFor(inactive(P 2 ) = true, I 7 ), union all([I 6 , I 7 ], I 8 ), relative complement all(I 5 , [I 8 ], I ).</p><p>(13)</p><p>Rule ( <ref type="formula">13</ref>) takes many more keystrokes to complete and requires the application of quite a few interval manipulation constructs, compared to statement (12). SimplEC here helps building a shorter and more natural-looking statement. RTEC has also been used for maritime monitoring. In this domain, maritime patrol officers are interested in detecting various types of illegal, suspicious or dangerous activity, such as when a vessel is rapidly moving towards some other vessel(s). Such a behaviour could indicate a vessel pursuit or even imminent collision. Consider the formalisation below:</p><formula xml:id="formula_13">happensAt(fastApproach(Vessel ), T ) :− happensAt(speedChange(Vessel ), T ), holdsAt(velocity(Vessel ) = Speed , T ), Speed &gt; 20 knots, holdsAt(coord (Vessel ) =(Lon, Lat), T ), not nearPorts(Lon, Lat), holdsAt(headingToVessels(Vessel ) = true, T ).<label>(14)</label></formula><p>Unlike the specifications that we have seen so far, the activity of interest here is defined as a derived event. speedChange(Vessel ) is an SDE detected from vessel position signals. velocity and coord are fluents indicating, respectively, the speed and coordinates of a vessel. These are also given as input to RTEC. nearPorts(Lon, Lat) is an atemporal predicate that becomes true when the point (Lon, Lat) is close to a port. headingToVessels(Vessel ) is a fluent that becomes true whenever a Vessel 's direction of movement is towards at least one other vessel. According to rule ( <ref type="formula" target="#formula_13">14</ref>), a 'fast approach' movement is recognised when a Vessel changes its speed at open sea, the new speed is above 20 knots, and there is at least one other nearby vessel towards which it is heading. The value of 20 knots was chosen by domain experts. More details about the application of RTEC to maritime monitoring may be found at <ref type="bibr" target="#b7">(Patroumpas et al. 2017</ref>).</p><p>In addition to fluents, SimplEC supports derived events. Rule ( <ref type="formula" target="#formula_13">14</ref>) e.g. may be expressed as follows:</p><p>happens fastApproach(Vessel ) iff speedChange(Vessel ), velocity(Vessel ) &gt; 20 knots, coord (Vessel ) =(Lon, Lat), not nearPorts(Lon, Lat), headingToVessels(Vessel ).</p><p>(</p><formula xml:id="formula_14">)<label>15</label></formula><p>Similar to initiate and terminate statements, the first condition of a happens statement is expected to be an event, while the remaining ones concern fluents unless otherwise indicated. In this example, the user has to declare separately that nearPorts is an atemporal predicate. We should also like to note, in this example, the ability to condense arithmetic comparisons, such as that of lines 3 and 4 of rule ( <ref type="formula" target="#formula_13">14</ref>).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Compiler</head><p>The compiler of SimplEC parses a set of statements in the simple language and, based on its grammar, translates the statements to rules in the RTEC format. Moreover, it constructs the declarations required for computing narrative assimilation queries. The declarations distinguish, for the benefit of RTEC, between simple and statically determined fluents, and between input and output entities (events and fluents). In SimplEC statement (11), for instance, the compiler will detect three statically determined fluents, namely moving( , ), walking( ), and close( , ), of which moving( , ) is an output entity, as it appears in the head of the statement, and the other two are input entities, as they do not appear to be defined by other, simpler entities. Subsequently, the compiler will generate the RTEC rule (5), along with the following declarations: sDFluent(moving( , )). sDFluent(walking( )). sDFluent(close( , )). outputEntity(moving( , )). inputEntity(walking( )). inputEntity(close( , )).</p><p>(16)</p><p>See the GitHub repository of RTEC for example declaration files. The declarations also express the 'caching hierarchy', that is, the order in which fluents and events are processed. RTEC performs bottom-up processing whereby fluents and events of level 1 of a hierarchy are processed first, subsequently moving to levels 2, 3, etc. The computed intervals of each level are cached. This way, fluent and event intervals of some level n may be simply fetched from memory when required in the processing of fluents and events of some higher level m.</p><p>To aid the user, the compiler may display the dependency graph of the event description. This is a directed graph where each vertex corresponds to a fluent or event, and for each pair of vertices (i, j) there is an edge from i to j if i appears in the body of a statement defining j. Figure <ref type="figure" target="#fig_2">2</ref> shows the dependency graph of an event description for city transport management. In this figure, we can observe the way in which the events and fluents affect each other. In the leftmost part of the figure there are vertices with no incoming edges. These correspond to input events and fluents that form the narrative upon which all complex activities will be recognised. In this domain, the input entities include information about the acceleration and deceleration of transport vehicles, changes in internal temperature, noise level or passenger density, as well as the time of arrival at a stop.</p><p>On the right of the bottom layer, there are two other layers of events and fluents that have both incoming and outgoing edges. These are output entities that also contribute to the definition of other output entities. On these layers we combine information from the bottom layer and produce higher-level information. For instance, we can recognise complex activities such as driving style and quality, vehicle punctuality and the passengers' comfort level. In the rightmost part of the figure, there is one last layer with no outgoing edges. These are the complex activities of the highest level-consider, for instance, passenger satisfaction.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Empirical Evaluation</head><p>SimplEC has been designed and implemented with a view to making the event descriptions of RTEC concise and Prologindependent. A SimplEC user with little or no programming skills should be able to define events and the effects thereof within a particular domain, by writing short, simple and straightforward statements. To test the extent to which this conciseness is achieved by our proposed language, we compared the RTEC code with its respective SimplEC code in terms of length and simplicity in three application domains already discussed in this paper: Human activity recognition, city transport management and maritime monitoring. Figure <ref type="figure" target="#fig_4">3</ref> illustrates the comparison.</p><p>Figure <ref type="figure" target="#fig_4">3a</ref> depicts the code size in bytes needed to construct equivalent formalisations in RTEC and SimplEC. In human activity recognition, the event descriptions along with the entity declarations of RTEC result in 7,406 bytes of code. The same information can be described in our proposed language using only 2,780 bytes, which corresponds to a 62.5% reduction. In city transport management, the achieved reduction is approximately 50%, while in maritime monitoring it is approximately 60%. In Figure <ref type="figure" target="#fig_4">3b</ref> we focus the comparison on the lines of code needed in each case. As far as the human activity recognition application is concerned, 130 RTEC rules were needed in order to describe the problem. This number is brought down to just 38 using SimplEC, which corresponds to a 70.8% reduction. Similarly, for city transport management, rules were reduced by approximately 72%, while in maritime monitoring they were reduced by 77%. Finally, apart from the metrics that have to do with the brevity of the event descriptions, there are metrics that concern the simplicity of a dialect. One such metric is the amount of unique domain-independent keywords and predicates. The application of this metric to the three domains is shown in Figure <ref type="figure" target="#fig_4">3c</ref>.</p><p>The significant difference in code size, lines of code and number of unique domain-independent predicates is mainly caused by the fact that there are several keywords, conditions and facts in the RTEC code, which are automatically inferred and generated internally by the SimplEC compiler and, therefore, need not be included in the SimplEC statement set, thus paving the way for fewer, shorter and more compact statements. These automatically inferred objects include the interval manipulation constructs and the entity declarations, among others. For instance, SimplEC statement (11) yields RTEC rule (5), along with the declarations  shown in ( <ref type="formula">16</ref>). Consequently, a user of SimplEC does not have to keep many special terms and domain-independent predicates in mind, thus making it easier to focus on the domain formalisation.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Related and Further Work</head><p>RTEC has a formal, declarative semantics as opposed to most complex event processing languages, several data stream processing and event query languages, and most commercial production rule systems (Cugola and Margara 2012). Moreover, RTEC supports atemporal reasoning and reasoning over background knowledge, and explicitly represents intervals, thus avoiding the related logical problems <ref type="bibr" target="#b7">(Paschke 2005)</ref>. Concerning the Event Calculus literature (e.g. <ref type="bibr" target="#b4">(Chittaro and Montanari 1996;</ref><ref type="bibr" target="#b3">Cervesato and Montanari 2000;</ref><ref type="bibr" target="#b4">Miller and Shanahan 2002;</ref><ref type="bibr" target="#b6">Paschke and Bichler 2008;</ref><ref type="bibr" target="#b0">Artikis and Sergot 2010;</ref><ref type="bibr" target="#b5">Montali et al. 2013</ref>)), a key feature of RTEC is that it includes a windowing technique <ref type="bibr" target="#b2">(Artikis, Sergot, and Paliouras 2015)</ref>. In contrast, no Event Calculus system 'forgets' or represents concisely the data stream history. We presented our efforts towards a simple language for RTEC. We observed, using real-world applications, that SimplEC helps in writing much more succinct event descriptions. However, the simple language must be evaluated by people that are not familiar with the Event Calculus. Towards this, we will make use of the domain experts of the datAcron project<ref type="foot" target="#foot_0">1</ref> , where RTEC is used as the complex event recognition engine for maritime and aviation monitoring. We are also working towards constructing simpler and more orderly dependency graphs.</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head></head><label></label><figDesc>initiatedAt(passenger density(ID, VT ) = Val , T ) :− happensAt(passenger density change(ID, VT , Val ), T ). (4) passenger density change is an SDE determined from sensor data. ID concerns the vehicle of type VT (bus, tram) on which the sensors (video cameras, microphones) are mounted, while the value Val may be low , medium or high. Statically determined fluents In addition to the domainindependent definition of holdsFor, an event description may include domain-specific holdsFor rules, used to define the values of a fluent F in terms of the values of other fluents.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_1"><head></head><label></label><figDesc>initiate passenger density(ID, VT ) = Val iff passenger density change(ID, VT , Val ).</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_2"><head>Figure 2 :</head><label>2</label><figDesc>Figure 2: Dependency graph of the city transport management event description.</figDesc><graphic coords="6,54.00,54.00,503.97,160.75" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_4"><head>Figure 3 :</head><label>3</label><figDesc>Figure 3: Comparison between RTEC and SimplEC in three real-world applications: Human Activity Recognition (HAR), City Transport Management (CTM) and Maritime Monitoring (MM). Dark blue bars correspond to RTEC while dark red ones correspond to SimplEC.</figDesc><graphic coords="7,54.00,57.16,161.29,122.10" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_0"><head>Table 1</head><label>1</label><figDesc></figDesc><table><row><cell>sum-</cell></row></table></figure>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="1" xml:id="foot_0">http://datacron-project.eu</note>
		</body>
		<back>

			<div type="acknowledgement">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Acknowledgements</head><p>This work is funded by the H2020 project datAcron (687591).</p></div>
			</div>

			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<analytic>
		<title level="a" type="main">Executable specification of open multi-agent systems</title>
		<author>
			<persName><forename type="first">Sergot</forename><forename type="middle">;</forename><surname>Artikis</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Artikis</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><forename type="middle">J</forename><surname>Sergot</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Logic Journal of the IGPL</title>
		<imprint>
			<biblScope unit="volume">18</biblScope>
			<biblScope unit="issue">1</biblScope>
			<biblScope unit="page" from="31" to="65" />
			<date type="published" when="2010">2010. 2010</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b1">
	<analytic>
		<title level="a" type="main">Logic-based event recognition</title>
		<author>
			<persName><surname>Artikis</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Knowledge Eng. Review</title>
		<imprint>
			<biblScope unit="volume">27</biblScope>
			<biblScope unit="issue">4</biblScope>
			<biblScope unit="page" from="469" to="506" />
			<date type="published" when="2012">2012. 2012</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<analytic>
		<title level="a" type="main">Reasoning on data streams: An approach to adaptation in pervasive systems</title>
		<author>
			<persName><forename type="first">Sergot</forename><surname>Artikis</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Paliouras ; Artikis</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><forename type="middle">J</forename><surname>Sergot</surname></persName>
		</author>
		<author>
			<persName><forename type="first">G</forename><surname>Paliouras</surname></persName>
		</author>
		<author>
			<persName><forename type="first">;</forename><surname>Bicocchi</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Hinchey</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Nature of Computation and Communication -International Conference</title>
				<meeting><address><addrLine>ICTCC</addrLine></address></meeting>
		<imprint>
			<date type="published" when="2014">2015. 2015. 2014</date>
			<biblScope unit="volume">27</biblScope>
			<biblScope unit="page" from="23" to="32" />
		</imprint>
	</monogr>
	<note>An event calculus for event recognition</note>
</biblStruct>

<biblStruct xml:id="b3">
	<analytic>
		<title level="a" type="main">A calculus of macro-events: Progress report</title>
		<author>
			<persName><forename type="first">Montanari</forename><forename type="middle">;</forename><surname>Cervesato</surname></persName>
		</author>
		<author>
			<persName><forename type="first">I</forename><surname>Cervesato</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Montanari</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Seventh International Workshop on Temporal Representation and Reasoning</title>
				<meeting><address><addrLine>TIME</addrLine></address></meeting>
		<imprint>
			<date type="published" when="2000">2000. 2000</date>
			<biblScope unit="page" from="47" to="58" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b4">
	<analytic>
		<title level="a" type="main">Processing flows of information: From data stream to complex event processing</title>
		<author>
			<persName><forename type="first">Montanari</forename><forename type="middle">;</forename><surname>Chittaro</surname></persName>
		</author>
		<author>
			<persName><forename type="first">L</forename><surname>Chittaro</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Montanari</surname></persName>
		</author>
		<author>
			<persName><forename type="first">G</forename><surname>Cugola</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A ;</forename><surname>Margara</surname></persName>
		</author>
		<author>
			<persName><forename type="first">R</forename><forename type="middle">A</forename><surname>Kowalski</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Sergot</surname></persName>
		</author>
		<author>
			<persName><forename type="first">R</forename><surname>Miller</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Shanahan</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Computational Logic: Logic Programming and Beyond</title>
				<imprint>
			<date type="published" when="1986">1996. 1996. 2012. 1986. 2002</date>
			<biblScope unit="volume">12</biblScope>
			<biblScope unit="page" from="452" to="490" />
		</imprint>
	</monogr>
	<note>LNAI</note>
</biblStruct>

<biblStruct xml:id="b5">
	<analytic>
		<title level="a" type="main">Monitoring business constraints with the event calculus</title>
		<author>
			<persName><surname>Montali</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">ACM TIST</title>
		<imprint>
			<biblScope unit="volume">5</biblScope>
			<biblScope unit="issue">1</biblScope>
			<biblScope unit="page">30</biblScope>
			<date type="published" when="2013">2013. 2013</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b6">
	<analytic>
		<title level="a" type="main">Knowledge representation concepts for automated SLA management</title>
		<author>
			<persName><surname>Paschke</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Bichler ; Paschke</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Bichler</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Decision Support Systems</title>
		<imprint>
			<biblScope unit="volume">46</biblScope>
			<biblScope unit="issue">1</biblScope>
			<date type="published" when="2008">2008. 2008</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b7">
	<analytic>
		<title level="a" type="main">ECA-RuleML: An approach combining ECA rules with temporal interval-based KR event/action logics and transactional update logics</title>
		<author>
			<persName><forename type="first">A</forename><surname>Paschke ; Paschke</surname></persName>
		</author>
		<author>
			<persName><surname>Patroumpas</surname></persName>
		</author>
		<idno>CoRR abs/cs/0610167</idno>
	</analytic>
	<monogr>
		<title level="j">GeoInformatica</title>
		<imprint>
			<biblScope unit="volume">21</biblScope>
			<biblScope unit="issue">2</biblScope>
			<biblScope unit="page" from="389" to="427" />
			<date type="published" when="2005">2005. 2005. 2017</date>
		</imprint>
	</monogr>
	<note type="report_type">Technical report</note>
	<note>Online event recognition from moving vessel trajectories</note>
</biblStruct>

<biblStruct xml:id="b8">
	<analytic>
		<title level="a" type="main">On the declarative semantics of stratified deductive databases and logic programs</title>
		<author>
			<persName><forename type="first">T</forename><surname>Przymusinski ; Przymusinski</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Foundations of Deductive Databases and Logic Programming</title>
				<imprint>
			<publisher>Morgan</publisher>
			<date type="published" when="1987">1987. 1987</date>
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
