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
- https://docs.data.world/tutorials/sparql/list-of-sparql-filter-functions.html
- Duplizieren von Items:
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
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 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)
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 wikidata entries with/out image per federal state / per district edit
map view of all wikidata entries with/out image per region edit
- (has property mountain range (P4552) with value Silvretta Alps (Q123180)): Sparql
- (has property mountain range (P4552) with value Schladming Tauern (Q668259)): Sparql
- (has property mountain range (P4552) with value Rottenmann and Wölz Tauern (Q671963)): Sparql
- (has property mountain range (P4552) with value Rätikon (Q659729)): Sparql
- (has property mountain range (P4552) with value Lechquellen Mountains (Q122641)): Sparql
- (has property mountain range (P4552) with value Lechtal Alps (Q700267)): Sparql
- (has property mountain range (P4552) with value Verwall Alps (Q589487)): Sparql
- (has property mountain range (P4552) with value Schober group (Q124453)): Sparql
- (has property mountain range (P4552) with value Venediger Group (Q668584)): Sparql
- (has property mountain range (P4552) with value Goldberg Group (Q381709)): Sparql
- (has property mountain range (P4552) with value Granatspitze Group (Q532682)): Sparql
- (has property mountain range (P4552) with value Glockner Group (Q454919)): Sparql
- (has property mountain range (P4552) with value Zillertal Alps (Q203151)): Sparql
- (has property mountain range (P4552) with value Stubai Alps (Q679261)): Sparql
- (has property mountain range (P4552) with value Ötztal Alps (Q307518)): Sparql
- (has property mountain range (P4552) with value Rieserferner Group (Q456137)): Sparql
- (has property mountain range (P4552) with value Carnic Alps (Q660390)): Sparql
- (has property mountain range (P4552) with value Gailtal Alps (Q152704)): Sparql
- (has property mountain range (P4552) with value Kitzbühel Alps (Q592910)): Sparql
- (has property mountain range (P4552) with value High Tauern (Q679359)): Sparql
- (has property mountain range (P4552) with value Ammergau Alps (Q473095)): Sparql
- (has property mountain range (P4552) with value Allgäu Alps (Q655747)): Sparql
- (has property mountain range (P4552) with value Karawanks (Q198007)): Sparql
- (has property mountain range (P4552) with value Kaiser Mountains (Q697614)): Sparql
- (has property mountain range (P4552) with value Karwendel (Q671207)): Sparql
- (has property mountain range (P4552) with value Kreuzeck group (Q666999)): Sparql
- (has property mountain range (P4552) with value Villgraten Mountains (Q682619)): Sparql
- (has property mountain range (P4552) with value Reiter Alpe (Q2142096)): Sparql
- (has property mountain range (P4552) with value Berchtesgaden Alps (Q679384)): Sparql
- (has property mountain range (P4552) with value Chiemgau Alps (Q572571)): Sparql
- (has property mountain range (P4552) with value Ybbstal Alps (Q697095)): Sparql
- (has property mountain range (P4552) with value Göstlinger Alpen (Q1521939)): Sparql
- (has property mountain range (P4552) with value Dachstein Mountains (Q261664)): Sparql
- (has property mountain range (P4552) with value Totes Gebirge (Q697915)): Sparql
- (has property mountain range (P4552) with value Salzkammergut Mountains (Q689198)): Sparql
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 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 <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
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 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 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
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
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
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 []
}
}
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
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)
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)
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
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)
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)
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)
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
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
#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
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)
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' }
}
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 .
}
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' }
}
&&
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' }
}
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
- 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
- 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
- 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
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
- 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 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
- 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]' }
}
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 != "")
}
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
#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
#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
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
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
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
#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
#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
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
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
#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
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)
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)
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
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)
#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)
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Molln 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|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)
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
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
#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
#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
#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
#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
#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" } .
}
#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
#title: items with both sexes
SELECT ?item WHERE { ?item wdt:P21 wd:Q6581072, wd:Q6581097 }