query-fc3d5ef6054cc89ee90881a0a888b651
items in Austria with #countries (border check)
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 ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:Map{"hide":"?rgb"}
#title:items in Austria with #countries (border check)
SELECT ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer WHERE {
{
SELECT DISTINCT ?item (COUNT(DISTINCT ?country) as ?anz) WHERE {
?item wdt:P17 wd:Q40 . #16
#?item wdt:P131*/wdt:P279* wd:Q1973 .
?item wdt:P31 wd:Q8502 .
?item wdt:P625 [] .
?item wdt:P17 ?country .
}
GROUP BY ?item
}.
?item wdt:P31 [] .
?item p:P625 ?coordStatement .
?coordStatement ps:P625 ?coord .
BIND(IF(?anz = 1, '60ff60', 'ff0000') AS ?rgb) .
BIND(IF(?anz = 1, 'inside (single P17)', 'border (multiple P17)') AS ?layer) .
SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?anz"):::projected
v5("?coord"):::projected
v4("?coordStatement")
v2("?country")
v1("?item"):::projected
v7("?layer"):::projected
v6("?rgb"):::projected
a1((" "))
a2((" "))
c9(["bd:serviceParam"]):::iri
c2(["wd:Q40"]):::iri
c11(["#91;AUTO_LANGUAGE,de,en#93;"]):::literal
c4(["wd:Q8502"]):::iri
v1 --"p:direct/P17"--> c2
v1 --"p:direct/P31"--> c4
v1 --"p:direct/P625"--> a1
v1 --"p:direct/P17"--> v2
bind1[/"count(?country)"/]
v2 --o bind1
bind1 --as--o v3
v1 --"p:direct/P31"--> a2
v1 --"p:P625"--> v4
v4 --"p:statement/P625"--> v5
bind2[/"if(?anz = '1^^xsd:integer','60ff60','ff0000')"/]
v3 --o bind2
bind2 --as--o v6
bind3[/"if(?anz = '1^^xsd:integer','inside (single P17)','border (multiple P17)')"/]
v3 --o bind3
bind3 --as--o v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c9 --"wikibase:language"--> c11
end