query-0b535aa558d98d1549e7e09edc6a3911
Железные дороги России
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#>
#defaultView:Map{"hide":["?coord1", "?coord2", "?line"]}
SELECT * WHERE {
?comm1 wdt:P31 wd:Q55488 ; wdt:P17 wd:Q159 ; wdt:P625 ?coord1 ; wdt:P197 ?comm2.
?comm1 wdt:P131* wd:Q5400.
MINUS { ?comm1 p:P31 [ ps:P31 wd:Q55488 ; pq:P582 [] ] . }
MINUS { ?comm2 p:P31 [ ps:P31 wd:Q55488 ; pq:P582 [] ] . }
?comm2 wdt:P625 ?coord2 .
?comm1 p:P625 [ ps:P625 []; psv:P625 [ wikibase:geoLongitude ?coord1lon; wikibase:geoLatitude ?coord1lat; ] ].
?comm2 p:P625 [ ps:P625 []; psv:P625 [ 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
a2((" "))
a4((" "))
a1((" "))
a3((" "))
a5((" "))
a7((" "))
a8((" "))
a10((" "))
a6((" "))
a9((" "))
c4(["wd:Q159"]):::iri
c2(["wd:Q55488"]):::iri
c8(["wd:Q5400"]):::iri
v1 --"p:direct/P31"--> c2
v1 --"p:direct/P17"--> c4
v1 --"p:direct/P625"--> v2
v1 --"p:direct/P197"--> v3
v1 --"p:direct/P131"--> c8
subgraph minus0["MINUS"]
style minus0 stroke-width:6px,fill:pink,stroke:red;
a1 --"p:statement/P31"--> c2
a1 --"p:qualifier/P582"--> a2
v1 --"p:P31"--> a1
end
subgraph minus1["MINUS"]
style minus1 stroke-width:6px,fill:pink,stroke:red;
a3 --"p:statement/P31"--> c2
a3 --"p:qualifier/P582"--> a4
v3 --"p:P31"--> a3
end
v3 --"p:direct/P625"--> v4
a5 --"p:statement/P625"--> a6
a7 --"wikibase:geoLongitude"--> v5
a7 --"wikibase:geoLatitude"--> v6
a5 --"p:statement/value/P625"--> a7
v1 --"p:P625"--> a5
a8 --"p:statement/P625"--> a9
a10 --"wikibase:geoLongitude"--> v7
a10 --"wikibase:geoLatitude"--> v8
a8 --"p:statement/value/P625"--> a10
v3 --"p:P625"--> a8
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