query-134be7d017a050bf71f90417abc95141
TODO
Use at
- https://query.wikidata.org/sparql
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 geo: <http://www.opengis.net/ont/geosparql#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide":["?line"]}
SELECT ?item ?osm ?itemLabel ?term1 ?term1Label ?term2 ?term2Label ?line WHERE {
?item wdt:P31/wdt:P279* wd:Q728937 .
?item wdt:P402 ?osm .
# ?item wdt:P17 wd:Q213 . # country = Czech Republic
?item wdt:P609 ?term1 .
?item wdt:P609 ?term2
FILTER(str(?term1) < str(?term2))
?term1 p:P625/psv:P625/wikibase:geoLatitude ?lat1 .
?term1 p:P625/psv:P625/wikibase:geoLongitude ?lon1 .
?term2 p:P625/psv:P625/wikibase:geoLatitude ?lat2 .
?term2 p:P625/psv:P625/wikibase:geoLongitude ?lon2 .
BIND(CONCAT('LINESTRING (', STR(?lon1), ' ', STR(?lat1), ',', STR(?lon2), ' ', STR(?lat2), ')') AS ?str) .
BIND(STRDT(?str, geo:wktLiteral) AS ?line)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?item"):::projected
v5("?lat1")
v7("?lat2")
v10("?line"):::projected
v6("?lon1")
v8("?lon2")
v4("?osm"):::projected
v9("?str")
v1("?term1"):::projected
v2("?term2"):::projected
a1((" "))
a2((" "))
a3((" "))
a4((" "))
a5((" "))
a6((" "))
a7((" "))
a8((" "))
a9((" "))
c3(["wd:Q728937"]):::iri
c11(["bd:serviceParam"]):::iri
c13(["#91;AUTO_LANGUAGE#93;,en"]):::literal
f0[["str(?term1) < str(?term2)"]]
f0 --> v1
f0 --> v2
v3 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v3 --"p:direct/P402"--> v4
v3 --"p:direct/P609"--> v1
v3 --"p:direct/P609"--> v2
v1 --"p:P625"--> a2
a2 --"p:statement/value/P625"--> a3
a3 --"wikibase:geoLatitude"--> v5
v1 --"p:P625"--> a4
a4 --"p:statement/value/P625"--> a5
a5 --"wikibase:geoLongitude"--> v6
v2 --"p:P625"--> a6
a6 --"p:statement/value/P625"--> a7
a7 --"wikibase:geoLatitude"--> v7
v2 --"p:P625"--> a8
a8 --"p:statement/value/P625"--> a9
a9 --"wikibase:geoLongitude"--> v8
bind1[/"concat('LINESTRING (',str(?lon1),' ',str(?lat1),',',str(?lon2),' ',str(?lat2),')')"/]
v6 --o bind1
v5 --o bind1
v8 --o bind1
v7 --o bind1
bind1 --as--o v9
bind2[/"STRDT(?str,'geo:wktLiteral')"/]
v9 --o bind2
bind2 --as--o v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end