query-5c5732b7670f2e541513d93514cf0fb7
title:Count all external identifiers being from Italy SELECT ?ids_count (COUNT(?item) AS ?item_count) WHERE { SELECT ?item (COUNT(?ids) AS ?ids_count) WHERE { ?item wdt:P9114 ?id . OPTIONAL { ?item ?prop ?ids. ?propItem wikibase:directClaim ?prop. ?propItem wikibase:propertyType wikibase:ExternalId. ?propItem wdt:P17 wd:Q38.} } GROUP BY ?item } GROUP BY ?ids_count ORDER BY ?ids_count
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/>
#title:Count all external identifiers being from Italy
SELECT ?ids_count (COUNT(?item) AS ?item_count) WHERE {
SELECT ?item (COUNT(?ids) AS ?ids_count) WHERE {
?item wdt:P9114 ?id .
OPTIONAL {
?item ?prop ?ids.
?propItem wikibase:directClaim ?prop.
?propItem wikibase:propertyType wikibase:ExternalId.
?propItem wdt:P17 wd:Q38.}
} GROUP BY ?item
} GROUP BY ?ids_count
ORDER BY ?ids_count
Query found at
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/Queries
- https://www.wikidata.org/wiki/User:Ep%C3%ACdosis/sandbox
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?id")
v5("?ids")
v7("?ids_count"):::projected
v2("?item"):::projected
v7("?item_count")
v4("?prop")
v6("?propItem")
c6(["wd:Q38"]):::iri
c4(["wikibase:ExternalId"]):::iri
v2 --"wdt:P9114"--> v3
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v2 -->v4--> v5
v6 -."wikibase:directClaim".-> v4
v6 --"wikibase:propertyType"--> c4
v6 --"wdt:P17"--> c6
end
bind1[/"count(?ids)"/]
v5 --o bind1
bind1 --as--o v7
bind3[/"count(?item)"/]
v2 --o bind3
bind3 --as--o v7