Queries behind Table 3 of our paper

For each subsection, we give the four concrete queries for the four backends in this order (which is also the order of the columns in Table 3)
QLever http://osm2rdf.cs.uni-freiburg.de:8080/osm-planet
Overpass API http://osm2rdf.cs.uni-freiburg.de:8081
PostGIS http://osm2rdf.cs.uni-freiburg.de:8083/pgadmin4/browser
Sophox https://sophox.org

For Q4 (OSM Germany):
QLever http://osm2rdf.cs.uni-freiburg.de:8080/osm-germany
Overpass API http://osm2rdf.cs.uni-freiburg.de:8082

Q1 = all university buildings

QLever

PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
SELECT ?osm_id ?geometry WHERE {
  ?osm_id osmkey:building "university" .
  ?osm_id geo:hasGeometry ?geometry .
}

Direct link to query with QLever

Overpass

way[building=university];
out geom;

Direct link to query with Overpass

PostGIS

SELECT osm_id, way
FROM planet_osm_polygon
WHERE way building = 'university';

Link to PostGIS instance (copy&paste query)

Sophox

PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
SELECT ?osm_id ?centroid WHERE {
  ?osm_id osmt:building "university" .
  ?osm_id osmm:loc ?centroid .
}

Direct link to query with Sophox

Q2 = all university buildings in the bounding box of Germany

QLever

PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX osm: <https://www.openstreetmap.org/>
SELECT ?osm_id ?geometry WHERE {
  ?osm_id osmkey:building "university" .
  ?osm_id geo:hasGeometry ?geometry .
  ?osm_id osm:envelope ?envelope .
  FILTER contained(?envelope, "LINESTRING(5.866315 47.270111, 15.041809 55.099161)")
}

Direct link to query with QLever

Overpass

way[building=university](47.270111, 5.866315, 55.099161 ,15.041809);
out geom;

Direct link to query with Overpass

PostGIS

SELECT osm_id, way
FROM planet_osm_polygon
WHERE way && ST_Transform(ST_MakeEnvelope(5.866315, 47.270111, 15.041809, 55.099161, 4326), 3857)
AND building = 'university';

Link to PostGIS instance (copy&paste query)

Sophox

PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
SELECT ?osm_id ?centroid WHERE {
  ?osm_id osmt:building "university" .
  SERVICE wikibase:box {
    ?osm_id osmm:loc ?centroid .
    bd:serviceParam wikibase:cornerSouthWest "Point(5.866315 47.270111)"^^geo:wktLiteral .
    bd:serviceParam wikibase:cornerNorthEast "Point(15.041809 55.099161)"^^geo:wktLiteral .
  }
}

Direct link to query with Sophox

Q3 = all university buildings in the bounding box of Freiburg

QLever

PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
PREFIX osm: <https://www.openstreetmap.org/>
SELECT ?osm_id ?geometry WHERE {
  ?osm_id osmkey:building "university" .
  ?osm_id geo:hasGeometry ?geometry .
  ?osm_id osm:envelope ?envelope .
  FILTER contained(?envelope, "LINESTRING(7.662006 47.903578, 7.930844 48.071058)")
}

Direct link to query with QLever

Overpass

way[building=university](47.903578, 7.662006, 48.071058, 7.930844);
out geom;

Direct link to query with Overpass

PostGIS

SELECT osm_id, way
FROM planet_osm_polygon
WHERE way && ST_Transform(ST_MakeEnvelope(7.662006, 47.903578, 7.930844, 48.071058, 4326), 3857)
AND building = 'university';

Link to PostGIS instance (copy&paste query)

Sophox

PREFIX osmt: <https://wiki.openstreetmap.org/wiki/Key:>
PREFIX osmm: <https://www.openstreetmap.org/meta/>
SELECT ?osm_id ?centroid WHERE {
  ?osm_id osmt:building "university" .
  SERVICE wikibase:box {
    ?osm_id osmm:loc ?centroid .
    bd:serviceParam wikibase:cornerSouthWest "Point(7.662006 47.903578)"^^geo:wktLiteral .
    bd:serviceParam wikibase:cornerNorthEast "Point(7.930844 48.071058)"^^geo:wktLiteral .
  }
}

Direct link to query with Sophox

Q4 = all university buildings in Freiburg

QLever

PREFIX osmrel: <https://www.openstreetmap.org/relation/>
PREFIX osmkey: <https://www.openstreetmap.org/wiki/Key:>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
SELECT ?osm_id ?geometry WHERE {
  osmrel:62768 ql:contains ?osm_id .
  ?osm_id osmkey:building "university" .
  ?osm_id geo:hasGeometry ?geometry .
}

Direct link to query with QLever

Overpass

relation(62768);
map_to_area;
way[building=university](area);
out geom;

Direct link to query with Overpass

PostGIS

SELECT osm_id, way
FROM planet_osm_polygon
WHERE way && ( SELECT way FROM planet_osm_polygon WHERE osm_id = -62768 )
AND building = 'university';

Link to PostGIS instance (copy&paste query)

Sophox

[no Sophox support for “contained in geometry” queries]