QLever

From OpenStreetMap Wiki
Jump to navigation Jump to search
QLever
Authors: ad-freiburg (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 and ad-freiburg/osm2rdf

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 and ogc: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 Viewbutton appears
  • Via the Download button, you can download the query results in various formats
  • Via the Sharebutton, you can copy&paste a variety of API calls corresponding to the current query

Data status

The status of used OpenStreetMap dataset can be found on: https://osm2rdf.cs.uni-freiburg.de/ It seems there is an approach for a weekly update of OpenStreetMap data.

Examples

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 (called Qleverfile) 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