query: SELECT ?station ?stationLabel ?picture (SAMPLE(?pictureCategory) AS ?pictureCategory) WHERE {
    hint:Query hint:optimizer "None".
  
    # get metro stations in germany
    ?station wdt:P31 wd:Q928830 ;
             wdt:P17 wd:Q183 .
  
    # and pictures of them
    ?station wdt:P18 ?picture .
  
    # build commons urls
    BIND(STRAFTER(str(?picture), "Special:FilePath/") AS ?filename)
    BIND(wikibase:decodeUri(CONCAT("File:", ?filename)) AS ?file)
  
    # and ask commons for the categories the pictures are in
    SERVICE wikibase:mwapi {
      bd:serviceParam wikibase:api "Categories".
      bd:serviceParam wikibase:endpoint "commons.wikipedia.org".
      bd:serviceParam mwapi:titles ?file.
      ?pictureCategory wikibase:apiOutput mwapi:category.
    }
  
    # and only get those with a Public Domain category
    FILTER(STRSTARTS(?pictureCategory, "Category:PD-"))
  
    SERVICE wikibase:label { bd:serviceParam wikibase:language "de,[AUTO_LANGUAGE]". }
  }
  GROUP BY ?station ?stationLabel ?picture
  LIMIT 100