-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent_getting_started.html
More file actions
337 lines (298 loc) · 15 KB
/
Copy pathcontent_getting_started.html
File metadata and controls
337 lines (298 loc) · 15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
---
layout: default
title: Getting Started - SECONDO
description: A hands-on quick-start guide to SECONDO: install it, restore the example databases, and run your first moving-objects queries in the GUI.
---
<style type="text/css">
ol li { margin-bottom: 0.8em; }
</style>
<h1> Getting Started </h1>
<div class="short">
This guide walks you through a "do it yourself" demo of <span class="secondo">Secondo</span>,
the moving objects database system. In about 15–20 minutes you will install
<span class="secondo">Secondo</span>, restore an example database, and run queries that
compute the trajectory of a moving underground train, find all trains passing through a
region, and see the query optimizer in action — without having to read any manuals
or papers first.
</div>
<h2> What is a Moving Object? </h2>
<div class="short">
<span class="secondo">Secondo</span> can represent and query complete histories of movement.
A trip taken by a vehicle can be stored as a single value of type <code>moving point</code>
(<code>mpoint</code> for short), and the spread of a forest fire over time can be stored as a
single value of type <code>moving region</code> (<code>mregion</code>). A moving point is
essentially a function from time into point values, and a moving region a function from time
into region values; they can be visualized as shown below.
<div style="margin:16px 0; text-align:center;">
<img src="/images/moving_objects_diagram.png" alt="A moving point visualized as a curve and a moving region visualized as a stack of cross-sections over the x, y, t axes" width="480">
</div>
Together with these data types, <span class="secondo">Secondo</span> provides operations to
query and manipulate them, for example:
<div style="overflow-x:auto;">
<table style="border-collapse:collapse; margin-top:10px; max-width:22cm;">
<tr>
<th style="text-align:left; padding:6px 14px 6px 0; border-bottom:2px solid var(--secondo-red);">Operation</th>
<th style="text-align:left; padding:6px 14px 6px 0; border-bottom:2px solid var(--secondo-red);">Signature</th>
<th style="text-align:left; padding:6px 0 6px 0; border-bottom:2px solid var(--secondo-red);">Meaning</th>
</tr>
<tr>
<td style="padding:6px 14px 6px 0; vertical-align:top;"><code>trajectory</code></td>
<td style="padding:6px 14px 6px 0; vertical-align:top;">mpoint → line</td>
<td style="padding:6px 0 6px 0; vertical-align:top;">the 2D projection of a moving point</td>
</tr>
<tr>
<td style="padding:6px 14px 6px 0; vertical-align:top;"><code>distance</code></td>
<td style="padding:6px 14px 6px 0; vertical-align:top;">mpoint × point → mreal</td>
<td style="padding:6px 0 6px 0; vertical-align:top;">time-dependent distance between a moving point and a static point</td>
</tr>
<tr>
<td style="padding:6px 14px 6px 0; vertical-align:top;"><code>passes</code></td>
<td style="padding:6px 14px 6px 0; vertical-align:top;">mpoint × region → bool</td>
<td style="padding:6px 0 6px 0; vertical-align:top;">whether a moving point ever passes through a given area</td>
</tr>
<tr>
<td style="padding:6px 14px 6px 0; vertical-align:top;"><code>inside</code></td>
<td style="padding:6px 14px 6px 0; vertical-align:top;">mpoint × mregion → mbool</td>
<td style="padding:6px 0 6px 0; vertical-align:top;">time-dependent boolean indicating when the point is inside the moving region</td>
</tr>
</table>
</div>
This approach to modeling and querying moving objects is described in a series of papers and
in the textbook <i>Moving Objects Databases</i> (Morgan Kaufmann, 2005); see the
<a href="content_papers.html">Publications</a> page for details.
</div>
<h2 id="install"> Step 1: Install SECONDO </h2>
<div class="short">
If you do not yet have a <span class="secondo">Secondo</span> installation, the fastest way to
try it is the official container image. It bundles everything you need, so no local
build is required:
<pre>
docker run -d --name secondo -p 8000:8000 -p 1234:1234 \
-v secondo-databases:/var/lib/secondo/databases \
ghcr.io/secondo-database/secondo:latest
</pre>
This gives you the <span class="secondo">Secondo</span> WebUI in your browser at
<a href="http://localhost:8000">http://localhost:8000</a>; you can skip ahead to
<a href="#queries">Step 4</a>. If you would rather install
<span class="secondo">Secondo</span> natively (Ubuntu <code>.deb</code> packages, building from
source, or macOS via Homebrew), see the full
<a href="content_install.html">Installation Instructions</a> page and then come back here.
</div>
<h2 id="restore"> Step 2: Restore the Example Database </h2>
<div class="short">
<ol>
<li>
Open a shell and change to the <code>secondo/bin</code> directory (skip this step for the
Ubuntu <code>.deb</code> or container installation, where the
<span class="secondo">Secondo</span> commands are available from any directory):
<pre>cd secondo/bin</pre>
</li>
<li>
Start a single-user session:
<pre>./SecondoTTYBDB</pre>
</li>
<li>
Restore the example database used in this guide, then quit:
<pre>restore database berlintest from berlintest;
close database;
q</pre>
In the Ubuntu <code>.deb</code> installation, the database files live in
<code>/opt/secondo/bin</code>, so use instead:
<pre>restore database berlintest from '/opt/secondo/bin/berlintest';</pre>
A command at this interface is terminated by either a semicolon or an empty line.
</li>
</ol>
</div>
<h2 id="gui"> Step 3: Start the Kernel and the WebUI </h2>
<div class="short">
<ol start="4">
<li>
Still in <code>secondo/bin</code>, start the kernel process that user interfaces connect to:
<pre>./SecondoMonitor -s</pre>
</li>
<li>
Open a new shell, change to <code>secondo/WebUI</code> (not needed for the
<code>.deb</code> or container installation), and start the WebUI:
<pre>make venv native
make prod</pre>
After the command <code>make prod</code> has finished, the WebUI is available in your browser at
<a href="http://localhost:8000">http://localhost:8000</a>.
</li>
<li>
In the database and catalog view at the left of the WebUI, open the berlintest database.
Alternatively, you can also use the command line in the WebUI to open the database:
<pre>open database berlintest</pre>
</li>
</ol>
</div>
<h2 id="queries"> Step 4: Run Your First Queries </h2>
<div class="short">
<ol start="7">
<li>
To load the underground network of Berlin as a background, type:
<pre>query UBahn</pre>
Or click on the UBahn entry in the catalog view at the left. The network appears in the main view.
<div style="text-align:center; margin:16px 0;">
<img src="/images/screen_ubahn.jpg" width="640" height="495" alt="Secondo WebUI showing the Berlin underground network">
</div>
The Berlin underground network appears — we will use it
as a background for the moving trains stored in the relation
<code>Trains(Id: int, Line: int, Up: bool, Trip: mpoint)</code>, which holds 562 trains
moving on 2003‑11‑20.<br>
<br>
You can adjust the color and the width of the lines by clicking on the <code>UBahn</code> layer
on the top right and adjusting it.
</li>
<li>The coordinates of the berlintest database are non-standard WGS 84 coordinates.
To map them and be able to get a map background, click on the projection dropdown on the top left and
select BerlinMOD -> OSM.
<div style="text-align:center; margin:16px 0;">
<img src="/images/screen_ubahn_mapped.jpg" width="640" height="495" alt="The Berlin underground network overlaid on an OpenStreetMap background">
<div style="font-size:0.8rem; color:gray; margin-top:4px;">Map data © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors</div>
</div>
</li>
<li>
Look at a single train, a value of type <code>mpoint</code>:
<pre>query train7</pre>
Use the animation "forward" button to see it move along its trajectory. You can also adjust the speed or pause the animation. Furthermore, you can change the symbol of the train by clicking on the <code>train7</code> layer on the top right and adjusting it.
<div style="text-align:center; margin:16px 0;">
<img src="/images/screen_ubahn_moving.jpg" width="640" height="495" alt="Train7 shown as a moving point on the map, mid-animation along its route">
<div style="font-size:0.8rem; color:gray; margin-top:4px;">Map data © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors</div>
</div>
</li>
<li>
Compute the path <code>train7</code> has taken:
<pre>query trajectory(train7)</pre>
The width and the color of the line can be adjusted by clicking on the <code>trajectory(train7)</code> layer.
<div style="text-align:center; margin:16px 0;">
<img src="/images/screen_ubahn_trajectory.jpg" width="640" height="495" alt="The full trajectory of train7 drawn as a line on the map">
<div style="font-size:0.8rem; color:gray; margin-top:4px;">Map data © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors</div>
</div>
</li>
<li>
Compute the time-dependent distance between <code>train7</code> and the underground
station <code>mehringdamm</code>:
<pre>query mehringdamm</pre>
then
<pre>query distance(train7, mehringdamm)</pre>
On the left, you will see a value of type <code>mreal</code>, which is a time-dependent real number. It represents the distance between the train and the station over time; it drops to 0 when train7 passes through the station.
<div style="text-align:center; margin:16px 0;">
<img src="/images/screen_ubahn_mehringdam_mreal.jpg" width="640" height="495" alt="Plot of the time-dependent distance between train7 and the mehringdamm station, dropping to zero as the train passes through">
<div style="font-size:0.8rem; color:gray; margin-top:4px;">Map data © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors</div>
</div>
</li>
<li>
Find all trains passing through the static region <code>tiergarten</code>:
<pre>query Trains count
query Trains feed filter[.Trip passes tiergarten] count
query Trains feed filter[.Trip passes tiergarten] consume</pre>
This confirms 562 trains in total, of which 80 pass through <code>tiergarten</code>, and
then displays them.
</li>
<li>You can clear the query results by clicking on the X button in the layers panel.</li>
</ol>
</div>
<h2 id="optimizer"> Step 5: Use the Query Optimizer </h2>
<div class="short">
<ol start="14">
<li>
SQL-style queries can be used as well. Find how many trains pass through
<code>mehringdamm</code>:
<pre>select count(*) from Trains where Trip passes mehringdamm</pre>
The first optimizer query takes a little longer while it initializes; the result is 122.
See the individual trains with:
<pre>select * from Trains where Trip passes mehringdamm</pre>
</li>
<li>
Also more complex queries can be optimized, not just on moving objects. The
<code>berlintest</code> database also contains restaurants and sights of interest in Berlin.
Find the names and addresses of all Italian restaurants within 2 km of the
Brandenburg Gate:
<pre>select [r:name, r:strasse, r:geoData]
from [restaurants as r, sehenswuerdpoi as s]
where [ s:name="Brandenburger Tor",
r:art="Italienisch",
distance(r:geoData, s:geodata) < 2000]</pre>
<div style="text-align:center; margin:16px 0;">
<img src="/images/screen_restaurant.jpg" width="640" height="495" alt="Secondo GUI showing Italian restaurants near the Brandenburg Gate plotted on a map of Berlin">
<div style="font-size:0.8rem; color:gray; margin-top:4px;">Map data © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap</a> contributors</div>
</div>
</li>
</ol>
</div>
<h2 id="next"> Where to Go Next </h2>
<div class="short">
<ul>
<li> To browse the available data types and operations from the GUI command line, type
<code>list algebras</code>, or for one algebra, e.g.
<code>list algebra TemporalAlgebra</code>. To search for a specific operator, e.g.
<code>atinstant</code>:
<pre>query SEC2OPERATORINFO feed filter[.Name contains "atinstant"] consume</pre>
</li>
<li> Read more about the general and specific documentation on the
<a href="content_docu.html">Documentation</a> pages. </li>
<li> Try the larger <a href="/BerlinMOD/BerlinMOD.html">BerlinMOD Benchmark</a>, a full
benchmark suite for moving-objects databases built on the same data. </li>
<li> See the research in the <a href="content_papers.html">Publications</a>
list, including the <i>Moving Objects Databases</i> textbook. </li>
</ul>
</div>
<h2 id="papers"> Related Papers, Book </h2>
<div class="short">
The spatio-temporal data model implemented by <span class="secondo">Secondo</span> is
described in the following papers and in the textbook <i>Moving Objects Databases</i>. See
the <a href="content_papers.html">Publications</a> page for further
<span class="secondo">Secondo</span>-related papers.
<ol class="pub-list" style="max-width:22cm;">
<li>
<div class="pub-meta">
<span class="authors">M. Erwig, R.H. Güting, M. Schneider, and M. Vazirgiannis</span>
<span class="title">Spatio-Temporal Data Types: An Approach to Modeling and Querying Moving Objects in Databases</span>
<span class="venue">GeoInformatica 3:3 (1999), 269-296.</span>
</div>
<div class="pub-links">
<a href="https://doi.org/10.1023/A:1009805532638" target="_blank" rel="noopener noreferrer">Paper</a>
</div>
</li>
<li>
<div class="pub-meta">
<span class="authors">R.H. Güting, M.H. Böhlen, M. Erwig, C.S. Jensen, N.A. Lorentzos, M. Schneider, and M. Vazirgiannis</span>
<span class="title">A Foundation for Representing and Querying Moving Objects</span>
<span class="venue">ACM Transactions on Database Systems 25:1 (2000), 1-42.</span>
</div>
<div class="pub-links">
<a href="https://doi.org/10.1145/352958.352963" target="_blank" rel="noopener noreferrer">Paper</a>
</div>
</li>
<li>
<div class="pub-meta">
<span class="authors">L. Forlizzi, R.H. Güting, E. Nardelli, and M. Schneider</span>
<span class="title">A Data Model and Data Structures for Moving Objects Databases</span>
<span class="venue">Proc. ACM SIGMOD Conf. (Dallas, Texas), May 2000, 319-330.</span>
</div>
<div class="pub-links">
<a href="https://doi.org/10.1145/342009.335432" target="_blank" rel="noopener noreferrer">Paper</a>
</div>
</li>
<li>
<div class="pub-meta">
<span class="authors">J.A. Cotelo Lema, L. Forlizzi, R.H. Güting, E. Nardelli, and M. Schneider</span>
<span class="title">Algorithms for Moving Objects Databases</span>
<span class="venue">The Computer Journal 46:6 (2003), 680-712.</span>
</div>
<div class="pub-links">
<a href="https://doi.org/10.1093/comjnl/46.6.680" target="_blank" rel="noopener noreferrer">Paper</a>
</div>
</li>
<li>
<div class="pub-meta">
<span class="authors">R.H. Güting and M. Schneider</span>
<span class="title">Moving Objects Databases</span>
<span class="venue">Morgan Kaufmann Publishers, 2005. ISBN 978-1-55860-828-3.</span>
</div>
</li>
</ol>
</div>
<div class="footnote">
Last Changed: 2026-08-23
</div>