query-d4988ebe4c357f8805c41f5bb5161c13

rq turtle/ttl

Image gallery of the most notable libraries

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 DISTINCT ?library ?libraryLabel (SAMPLE(?image) AS ?image) ?sitelinks WHERE {
?library wdt:P31/wdt:P279* wd:Q7075 . # libraries or subtypes
MINUS {?library wdt:P31/wdt:P279* wd:Q212805} # but not digital libraries
?library wikibase:sitelinks ?sitelinks.
OPTIONAL {?library wdt:P18 ?img}
BIND (IF(BOUND(?img), ?img, <http://commons.wikimedia.org/wiki/Special:FilePath/No%20image%20available.svg>) AS ?image)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} GROUP BY ?library ?libraryLabel ?sitelinks
ORDER BY DESC(?sitelinks)
LIMIT 1000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v5("?image"):::projected v3("?img") v2("?library"):::projected v1("?sitelinks"):::projected a1((" ")) a2((" ")) c3(["wd:Q7075"]):::iri c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal c4(["wd:Q212805"]):::iri v2 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 subgraph minus0["MINUS"] style minus0 stroke-width:6px,fill:pink,stroke:red; v2 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c4 end v2 --"wikibase:sitelinks"--> v1 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P18".-> v3 end bind1[/"if(bound(?img),?img,http://commons.wikimedia.org/wiki/Special:FilePath/No%20image%20available.svg)"/] v3 --o bind1 bind1 --as--o v5 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind3[/"sample(?image)"/] v5 --o bind3 bind3 --as--o v5