query-7d2508d44d8e5a8f50e1f6fd6d84eb2f

rq turtle/ttl

TODO

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#>
SELECT DISTINCT ?item ?itemLabel ?long (SAMPLE(?coords) AS ?coords) WHERE {
   VALUES ?town_city {wd:Q3957 wd:Q515} .
   ?item wdt:P31/wdt:P279* ?town_city .
   ?item wdt:P131* wd:Q173 .
   ?item p:P625/psv:P625/wikibase:geoLongitude ?long .
   ?item wdt:P625 ?coords
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?item ?itemLabel ?long
ORDER BY ?long LIMIT 40

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?coords"):::projected v3("?item"):::projected v1("?long"):::projected v2("?town_city") a1((" ")) a2((" ")) a3((" ")) c10(["bd:serviceParam"]):::iri c4(["wd:Q173"]):::iri c12(["#91;AUTO_LANGUAGE#93;,en"]):::literal bind0[/VALUES ?town_city/] bind0-->v2 bind00(["wd:Q3957"]) bind00 --> bind0 bind01(["wd:Q515"]) bind01 --> bind0 v3 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> v2 v3 --"p:direct/P131"--> c4 v3 --"p:P625"--> a2 a2 --"p:statement/value/P625"--> a3 a3 --"wikibase:geoLongitude"--> v1 v3 --"p:direct/P625"--> v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end bind2[/"sample(?coords)"/] v5 --o bind2 bind2 --as--o v5