query-92ccface7dfaa8e7601015aeb08d3dfe
Railway network in Lithuania
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>
#title:Railway network in Lithuania
#defaultView:Map{"hide":["?coord1", "?coord2", "?line"]}
SELECT * WHERE {
?comm1 wdt:P31 wd:Q55488;
wdt:P17 wd:Q37;
wdt:P625 ?coord1;
wdt:P197 ?comm2.
MINUS {
?comm1 p:P31 _:b11.
_:b11 ps:P31 wd:Q55488;
pq:P582 _:b10.
}
MINUS {
?comm2 p:P31 _:b13.
_:b13 ps:P31 wd:Q55488;
pq:P582 _:b12.
}
?comm2 wdt:P625 ?coord2.
?comm1 p:P625 _:b16.
_:b16 ps:P625 _:b14;
psv:P625 _:b15.
_:b15 wikibase:geoLongitude ?coord1lon;
wikibase:geoLatitude ?coord1lat.
?comm2 p:P625 _:b19.
_:b19 ps:P625 _:b17;
psv:P625 _:b18.
_:b18 wikibase:geoLongitude ?coord2lon;
wikibase:geoLatitude ?coord2lat.
BIND(CONCAT("LINESTRING (", STR(?coord1lon), " ", STR(?coord1lat), ",", STR(?coord2lon), " ", STR(?coord2lat), ")") AS ?str)
BIND(STRDT(?str, geo:wktLiteral) AS ?line)
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?comm1"):::projected
v3("?comm2"):::projected
v2("?coord1"):::projected
v6("?coord1lat"):::projected
v5("?coord1lon"):::projected
v4("?coord2"):::projected
v8("?coord2lat"):::projected
v7("?coord2lon"):::projected
v10("?line"):::projected
v9("?str"):::projected
a1((" "))
a10((" "))
a2((" "))
a3((" "))
a4((" "))
a5((" "))
a6((" "))
a7((" "))
a8((" "))
a9((" "))
c4(["wd:Q37"]):::iri
c2(["wd:Q55488"]):::iri
v1 --"p:direct/P31"--> c2
v1 --"p:direct/P17"--> c4
v1 --"p:direct/P625"--> v2
v1 --"p:direct/P197"--> v3
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
v1 --"p:P31"--> a1
a1 --"p:statement/P31"--> c2
a1 --"p:qualifier/P582"--> a2
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
v3 --"p:P31"--> a3
a3 --"p:statement/P31"--> c2
a3 --"p:qualifier/P582"--> a4
end
v3 --"p:direct/P625"--> v4
v1 --"p:P625"--> a5
a5 --"p:statement/P625"--> a6
a5 --"p:statement/value/P625"--> a7
a7 --"wikibase:geoLongitude"--> v5
a7 --"wikibase:geoLatitude"--> v6
v3 --"p:P625"--> a8
a8 --"p:statement/P625"--> a9
a8 --"p:statement/value/P625"--> a10
a10 --"wikibase:geoLongitude"--> v7
a10 --"wikibase:geoLatitude"--> v8
bind2[/"concat('LINESTRING (',str(?coord1lon),' ',str(?coord1lat),',',str(?coord2lon),' ',str(?coord2lat),')')"/]
v5 --o bind2
v6 --o bind2
v7 --o bind2
v8 --o bind2
bind2 --as--o v9
bind3[/"STRDT(?str,'geo:wktLiteral')"/]
v9 --o bind3
bind3 --as--o v10