Getting Started
This guide walks you through a "do it yourself" demo of Secondo,
the moving objects database system. In about 15–20 minutes you will install
Secondo, 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.
What is a Moving Object?
Secondo can represent and query complete histories of movement.
A trip taken by a vehicle can be stored as a single value of type
Together with these data types, Secondo provides operations to
query and manipulate them, for example:
This approach to modeling and querying moving objects is described in a series of papers and
in the textbook Moving Objects Databases (Morgan Kaufmann, 2005); see the
Publications page for details.
moving point
(mpoint for short), and the spread of a forest fire over time can be stored as a
single value of type moving region (mregion). 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.
| Operation | Signature | Meaning |
|---|---|---|
trajectory |
mpoint → line | the 2D projection of a moving point |
distance |
mpoint × point → mreal | time-dependent distance between a moving point and a static point |
passes |
mpoint × region → bool | whether a moving point ever passes through a given area |
inside |
mpoint × mregion → mbool | time-dependent boolean indicating when the point is inside the moving region |
Step 1: Install SECONDO
If you do not yet have a Secondo installation, the fastest way to
try it is the official container image. It bundles everything you need, so no local
build is required:
docker run -d --name secondo -p 8000:8000 -p 1234:1234 \
-v secondo-databases:/var/lib/secondo/databases \
ghcr.io/secondo-database/secondo:latest
This gives you the Secondo WebUI in your browser at
http://localhost:8000; you can skip ahead to
Step 4. If you would rather install
Secondo natively (Ubuntu .deb packages, building from
source, or macOS via Homebrew), see the full
Installation Instructions page and then come back here.
Step 2: Restore the Example Database
-
Open a shell and change to the
secondo/bindirectory (skip this step for the Ubuntu.debor container installation, where the Secondo commands are available from any directory):cd secondo/bin
-
Start a single-user session:
./SecondoTTYBDB
-
Restore the example database used in this guide, then quit:
restore database berlintest from berlintest; close database; q
In the Ubuntu.debinstallation, the database files live in/opt/secondo/bin, so use instead:restore database berlintest from '/opt/secondo/bin/berlintest';
A command at this interface is terminated by either a semicolon or an empty line.
Step 3: Start the Kernel and the WebUI
-
Still in
secondo/bin, start the kernel process that user interfaces connect to:./SecondoMonitor -s
-
Open a new shell, change to
secondo/WebUI(not needed for the.debor container installation), and start the WebUI:make venv native make prod
After the commandmake prodhas finished, the WebUI is available in your browser at http://localhost:8000. -
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:
open database berlintest
Step 4: Run Your First Queries
-
To load the underground network of Berlin as a background, type:
query UBahn
Or click on the UBahn entry in the catalog view at the left. The network appears in the main view.The Berlin underground network appears — we will use it as a background for the moving trains stored in the relation
Trains(Id: int, Line: int, Up: bool, Trip: mpoint), which holds 562 trains moving on 2003‑11‑20.
You can adjust the color and the width of the lines by clicking on theUBahnlayer on the top right and adjusting it. - 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.
Map data © OpenStreetMap contributors -
Look at a single train, a value of type
mpoint:query train7
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 thetrain7layer on the top right and adjusting it.
Map data © OpenStreetMap contributors -
Compute the path
train7has taken:query trajectory(train7)
The width and the color of the line can be adjusted by clicking on thetrajectory(train7)layer.
Map data © OpenStreetMap contributors -
Compute the time-dependent distance between
train7and the underground stationmehringdamm:query mehringdamm
thenquery distance(train7, mehringdamm)
On the left, you will see a value of typemreal, 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.
Map data © OpenStreetMap contributors -
Find all trains passing through the static region
tiergarten:query Trains count query Trains feed filter[.Trip passes tiergarten] count query Trains feed filter[.Trip passes tiergarten] consume
This confirms 562 trains in total, of which 80 pass throughtiergarten, and then displays them. - You can clear the query results by clicking on the X button in the layers panel.
Step 5: Use the Query Optimizer
-
SQL-style queries can be used as well. Find how many trains pass through
mehringdamm:select count(*) from Trains where Trip passes mehringdamm
The first optimizer query takes a little longer while it initializes; the result is 122. See the individual trains with:select * from Trains where Trip passes mehringdamm
-
Also more complex queries can be optimized, not just on moving objects. The
berlintestdatabase 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: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]
Map data © OpenStreetMap contributors
Where to Go Next
- To browse the available data types and operations from the GUI command line, type
list algebras, or for one algebra, e.g.list algebra TemporalAlgebra. To search for a specific operator, e.g.atinstant:query SEC2OPERATORINFO feed filter[.Name contains "atinstant"] consume
- Read more about the general and specific documentation on the Documentation pages.
- Try the larger BerlinMOD Benchmark, a full benchmark suite for moving-objects databases built on the same data.
- See the research in the Publications list, including the Moving Objects Databases textbook.
Related Papers, Book
The spatio-temporal data model implemented by Secondo is
described in the following papers and in the textbook Moving Objects Databases. See
the Publications page for further
Secondo-related papers.
Last Changed: 2026-08-23