query-f21c92ad8e262a8e4dc9eac64a363ddb
Propertiescountry (P17)located in the administrative territorial entity (P131)
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#>
SELECT ?item ?itemLabel ( COUNT(?iedvien) as ?iedv1 ) ( COUNT(?iedvien) - COUNT(DISTINCT ?iedvien) AS ?iedv)
WHERE
{
?item p:P131/ps:P131 ?iedvien .
?item wdt:P17 wd:Q211 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}
GROUP BY ?item ?itemLabel
HAVING (?iedv1 > 1) # for testing
# HAVING (?iedv > 1) # to find actual duplicates
ORDER BY DESC(?iedv) ?itemLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?iedv")
v6("?iedv1")
v5("?iedvien"):::projected
v4("?item"):::projected
v2("?itemLabel"):::projected
a1((" "))
c7(["bd:serviceParam"]):::iri
c9(["en"]):::literal
c5(["wd:Q211"]):::iri
f0[["?iedv1 > '1^^xsd:integer'"]]
f0 --> v6
v4 --"p:P131"--> a1
a1 --"p:statement/P131"--> v5
v4 --"p:direct/P17"--> c5
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c7 --"wikibase:language"--> c9
end
bind4[/"count(?iedvien)"/]
v5 --o bind4
bind4 --as--o v6
bind5[/" - "/]
null --o bind5
null --o bind5
bind5 --as--o v6