query-0feb322948a122ce91a628234a5aa4be
Possible duplicates with zanikleobce.cz abandoned objects ID (P3003)
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX geof: <http://www.opengis.net/def/function/geosparql/>
#defaultView:Map
SELECT DISTINCT ?item ?itemLabel ?coord ?layer {
?item1 wdt:P3003 []; wdt:P625 ?coord1; rdfs:label ?label .
BIND( STRLANG( STR( IF( CONTAINS( ?label, ' (' ), STRBEFORE( ?label, ' (' ), ?label ) ), 'cs' ) AS ?itemLabel ) .
?itemLabel ^rdfs:label ?item2 .
FILTER( ?item1 != ?item2 ) .
FILTER EXISTS {
?item2 wdt:P17 wd:Q213; wdt:P625 ?coord2; wdt:P31/wdt:P279* wd:Q486972 .
FILTER( geof:distance( ?coord1, ?coord2 ) < 2 ) .
} .
OPTIONAL { ?item2 wdt:P625 ?coord2 } .
VALUES ?x { 1 2 } .
BIND( IF( ?x = 1, ?item1, ?item2 ) AS ?item ) .
BIND( IF( ?x = 1, ?coord1, ?coord2 ) AS ?coord ) .
BIND( IF( ?x = 1, 'zaniklá', 'druhá' ) AS ?layer ) .
} ORDER BY ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?coord"):::projected
v2("?coord1")
v3("?coord2")
v8("?item"):::projected
v5("?item1")
v4("?item2")
v7("?itemLabel"):::projected
v6("?label")
v10("?layer"):::projected
v7("?x")
a2((" "))
a1((" "))
c7(["wd:Q486972"]):::iri
c3(["wd:Q213"]):::iri
f0[[" "]]
subgraph f0e0["Exists Clause"]
e0f0[["http://www.opengis.net/def/function/geosparql/distance(?coord1,?coord2) < '2^^xsd:integer'"]]
e0f0 --> e0v1
e0f0 --> e0v2
e0v3 --"wdt:P17"--> e0c3
e0v3 --"wdt:P625"--> e0v2
e0v3 --"wdt:P31"--> e0a1
e0a1 --"wdt:P279"--> e0c7
e0v1("?coord1"):::projected
e0v2("?coord2"):::projected
e0v3("?item2"):::projected
e0a1((" ")):::projected
e0c7(["wd:Q486972"]):::iri
e0c3(["wd:Q213"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> v3
f0 --> v4
f0 --> c2
f0 --> c3
f0 --> c4
f0 --> c5
f0 --> a1
f0 --> c6
f0 --> c7
f1[["http://www.opengis.net/def/function/geosparql/distance(?coord1,?coord2) < '2^^xsd:integer'"]]
f1 --> v2
f1 --> v3
v4 --"wdt:P17"--> c3
v4 --"wdt:P625"--> v3
v4 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c7
f2[["?item1 != ?item2"]]
f2 --> v5
f2 --> v4
v5 --"wdt:P3003"--> a2
v5 --"wdt:P625"--> v2
v5 --"rdfs:label"--> v6
bind3[/"STRLANG(str(if(contains(?label,' ('),substring-before(?label,' ('),?label)),'cs')"/]
v6 --o bind3
bind3 --as--o v7
v4 --"rdfs:label"--> v7
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v4 -."wdt:P625".-> v3
end
bind4[/VALUES ?x/]
bind4-->v7
bind40(["1^^xsd:integer"])
bind40 --> bind4
bind41(["2^^xsd:integer"])
bind41 --> bind4
bind5[/"if(?x = '1^^xsd:integer',?item1,?item2)"/]
v7 --o bind5
v5 --o bind5
v4 --o bind5
bind5 --as--o v8
bind6[/"if(?x = '1^^xsd:integer',?coord1,?coord2)"/]
v7 --o bind6
v2 --o bind6
v3 --o bind6
bind6 --as--o v9
bind7[/"if(?x = '1^^xsd:integer','zaniklá','druhá')"/]
v7 --o bind7
bind7 --as--o v10