QLever
QLever | |
---|---|
Authors: | ad-freiburg GitHub (Hannah Bast, Johannes Kalmbach, Patrick Brosi + many others) |
Platforms: | Linux, macOS, and others |
Website: | https://qlever.cs.uni-freiburg.de/osm-planet |
Source code: | ad-freiburg/qlever GitHub and ad-freiburg/osm2rdf GitHub |
An efficient SPARQL engine for very large datasets, including the complete OpenStreetMap data. Provides context-sensitive autocompletion, efficient support for geometric "contains" and "intersects" queries, and an interactive display of a large number of geometric objects on a map. |
QLever is an open-source general-purpose SPARQL engine with partial support for OGC GeoSPARQL 1.1. The public website provides access to SPARQL endpoints for a variety of large datasets, including RDF versions of the complete OpenStreetMap and OpenHistoricalMap datasets. Alternatively, you can set up a QLever instance locally yourself, as described below.
Notable features of QLever that are relevant for the OpenStreetMap data are:
- QLever can handle very large datasets efficiently. The OpenStreetMap data, when converted to RDF, has around 40 billion triples, see https://github.com/ad-freiburg/osm2rdf.
- SPARQL is a fully standardized query language. In particular, it allows easy federated search over mutiple datasets, for example, the OpenStreetMap data and Wikidata. Here is an example query: the power network of the EU .
- QLever provides context-sensitive autocompletion for writing SPARQL queries. That way, one can write queries without being an expert in SPARQL and without being familiar with the schema of the data.
- QLever provides efficient support for the GeoSPARQL predicates
ogc:sfContains
andogc:sfIntersects
. For example: all streets in in the Alps. - QLever can show large numbers of geometric objects on map interactively. For example, the query from the previous item returns around 4 million objects; to display them, click on the
MapView
button on the top right of the result list.
How to query OSM
- Choose the OSM Planet or OHM Planet dataset
- Choose an entry from the menu
Examples
at the bottom right or type your own query using the autocompletion - For query results with geometric information in the last column, a
Map View
button appears - Via the
Download
button, you can download the query results in various formats - Via the
Share
button, you can copy&paste a variety of API calls corresponding to the current query
Data status
QLever's OpenStreetMap coverage is based on the latest weekly planet file that has been processed into an osm2rdf dataset. Therefore, the data can be up to two weeks behind the OSM database. Expand the Index Information panel of the OSM Planet query tool to see the timestamp. QLever's OpenHistoricalMap coverage is based on OHM's daily planet, so it can be up to one day old.
Prefixes
Prefix | URL | Description |
---|---|---|
osmnode: |
https://www.openstreetmap.org/node/ |
Node IDs |
osmway: |
https://www.openstreetmap.org/way/ |
Way IDs |
osmrel: |
https://www.openstreetmap.org/relation/ |
Relation IDs, plus relation metakeys such as osmrel:member
|
osmkey: |
https://www.openstreetmap.org/wiki/Key: |
Keys |
osmmeta: |
https://www.openstreetmap.org/meta/ |
Element metakeys such as osmmeta:timestamp
|
osm2rdf: |
https://osm2rdf.cs.uni-freiburg.de/rdf# |
Metakeys added by osm2rdf such as osm2rdf:facts , osm2rdf:length , and osm2rdf:area
|
osm2rdfkey: |
https://osm2rdf.cs.uni-freiburg.de/rdf/key# |
Keys reinterpreted as RDF types by osm2rdf, such as osm2rdfkey:wikidata (as wd: )
|
osm2rdfmember: |
https://osm2rdf.cs.uni-freiburg.de/rdf/member# |
Relation member metakeys such as osm2rdfmember:role and osm2rdfmember:id
|
Some of these prefixes are shared with OpenHistoricalMap.
Examples
- The main list of examples for QLever can be found in the Example queries subpage.
- https://qlever.cs.uni-freiburg.de/osm-planet provides many example queries, just click on the
Examples
button. - SPARQL vs Overpass QL examples contains examples of QLever queries with the equivalent Sophox and Overpass queries.
- See also the example OpenHistoricalMap queries.
Self-hosting
QLever is open source and easy to use. To set up your own QLever instance, go to https://github.com/ad-freiburg/qlever-control and follow the instructions there. To setup a QLever instance for the OpenStreetMap data, do the following
- Install the
qlever
script by following the instructions on https://github.com/ad-freiburg/qlever-control - Do
qlever setup-config osm-planet
to get a prefilled config file (calledQleverfile
) for the OpenStreepMap data - Edit
Qleverfile
in case you want to download only the data for a particular country (e.g., for testing) - Do
qlever get-data
to download the data from https://osm2rdf.cs.uni-freiburg.de/ - Do
qlever index
to build a QLever index for that data (indexing speed up to 5 billion triples per hour on modern hardware) - Do
qlever start
to start the server - Do
qlever test-query
to launch a test query and check whether everythings works - Do
qlever ui
to launch a version of the QLever UI like the one on https://qlever.cs.uni-freiburg.de/osm-planet - Do
qlever autocompletion-warmup
to speed up the autocompletion in the UI
External links
- OpenStreetMap planet instance
- OpenHistoricalMap instance
- Post about QLever on OSM diary