query: PREFIX schema: <http://schema.org/>
  
  SELECT ?qid ("Scommonswiki" AS ?pid) (CONCAT("\"Category:", ?Commons_Kategorie, "\"") AS ?value) WHERE {
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
    ?item wdt:P31/wdt:P279* wd:Q358.
    ?item wdt:P373 ?Commons_Kategorie.
    MINUS {
      ?article schema:about ?item.
      ?article schema:isPartOf <https://commons.wikimedia.org/>.
    }
    MINUS { ?item wdt:P935 ?CommonsGalerie. }
    MINUS { ?item wdt:P910 ?MainCat. }
    BIND(SUBSTR(STR(?item), (STRLEN(STR(<http://www.wikidata.org/entity/>))) + 1) AS ?qid)
  }
  LIMIT 1000