query-a9c57d6bfe93b66d645b9b2787cf5c7d

rq turtle/ttl

Collections

Use at

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/Q128933830>

SELECT 
  ?artworks

  ?collection ?collectionLabel 
  (CONCAT("#collection/", SUBSTR(STR(?collection), 32)) AS ?collectionUrl)

  ?example_artwork ?example_artworkLabel
  (CONCAT("#artwork/", SUBSTR(STR(?example_artwork), 32)) AS ?example_artworkUrl)
WHERE {
   {
  SELECT
    (COUNT(?artwork) AS ?artworks)
    ?collection
    (SAMPLE(?artwork) AS ?example_artwork)
  WHERE {
    ?artwork wdt:P608 target: ;
             wdt:P195 ?collection .
  }
  GROUP BY ?collection
}  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,cz,da,de,es,fr,jp,nb,nl,nn,sv,zh". }
}
ORDER BY DESC(?artworks)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?artwork") v4("?artworks"):::projected v3("?collection"):::projected v5("?collectionUrl") v4("?example_artwork"):::projected v6("?example_artworkUrl") c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,mul,en,cz,da,de,es,fr,jp,nb,nl,nn,sv,zh"]):::literal c2([http://www.wikidata.org/entity/Q128933830]):::iri v2 --"wdt:P608"--> c2 v2 --"wdt:P195"--> v3 bind2[/"count(?artwork)"/] v2 --o bind2 bind2 --as--o v4 bind3[/"sample(?artwork)"/] 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 bind5[/"concat('#artwork/',substring(str(?example_artwork),'32^^xsd:integer'))"/] v4 --o bind5 bind5 --as--o v6