query-03a49a9df328321f7172065cc63e1157

rq turtle/ttl

List of subcategories and gallery pages in Category:Flora Batava - KB copy (Commons query service)

Lazy query, we should do a UNION (?) to get a nice table with the Category and Gallery on the same row

SELECT ?page ?pageURL ?ns WITH { SELECT ?page ?ns WHERE { SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator" . bd:serviceParam wikibase:endpoint "commons.wikimedia.org" . bd:serviceParam mwapi:gcmtitle "Category:Flora Batava - KB copy" . bd:serviceParam mwapi:generator "categorymembers" . bd:serviceParam mwapi:gcmlimit "max" . ?page wikibase:apiOutput mwapi:title . ?ns wikibase:apiOutput "@ns". } FILTER regex (?ns, "(14|0)$") #(sub)categories & gallery pages only } } AS %get_files WHERE { INCLUDE %get_files BIND(REPLACE(?page, " ", "_", "i") AS ?p)
BIND(URI(CONCAT('https://commons.wikimedia.org/wiki/', ?p)) AS ?pageURL). } ORDER BY ?page

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
# List of subcategories and gallery pages in Category:Flora Batava - KB copy (Commons query service)
# Lazy query, we should do a UNION (?) to get a nice table with the Category and Gallery on the same row
SELECT ?page ?pageURL ?ns 
WHERE
{

{
  SELECT ?page ?ns
  WHERE
{
  SERVICE wikibase:mwapi
  {
    bd:serviceParam wikibase:api "Generator" .
    bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .
    bd:serviceParam mwapi:gcmtitle "Category:Flora Batava - KB copy" .
    bd:serviceParam mwapi:generator "categorymembers" .
    bd:serviceParam mwapi:gcmlimit "max" .
    ?page wikibase:apiOutput mwapi:title .
    ?ns wikibase:apiOutput "@ns".
  }
  FILTER regex (?ns, "(14|0)$")  #(sub)categories & gallery pages only
  }
}  BIND(REPLACE(?page, " ", "_", "i") AS ?p)  
  BIND(URI(CONCAT('https://commons.wikimedia.org/wiki/', ?p)) AS ?pageURL). 
} 
ORDER BY ?page

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?ns"):::projected v3("?p") v1("?page"):::projected v4("?pageURL"):::projected c13(["max"]):::literal c16(["@ns"]):::literal c9(["Category:Flora Batava - KB copy"]):::literal c11(["categorymembers"]):::literal c3(["bd:serviceParam"]):::iri c15(["mwapi:title"]):::iri c7(["commons.wikimedia.org"]):::literal c5(["Generator"]):::literal f0[["regex(?ns,'(14|0)$')"]] f0 --> v2 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c3 --"mwapi:api"--> c5 c3 --"mwapi:endpoint"--> c7 c3 --"mwapi:gcmtitle"--> c9 c3 --"mwapi:generator"--> c11 c3 --"mwapi:gcmlimit"--> c13 v1 --"mwapi:apiOutput"--> c15 v2 --"mwapi:apiOutput"--> c16 end bind1[/"replace(?page,' ','_','i')"/] v1 --o bind1 bind1 --as--o v3 bind2[/"concat('https://commons.wikimedia.org/wiki/',?p)"/] v3 --o bind2 bind2 --as--o v4