Wikidata:WikiProject Poland/Maintenance Queries

From Wikidata
Jump to navigation Jump to search

Home

 


Properties

 

Maintenance Queries

 

Showcase Queries

 



Villages[edit]

villages that should have instance of (P31) = village of Poland (Q3558970), but have village (Q532)
# villages that should have P31 = Q3558970, but have Q532
SELECT ?item ?itemLabel ?adminLabel
WHERE
{
	?item wdt:P31 wd:Q532 .
  	?item wdt:P17 wd:Q36 .
  	?item wdt:P131 ?admin
	SERVICE wikibase:label { bd:serviceParam wikibase:language "pl" }
}
Try it!
villages that have parenthesis in label
# villages that have parenthesis in label
SELECT DISTINCT ?village ?label ?villageDescription ?wojLabel ?powiatLabel ?gminaLabel
WHERE
{
  ?village wdt:P31 wd:Q3558970;
          rdfs:label ?label .
  FILTER(LANG(?label) IN ("pl")) .
  FILTER(CONTAINS(?label, "(")) .
  ?village wdt:P17 wd:Q36 . 
  ?village wdt:P131 ?gmina . ?gmina wdt:P131 ?powiat . ?powiat wdt:P131 ?woj .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pl"}
}
LIMIT 10000
Try it!
villages without description in Polish
# villages without description in Polish
SELECT DISTINCT ?village ?villageLabel
WHERE
{
  ?village wdt:P17 wd:Q36 .
  OPTIONAL { ?village schema:description ?villageDescription  }
  FILTER (!BOUND(?villageDescription))
  ?village wdt:P31 wd:Q3558970 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pl"}
}
LIMIT 1000
Try it!

Gminas[edit]

description checker for gminas
# description checker for gminas
SELECT DISTINCT ?item ?itemLabel ?itemDescription ?gminaLabel ?wojLabel WHERE {
  # get instance of any gmina wiejska, miejsko-wiejska
  {?item wdt:P31 wd:Q3504085 .} UNION { ?item wdt:P31 wd:Q3491915 . }
  ?item wdt:P31 ?gmina .
  ?item wdt:P131 ?powiat . ?powiat wdt:P131 ?woj .
  # from Poland
  ?item wdt:P131* wd:Q36 .
  # where instance of has no end time
  MINUS { ?item p:P31 [ pq:P580 ?end_time ] } .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "pl". }
}
ORDER BY ?itemLabel
Try it!

Items without statements[edit]