query-191664bba0c2a2b5a16eb1e1e86eea4b

rq turtle/ttl

List of Commons category and gallery pages per volume (Wikidata query service) SELECT DISTINCT ?volume ?volumeLabel ?CommonsCategory ?CommonsCategoryURL ?CommonsGallery ?CommonsGalleryURL WHERE { wd:Q117860156 wdt:P527 ?volume.

?volume wdt:P373 ?CommonsCategory. BIND(REPLACE(?CommonsCategory, " ", "_", "i") AS ?CommonsCat)
BIND(URI(CONCAT('https://commons.wikimedia.org/wiki/Category:', ?CommonsCat)) AS ?CommonsCategoryURL).

?volume wdt:P935 ?CommonsGallery. BIND(REPLACE(?CommonsGallery, " ", "_", "i") AS ?CommonsGal)
BIND(URI(CONCAT('https://commons.wikimedia.org/wiki/', ?CommonsGal)) AS ?CommonsGalleryURL).

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY ?volumeLabel

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#>
# List of Commons category and gallery pages per volume (Wikidata query service)
SELECT DISTINCT  ?volume  ?volumeLabel ?CommonsCategory ?CommonsCategoryURL ?CommonsGallery ?CommonsGalleryURL
WHERE 
{
  wd:Q117860156 wdt:P527 ?volume.

  ?volume wdt:P373 ?CommonsCategory.
  BIND(REPLACE(?CommonsCategory, " ", "_", "i") AS ?CommonsCat)  
  BIND(URI(CONCAT('https://commons.wikimedia.org/wiki/Category:', ?CommonsCat)) AS ?CommonsCategoryURL). 

  ?volume wdt:P935 ?CommonsGallery.
  BIND(REPLACE(?CommonsGallery, " ", "_", "i") AS ?CommonsGal)  
  BIND(URI(CONCAT('https://commons.wikimedia.org/wiki/', ?CommonsGal)) AS ?CommonsGalleryURL). 

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
}
ORDER BY  ?volumeLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?CommonsCat") v3("?CommonsCategory"):::projected v5("?CommonsCategoryURL"):::projected v7("?CommonsGal") v6("?CommonsGallery"):::projected v8("?CommonsGalleryURL"):::projected v2("?volume"):::projected v1("?volumeLabel"):::projected c6(["bd:serviceParam"]):::iri c1(["wd:Q117860156"]):::iri c8(["#91;AUTO_LANGUAGE#93;,en"]):::literal c1 --"wdt:P527"--> v2 v2 --"wdt:P373"--> v3 bind0[/"replace(?CommonsCategory,' ','_','i')"/] v3 --o bind0 bind0 --as--o v4 bind1[/"concat('https://commons.wikimedia.org/wiki/Category:',?CommonsCat)"/] v4 --o bind1 bind1 --as--o v5 v2 --"wdt:P935"--> v6 bind2[/"replace(?CommonsGallery,' ','_','i')"/] v6 --o bind2 bind2 --as--o v7 bind3[/"concat('https://commons.wikimedia.org/wiki/',?CommonsGal)"/] v7 --o bind3 bind3 --as--o v8 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end