User:Herzi Pinki/Sparql

My SPARQL queries. Can be moved to somewhere else, when the {{SPARQL}} is available. Thanks to all supporting me to get this queries created. Feel free to use.

Snippets edit

see also Template:SPARQL

   hint:Query hint:optimizer "None".
   https://query.wikidata.org/embed.html?query=
   |embedded=y
mw.loader.load( '//www.wikidata.org/w/index.php?title=User:DarwIn/duplicate_item.js&action=raw&ctype=text/javascript' );
// [[User:DarwIn/duplicate_item.js]]
order by ?item offset 0 limit 100

WikiDaheim related checks edit

all Austrian wikidata entries without image edit

#title:all Austrian wikidata entries without image 
SELECT ?_s ?_sLabel ?_sDescription (GROUP_CONCAT(DISTINCT ?woBezeichnung; separator=', ') AS ?woLabels) WHERE {
  ?_s wdt:P17 wd:Q40 .
  ?_s wdt:P131*/wdt:P279* wd:Q40 .
  ?_s wdt:P31 [] .
  ?_s wdt:P625 [] .
  ?_s wdt:P131 ?wo .

  OPTIONAL {
    ?wo rdfs:label ?woLiteral .
    FILTER(LANG(?woLiteral) = 'de') .
  }
  BIND(IF(BOUND(?woLiteral), ?woLiteral, STRAFTER(STR(?wo), 'entity/')) AS ?woBezeichnung) .
  
  MINUS { ?_s wdt:P18 [] }
  MINUS { ?_s wdt:P373 [] }
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?_s ?_sLabel ?_sDescription ORDER BY ASC(?_sLabel)
all Austrian wikidata entries without image

all Austrian wikidata mountain entries without image edit

replace mountain (Q8502) at your choice

#title:all Austrian wikidata mountain entries without image 
SELECT ?_s ?_sLabel ?_sDescription (GROUP_CONCAT(DISTINCT ?woBezeichnung; separator=', ') AS ?woLabels) WHERE {
  ?_s wdt:P17 wd:Q40 .
  ?_s wdt:P131*/wdt:P279* wd:Q40 .
  ?_s wdt:P31 wd:Q8502 .
  ?_s wdt:P625 [] .
  ?_s wdt:P131 ?wo .

  OPTIONAL {
    ?wo rdfs:label ?woLiteral .
    FILTER(LANG(?woLiteral) = 'de') .
  }
  BIND(IF(BOUND(?woLiteral), ?woLiteral, STRAFTER(STR(?wo), 'entity/')) AS ?woBezeichnung) .
  
  MINUS { ?_s wdt:P18 [] }
  MINUS { ?_s wdt:P373 [] }
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?_s ?_sLabel ?_sDescription ORDER BY ASC(?_sLabel)
all Austrian wikidata mountain entries without image

map view of all Austrian wikidata entries with/out image edit

mountain (Q8502), ignoring stuff imported from sv:WP or ceb:WP (considered unreliable)

missing, time limit

map view of all Styrian wikidata entries with/out image edit

replace mountain (Q8502), Styria (Q41358) at your choice; ignoring stuff imported from sv:WP or ceb:WP (considered unreliable)

#defaultView:Map{"hide":"?rgb"}
#title:map view of all Styrian wikidata entries with/out image 
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17|wdt:P131* wd:Q41358 .
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
map view of all Styrian wikidata entries with/out image

map view of all wikidata entries with/out image per federal state / per district edit

(Austria (Q40)): Sparql
federal state districts cities
(Burgenland (Q43210)): Sparql

(Eisenstadt-Umgebung District (Q261432)): Sparql, (Güssing District (Q660312)): Sparql, (Jennersdorf District (Q756277)): Sparql, (Mattersburg District (Q748570)): Sparql, (Neusiedl am See District (Q660325)): Sparql, (Oberpullendorf District (Q748891)): Sparql, (Oberwart District (Q660230)): Sparql, (Rust (Q259214)): Sparql

(Carinthia (Q37985)): Sparql

(Feldkirchen District (Q665735)): Sparql, (Hermagor District (Q613991)): Sparql, (Klagenfurt-Land District (Q660701)): Sparql, (Sankt Veit an der Glan District (Q660255)): Sparql, (Spittal an der Drau District (Q660293)): Sparql, (Villach-Land District (Q660264)): Sparql, (Völkermarkt District (Q660279)): Sparql, (Wolfsberg District (Q665641)): Sparql, (Villach (Q483522)): Sparql

(Lower Austria (Q42497)): Sparql

(Amstetten District (Q694449)): Sparql, (Baden District (Q279874)): Sparql, (Bruck an der Leitha District (Q584543)): Sparql, (Gänserndorf District (Q694442)): Sparql, (Gmünd District (Q694421)): Sparql, (Hollabrunn District (Q694349)): Sparql, (Horn District (Q143167)): Sparql, (Korneuburg District (Q694372)): Sparql, (Krems District (Q694399)): Sparql, (Lilienfeld District (Q694463)): Sparql, (Melk District (Q261942)): Sparql, (Mistelbach District (Q257454)): Sparql, (Mödling District (Q254176)): Sparql, (Neunkirchen District (Q694386)): Sparql, (Sankt Pölten District (Q694393)): Sparql, (Scheibbs District (Q253068)): Sparql, (Tulln District (Q694428)): Sparql, (Waidhofen an der Thaya District (Q594032)): Sparql, (Wiener Neustadt District (Q694413)): Sparql, (Zwettl District (Q694452)): Sparql, (Waidhofen an der Ybbs (Q427385)): Sparql, (St. Pölten (Q82500)): Sparql

(Upper Austria (Q41967)): Sparql

(Braunau District (Q255626)): Sparql, (Eferding District (Q47289)): Sparql, (Freistadt District (Q257347)): Sparql, (Gmunden District (Q253221)): Sparql, (Grieskirchen District (Q655262)): Sparql, (Kirchdorf District (Q660512)): Sparql, (Linz-Land District (Q265632)): Sparql, (Perg District (Q660530)): Sparql, (Ried District (Q264704)): Sparql, (Rohrbach District (Q252828)): Sparql, (Schärding District (Q47482)): Sparql, (Steyr-Land District (Q854074)): Sparql, (Urfahr-Umgebung District (Q253585)): Sparql, (Vöcklabruck District (Q267479)): Sparql, (Wels-Land District (Q660544)): Sparql, (Steyr (Q260320)): Sparql, (Wels (Q178582)): Sparql

(Salzburg (Q43325)): Sparql

(Hallein District (Q254533)): Sparql, (Salzburg-Umgebung District (Q255469)): Sparql, (Sankt Johann im Pongau District (Q256828)): Sparql, (Tamsweg District (Q268090)): Sparql, (Zell am See District (Q257897)): Sparql, (Salzburg (Q34713)): Sparql

(Styria (Q41358)): Sparql

(Bruck-Mürzzuschlag District (Q853690)): Sparql, (Deutschlandsberg District (Q660219)): Sparql, (Graz-Umgebung District (Q672475)): Sparql, (Hartberg-Fürstenfeld District (Q853765)): Sparql, (Leibnitz District (Q660400)): Sparql, (Leoben District (Q665720)): Sparql, (Liezen District (Q255834)): Sparql, (Murau District (Q388913)): Sparql, (Murtal District (Q526517)): Sparql, (Südoststeiermark District (Q854043)): Sparql, (Voitsberg District (Q672537)): Sparql, (Weiz District (Q665571)): Sparql, (Graz (Q13298)): Sparql

(Tyrol (Q42880)): Sparql

(Imst District (Q665668)): Sparql, (Innsbruck-Land District (Q699582)): Sparql, (Kitzbühel District (Q265649)): Sparql, (Kufstein District (Q255141)): Sparql, (Landeck District (Q665605)): Sparql, (Lienz District (Q251931)): Sparql, (Reutte district (Q854005)): Sparql, (Schwaz District (Q266685)): Sparql, (Innsbruck (Q1735)): Sparql

(Vorarlberg (Q38981)): Sparql

(Bludenz District (Q698606)): Sparql, (Bregenz District (Q698621)): Sparql, (Dornbirn District (Q698581)): Sparql, (Feldkirch District (Q384914)): Sparql

(Vienna (Q1741)): Sparql
around Austria

(Slovenia (Q215)): Sparql, (Slowenien südlich von Österreich) Query

(South Tyrol (Q15124)): Sparql, (Italien südlich von Österreich): Query

(Grisons (Q11925)): Sparql, (Appenzell Innerrhoden (Q12094)): Sparql, (Appenzell Ausserrhoden (Q12079)): Sparql, (canton St. Gallen (Q12746)): Sparql,

(Liechtenstein (Q347)): Sparql,

(Upper Bavaria (Q10562)): Sparql, (Lower Bavaria (Q10559)): Sparql, (Swabia (Q10557)): Sparql,

(Prachatice District (Q385016)): Sparql, (České Budějovice District (Q753120)): Sparql, (Český Krumlov District (Q605208)): Sparql, (Jindřichův Hradec District (Q1160841)): Sparql, (Břeclav District (Q582488)): Sparql, (Znojmo District (Q853969)): Sparql,

(Bratislava Region (Q183498)): Sparql, (Trnava Region (Q181342)): Sparql,

(Győr-Moson-Sopron County (Q187753)): Sparql, (Vas County (Q187677)): Sparql, (Ungarn westlich von Österreich): Query

around: Query

map view of all wikidata entries with/out image per region edit

map view of all Austrian wikidata mountain entries with/out image edit

replace mountain (Q8502) at your choice, ignoring stuff imported from sv:WP or ceb:WP (considered unreliable)

#defaultView:Map{"hide":"?rgb"}
#title:map view of all Austrian wikidata mountain entries with/out image 
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17|wdt:P131* wd:Q40 .
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31/wdt:P279* wd:Q8502 .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
map view of all Austrian wikidata mountain entries with/out image

map view of all Austrian wikidata entries without located in the administrative territorial entity (P131) edit

#title:map view of all Austrian wikidata entries without [[Property:P131|located in the administrative territorial entity&#32;<small dir="ltr">(P131)</small>]] 
#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q40 .
    ?item wdt:P625 [] .
    minus {?item wdt:P31 wd:Q34770}
  FILTER NOT EXISTS {
    ?item wdt:P131 [] .
  }
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
map view of all Austrian wikidata entries without located in the administrative territorial entity (P131)

items in Austria assigned to different levels of P131 edit

#defaultView:Map{"hide":"?rgb"}
#title:items in Austria assigned to different levels of P131 
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q40 .
    ?item wdt:P131*/wdt:P279* wd:Q40 .
    ?item wdt:P31 [] .
    ?item wdt:P625 [] .
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
    ?item wdt:P131 ?wo .
    ?item wdt:P131 ?wo2 .
    ?wo wdt:P131+ ?wo2 .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
items in Austria assigned to different levels of P131

items in Austria with sv or ceb sitelinks not assigned to municipality level edit

#defaultView:Map{"hide":"?rgb"}
#title:items in Austria with sv or ceb sitelinks not assigned to municipality level 
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q40 .
    ?item wdt:P131*/wdt:P279* wd:Q40 .
    ?item wdt:P31 [] .
    ?item wdt:P625 [] .
    ?item wdt:P131 ?wo .
    minus {?item wdt:P31 wd:Q667509 .} # not is a gemeinde
    minus {?item wdt:P31 wd:Q871419 .} # no districts
    {?wo wdt:P31 wd:Q871419 .} union {?wo wdt:P31 wd:Q261543 .} # bundesland or bezirk
    minus {?wo wdt:P31 wd:Q667509 .} # not in a municipality (e.g. statutarstadt)
    ?sitelink schema:about ?item .
  FILTER EXISTS {
    ?article schema:about ?item .
    ?article schema:isPartOf <https://de.wikipedia.org/> . #Targeting Wikipedia language where subjects has no article.
  }
  FILTER EXISTS {
    ?article schema:about ?item .
    {?article schema:isPartOf <https://sv.wikipedia.org/> .} #Targeting Wikipedia language where subjects has no article.
    union
    {?article schema:isPartOf <https://ceb.wikipedia.org/> .} #Targeting Wikipedia language where subjects has no article.
  }
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
items in Austria with sv or ceb sitelinks not assigned to municipality level

items in Austria with only sv and ceb sitelinks not assigned to municipality level edit

#defaultView:Map{"hide":"?rgb"}
#title:items in Austria with only sv and ceb sitelinks not assigned to municipality level 
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q40 .
    ?item wdt:P131*/wdt:P279* wd:Q40 .
    ?item wdt:P31 [] .
    ?item wdt:P625 [] .
    ?item wdt:P131 ?wo .
    minus {?item wdt:P31 wd:Q667509 .} # not is a gemeinde
    {?wo wdt:P31 wd:Q871419 .} union {?wo wdt:P31 wd:Q261543 .} # bundesland or bezirk
    minus {?wo wdt:P31 wd:Q667509 .} # not a municipality (e.g. statutarstadt)
    ?sitelink schema:about ?item .
  FILTER NOT EXISTS {
    ?article schema:about ?item .
    ?article schema:isPartOf <https://de.wikipedia.org/> . #Targeting Wikipedia language where subjects has no article.
  }
  FILTER EXISTS {
    ?article schema:about ?item .
    {?article schema:isPartOf <https://sv.wikipedia.org/> .} #Targeting Wikipedia language where subjects has no article.
    union
    {?article schema:isPartOf <https://ceb.wikipedia.org/> .} #Targeting Wikipedia language where subjects has no article.
  }
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
items in Austria with only sv and ceb sitelinks not assigned to municipality level

Muster:

items in Austria with #countries (border check) edit

#defaultView:Map{"hide":"?rgb"}
#title:items in Austria with #countries (border check)
SELECT ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer WITH {
  SELECT DISTINCT ?item (COUNT(DISTINCT ?country) as ?anz) WHERE {
    ?item wdt:P17 wd:Q40 . #16
    #?item wdt:P131*/wdt:P279* wd:Q1973 .
    ?item wdt:P31 wd:Q8502 .
    ?item wdt:P625 [] .
    ?item wdt:P17 ?country .
  }
  GROUP BY ?item
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  BIND(IF(?anz = 1, '60ff60', 'ff0000') AS ?rgb) .
  BIND(IF(?anz = 1, 'inside (single P17)', 'border (multiple P17)') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer
items in Austria with #countries (border check)

joch - a mountain or a saddle? edit

#defaultView:Map{"hide":"?rgb"}
#title: find geographical objects by regular expressions
SELECT ?item ?itemLabel ?itemDescription ?isALabel (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
   ?item wdt:P17 wd:Q40 . # österreich
   ?item wdt:P31 [] . # with type
   ?item wdt:P625 [] . # with coords
 
   # check name:
   ?item rdfs:label ?itemLabel .
   FILTER (LANG(?itemLabel) = "de"). 
   FILTER regex(?itemLabel, ".*joch$", "i").
   
   # filter to objects assigned to (P131) administrative units in Austria
   MINUS {?item wdt:P31 wd:Q261543 }.
   Minus {?item wdt:P31 wd:Q406957 }.
   
   ?item wdt:P131 ?wo .
   minus {?item wdt:P31 wd:Q667509 .} # no municipalities
   minus {?item wdt:P31 wd:Q871419 .} # no districts
   {?wo wdt:P31 wd:Q871419 .} union {?wo wdt:P31 wd:Q261543 .}
   minus {?wo wdt:P31 wd:Q667509 .}
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31/wdt:P279* ?isA.
  VALUES ?isA {wd:Q8502 wd:Q16887036 wd:Q2231510 wd:Q10862618}. # filter for types
    OPTIONAL {
      ?isA rdfs:label ?isALabel.
      FILTER(LANG(?isALabel) = 'de') .
    }

  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?isALabel ?whereLabels ?coord ?rgb ?layer
find geographical objects by regular expressions

missing images in Ternberg edit

#title:missing images in Ternberg 
SELECT DISTINCT ?_s ?_sLabel ?_sDescription ?woLabel WHERE {
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
 ?_s wdt:P17 wd:Q40.
 ?_s wdt:P131*/wdt:P279* wd:Q40.
 ?_s wdt:P31 [].
 ?_s wdt:P625 [].
 ?_s wdt:P131 wd:Q671466
 MINUS
 {
   ?_s wdt:P18 []
 }
 MINUS
 {
   ?_s wdt:P373 []
 }
}
missing images in Ternberg

Organs without a church edit

find artist by initials edit

#title:find artist by initials 
SELECT DISTINCT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?profLabel; SEPARATOR=', ') AS ?profLabels) ?yearOfBirth ?yearOfDeath ?firstname ?lastname where 
{
    ### variable search parameters
    BIND (1960 as ?dateOfWork) .
    # using bind for regex will slow down to timeout
    #BIND ("^D" as ?firstnamePattern). # first letter of initials, assuming firstname
    #BIND ("^K" as ?lastnamePattern). # second letter of initials, assuming lastname
    ###
  
    optional {?item wdt:P569 ?d1.}
    optional {?item wdt:P570 ?d2.}
    BIND(IF(BOUND(?d1), year(?d1), 0) AS ?yearOfBirth) . # use null value
    BIND(IF(BOUND(?d2), year(?d2), 3000) AS ?yearOfDeath) .
    #hint:Prior hint:rangeSafe true .
    ?item wdt:P106/wdt:P279* wd:Q3391743 . #Q483501 
    ?item wdt:P106 ?prof.
    OPTIONAL {
      ?prof rdfs:label ?profLiteral .
      FILTER(LANG(?profLiteral) = 'de') .
    }

    BIND(IF(BOUND(?prof), IF(BOUND(?profLiteral), ?profLiteral, STRAFTER(STR(?prof), 'entity/')), 'no Prof') AS ?profLabel) .

    FILTER( ?yearOfBirth+20 <= ?dateOfWork && ?yearOfDeath >= ?dateOfWork )
    ?item wdt:P735 / wdt:P1705 ?firstname . FILTER( REGEX(?firstname, "^D" ) )
    ?item wdt:P734 / wdt:P1705 ?lastname . FILTER( REGEX(?lastname, "^K" ) )
    #?item wdt:P735 / wdt:P1705 ?firstname . FILTER( REGEX(?firstname, ?firstnamePattern ) )
    #?item wdt:P734 / wdt:P1705 ?lastname . FILTER( REGEX(?lastname, ?lastnamePattern ) )

    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
} group by ?item ?itemLabel ?itemDescription ?profLabels ?yearOfBirth ?yearOfDeath ?firstname ?lastname
find artist by initials

Denkmallisten edit

all Denkmal edit

#title: all monuments (Denkmal) in Austria
SELECT DISTINCT ?idNr ?item ?itemLabel ?itemDescription
                (GROUP_CONCAT(DISTINCT ?isALabel; SEPARATOR=', ') as ?isALabels)
                (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels)
                (SAMPLE(?image) AS ?image) ?coord ?adr ?commonscatSitelink ?commonscatProperty  WITH {
  SELECT DISTINCT ?item WHERE {
   ?item wdt:P2951 ?id .
   ?item wdt:P17 wd:Q40 . # österreich
   }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  optional { ?item wdt:P31 ?isA .
    OPTIONAL {
      ?isA rdfs:label ?isALiteral .
      FILTER(LANG(?isALiteral) = 'de') .
    }
  }
  optional { ?item p:P625 ?coordStatement .
             ?coordStatement ps:P625 ?coord }
            
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
      
  optional { ?item wdt:P6375 ?adr }

  optional {?commonscatSitelink schema:about ?item ; schema:isPartOf <https://commons.wikimedia.org/> .}
  optional {?item wdt:P373 ?commonscatProperty .}

  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  BIND(IF(BOUND(?isA), IF(BOUND(?isALiteral), ?isALiteral, STRAFTER(STR(?isA), 'entity/')), 'no P31') AS ?isALabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  ?item wdt:P2951 ?id .
  Bind (xsd:integer(?id) as ?idNr)
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE]' }
} GROUP BY ?idNr ?item ?itemLabel ?itemDescription  ?isALabels ?whereLabels ?coord ?adr ?commonscatSitelink ?commonscatProperty ORDER BY ASC(?idNr)
all monuments (Denkmal) in Austria

Objekte mit ObjektID und optional HERIS-ID edit

#title: Objekte mit ObjektID und optional HERIS-ID
SELECT DISTINCT ?oldid ?oldidNr ?herisIdNr ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) WHERE {
   ?item wdt:P2951 ?oldid .
   ?item wdt:P17 wd:Q40 . # österreich
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
     optional {?item wdt:P9154 ?herisId .
     Bind (xsd:integer(?herisId) as ?herisIdNr)
   }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  Bind (xsd:integer(?oldid) as ?oldidNr)
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE]' }
} GROUP BY ?oldid ?oldidNr ?herisIdNr ?item ?itemLabel ?itemDescription ?whereLabels ORDER BY ASC(?oldidNr)
Objekte mit ObjektID und optional HERIS-ID

Kirchen und Friedhöfe edit

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?isALabel; SEPARATOR=', ') AS ?isALabels) (GROUP_CONCAT(DISTINCT ?partLabel; SEPARATOR=', ') AS ?partLabels) (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
 ?item wdt:P17 wd:Q40 .
 ?item wdt:P1435 wd:Q1188447.
 ?item wdt:P31 ?isA.
 ?item wdt:P625 [] .
 ?item rdfs:label ?itemLabel .
   FILTER (LANG(?itemLabel) = "de"). 
   FILTER regex(?itemLabel, ".*kirche.*(fried|kirch)hof.*", "i").
  MINUS {?item wdt:P31 wd:Q261543 }.
  Minus {?item wdt:P31 wd:Q406957 }.
  #MINUS {?item wdt:P31 wd:Q1497375 }.
  #Minus {?item wdt:P31 wd:Q105644486 }.
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL {
    ?item wdt:P31 ?isA .
    OPTIONAL {
      ?isA rdfs:label ?isALiteral .
      FILTER(LANG(?isALiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?isA), IF(BOUND(?isALiteral), ?isALiteral, STRAFTER(STR(?isA), 'entity/')), 'no P31') AS ?isALabel) .
  OPTIONAL {
    ?item wdt:P527 ?part .
    OPTIONAL {
      ?part rdfs:label ?partLiteral .
      FILTER(LANG(?partLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?part), IF(BOUND(?partLiteral), ?partLiteral, STRAFTER(STR(?part), 'entity/')), 'no parts') AS ?partLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?isALabels ?partLabels ?whereLabels ?coord ?rgb ?layer
Try it!

Pfarrhöfe als Kulturgut edit

#defaultView:Map{"hide":"?rgb"}
#title: Kulturgut Pfarrhof
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
 ?item wdt:P17 wd:Q40 .
 #{?item wdt:P31/wdt:P279* wd:Q8502} union {?item wdt:P31/wdt:P279* wd:Q207326}. # Berg
 ?item wdt:P31 wd:Q2065736 .   #Kulturdenkmal
 ?item wdt:P625 [] .
 #?item wdt:P2044 ?ele .
      ?item rdfs:label ?itemLabel .
   FILTER (LANG(?itemLabel) = "de"). 
   FILTER regex(?itemLabel, ".*Pfarrhof.*", "i").
   #FILTER regex(?itemLabel, ".*kirche.*kirchen.*", "i").
  MINUS {?item wdt:P31 wd:Q261543 }.
  Minus {?item wdt:P31 wd:Q406957 }.
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer ORDER BY ASC(?item)
Kulturgut Pfarrhof

Kulturdenkmäler in Denkmallisten edit

SELECT ?_s ?_sLabel ?_sDescription  WHERE {
  ?_s wdt:P17 wd:Q40 .
  ?_s wdt:P31 wd:Q2065736 .

  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?_s ?_sLabel ?_sDescription ORDER BY ASC(?_sLabel)
Try it!

denkmalgeschützte Objekte, wo die Denkmalliste nicht mit der Denkmalliste der Gemeinde übereinstimmt edit

#title: denkmalgeschützte Objekte, wo die Denkmalliste nicht mit der Denkmalliste der Gemeinde übereinstimmt
# können grenzüberschreitende oder verschobene Denkmäler sein
# Ausgenommen: Denkmallisten in Gemeinden, die aufgeteilt sind.
SELECT ?_s ?_sLabel ?_sDescription ?gemeinde ?gemeindeLabel ?dl1Label ?dl2Label WHERE {
  ?_s wdt:P17 wd:Q40 .
  ?_s wdt:P1435 wd:Q1188447.
  ?_s wdt:P131 ?gemeinde .
  FILTER(?gemeinde != wd:Q1735). # Innsbruck
  FILTER(?gemeinde != wd:Q34713). # Salzburg
  FILTER(?gemeinde != wd:Q1741). # Wien
  FILTER(?gemeinde != wd:Q13298). # Graz
  FILTER(?gemeinde != wd:Q82500). # St. Pölten
  FILTER(?gemeinde != wd:Q302745). # Hall in Tirol
  FILTER(?gemeinde != wd:Q871601). # Friesach
  FILTER(?gemeinde != wd:Q255684). # Hallein
  ?_s wdt:P2817 ?dl1.
  ?gemeinde wdt:P31 wd:Q667509 .
  ?gemeinde wdt:P1456  ?dl2 .
  FILTER(?dl1 != ?dl2) .

  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?_s ?_sLabel ?_sDescription ?gemeinde ?gemeindeLabel ?dl1Label ?dl2Label ORDER BY ASC(?_sLabel)
denkmalgeschützte Objekte, wo die Denkmalliste nicht mit der Denkmalliste der Gemeinde übereinstimmt

Feuerwehr edit

#title: Feuerwehrhaus mit Commonscat ohne Bild
SELECT ?item ?itemLabel ?itemDescription ?Bild ?location ?commonscat_property ?verwaltungseinheit WHERE {
  {  ?item wdt:P31 wd:Q1195942. } 
  {  ?item wdt:P17 wd:Q40. }
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". }
  OPTIONAL { ?item wdt:P18 ?Bild. }    # optional, wenn vorhanden, Bild mitausgeben
  OPTIONAL { ?item wdt:P625 ?location. }  # optional, wenn vorhanden, koordinaten
  OPTIONAL { ?item wdt:P373 ?commonscat_property. }  # optional, wenn vorhanden, commonscat-property (NICHT SITELINK!)
  OPTIONAL { ?item wdt:P131 ?verwaltungseinheit. }  # optional, wenn vorhanden,verwaltungseinheit

FILTER (!bound(?Bild))   # nur jene OHNE bild
FILTER (bound(?commonscat_property))   # nur jene mit commonscat_property
  
}
ORDER BY ?itemLabel
Feuerwehrhaus mit Commonscat ohne Bild

Architekten edit

#title: österr. Architekten mit / ohne Artikel
SELECT ?_s ?_sLabel ?_sDescription ?article WHERE {
  #?_s wdt:P17 wd:Q40 .
  #?_s wdt:P131*/wdt:P279* wd:Q1741 .
  ?_s wdt:P106 wd:Q42973.
  ?_s wdt:P27 wd:Q40.
  #?_s wdt:P84 wd:Q84902
  # ?_s rdfs:label ?_sLabel .
  optional {
    ?article schema:about ?_s .
    ?article schema:isPartOf <https://de.wikipedia.org/> . #Targeting Wikipedia language where subjects has no article.
    }
  #FILTER NOT EXISTS {
  #  ?article schema:about ?_s .
  #  ?article schema:isPartOf <https://de.wikipedia.org/> . #Targeting Wikipedia language where subjects has no article.
  #}
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?_s ?_sLabel ?_sDescription ?article
österr. Architekten mit / ohne Artikel
#title: Werke eines Architekten
SELECT ?_s ?_sLabel ?_sDescription WHERE {
  #?_s wdt:P17 wd:Q40 .
  #?_s wdt:P131*/wdt:P279* wd:Q1741 .
  ?_s wdt:P84 wd:Q84902
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?_s ?_sLabel ?_sDescription
Werke eines Architekten

slowenische Namen in Kärnten edit

#defaultView:Map{"hide":"?rgb"}
#title: find item in Kärnten with de / sl labels
SELECT ?item ?itemLabel ?itemDescription ?labelDe ?labelSl ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item ?labelDe ?labelSl WHERE {
    ?item wdt:P17 wd:Q40 .
    ?item wdt:P625 [] .
    ?item wdt:P131*/wdt:P279* wd:Q37985 .
    OPTIONAL {
      ?item rdfs:label ?labelDe .
      FILTER(LANG(?labelDe) = 'de') .
    }
    OPTIONAL {
      ?item rdfs:label ?labelSl .
      FILTER(LANG(?labelSl) = 'sl') .
    }

  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  
  bind (if (bound(?labelDe), if (bound(?labelSl), if (?labelDe = ?labelSl, 'ffff00', '00ff00'), 'ff0000'), '000000') as ?rgb ).
  bind (if (bound(?labelDe), if (bound(?labelSl), if (?labelDe = ?labelSl, 'de=sl?', 'de!=sl'), 'no sl'), 'no de') as ?layer ).
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?labelDe ?labelSl ?coord ?rgb ?layer ORDER BY ASC(?item)
find item in Kärnten with de / sl labels

all given names edit

#title:get all male given names
SELECT ?item ?itemLabel
WHERE {
  {
      select * {
         # ?item wdt:P31 wd:Q12308941. # male
         # ?item wdt:P31 wd:Q11879590. # female
        ?item wdt:P31 wd:Q3409032. # neutral
      }
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'de' }
}
get all male given names

Acc. to https://stackoverflow.com/questions/38527828/how-to-query-wikidata-items-using-its-labels I tried:

SELECT DISTINCT ?item ?label
WHERE
{
  SERVICE wikibase:mwapi
  {
    bd:serviceParam wikibase:endpoint "www.wikidata.org";
                    wikibase:api "Generator";
                    mwapi:generator "search";
                    mwapi:gsrsearch "inlabel:Franz"@de;
                    mwapi:gsrlimit "max".
    ?item wikibase:apiOutputItem mwapi:title.
  }
  ?item rdfs:label ?label. FILTER( LANG(?label)="de" )

  # … at this point, you have matching ?item(s) 
  # and can further restrict or use them
  # as in any other SPARQL query

  # Example: the following restricts the matches
  # to college towns (Q1187811) only

  ?item wdt:P31 wd:Q12308941 .
  }
Try it!

which gives me a list of names similar to the given name "Franz".

#title:get all items for male given names
SELECT ?item ?itemLabel
WHERE {
  ?item wdt:P31 wd:Q12308941.
  #SERVICE wikibase:label { bd:serviceParam wikibase:language 'de' }
}
get all items for male given names

&&

SELECT ?item ?itemLabel
WHERE {
  ?item rdfs:label ?itemLabel .
   FILTER (LANG(?itemLabel) = "de"). 
VALUES ?item {

wd:Q741
wd:Q923
wd:Q1557
wd:Q4642
wd:Q20164
wd:Q20790
wd:Q24223
wd:Q29884
wd:Q37080
wd:Q42771
}.
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'de' }
}
Try it!

my fancy checks edit

  • check elevation of Slovenian settlements. There where some errors on it:WP resulting in wrong elevation on wikidata. This gives the highest settlements by descending elevation.
SELECT DISTINCT ?_s ?_sLabel ?_sDescription ?elevation WHERE {
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?_s wdt:P17 wd:Q215.
?_s wdt:P31 wd:Q486972.
?_s wdt:P2044 ?elevation.
FILTER ( ?elevation > 1000 )
}

ORDER BY DESC(?elevation)
LIMIT 500
Try it!
  • list & visualize objects in a coordinate rectangle
#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
  ?item wdt:P17|wdt:P131* wd:Q1488897 ;
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 48.4 < ?lat && ?lat < 48.55 && 11.1 < ?lon && ?lon < 11.3 )
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!
  • Find graves by cemetery
#title: Find graves by cemetery
SELECT ?item ?itemLabel ?itemDescription ?cemeteryLabel ?bild ?grab  ?commonscat ?nr ?coords ?url
WHERE
{
    ?item wdt:P119 wd:Q2718154 . #id of cemetery
    #?item wdt:P119 ?cemetery . # all Vienna cemeteries
    #?cemetery wdt:P131* wd:Q1741.
    ?item p:P119 ?ort
    optional {?item wdt:P18 ?bild}.
    optional {?item wdt:P1442 ?grab }.
    optional {?ort pq:P965 ?nr }.
    optional {?ort pq:P625 ?coords }.
    optional {?ort prov:wasDerivedFrom ?ref . ?ref pr:P854 ?url }.
    optional {?ort pq:P373 ?commonscat }.
    

  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE],de,en' }
}
#GROUP BY ?item 
#ORDER BY ?item
#LIMIT 25
Find graves by cemetery
  • Search in labels with regex
#title: Search in labels with regex
SELECT ?item ?itemLabel WHERE {
   ?item wdt:P17 wd:Q40;
   rdfs:label ?itemLabel;
   FILTER (LANG(?itemLabel) = "de"). 
   FILTER regex(?itemLabel, ".*östereich.*", "i").
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],de" } .
} limit 500
Search in labels with regex
SELECT ?item ?itemLabel ?description WHERE {
   ?item wdt:P17 wd:Q40.
   ?item schema:description ?description.
   FILTER (lang(?description) = "en" )
   FILTER regex(?description, "' Austria").
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" } .
} limit 500
Try it!
  • wildcard search in labels
#defaultView:Map{"hide":"?rgb"}
#title: wildcard search in labels
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
 ?item wdt:P17 wd:Q40 .
 ?item wdt:P31/wdt:P279* wd:Q355304. # Fließgewässer
 ?item wdt:P625 [] .
      ?item rdfs:label ?itemLabel .
   FILTER (LANG(?itemLabel) = "de"). 
   FILTER regex(?itemLabel, ".*wei[ss|ß]enbach.*", "i").
  MINUS {?item wdt:P31 wd:Q261543 }.
  Minus {?item wdt:P31 wd:Q406957 }.
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
wildcard search in labels
  • wildcard search in descriptions (begraafplaats)
#defaultView:Map{"hide":"?rgb"}
#title:wildcard search in descriptions (begraafplaats)
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
 ?item wdt:P17 wd:Q40 .
 #?item wdt:P31/wdt:P279* wd:Q16970. 
 #minus {?item wdt:P31/wdt:P279* wd:Q39614. }
 ?item wdt:P31/wdt:P279* wd:Q39614.
 ?item wdt:P625 [] .
 ?item rdfs:label ?itemLabel .
 ?item schema:description ?itemDescription .
   FILTER (LANG(?itemDescription) = "nl"). 
   FILTER regex(?itemDescription, "^begraafplaats.*", "i").
  MINUS {?item wdt:P31 wd:Q261543 }.
  Minus {?item wdt:P31 wd:Q406957 }.
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en,nl]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
wildcard search in descriptions (begraafplaats)
  • Get Refs for Kriegerdenkmal in Austria
#title: Get Refs for Kriegerdenkmal in Austria
SELECT ?item ?ref1 ?ref2Label ?ref3Label
WHERE {
  ?item wdt:P17 wd:Q40 .
 {?item wdt:P31 wd:Q358 .} union {?item wdt:P31 wd:Q2065736 .} 
   ?item wdt:P625 [] .
 ?item rdfs:label ?itemLabel .
   FILTER (LANG(?itemLabel) = "de"). 
   FILTER regex(?itemLabel, ".*Kriegerdenkmal.*", "i").
  ?item p:P31 [ prov:wasDerivedFrom ?ref ] .
  ?ref pr:P248 ?ref1.
  ?ref pr:P854 ?ref2.
  ?ref pr:P577 ?ref3.
 #?ref1 rdfs:label ?ref1Label .
 #?ref2 rdfs:label ?ref2Label .
 #?ref3 rdfs:label ?ref3Label .
  MINUS {?item wdt:P31 wd:Q261543 }.
  Minus {?item wdt:P31 wd:Q406957 }.

  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
}
Get Refs for Kriegerdenkmal in Austria

de-at only edit

#title: de-at only 
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?labelDe ?labelAt  ?DescrAt ?AliasAt ?labelEn WHERE {
    ?item wdt:P17 wd:Q40 .
    minus {
      ?item rdfs:label ?labelDe .
      FILTER(LANG(?labelDe) = 'de') .
    }
    minus {
      ?item schema:description ?DescrDe .
      FILTER(LANG(?DescrDe) = 'de') .
    }
    minus {
      ?item skos:altLabel ?AliasDe .
      FILTER(LANG(?AliasDe) = 'de') .
    }
    OPTIONAL {
      ?item rdfs:label ?labelAt .
      FILTER(LANG(?labelAt) = 'de-at') .
    }
    OPTIONAL {
      ?item schema:description ?DescrAt .
      FILTER(LANG(?DescrAt) = 'de-at') .
    }
    OPTIONAL {
      ?item skos:altLabel ?AliasAt .
      FILTER(LANG(?AliasAt) = 'de-at') .
    }
    OPTIONAL {
      ?item rdfs:label ?labelEn .
      FILTER(LANG(?labelEn) = 'en') .
    }
  #filter (bound (?labelAt) != bound (?labelEn))
  filter (?labelAt != "")

  }
de-at only

values with units edit

#title: Mountains by height
SELECT ?item ?itemLabel  ?height_in_m ?globeLabel ?height ?unitLabel ?lowerbound ?upperbound ?precision ?height2 ?conversion
WHERE
{
  ?item          wdt:P31/wdt:P279*           wd:Q8502.    # berg
  ?item          wdt:P17                     wd:Q142.
  ?item          p:P2044                     ?stmnode.    # elevation
  optional {?item          wdt:P376                     ?globe.}
  ?stmnode       psv:P2044                   ?valuenode.
  ?valuenode     wikibase:quantityAmount     ?height.
  ?valuenode     wikibase:quantityUnit       ?unit.
  #optional {?valuenode     wikibase:quantityLowerBound ?lowerbound.
  #?valuenode     wikibase:quantityUpperBound ?upperbound.
  #BIND((?upperbound-?lowerbound)/2 AS ?precision).
  #BIND(IF(?precision=0, ?height, (CONCAT(str(?height), "±", str(?precision)))) AS ?height2). }

  # conversion to SI unit
  ?unit          p:P2370                 ?unitstmnode.   # conversion to SI unit
  ?unitstmnode   psv:P2370               ?unitvaluenode. 
  ?unitvaluenode wikibase:quantityAmount ?conversion.
  ?unitvaluenode wikibase:quantityUnit   wd:Q11573.      # meter
  BIND(?height* ?conversion AS ?height_in_m).
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". }
} 
ORDER BY DESC(?height_in_m)
LIMIT 10000
Mountains by height
#title: rivers by length
SELECT ?item ?itemLabel  ?length_in_m ?length ?unitLabel ?lowerbound ?upperbound ?precision ?length2 ?conversion
WHERE
{
  ?item          wdt:P31/wdt:P279*           wd:Q47521.    # bach
  ?item          p:P2043                     ?stmnode.    # length
  ?stmnode       psv:P2043                   ?valuenode.
  ?valuenode     wikibase:quantityAmount     ?length.
  ?valuenode     wikibase:quantityUnit       ?unit.
  optional {?valuenode     wikibase:quantityLowerBound ?lowerbound.
  ?valuenode     wikibase:quantityUpperBound ?upperbound.
  BIND((?upperbound-?lowerbound)/2 AS ?precision).
  BIND(IF(?precision=0, ?length, (CONCAT(str(?length), "±", str(?precision)))) AS ?length2). }

  # conversion to SI unit
  ?unit          p:P2370                 ?unitstmnode.   # conversion to SI unit
  ?unitstmnode   psv:P2370               ?unitvaluenode. 
  ?unitvaluenode wikibase:quantityAmount ?conversion.
  ?unitvaluenode wikibase:quantityUnit   wd:Q11573.      # meter
  BIND(?length * ?conversion AS ?length_in_m).
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". }
} 
ORDER BY DESC(?length_in_m)
LIMIT 10000
rivers by length
#title: Coords by precision
SELECT ?item ?itemLabel ?coord ?lon ?lat ?precision
WHERE
{
 ?item wdt:P131/wdt:P279* wd:Q1741.   # in the administrative territory of Wien
 ?item          wdt:P31/wdt:P279*           wd:Q41176.    # gebäude
 ?item p:P625 ?coordinate.
 ?coordinate ps:P625 ?coord.
 ?coordinate psv:P625 ?coordinate_node.
 ?coordinate_node wikibase:geoLongitude ?lon.
 ?coordinate_node wikibase:geoLatitude ?lat.  
 ?coordinate_node wikibase:geoPrecision ?precision.  
  FILTER(?precision != 1.0E-8) .
  FILTER(?precision != 1.0E-7) .
  FILTER(?precision != 1.0E-6) .
  FILTER(?precision != 1.0E-5) .
  FILTER(?precision != 1.0E-4) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en". }
}
ORDER BY ASC(?precision)
LIMIT 10000
Coords by precision

get articles and coordinates by ISO1 edit

#title: get articles and coordinates by ISO1 
SELECT distinct ?articlename ?item ?itemLabel ?coord WHERE {
 ?country wdt:P297 "AT".
 ?item wdt:P17 ?country; wdt:P625 ?coord .
 ?article schema:about ?item .
 ?article schema:isPartOf <https://de.wikipedia.org/> ; 
          schema:name ?articlename .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
} GROUP BY ?articlename ?item ?itemLabel ?coord ORDER BY ASC(?articlename)
limit 400
get articles and coordinates by ISO1
SELECT distinct ?articlename ?item ?lat ?lon ?precision WHERE {
 ?country wdt:P297 "AT".
 ?item wdt:P17 ?country.
 ?item p:P625 ?coordinate.
 #?coordinate ps:P625 ?coord.
 ?coordinate psv:P625 ?coordinate_node.
 ?coordinate_node wikibase:geoLongitude ?lon.
 ?coordinate_node wikibase:geoLatitude ?lat.  
 ?coordinate_node wikibase:geoPrecision ?precision.  
 ?article schema:about ?item .
 ?article schema:isPartOf <https://de.wikipedia.org/> ; 
          schema:name ?articlename .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "de" }
} GROUP BY ?articlename ?item ?lat ?lon ?precision ORDER BY ASC(?articlename)
limit 400
Try it!

External queries edit

find Denkmalgeschützte Objekte for Doris edit

#title: Objekte mit HERIS-ID, url in Denkmalliste, ev. url auf Artikel, Koordinaten
SELECT DISTINCT ?item ?itemQid 
                (GROUP_CONCAT(DISTINCT ?HERISId; SEPARATOR=', ') AS ?HERISIds) ?url
                #?dl (GROUP_CONCAT(DISTINCT ?dlQid; SEPARATOR=', ') AS ?dlQids) ?dlLink ?dlUrl
                #?articleLink
                ?articleName ?articleUrl
                ?lat ?lon
   WHERE {
   ?item wdt:P17 wd:Q40 . # Österreich
    
   ?item wdt:P131*/wdt:P279* wd:Q41967. # Oberösterreich
   ?item wdt:P9154 ?HERISId. # BDA HERIS-ID
   ?item wdt:P1435 wd:Q1188447. # Denkmalgeschütztes Objekt in Österreich (to be sure)
   ?item p:P1435 ?protection .
     FILTER NOT EXISTS {?protection pq:P582 ?x . } # check if still a protected object (protection is finished setting qualifier P582 to enddate.
   ?item wdt:P2817 ?dl. ?dl wdt:P17 wd:Q40. # Denkmalliste in Österreich

   optional {
   ?item p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
         ]
  }

  optional {
    ?dlLink schema:about ?dl . # wikipedia link to the Denkmalliste in the German speaking Wikipedia
    ?dlLink schema:inLanguage "de" .
  }

  optional {
    ?articleLink schema:about ?item . # optional name of an Wikipedia article describing the object in the Denkmalliste in more detail (in the German speaking Wikipedia)
    ?articleLink schema:inLanguage "de" .
  }

   # get the plain wikidata id in string format for the protected object
   bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)
   # get the plain wikidata id in string format for the Denkmalliste, the protected object is listed in
   bind (replace(xsd:string(?dl),"http://www.wikidata.org/entity/","") as ?dlQid)
   # convert the link to the denkmalliste to url as plain text (with escaped umlauts)
   bind (xsd:string(?dlLink) as ?dlUrl)
   
   # convert the article stuff 
   # convert the link to an article to url as plain text (with escaped umlauts)
   bind (xsd:string(?articleLink) as ?articleUrl)
   # grep the article name (still with escaped umlauts)
   bind (replace(replace(xsd:string(?articleLink),"https://de.wikipedia.org/wiki/",""),"_"," ") as ?articleName)
   # provide the link to an item as a table entry in a denkmalliste. This is the main entry point from Doris.
   bind(concat(?dlUrl, "#", ?itemQid) AS ?url ) .
} GROUP BY ?item ?itemQid
           ?HERISIds ?url
           #?dl ?dlQids ?dlLink ?dlUrl
           #?articleLink 
           ?articleName ?articleUrl
           ?lat ?lon
Objekte mit HERIS-ID, url in Denkmalliste, ev. url auf Artikel, Koordinaten
#title: Objekte mit HERIS-ID, url in Denkmalliste, ev. url auf Artikel, Koordinaten (embedded)
SELECT DISTINCT ?item ?itemQid 
                (GROUP_CONCAT(DISTINCT ?HERISId; SEPARATOR=', ') AS ?HERISIds) ?url
                #?dl (GROUP_CONCAT(DISTINCT ?dlQid; SEPARATOR=', ') AS ?dlQids) ?dlLink ?dlUrl
                #?articleLink
                ?articleName ?articleUrl
                ?lat ?lon
   WHERE {
   ?item wdt:P17 wd:Q40 . # Österreich
    
   ?item wdt:P131*/wdt:P279* wd:Q41967. # Oberösterreich
   ?item wdt:P9154 ?HERISId. # BDA HERIS-ID
   ?item wdt:P1435 wd:Q1188447. # Denkmalgeschütztes Objekt in Österreich (to be sure)
   ?item p:P1435 ?protection .
     FILTER NOT EXISTS {?protection pq:P582 ?x . } # check if still a protected object (protection is finished setting qualifier P582 to enddate.
   ?item wdt:P2817 ?dl. ?dl wdt:P17 wd:Q40. # Denkmalliste in Österreich

   optional {
   ?item p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
         ]
  }

  optional {
    ?dlLink schema:about ?dl . # wikipedia link to the Denkmalliste in the German speaking Wikipedia
    ?dlLink schema:inLanguage "de" .
  }

  optional {
    ?articleLink schema:about ?item . # optional name of an Wikipedia article describing the object in the Denkmalliste in more detail (in the German speaking Wikipedia)
    ?articleLink schema:inLanguage "de" .
  }

   # get the plain wikidata id in string format for the protected object
   bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)
   # get the plain wikidata id in string format for the Denkmalliste, the protected object is listed in
   bind (replace(xsd:string(?dl),"http://www.wikidata.org/entity/","") as ?dlQid)
   # convert the link to the denkmalliste to url as plain text (with escaped umlauts)
   bind (xsd:string(?dlLink) as ?dlUrl)
   
   # convert the article stuff 
   # convert the link to an article to url as plain text (with escaped umlauts)
   bind (xsd:string(?articleLink) as ?articleUrl)
   # grep the article name (still with escaped umlauts)
   bind (replace(replace(xsd:string(?articleLink),"https://de.wikipedia.org/wiki/",""),"_"," ") as ?articleName)
   # provide the link to an item as a table entry in a denkmalliste. This is the main entry point from Doris.
   bind(concat(?dlUrl, "#", ?itemQid) AS ?url ) .
} GROUP BY ?item ?itemQid
           ?HERISIds ?url
           #?dl ?dlQids ?dlLink ?dlUrl
           #?articleLink 
           ?articleName ?articleUrl
           ?lat ?lon
Objekte mit HERIS-ID, url in Denkmalliste, ev. url auf Artikel, Koordinaten (embedded)
#title: Objekte mit HERIS-ID, url in Denkmalliste, ev. url auf Artikel, Koordinaten für ganz Österreich
SELECT DISTINCT ?item ?itemQid 
                (GROUP_CONCAT(DISTINCT ?HERISId; SEPARATOR=', ') AS ?HERISIds) ?url
                #?dl (GROUP_CONCAT(DISTINCT ?dlQid; SEPARATOR=', ') AS ?dlQids) ?dlLink ?dlUrl
                #?articleLink
                ?articleName ?articleUrl
                ?lat ?lon
   WHERE {
   ?item wdt:P17 wd:Q40 . # Österreich
    
   ?item wdt:P9154 ?HERISId. # BDA HERIS-ID
   ?item wdt:P1435 wd:Q1188447. # Denkmalgeschütztes Objekt in Österreich (to be sure)
   ?item p:P1435 ?protection .
     FILTER NOT EXISTS {?protection pq:P582 ?x . } # check if still a protected object (protection is finished setting qualifier P582 to enddate.
   ?item wdt:P2817 ?dl. ?dl wdt:P17 wd:Q40. # Denkmalliste in Österreich

   optional {
   ?item p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
         ]
  }

  optional {
    ?dlLink schema:about ?dl . # wikipedia link to the Denkmalliste in the German speaking Wikipedia
    ?dlLink schema:inLanguage "de" .
  }

  optional {
    ?articleLink schema:about ?item . # optional name of an Wikipedia article describing the object in the Denkmalliste in more detail (in the German speaking Wikipedia)
    ?articleLink schema:inLanguage "de" .
  }

   # get the plain wikidata id in string format for the protected object
   bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)
   # get the plain wikidata id in string format for the Denkmalliste, the protected object is listed in
   bind (replace(xsd:string(?dl),"http://www.wikidata.org/entity/","") as ?dlQid)
   # convert the link to the denkmalliste to url as plain text (with escaped umlauts)
   bind (xsd:string(?dlLink) as ?dlUrl)
   
   # convert the article stuff 
   # convert the link to an article to url as plain text (with escaped umlauts)
   bind (xsd:string(?articleLink) as ?articleUrl)
   # grep the article name (still with escaped umlauts)
   bind (replace(replace(xsd:string(?articleLink),"https://de.wikipedia.org/wiki/",""),"_"," ") as ?articleName)
   # provide the link to an item as a table entry in a denkmalliste. This is the main entry point from Doris.
   bind(concat(?dlUrl, "#", ?itemQid) AS ?url ) .
} GROUP BY ?item ?itemQid
           ?HERISIds ?url
           #?dl ?dlQids ?dlLink ?dlUrl
           #?articleLink 
           ?articleName ?articleUrl
           ?lat ?lon
Objekte mit HERIS-ID, url in Denkmalliste, ev. url auf Artikel, Koordinaten für ganz Österreich

find UNESCO stuff for karthographer edit

#title:find UNESCO stuff for karthographer 
SELECT ?id ?geo 
                (concat(?articleLink, '[[File:Wikidata-logo S.svg|16px|link=d:', substr(str(?id),32,13), ']]', (SAMPLE(?idBild))) as ?description)
                ('small' as ?marker_size) ?marker_color
         WHERE { ?id wdt:P17 ?country.
                 VALUES ?country {wd:Q40}. # {wd:}.Q843
                 ?id wdt:P1435 wd:Q9259.
                 ?id wdt:P757 [].
                 ?id wdt:P625 ?geo.
                 SERVICE wikibase:label { bd:serviceParam wikibase:language 'de,en' .
                                          ?id rdfs:label ?idLabel . }
                 OPTIONAL { ?id wdt:P18 ?img .}
                 BIND(IF(BOUND(?img), concat('\\n', '[[File:', substr(str(?img), 52, 400), '|250px]]'), '') AS ?idBild) .
                 OPTIONAL {
                    ?id p:P1435 ?statement.
                    ?statement ps:P1435 wd:Q9259.
                    ?statement pq:P580 [].
                    #VALUES ?year {1997}.
                    }
                 bind(if(BOUND(?img), if(BOUND(?end), '#80F080', '#008000'), if(BOUND(?end), '#F08080', '#800000')) as ?marker_color).
                 optional {
                    ?link schema:about ?id .
                    ?link schema:isPartOf <https://de.wikipedia.org/> .
                    ?link schema:name ?lemma .
                 }
                    bind (if(Bound(?link), concat('[[:de:', ?lemma, '|',?idLabel,']]\\n'), concat(?idLabel,'\\n')) as ?articleLink).
               }
         GROUP BY ?id ?geo ?articleLink ?marker_color
find UNESCO stuff for karthographer

Geo-Information competition edit

Find all items in country without coords edit

#title: items by country without coordinates
SELECT ?item ?itemLabel ?itemDescription WHERE {
    ?item wdt:P17 wd:Q40 .
    ?item wdt:P131*/wdt:P279* wd:Q40 .
    ?item wdt:P31*/wdt:P279* ?isA .
    VALUES ?isA {wd:Q271669 wd:Q486972} # landform settlement
    filter not exists { ?item wdt:P625 [] .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
  } limit 10000
items by country without coordinates
#title: items by country without coordinates
SELECT ?item ?itemLabel ?itemDescription WHERE {
    ?item wdt:P17 wd:Q40 .
    #?item wdt:P31 wd:Q8502 . # mountain
    filter not exists { ?item wdt:P625 [] .}
  minus { ?item wdt:P31 wd:Q13406463} # Wikimedia-Liste
  minus { ?item wdt:P31 wd:Q43229} # Organisation
  minus { ?item wdt:P31 wd:Q4830453 } # Gewerbebetrieb
  minus { ?item wdt:P31 wd:Q93868746 } #numerischer Identifikator
  minus { ?item wdt:P31/wdt:P279* wd:Q12973014 } # Sportmannschaft
  #minus { ?item wdt:P31/wdt:P279* wd:Q43229} # Organisation
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
  } limit 10000
items by country without coordinates

Find all items in country without P131 (administration unit) edit

#defaultView:Map{"hide":"?rgb"}
#title: items by country with coordinates, without adminstrative unit
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q40 .
    ?item wdt:P625 [] .
    #?item wdt:P31 wd:Q8502 .
    filter not exists {
      ?item wdt:P131 ?wo
      }
  #minus {?item wdt:P31/wdt:P279* wd:Q27686 .}
  #minus {?item wdt:P31/wdt:P279* wd:Q1444 .}
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer ORDER BY ASC(?item)
items by country with coordinates, without adminstrative unit

Find all items in country without P131 = municipality (lowest level) edit

#defaultView:Map{"hide":"?rgb"}
#title: items in Carinthia with coordinates and missing municipality without WP:de articles, but WP:sv or WP:ceb
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q40 .
    ?item wdt:P131*/wdt:P279* wd:Q37985 .
    #?item wdt:P131*/wdt:P279* wd:Q980 . # by
    ?item wdt:P31 [] .
    ?item wdt:P625 [] .
    ?item wdt:P131 ?wo .
    minus {?item wdt:P31 wd:Q667509 .} # not is a gemeinde at
    # minus {?item wdt:P31 wd:Q262166 .} # not is a gemeinde de
    minus {?item wdt:P31 wd:Q35779580.}
    # minus {?item wdt:P31 wd:Q355304 .}  # not a fließgewässer
    {?wo wdt:P31 wd:Q871419 .} union {?wo wdt:P31 wd:Q261543 .} # bundesland or bezirk at
    #{?wo wdt:P31 wd:Q106658 .} union {?wo wdt:P31 wd:Q1221156 .} # bundesland or bezirk de
    minus {?wo wdt:P31 wd:Q667509 .} # not a municipality (e.g. statutarstadt) at
    #minus {?wo wdt:P31 wd:Q262166 .} # not a municipality (e.g. statutarstadt) de
    ?sitelink schema:about ?item .
  FILTER NOT EXISTS {
    ?article schema:about ?item .
    ?article schema:isPartOf <https://de.wikipedia.org/> . #Targeting Wikipedia language where subjects has no article.
  }
  FILTER EXISTS {
    ?article schema:about ?item .
    {?article schema:isPartOf <https://sv.wikipedia.org/> .} #Targeting Wikipedia language where subjects has no article.
    union
    {?article schema:isPartOf <https://ceb.wikipedia.org/> .} #Targeting Wikipedia language where subjects has no article.
  }
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer ORDER BY ASC(?item)
items in Carinthia with coordinates and missing municipality without WP:de articles, but WP:sv or WP:ceb

Find all items in country without P17 (country) by administration unit edit

#title: items by country without coordinates and without country (and without god and without patriarchy)
SELECT ?item ?itemLabel ?itemDescription WHERE {
    filter not exists {?item wdt:P17 [] .}
    ?item wdt:P131*/wdt:P279* wd:Q40 .
    #?item wdt:P31*/wdt:P279* ?isA .
    #VALUES ?isA {wd:Q271669 wd:Q486972}
    filter not exists { ?item wdt:P625 [] .}
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
  } limit 10000
items by country without coordinates and without country (and without god and without patriarchy)

Border check edit

has to be checked from both sides of the border to find items

  • on the border but not assigned to both countries
  • inside the border (save to ignore)
  • outside the own border - wrong country, or duplicates
  • outside the foreign border - wrong country, or duplicates
#defaultView:Map{"hide":"?rgb"}
#title: Border check (with distinct types, less timeout)
SELECT ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer WITH {
  SELECT DISTINCT ?item (COUNT(DISTINCT ?country) as ?anz) WHERE {
    hint:Query hint:optimizer "None".  
    ?item wdt:P17 wd:Q215 . #16
    #?item wdt:P131*/wdt:P279* wd:Q980 . # in case of timelimit restrict to sub unit
    ?item wdt:P31 ?isA .
    VALUES ?isA {wd:Q8502 wd:Q16887036 wd:Q2231510 wd:Q10862618 wd:Q35666 wd:Q23397 wd:Q133056} # distinct border related types
    ?item wdt:P625 [] .
    ?item wdt:P17 ?country .
  }
  GROUP BY ?item
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  BIND(IF(?anz = 1, '60ff60', 'ff0000') AS ?rgb) .
  BIND(IF(?anz = 1, 'inside (single P17)', 'border (multiple P17)') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer # ORDER BY ASC(?item)
Border check (with distinct types, less timeout)
#defaultView:Map{"hide":"?rgb"}
#title: Border check (with landform & settlement base classes, timeout prone)
SELECT ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer WITH {
  SELECT DISTINCT ?item (COUNT(DISTINCT ?country) as ?anz) WHERE {
    hint:Query hint:optimizer "None".  
    ?item wdt:P17 wd:Q77 . #16
    #?item wdt:P131*/wdt:P279* wd:Q980 . # in case of timelimit restrict to sub unit
    ?item wdt:P31*/wdt:P279* ?isA .
    VALUES ?isA {wd:Q271669 wd:Q486972} # landform settlement
    ?item wdt:P625 [] .
    ?item wdt:P17 ?country .
  }
  GROUP BY ?item
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  BIND(IF(?anz = 1, '60ff60', 'ff0000') AS ?rgb) .
  BIND(IF(?anz = 1, 'inside (single P17)', 'border (multiple P17)') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?coord ?anz ?rgb ?layer # ORDER BY ASC(?item)
Border check (with landform & settlement base classes, timeout prone)

rastered coordinates edit

rastered coordinates are such that are rounded to full minutes (don't have more precision than minutes) and are likely to be unprecise or wrong. This is not true for large areas as lakes, mountain ranges, regions, etc.

Argentina edit

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q414 ;
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Austria edit

#title: get objects located in the area of Austria without assignment to Austria (P17)
#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q40 ;
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
get objects located in the area of Austria without assignment to Austria (P17)

Australia edit

(timeout -> restrict to feature landforms (Q271669))

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q408.
    #?item wdt:P31/wdt:P279* wd:Q8502. # restrict to mountains
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  ?item wdt:P31 wd:Q8502. # restrict to feature to avoid timeout
  #minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Canada edit

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q16.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Chile edit

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q298.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item    
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  #minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

for a single region (less likely to run into timeout)

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q298.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item wdt:P131* wd:Q2189.
    ?item    
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  #minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

France edit

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q142.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Germany edit

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q183.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

India edit

not that impressive: ~800 points

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q668.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Malta edit

not that impressive: 8 points

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q233.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Netherlands edit

not that impressive: ~460 points

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q55.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

New Zealand edit

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q664.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Niger edit

not that impressive: ~200 points

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q1032.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Nigeria edit

not that impressive: ~220 points

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q1033.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Senegal edit

not that impressive: ~75 points

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q1041.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!

Spain edit

#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17 wd:Q29.
    ?item wdt:P31/wdt:P279* wd:Q271669. # restrict to landforms
    ?item
         p:P625 [
           psv:P625 [
             wikibase:geoLatitude ?lat ;
             wikibase:geoLongitude ?lon ;
           ] ;
           ps:P625 ?coord
         ]
  FILTER ( 0.002 > abs(round(?lat*60)-?lat*60) && 0.002 > abs(round(?lon*60)-?lon*60) )
  minus {?item wdt:P31/wdt:P279* wd:Q15284}
  #minus {?item wdt:P31/wdt:P279* wd:Q82794} # does not work, as it also removes rivers
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q169514 } # imported from Wikimedia project: Swedish Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P143 wd:Q837615 } # imported from Wikimedia project: Cebuano Wikipedia 
  #MINUS { ?coordStatement prov:wasDerivedFrom/pr:P248 wd:Q1194038 } # stated in: GEOnet Names Server
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer
Try it!


Molln edit

 
um Molln herum
#defaultView:Map{"hide":"?rgb"}
SELECT ?item ?itemLabel ?itemDescription (GROUP_CONCAT(DISTINCT ?whereLabel; SEPARATOR=', ') AS ?whereLabels) (SAMPLE(?image) AS ?image) ?coord ?rgb ?layer WITH {
  SELECT DISTINCT ?item WHERE {
    ?item wdt:P17|wdt:P131* wd:Q684847 .
  }
} AS %subquery1 WHERE {
  INCLUDE %subquery1 .
  ?item wdt:P31 [] .
  ?item p:P625 ?coordStatement .
  ?coordStatement ps:P625 ?coord .
  OPTIONAL {
    ?item wdt:P131 ?where .
    OPTIONAL {
      ?where rdfs:label ?whereLiteral .
      FILTER(LANG(?whereLiteral) = 'de') .
    }
  }
  BIND(IF(BOUND(?where), IF(BOUND(?whereLiteral), ?whereLiteral, STRAFTER(STR(?where), 'entity/')), 'no P131') AS ?whereLabel) .
  OPTIONAL { ?item wdt:P18 ?image }
  BIND(IF(EXISTS { ?item p:P18 [] }, '0000ff', 'ff0000') AS ?rgb) .
  BIND(IF(EXISTS { ?item p:P18 [] }, 'With image', 'Without image') AS ?layer) .
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
} GROUP BY ?item ?itemLabel ?itemDescription ?whereLabels ?coord ?rgb ?layer ORDER BY ASC(?item)
Try it!

Zum Frauentag edit

läuft klarerweise auf Timeout

#title: kein Gott, kein Staat, kein Patriarchat (zum Frauentag)
SELECT ?item ?itemLabel ?itemDescription WHERE {
    #hint:Query hint:optimizer "None".  
    filter not exists {?item wdt:P17 [] .}
    minus {?item wdt:P31* wd:Q178885.}
    minus {?item ?rel wd:Q181339.}
  SERVICE wikibase:label { bd:serviceParam wikibase:language '[AUTO_LANGUAGE,de,en]' }
  } limit 10000
kein Gott, kein Staat, kein Patriarchat (zum Frauentag)

Vornamen und Geschlechter edit

#title: male persons with female given name
#set ?givenName to the item for the given name
SELECT distinct ?item ?itemQid ?itemLabel WHERE {
  bind (wd:Q4120836 as ?givenName). # Johanna
  ?item wdt:P735 ?givenName .
  ?item wdt:P735 ?givenName2 .
  #?item wdt:P106 wd:Q82955.
  filter not exists {?item wdt:P742 []}
  ?item wdt:P21 wd:Q6581097. # male
  #?givenName wdt:P31 wd:Q11879590. # female given name
  filter not exists {?givenName2 wdt:P31 wd:Q12308941} # no male given name
  # get the plain wikidata id in string format
  bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)

  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" } .
} limit 50
male persons with female given name
#title: female persons with male given name
#set ?givenName to the item for the given name
SELECT distinct ?item ?itemQid ?itemLabel WHERE {
  bind (wd:Q4925932 as ?givenName). # Franz
  ?item wdt:P735 ?givenName .
  ?item wdt:P735 ?givenName2 .
  #?item wdt:P106 wd:Q82955.
  filter not exists {?item wdt:P742 []}
  ?item wdt:P21 wd:Q6581072. # female
  #?givenName wdt:P31 wd:Q12308941. # male given name
  filter not exists {?givenName2 wdt:P31 wd:Q11879590} # no female given name
  # get the plain wikidata id in string format
  bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)

  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" } .
} limit 50
female persons with male given name
#title: check partner for same gender (male)
SELECT distinct ?item ?itemQid ?itemLabel ?item2 ?item2Label WHERE {
  ?item wdt:P26 ?item2 .
  ?item wdt:P21 wd:Q6581097 .
  ?item2 wdt:P21 wd:Q6581097 .
  #?item wdt:P21 ?sex .
  #?item2 wdt:P21 ?sex2 .
  #filter (?sex = wd:Q6581097 && ?sex2 = wd:Q6581097 {{|}}{{|}} ?sex = wd:Q6581072 && ?sex2 = wd:Q6581072)
  #filter not exists {?item wdt:P742 []}
  filter (xsd:string(?item) > xsd:string(?item2) )
  filter not exists {?item wdt:P91 wd:Q6636 }
  #bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)

  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" } .
} order by ?item offset 0 limit 100
check partner for same gender (male)
#title: check partner for same gender (female)
SELECT distinct ?item ?itemQid ?itemLabel ?item2 ?item2Label WHERE {
  ?item wdt:P26 ?item2 .
  ?item wdt:P21 wd:Q6581072 .
  ?item2 wdt:P21 wd:Q6581072 .
  #filter not exists {?item wdt:P742 []}
  filter (xsd:string(?item) > xsd:string(?item2) )
  filter not exists {?item wdt:P91 wd:Q6636 }
  #bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)

  SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" } .
} order by ?item offset 0 limit 100
check partner for same gender (female)
#title: female persons with male names
SELECT distinct ?item ?itemQid ?itemLabel WHERE {
  ?givenName wdt:P31 wd:Q12308941. # male given name
  ?item wdt:P21 wd:Q6581072. # female
  ?item wdt:P735 ?givenName .
  ?item wdt:P735 ?givenName2 .
  #?item wdt:P735 ?givenName3 .
  #?item wdt:P106 wd:Q82955.
  filter not exists {?item wdt:P742 []}
  filter not exists {?givenName2 wdt:P31 wd:Q11879590} # no female given name
  filter not exists {?givenName2 wdt:P31 wd:Q3409032} # no unisex given name
  # get the plain wikidata id in string format
  bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)

  #SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" } .
} limit 500
female persons with male names
#title: count couples with same gender (female)
SELECT (count(distinct ?item) as ?count) WHERE {
  ?item wdt:P26 ?item2 .
  ?item wdt:P21 wd:Q6581072 . #female
  ?item2 wdt:P21 wd:Q6581072 . #female
  #?item wdt:P21 wd:Q6581097 . #male
  #?item2 wdt:P21 wd:Q6581097 . #male
  #?item wdt:P21 ?sex .
  #?item2 wdt:P21 ?sex2 .
  #filter (?sex = wd:Q6581097 && ?sex2 = wd:Q6581097 {{|}}{{|}} ?sex = wd:Q6581072 && ?sex2 = wd:Q6581072)
  #filter not exists {?item wdt:P742 []}
  filter (xsd:string(?item) > xsd:string(?item2) )
  filter not exists {?item wdt:P91 wd:Q6636 }
  #bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)

  #SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" } .
}
count couples with same gender (female)


#title: humans with double gender (non trans)
SELECT  ?item  where { # (count(distinct ?item) as ?count) WHERE { #
  ?item wdt:P21 wd:Q6581072 .
  ?item wdt:P21 wd:Q6581097 .
  filter not exists {?item wdt:P21/wdt:P279* wd:Q189125 }
  ?item wdt:P31 wd:Q5 .
  #bind (replace(xsd:string(?item),"http://www.wikidata.org/entity/","") as ?itemQid)

  #SERVICE wikibase:label { bd:serviceParam wikibase:language "de,en" } .
} order by ?item offset 0 limit 100
humans with double gender (non trans)
#title: items with both sexes
SELECT ?item WHERE { ?item wdt:P21 wd:Q6581072, wd:Q6581097 }
items with both sexes