query: SELECT ?item ?item2 (REPLACE(CONCAT('[', ?formatter, ' $1]'), '\\$1', ?gnd) AS ?url) WITH {
    SELECT * {
      ?item wdt:P227/^wdt:P227 ?item2 .
      FILTER( STR( ?item ) < STR( ?item2 ) ) .
    }
  } AS %duplicates WITH {
    SELECT * { wd:P227 wdt:P1630 ?formatter } LIMIT 1
  } AS %formatter WHERE {
    INCLUDE %duplicates .
    INCLUDE %formatter .
    ?item wdt:P227 ?gnd .
    ?item2 wdt:P227 ?gnd .
  } ORDER BY ?gnd