query-e235cd78b951d62fd2e801e8d87bbd6f

rq turtle/ttl

Random selection of images from a collectionIn theory, results should change each day.

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:ImageGrid
SELECT ?item ?itemLabel (SAMPLE(?img) AS ?image) WHERE {
  ?item wdt:P195 wd:Q109893034 .
  ?item wdt:P18 ?img
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  BIND(SHA512(CONCAT(STR(RAND()), STR(NOW()), STR(?item))) AS ?random)
} GROUP BY ?item ?itemLabel
ORDER BY ?random
LIMIT 20

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?image") v3("?img"):::projected v2("?item"):::projected v4("?random") c2(["wd:Q109893034"]):::iri c5(["bd:serviceParam"]):::iri c7(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"wdt:P195"--> c2 v2 --"wdt:P18"--> v3 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c5 --"wikibase:language"--> c7 end bind0[/"SHA512(concat(str(RAND()),str(NOW()),str(?item)))"/] v2 --o bind0 bind0 --as--o v4 bind2[/"sample(?img)"/] v3 --o bind2 bind2 --as--o v4