query-4fb926c3759078803ee31bda3400d0b4
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 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#>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map
SELECT ?line
{
?airport1 wdt:P31/wdt:P279* wd:Q1248784 ;
wdt:P625 ?airportNode .
?airport1 p:P521 ?linkStatement .
?linkStatement ps:P521 ?airport2 ;
pq:P137 wd:Q204296 .
?airport1 p:P625 [psv:P625 [ wikibase:geoLongitude ?coord1lon; wikibase:geoLatitude ?coord1lat; ] ] .
?airport2 p:P625 [psv:P625 [ wikibase:geoLongitude ?coord2lon; wikibase:geoLatitude ?coord2lat; ] ] .
BIND(IF(?coord1lon < 0, ?coord1lon + 360, ?coord1lon) AS ?coord1lonB) .
BIND(IF(?coord2lon < 0, ?coord2lon + 360, ?coord2lon) AS ?coord2lonB) .
BIND(CONCAT('LINESTRING (', STR(?coord1lonB), ' ', STR(?coord1lat), ',', STR(?coord2lonB), ' ', STR(?coord2lat), ')') AS ?str) .
BIND(STRDT(?str, geo:wktLiteral) AS ?line) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?airport1")
v4("?airport2")
v2("?airportNode")
v6("?coord1lat")
v5("?coord1lon")
v9("?coord1lonB")
v8("?coord2lat")
v7("?coord2lon")
v10("?coord2lonB")
v12("?line"):::projected
v3("?linkStatement")
v11("?str")
a1((" "))
a3((" "))
a2((" "))
a5((" "))
a4((" "))
c8(["wd:Q204296"]):::iri
c16(["en"]):::literal
c3(["wd:Q1248784"]):::iri
c14(["bd:serviceParam"]):::iri
v1 --"p:direct/P31"--> a1
a1 --"p:direct/P279"--> c3
v1 --"p:direct/P625"--> v2
v1 --"p:P521"--> v3
v3 --"p:statement/P521"--> v4
v3 --"p:qualifier/P137"--> c8
a2 --"wikibase:geoLongitude"--> v5
a2 --"wikibase:geoLatitude"--> v6
a3 --"p:statement/value/P625"--> a2
v1 --"p:P625"--> a3
a4 --"wikibase:geoLongitude"--> v7
a4 --"wikibase:geoLatitude"--> v8
a5 --"p:statement/value/P625"--> a4
v4 --"p:P625"--> a5
bind0[/"if(?coord1lon < '0^^xsd:integer',?coord1lon + '360^^xsd:integer',?coord1lon)"/]
v5 --o bind0
bind0 --as--o v9
bind1[/"if(?coord2lon < '0^^xsd:integer',?coord2lon + '360^^xsd:integer',?coord2lon)"/]
v7 --o bind1
bind1 --as--o v10
bind2[/"concat('LINESTRING (',str(?coord1lonB),' ',str(?coord1lat),',',str(?coord2lonB),' ',str(?coord2lat),')')"/]
v9 --o bind2
v6 --o bind2
v10 --o bind2
v8 --o bind2
bind2 --as--o v11
bind3[/"STRDT(?str,'geo:wktLiteral')"/]
v11 --o bind3
bind3 --as--o v12
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c14 --"wikibase:language"--> c16
end