query-830d789dd4b56a43cb2e4a16c4564acf

rq turtle/ttl

What hospitals are there in East-Berlin? We then return all hospitals, the longitude of which is greater than the longitude of the Brandenburg Gate. The issue with that is that some Berlin hospitals miss a coordinate location and those will be left out from the results. ]5[To retrieve the hospitals from the eastern parts of Berlin, we can filter for hospitals’ coordinate location, then compare its longitude parameter to the center of Berlin. As Berlin’s center we have chosen its historical center at the Brandenburg Gate, which is located at latitude 52.516266, longitude 13.377775.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#All hospitals from East-Berlin (estimated)
#defaultView:Map
SELECT ?item ?itemLabel ?coordPoints ?lon ?lat WHERE
{
    ?item wdt:P31 wd:Q16917. #is hospital
    ?item wdt:P131 wd:Q64. #in Berlin
    ?item p:P625 ?coord.
    ?item wdt:P625 ?coordPoints.
    ?coord psv:P625 ?coordNode.
    ?coordNode wikibase:geoLongitude ?lon.
    ?coordNode wikibase:geoLatitude ?lat.  
    FILTER (?lon > 13.377775) #East from Brandenburger Tor
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?coord") v5("?coordNode") v4("?coordPoints"):::projected v2("?item"):::projected v6("?lat"):::projected v1("?lon"):::projected c14(["de"]):::literal c5(["wd:Q64"]):::iri c12(["bd:serviceParam"]):::iri c3(["wd:Q16917"]):::iri f0[["?lon > '13.377775^^xsd:decimal'"]] f0 --> v1 v2 --"p:direct/P31"--> c3 v2 --"p:direct/P131"--> c5 v2 --"p:P625"--> v3 v2 --"p:direct/P625"--> v4 v3 --"p:statement/value/P625"--> v5 v5 --"wikibase:geoLongitude"--> v1 v5 --"wikibase:geoLatitude"--> v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c12 --"wikibase:language"--> c14 end