query-17a16180b3615c787448e8c55e27fee0

rq turtle/ttl

For all non-plate, non-text pages (in Category:Flora Batava - KB copy, and its subcategories), are all required structured data fields present?

Example File:Preface NL 01 - FloraBatava-KB-v01.jpg

- collection (P195) = Koninklijke Bibliotheek (Q1526131)

- instance of (P31) = digital image (Q1250322)

- copyright status (P6216) = public domain (Q19652)

SELECT DISTINCT ?file ?title ?collection ?instanceof ?copyrightstatus WITH { SELECT ?file ?title 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 "100" . ?categoryName wikibase:apiOutput mwapi:title . ?ns wikibase:apiOutput "@ns". } FILTER (?ns = "14") # (sub)categories only

SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Generator" . bd:serviceParam wikibase:endpoint "commons.wikimedia.org" . bd:serviceParam mwapi:gcmtitle ?categoryName. bd:serviceParam mwapi:generator "categorymembers" . bd:serviceParam mwapi:gcmtype "file" . bd:serviceParam mwapi:gcmlimit "3000" . ?title wikibase:apiOutput mwapi:title . ?pageid wikibase:apiOutput "@pageid" . } BIND (URI(CONCAT('https://commons.wikimedia.org/entity/M', ?pageid)) AS ?file) } } AS %get_files WHERE { INCLUDE %get_files

FILTER(!REGEX(?title,"(Pl[0-9]{4} - FloraBatava-KB-v[0-9]{2}.jpg)$")) FILTER(!REGEX(?title,"(DescriptionFR[0-9]+ - FloraBatava-KB-v[0-9]{2}.jpg)$")) FILTER(!REGEX(?title,"(DescriptionNL[0-9]+ - FloraBatava-KB-v[0-9]{2}.jpg)$"))

OPTIONAL{ ?file wdt:P195 ?collection.} # collection (P195) = Koninklijke Bibliotheek (Q1526131) OPTIONAL{ ?file wdt:P6216 ?copyrightstatus.} # copyright status (P6216) = public domain (Q19652) OPTIONAL {?file wdt:P31 ?instanceof. FILTER (?instanceof = wd:Q1250322)} # ?instanceof must be a digital image (Q1250322) } ORDER BY ?title

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
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#>
# For all non-plate, non-text pages (in Category:Flora Batava - KB copy, and its subcategories), are all required structured data fields present?
# Example File:Preface NL 01 - FloraBatava-KB-v01.jpg
# - collection (P195) = Koninklijke Bibliotheek (Q1526131)
# - instance of (P31) = digital image (Q1250322)
# - copyright status (P6216) = public domain (Q19652)

SELECT DISTINCT 
?file ?title ?collection ?instanceof ?copyrightstatus
WHERE
{

{
  SELECT ?file ?title
  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 "100" .
    ?categoryName wikibase:apiOutput mwapi:title .
    ?ns wikibase:apiOutput "@ns".
  }
  FILTER (?ns = "14") # (sub)categories only

  SERVICE wikibase:mwapi
  {
    bd:serviceParam wikibase:api "Generator" .
    bd:serviceParam wikibase:endpoint "commons.wikimedia.org" .
    bd:serviceParam mwapi:gcmtitle ?categoryName.
    bd:serviceParam mwapi:generator "categorymembers" .
    bd:serviceParam mwapi:gcmtype "file" .
    bd:serviceParam mwapi:gcmlimit "3000" .
    ?title wikibase:apiOutput mwapi:title .
    ?pageid wikibase:apiOutput "@pageid" .
  }
    BIND (URI(CONCAT('https://commons.wikimedia.org/entity/M', ?pageid)) AS ?file)
  }
}          
  FILTER(!REGEX(?title,"(Pl[0-9]{4} - FloraBatava-KB-v[0-9]{2}.jpg)$")) 
  FILTER(!REGEX(?title,"(DescriptionFR[0-9]+ - FloraBatava-KB-v[0-9]{2}.jpg)$")) 
  FILTER(!REGEX(?title,"(DescriptionNL[0-9]+ - FloraBatava-KB-v[0-9]{2}.jpg)$")) 

  OPTIONAL{ ?file wdt:P195 ?collection.}  # collection (P195) = Koninklijke Bibliotheek (Q1526131)
  OPTIONAL{ ?file wdt:P6216 ?copyrightstatus.}  # copyright status (P6216) = public domain (Q19652)
  OPTIONAL {?file wdt:P31 ?instanceof.
            FILTER (?instanceof = wd:Q1250322)} # ?instanceof must be a digital image (Q1250322) 
 } ORDER BY ?title

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v4("?categoryName") v7("?collection"):::projected v8("?copyrightstatus"):::projected v6("?file"):::projected v2("?instanceof"):::projected v3("?ns") v5("?pageid") v1("?title"):::projected c20(["@ns"]):::literal c23(["3000"]):::literal c13(["Category:Flora Batava - KB copy"]):::literal c7(["bd:serviceParam"]):::iri c22(["file"]):::literal c11(["commons.wikimedia.org"]):::literal c24(["@pageid"]):::literal c15(["categorymembers"]):::literal c17(["100"]):::literal c19(["mwapi:title"]):::iri c9(["Generator"]):::literal f0[["not regex(?title,'(DescriptionNL#91;0-9#93;+ - FloraBatava-KB-v#91;0-9#93;{2}.jpg)$')"]] f0 --> v1 f1[["not regex(?title,'(DescriptionFR#91;0-9#93;+ - FloraBatava-KB-v#91;0-9#93;{2}.jpg)$')"]] f1 --> v1 f2[["not regex(?title,'(Pl#91;0-9#93;{4} - FloraBatava-KB-v#91;0-9#93;{2}.jpg)$')"]] f2 --> v1 f3[["?ns = '14'"]] f3 --> v3 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c7 --"mwapi:api"--> c9 c7 --"mwapi:endpoint"--> c11 c7 --"mwapi:gcmtitle"--> c13 c7 --"mwapi:generator"--> c15 c7 --"mwapi:gcmlimit"--> c17 v4 --"mwapi:apiOutput"--> c19 v3 --"mwapi:apiOutput"--> c20 end subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c7 --"mwapi:api"--> c9 c7 --"mwapi:endpoint"--> c11 c7 --"mwapi:gcmtitle"--> v4 c7 --"mwapi:generator"--> c15 c7 --"mwapi:gcmtype"--> c22 c7 --"mwapi:gcmlimit"--> c23 v1 --"mwapi:apiOutput"--> c19 v5 --"mwapi:apiOutput"--> c24 end bind4[/"concat('https://commons.wikimedia.org/entity/M',?pageid)"/] v5 --o bind4 bind4 --as--o v6 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P195".-> v7 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P6216".-> v8 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v6 -."wdt:P31".-> v2 end