query-a8884b3247d8d75b61e5ac7f6abfa6df
Collections
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX target: <http://www.wikidata.org/entity/Q35>
SELECT
?items
?collection ?collectionLabel
(CONCAT("#collection/", SUBSTR(STR(?collection), 32)) AS ?collectionUrl)
?collectionDescription
?example_item ?example_itemLabel
WHERE {
{
SELECT
(COUNT(?item) AS ?items)
?collection
(SAMPLE(?item) AS ?example_item)
WHERE {
?collection ^wdt:P195 ?item ;
wdt:P17 target: .
}
GROUP BY ?collection
} SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?items)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?collection"):::projected
v5("?collectionUrl")
v4("?example_item"):::projected
v2("?item")
v4("?items"):::projected
c5(["bd:serviceParam"]):::iri
c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c3([http://www.wikidata.org/entity/Q35]):::iri
v2 --"wdt:P195"--> v3
v3 --"wdt:P17"--> c3
bind2[/"count(?item)"/]
v2 --o bind2
bind2 --as--o v4
bind3[/"sample(?item)"/]
v2 --o bind3
bind3 --as--o v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end
bind4[/"concat('#collection/',substring(str(?collection),'32^^xsd:integer'))"/]
v3 --o bind4
bind4 --as--o v5