=Paper=
{{Paper
|id=Vol-3637/paper53
|storemode=property
|title=Advanced Temporal Reasoning for Intelligent Traffic Monitoring
|pdfUrl=https://ceur-ws.org/Vol-3637/paper53.pdf
|volume=Vol-3637
|authors=Anees ul Mehdi,Alessandro Oltramari
|dblpUrl=https://dblp.org/rec/conf/jowo/MehdiO23
}}
==Advanced Temporal Reasoning for Intelligent Traffic Monitoring==
Advanced Temporal Reasoning for Intelligent Traffic
Monitoring
Anees ul Mehdi1,∗ , Alessandro Oltramari2
1
Corporate Research and Central of Artificial Intelligence, Renningen, Germany
2
Bosch Center for Artificial Intelligence, Pittsburgh, USA
Abstract
Times series, namely data characterized by temporal information, are a common feature of industrial use
cases, especially when considering sensor-based technology. The work presented in this paper focuses
on traffic time series collected from stationary cameras, and preprocessed through machine learning
algorithms. We introduce the notion of traffic scene, which is central to an ontology of the traffic domain
and instrumental to instantiate a knowledge graph for such domain. We then define the formal syntax
and semantics of a new language for querying knowledge graphs that is capable of handling temporal
information beyond SPARQL expressivity. Finally, we illustrate examples of advanced temporal queries
for intelligent traffic monitoring applications.
Keywords
Ontologies, Knowledge Graphs, Temporal Reasoning, Traffic Monitoring
1. Introduction
In this work, we aim to address the limitations of current knowledge graph (KG) approaches
in representing and reasoning over dynamic information. In particular, we designed a query
language called Temporal Query Language (TQL), which extends SPARQL. The article provides a
detailed description of the TQL primitives, clarifying the notion of time assumed in the language,
and illustrates an intelligent traffic monitoring application.
2. Problem Description and Setup
Query 11 shows a KG excerpt related to traffic objects and their properties. In particular, Line 2
and 3 are asserting that there are two entities of type Car, whereas Line 4 and 5 are describing
their speeds (the implicit unit of measure adopted is miles per hour).
The instant at which a given information holds can be easily represented in RDF. As an
example, we can state that ”car 1 has a speed of 22.0 on July 27, 2021 at 14:21”. One way of
Ontology Showcase and Demonstrations Track, 9th Joint Ontology Workshops (JOWO 2023), co-located with FOIS 2023,
19-20 July, 2023, Sherbrooke, Québec, Canada.
∗
Corresponding author.
Envelope-Open anees.ulmehdi@de.bosch.com (A. u. Mehdi); alessandro.oltramari@us.bosch.com (A. Oltramari)
GLOBE https://www.bosch.com/research/about-bosch-research/our-research-experts/alessandro-oltramari/
(A. Oltramari)
© 2023 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).
1
tmo is an example prefix.
CEUR
ceur-ws.org
Workshop ISSN 1613-0073
Proceedings
Query 1: Virtualization query example
1 ...
2 tmo:car_1 rdf:type tmo:Car .
3 tmo:car_2 rdf:type tmo:Car .
4 tmo:car_1 tmo:speed 22.0 .
5 tmo:car_2 tmo:speed 25.0 .
6 ...
Query 2: Querying information with time
1 SELECT ?car
2 WHERE
3 {
4 tmo:car_1 rdf:type tmo:Car .
5 tmo:car_1 tmo:associatedWith ?x .
6 ?x tmo:hasSpeed ?speed .
7 ?x tmo:time ?time .
8 FILTER(?speed>22.0)
9 FILTER(?time<”2021-06-27T09:00:00” && ?time>”2021-06-27T21:00:00”)
10 }
representing this information in RDF is to use reification2 , whereas tmo:associatedWith is
just an auxiliary predicate and _:x is called a blank node. Blank nodes are auxiliary nodes for
connecting different entities in a KG.
tmo:car_1 tmo:associatedWith _:x .
_:x tmo:hasSpeed 22.0 .
_:x tmo:time ”2021-06-27T14:21:00”^^xsd:dateTime
Alternatively, we can use RDF-star3 and represent the same information as following:
<>
tmo:time ”2021-06-27T14:21:00”^^xsd:dateTime
Regardless of the way we represent temporal information, the question is how to effectively
query such information and extract salient dynamic properties from it. When treating time
like any other property in RDF, we can use standard query language such as SPARQL. For
example, Query 2 asks for all cars with speed greater than 20.0 between 9:00AM to 9:00PM on
July 27, 2021. This is a usual interpretation of time. Filters like the one shown in Line 9, allow to
query for data that satisfy certain restrictions on the associated time point. In other words, the
way we can filter time-associated data is to compare the time points using the usual operators
like , <, =, ! = etc. But how to conceptualize and generalize events from time points is left to
the human. In case of traffic situations, sometimes we are interested in relating information
at different time points and beyond the simple semantics of the aforementioned comparison
operators. As an example, suppose we want to check if there is a car idling until a police patrol
car arrives at the scene. Such query cannot be formalized in SPARQL, as it would require some
sort of a while-loop in order to traverse time-indexed KG triples unless certain conditions are
2
https://www.w3.org/wiki/RdfReification. Note that we are not using the usual reification approach of associating a
triple to a blank node.
3
https://w3c.github.io/rdf-star/cg-spec/2021-07-01.html
satisfied (appearance of a police vehicle in this example). Query languages like SPARQL lack
such a capability. Even though some queries about information over time could be expressed in
SPARQL, such queries usually end up to be too complex and prone to error. In this work, our
goal is to devise a query language to address these issues. We call the language temporal query
language (TQL). TQL basically allows us to query about information while constraining them
over time. A detailed description will be provided in upcoming sections. For this language, we
take certain assumptions about the notion of time in the target knowledge graph, as described
below.
2.1. KG Requirements
The query language we present in this work takes the following assumptions about the target
knowledge graph.
Universality of Schema The schema or the ontology part of a given KG graph is assumed to
be universal. i.e., we do not allow time to be associated with ontological axioms. In other words,
the schema is true at all time points i.e., the axioms or knowledge about a particular domain
are not time dependent. Further, we want to avoid computational issues like undecidability of
query answering [1].
Temporal Data Not all data need to be temporal. But the parts of the data with temporal
information need to be associated with some notion of time. In the previous section, we
have seen example how a timestamp can be associated to a triple using the usual datatype
xsd:dateTime. Nevertheless, this is not a hard requirement in our case. All we need is some
way of ordering information. Further, we need this ordering to be linear i.e., give a time point 𝑇
in this order, there is at most one successor 𝑇 ′ time point of 𝑇. A KG 𝒢 thus can be perceived
as a union of 𝒢𝑆 , 𝒢𝑇1 , … , 𝒢𝑇𝑛 where 𝒢𝑆 represents the schema part of 𝒢 along with the triples
which are not associated to some time and hence contain no temporal information, whereas 𝐺𝑇𝑖
represents the set of triples which are associated with time point 𝑇𝑖 for 1 ≤ 𝑖 ≤ 𝑛. Without loss
of generality, we associate time to a set of triples onward.
3. Use-case
In this work, we apply TQL to improve the analysis of traffic video feeds: the goal is to infer
complex behavior from object classes, positions, trajectories recognized by state-of-the-art
machine vision systems running on top of stationary cameras. A traffic monitoring ontology
has been created, to represent the semantic content or scene of each video frame, and to generate
a knowledge graph with the annotated data.
3.1. Traffic Monitoring Ontology
Videos collected from different cameras are analyzed frame by frame. For each frame we get
information about the objects and their characteristics in it. We describe this information in a
KG using different classes and relationships. Note that each frame is recorded at a particular
Query 3: Triples describing an observation about a car in a frame
1 tmo:atomicScene1 tmo:composedOf tmo:position1.
2 tso:TimeStamp ”2021-03-03T07:30:44”^^xsd:dateTime;
3 tmo:position1 rdf:type tso:Position;
4 tmo::hasParticipant tmo:car1;
5 tmo::hasProperty ?speedProperty1.
6 ?speedProperty1 rdf:type tso:Speed;
7 tmo:hasValue 20.0.
time point. For our use-case, we consider these time points when dealing with dynamic aspect
of the domain. The notion of time will be explained in Section 5.
Figure 1: Traffic Monitoring Ontology
Figure 1 shows a snippet of the traffic monotoring ontology (TMO). We next go through the
classes and relations in TMO.
AtomicScene and Observation The class AtomicScene is a composition of the class Ob-
servation. The elements of Observation represent different types of observations made in a
given frame. In our case, the only observations we have are of type Position, which describes a
traffic object using some spatial coordinates4 . However, as an example, if there is a car observed
in a frame, triples describing all the relevant information about the car are shown in Query 3.
As shown on line 4, Position (Observation) is used to accumulate information about a traffic
object (tmo:car1 in this case). What we are describing is that in the given frame we make an
observation (of type Position) in which we have a participant (tmo:car1), a property (tmo:Speed)
for which we have a value of 20.0. Finally, note that that Line 3 associates a single time point
to tmo:atomicScene1. We could actually associate the same time to every triple in Query 3.
But since all the triples carry the same time point, we can group them using an instance of
AtomicScene.
ComplexScene A complex scene is a composition of atomic scenes. Which atomic scenes
constitute a complex scene depends on the pertinent interpretations derived by the use case
(see Event) or external constraints.
4
Including geo-spatial coordinates, bounding boxes and Cartesian coordinates, etc. Note that Figure 1 is only
showing a partial view of the ontology, focused on temporal aspects.
Figure 2: Event as Interpretation
Event Previously we mentioned that complex scenes are composition of atomic scenes. We
do not enforce any condition on which atomic scene can be composed into a complex scene. In
practice however, we are not interested in random aggregates of atomic scenes. To this end,
we use the class Event to represent scenes in a meaningful manner. Events thus can be seen
as semantic tags we put on scenes (atomic or complex). Figure 3.1 outlines this idea. As an
example, a scene can be interpreted as a congestion in, say, a village, while it can be interpreted
as a rush hour in a city. Pictorially, we see in Figure 3.1 the relationship between atomic scenes,
complex scenes and events. Different interpretations (events) can be associated to the same
complex scene.
Figure 3: Event Interpretation Examples
After presenting an overview of the relevant part of our KG, we next describe the need for
a temporal query language. In the next section, we will see why standard querying is not
sufficient in use-cases like traffic monitoring where the data is inherently dynamic and thus
involves time as an aspect.
4. Query Languages Limitations
In this section, we describe why standard query languages like SPARQL are not sufficient when
dealing with data, such as from traffic monitoring domain, which involves dynamic aspects. This
will advocate the idea of devising a more expressive query language which we will introduce in
Section 5. To this end, we present the following example scenarios.
Query 4: query checking for accelerating car
1 ASK
2 WHERE
3 {
4 ...
5 tmo:atomicScene_i tmo:composedOf tmo:position_i.
6 tso:TimeStamp ?t_i.
7 tmo:position_i rdf:type tso:Position;
8 tmo::hasParticipant tmo:car;
9 tmo::hasProperty ?speedProperty.
10 ?speedProperty rdf:type tso:Speed;
11 tmo:hasValue ?speed_i.
12 tmo:atomicScene_j tmo:composedOf tmo:position_j.
13 tso:TimeStamp ?t_j.
14 tmo:position_j rdf:type tso:Position;
15 tmo::hasParticipant tmo:car;
16 tmo::hasProperty ?speedProperty.
17 ?speedProperty rdf:type tso:Speed;
18 tmo:hasValue ?speed_j.
19 ...
20 FILTER(speed_1 𝑛 and
𝜏 (𝑛, 𝑛′ ) = true otherwise. Note the likelihood constraint with threshold function 𝜏 on the
variable ?speed makes sure that the value of ?speed increases as we move over time. This way
we capture the notion of acceleration for the car. Further, the above query is of the form Λ.ΓUΛ′
with Λ = ∅. Further, ℜ𝐸 (?car) constraints the existence of a car over all time points unless there
is a time point 𝑇 where we we find a second car with position of the first car overlapping that of
the second one in the knowledge graph 𝒢 ∪ 𝒟𝑇 .
6. Related Work
Incorporating time into RDF has been investigated in prior work [6, 7, 8, 9, 10, 11]. By and
large, these studies differ in aspects like treatment of the notion of time and expressivity of the
query language. Contributions like [6] extend the idea of TSQL2 [12] in traditional databases to
RDF. The treatment of time there is different from the usual notion of time in classical temporal
logic like LTL [13]. Nevertheless, works like [11] extends SPARQL with constructs provided
in LTL. A thorough comparison of our approach to the state-of-the-art is beyond the scope
of this paper. However, the treatment of time in our work exhibits some similarities to the
one presented in [6]. What distinguishes TQL is that it considers only one dimension for time,
as our definition of temporal KG is based on a linear order (T, <) unlike N-dimensional time
𝒯 = 𝒯1 × 𝒯2 × ⋯ × 𝒯𝑛 in [6, 7], where the focus is ontology versioning. When it comes to our
query language, our work is somewhat similar to SPARQL-LTL presented in [11]. However, the
focus in [11] when it comes to the notion of time is more on versioning of RDF data. Hence, the
defined semantics consider different named graphs where each graph represents one version
of the data. As pointed out by the authors, it is not a limitation per se. We believe this is
comparable to our definition of temporal knowledge graph (Definition 5.2), where without loss
of generality, we assume a set of triples to be associated with a time point.
Besides all similarities to the existing approaches, the notion of temporal constraint, to the
best of our knowledge, adds new expressivity to SPARQL extended with the temporal operators.
Even though such constraints are translated into SPARQL checks, the succinctness they add to
the query language is of great advantage, as it helps to reduce complex queries to simpler and
more compact ones (as shown in the examples in the traffic monitoring domain).
7. Conclusion and Future Work
We have discussed the benefit of temporal queries in knowledge graphs. We then presented
a formal query language for formalizing temporal queries. We called it as Temporal Query
Language (TQL). We have precisely defined syntax and semantics of TQL, where we considered
different types of temporal queries. We have seen how temporal constraints adds further
expressivity to the query language. We have already a first implementation of a query engine
for answering temporal queries. A description of the engine, along with a report on experiments
and evaluation conducted, is beyond the scope of this paper. In future work, we would like to
analyze what other types of temporal queries can be of interest for different use-cases and, in
parallel, developing an advanced query editor for TQL.
References
[1] C. Lutz, F. Wolter, M. Zakharyaschev, Temporal description logics: A survey, in: Proceed-
ings of the Fifteenth International Symposium on Temporal Representation and Reasoning,
IEEE Computer Society Press, 2008.
[2] S. Bechhofer, F. van Harmelen, J. Hendler, I. Horrocks, D. McGuinness, P. Patel-Schneijder,
L. A. Stein, Technical Report, 2004.
[3] F. Baader, I. Horrocks, C. Lutz, U. Sattler, An Introduction to Description Logic, Cambridge
University Press, 2017. doi:1 0 . 1 0 1 7 / 9 7 8 1 1 3 9 0 2 5 3 5 5 .
[4] P. Hitzler, M. Krtzsch, S. Rudolph, Foundations of Semantic Web Technologies, 1st ed.,
Chapman and Hall/CRC, 2009.
[5] C. Lutz, F. Wolter, M. Zakharyaschev, Temporal description logics: A survey, in: Proceed-
ings of the Fifteenth International Symposium on Temporal Representation and Reasoning,
2008.
[6] F. Grandi, T-SPARQL: A tsql2-like temporal query language for RDF, in: Local Proceedings
of the Fourteenth East-European Conference on Advances in Databases and Information
Systems, Novi Sad, Serbia, September 20-24, 2010, CEUR Workshop Proceedings, 2010.
[7] F. Grandi, Multi-temporal RDF ontology versioning, in: Proceedings of the 3rd In-
ternational Workshop on Ontology Dynamics, (IWOD 2009) , collocated with the 8th
International Semantic Web Conference ( ISWC-2009 ), Washington DC, USA, October 26,
2009, CEUR Workshop Proceedings, 2009.
[8] J. Tappolet, A. Bernstein, Applied temporal RDF: efficient temporal querying of RDF data
with SPARQL, in: The Semantic Web: Research and Applications, 6th European Semantic
Web Conference, ESWC 2009, Heraklion, Crete, Greece, May 31-June 4, 2009, Proceedings,
2009.
[9] A. Pugliese, O. Udrea, V. S. Subrahmanian, Scaling RDF with time, in: Proceedings of the
17th International Conference on World Wide Web, WWW 2008, Beijing, China, April
21-25, 2008, 2008.
[10] C. Gutierrez, C. A. Hurtado, A. A. Vaisman, Introducing time into RDF, IEEE Trans. Knowl.
Data Eng. (2007).
[11] M. W. Chekol, V. Fionda, G. Pirrò, Time travel queries in RDF archives, in: Joint proceedings
of the 3rd Workshop on Managing the Evolution and Preservation of the Data Web
(MEPDaW 2017) and the 4th Workshop on Linked Data Quality (LDQ 2017) co-located
with 14th European Semantic Web Conference (ESWC 2017), Portorož, Slovenia, May
28th-29th, 2017, CEUR-WS.org, 2017.
[12] J. Clifford, C. E. Dyreson, R. T. Snodgrass, T. Isakowitz, C. S. Jensen, ”now”, in: R. T.
Snodgrass (Ed.), The TSQL2 Temporal Query Language, Kluwer, 1995, pp. 383–392.
[13] F. Kröger, S. Merz, Basic Propositional Linear Temporal Logic, 2008.