Abstract
This paper presents a novel approach to express and evaluate the complex class of queries in moving object databases called spatiotemporal pattern queries (STP queries). That is, one can specify temporal order constraints on the fulfillment of several predicates. This is in contrast to a standard spatiotemporal query that is composed of a single predicate. We propose a language design for spatiotemporal pattern queries in the context of spatiotemporal DBMSs. The design builds on the well established concept of lifted predicates. Hence, unlike previous approaches, patterns are neither restricted to specific sets of predicates, nor to specific moving object types. The proposed language can express arbitrarily complex patterns that involve various types of spatiotemporal operations such as range, metric, topological, set operations, aggregations, distance, direction, and boolean operations. This work covers the language integration in SQL, the evaluation of the queries, and the integration with the query optimizer. We also propose a simple language for defining the temporal constraints. The approach allows for queries that were never available. We provide a complete implementation in C+ + and Prolog in the context of the Secondo platform. The implementation is made publicly available online as a Secondo Plugin, which also includes automatic scripts for repeating the experiments in this paper.
Similar content being viewed by others
Notes
Here tuple is viewed as a type variable that can be instantiated by any valid tuple type.
The xangle operator is a corrected copy of the Secondo mdirection operator. It is presented only for the sake of this example. In the Secondo versions newer than 2.9.1, the mdirection operator works fine.
Since our optimizer extension wraps around the standard optimizer implementation, you may get different optimization results in later Secondo versions. The described results in this paper are obtained from version 2.9.1.
References
Allen JF (1983) Maintaining knowledge about temporal intervals. Commun ACM 26(11):832–843
Alvares LO, Bogorny V, Kuijpers B, Fernandes de Macedo JA, Moelans B, Vaisman A (2007) A model for enriching trajectories with semantic geographical information. In: GIS ’07: proceedings of the 15th annual ACM international symposium on advances in geographic information systems, pp 1–8
Bessiere C (2006) Handbook of constraint programming, chap 3. Elsevier
Cotelo Lema JA, Forlizzi L, Güting RH, Nardelli E, Schneider M (2003) Algorithms for moving objects databases. Comput J 46(6):680–712
du Mouza C, Rigaux P (2005) Mobility patterns. Geoinformatica 9(4):297–319
Düntgen C, Behr T, Güting RH (2009) BerlinMOD: a benchmark for moving object databases. VLDB J 18(6):1335–1368
Erwig M, Schneider M (1999) Developments in spatio-temporal query languages. In DEXA ’99: Proceedings of the 10th international workshop on database & expert systems applications, p 441
Erwig Ma, Schneider M (2002) Spatio-temporal predicates. IEEE Trans Knowl Data Eng 14(4):881–901
Erwig M (2004) Toward spatiotemporal patterns. In: de Caluwa R, de Tré G, Boudogua G (eds) Spatio-temporal databases. Springer-Verlag, New York, pp 29–54
Forlizzi L, Güting RH, Nardelli E, Schneider M (2000) A data model and data structures for moving objects databases. In: SIGMOD ’00: proceedings of the 2000 ACM SIGMOD international conference on management of data, pp 319–330
Frentzos E, Gratsias K, Pelekis N, Theodoridis Y (2007) Algorithms for nearest neighbor search on moving object trajectories. Geoinformatica 11(2):159–193
Gudmundsson J, van Kreveld M, Speckmann B (2004) Efficient detection of motion patterns in spatio-temporal data sets. In: GIS ’04: proceedings of the 12th annual ACM international workshop on geographic information systems, pp 250–257
Güting RH, Almeida V, Ansorge D, Behr T, Ding Z, Höse T, Hoffmann F, Spiekermann M, Telle U (2005) Secondo: an extensible DBMS platform for research prototyping and teaching. In: ICDE ’05: proceedings of the 21st international conference on data engineering, pp 1115–1116
Güting RH, Behr T, Almeida V, Ding Z, Hoffmann F, Spiekermann M (2004) Secondo: an extensible DBMS architecture and prototype. Technical Report Informatik-Report 313, FernUniversität Hagen
Güting RH, Behr T, Xu J (2010) Efficient k-nearest neighbor search on moving object trajectories. VLDB J (online first)
Güting RH, Böhlen MH, Erwig M, Jensen CS, Lorentzos NA, Schneider M, Vazirgiannis M (2000) A foundation for representing and querying moving objects. ACM Trans Database Syst 25(1):1–42
Hadjieleftheriou M, Kollios G, Bakalov P, Tsotras VJ (2005) Complex spatio-temporal pattern queries. In: VLDB ’05: proceedings of the 31st international conference on very large data bases, pp 877–888
Ioannidis YE (1996) Query optimization. ACM Comput Surv 28(1):121–123
Pelekis N, Kopanakis I, Marketos G, Ntoutsi I, Andrienko G, Theodoridis Y (2007) Similarity search in trajectory databases. In: TIME ’07: proceedings of the 14th international symposium on temporal representation and reasoning, pp 129–140
Schneider M (2005) Evaluation of spatio-temporal predicates on moving objects. In: ICDE ’05: proceedings of the 21st international conference on data engineering, pp 516–517
Wolfson O, Xu B, Chamberlain S, Jiang L (1998) Moving objects databases: issues and solutions. In: SSDBM’98: 10th international conference on scientific and statistical database management, pp 111–122
Secondo Plugins. http://dna.fernuni-hagen.de/secondo.html/start_content_plugins.html
Secondo Programmer’s Guide. http://dna.fernuni-hagen.de/secondo.html/files/programmersguide.pdf
Secondo User Manual. http://dna.fernuni-hagen.de/secondo.html/files/secondomanual.pdf
Secondo Web Site. http://dna.fernuni-hagen.de/secondo.html/
Author information
Authors and Affiliations
Corresponding author
Appendices
A The Expr1Script.sec file
This is a commented version of the Expr1Script.sec script.
The script runs the first experiment with minimal user interaction. The experiment, as described in Section 9.1, is intended to evaluate the execution overhead of the STP predicates. This script first creates the required database objects, then executes the queries and logs the run times.
The commands open the database berlintest and creates 30 random mbool objects with the names mb1... mb30. These objects are needed for the queries. The randommbool operator works as described in Section 9.1.1.
The five vector temporal connectors are used in the queries as examples for vector temporal connectors. They are used together with the 26 simple temporal connectors to generate the queries.
The query imports the experiment queries from the comma separated file STPQExpr1Query.csv and stores them in a Secondo relation called STPQExpr1Query. The [const . value .] operator tells the cvsimport operator the schema of the relation, which is shown in Table 7.
The file contains 4,900 queries that were randomly generated as described in Section 9.1.2. The queries represent 49 experimental settings, each of which have 100 queries. The following query executes them and logs the results in the relation STPQExpr1Result:
This query can take half an hour depending on your machine. You can query the results relation in any of the Secondo user interfaces [24] and create aggregations for the charts. Additionally, the following query exports the relation to the comma separated file STPQExpr1Result.csv in the Secondo bin directory.
NOTE We encourage the reader to get information about the Secondo operators by using the built-in operator descriptions. For example, to get help on the operator csvimport, write the following query at the Secondo prompt:
B The Expr2Script.sec file
This is a commented version for the Expr2Script.sec script.
The script is used to generate the data required for running the second experiment in this paper without executing the queries. The queries need to be executed in the SecondoPL environment afterwards.
First, the commands open the database berlintest. The geometries of the first 300 restaurants in the Restaurants table are then copied to point objects (point1... point300) to be used in the queries.
The five vector temporal connectors, that are also created in Expr1Script.sec, are included here so that the two experiments can be run independently.
This query creates the Trains20 relation by replicating the tuples of the Trains relation 20 times. In the following query, we create an index on the Trains20 relation to test the proposed STP predicate optimization. The index is a spatial R-tree on the units of the Trip attribute. Instead of indexing the complete movement, the index is built on the units (i.e. a bounding box is computed for every unit in the Trip). This is done so that the bounding boxes better approximate the moving point.
C The expr2Queries.pl file
This Prolog file is used to run the queries of the second experiment and log the execution times. It defines four prolog predicates:
-
1.
runSTPQExpr2DisableOptimization/0: switches off STP predicate optimization by setting the optimizer options, and executes the queries.
-
2.
runSTPQExpr2EnableOptimization/0: switches on STP predicate optimization, and executes the queries.
-
3.
executeSQL/4: helper predicate for executing queries.
-
4.
runSTPQExpr2/4: the facts table that stores the queries. The file contains 490 such facts, 10 queries for each of the 49 experimental settings. The queries are randomly generated as described in Section 9.2.2. For every query, the fact also stores its serial, number of lifted predicates, and number of constraints.
D Running the Berlintest application example
To execute the queries in the berlintest example, you need first to run the script BerlintestScript.sec from the SecondoTTYNT prompt. The script is installed within the STPattern Plugin. You also need to have the berlintest database restored in your system. The script file creates the required database objects but it doesn’t execute the queries. It first defines some temporal connectors:
Then it restores the SnowStorms relation from the SnowStorms file in the Secondo/bin directory, which is installed with the Plugin.
The following command creates the relation TrainsMeet, that is used in the example in Section 10.2.3. Every tuple in the relation is a different combination of an up train, down train of the same line, and the stations where the train line stops.
Next we create the relation TrainsDelay, used in the example in Section 10.2.4. Every tuple has a schedule and an actual moving point. The schedule movement is a copy from the Trip attribute in the Trains relation. The actual movement should have delays of about half an hour. We shift the Trip 1,795 s forward, and apply a random positive or negative delay up to 10 s to the result. This creates actual movements with random delays between 29:45 and 30:05 min.
After running the BerlintestScript.sec script, use the Javagui to execute the queries. It is the graphical user interface for Secondo. To launch it:
-
1.
Start the Secondo kernel in server mode, the optimizer server, and the GUI:
In a new shell, go to $SECONDO_BUILD_DIR/bin, and type SecondoMonitor -s.
In a new shell, go to $SECONDO_BUILD_DIR/Optimizer, and type StartOptServer.
In a new shell, go to $SECONDO_BUILD_DIR/Javagui, and type sgui. The Javagui will start and connect to both the kernel and the optimization server.
-
2.
Open the database. In the Javagui type:
open database berlintest.
-
3.
Set the optimizer options. The Secondo optimizer maintains a list of options that controls the optimization. The examples in this paper require the options improvedcosts, determinePredSig, autoSamples, rewriteInference, rtreeIndexRules, and autosave. To set each of these options, type in the Javagui:
optimizer setOption(option)
-
4.
View the underlying network. Type:
select * from ubahn to display the underground trains network.
select * from trains to display the moving trains. Use the slider to view the results.
Select the last query in the top-right panel and press hide to hide the trains.
select * from snowstorms to display the moving snow storms.
hide the snow storms.
-
5.
Type the example queries as in Section 10.2, and make sure to type everything in lower case.
Rights and permissions
About this article
Cite this article
Sakr, M.A., Güting, R.H. Spatiotemporal pattern queries. Geoinformatica 15, 497–540 (2011). https://doi.org/10.1007/s10707-010-0114-3
Received:
Revised:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10707-010-0114-3