User:Bouzinac/Data quality
Jump to navigation
Jump to search
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Try it!
Buildings that are not a part of a bounding box covering the mainland of a country
https://w.wiki/5Gdp in europe?
tring search elements without instance of (P31) nor subclass of (P279)[edit]
SELECT DISTINCT ?item ?itemLabel ?itemDescription
WHERE {
hint:Query hint:optimizer "None".
SERVICE wikibase:mwapi {
bd:serviceParam wikibase:api "Search";
wikibase:endpoint "www.wikidata.org";
mwapi:srsearch "inlabel:siege -haswbstatement:P31 -haswbstatement:P279" .
#haswbstatement:P31=Q5". exemple pour les humains
?title wikibase:apiOutput mwapi:title.
}
BIND(IRI(CONCAT(STR(wd:), ?title)) AS ?item)
#add any other requirements here
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
- Gares d'aéroport : https://w.wiki/3JmD
Elements without labels in fr[edit]
SELECT ?item ?label ?date (year(?date) as ?annee) WHERE {
?item wdt:P31 wd:Q47018478.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "fr,en".
?item rdfs:label ?label.
}
MINUS { ?item (wdt:P576|wdt:P582|wdt:P3999) ?dispar. }#on ne veut pas les item disparues
MINUS {
?item wdt:P5817|wdt:P5816 ?interdit.
VALUES ?interdit { wd:Q811683 wd:Q63065035 wd:Q12377751 wd:Q97317113 wd:Q55653430 wd:Q30108381 wd:Q55570340 wd:Q11639308 wd:Q104664889
}
}#on ne veut pas les cas particuliers, en construction etc
FILTER(NOT EXISTS {
?item rdfs:label ?lang_label.
FILTER(LANG(?lang_label) = "fr")
})
}
Elements sharing same date : probably same thing[edit]
Elements with labels in different languages[edit]
- https://w.wiki/6As9
- https://w.wiki/6AsU (avec optional)
Missing descriptions in frlang[edit]
Finding a specific text description in frdescription lang[edit]
Labels fr de stations à rajouter[edit]
select ?item (group_concat(?partieLabel;separator=", ") as ?partieLabelFr) (group_concat(?ligneLabel;separator=", ") as ?ligneLabelFr)
where {SELECT ?item ?ligne ?ligneLabel ?partieLabel ?partie WHERE {
?item wdt:P31 wd:Q928830.
OPTIONAL { ?item wdt:P361 ?partie. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
FILTER(NOT EXISTS {
?item schema:description ?itemdesc.
FILTER((LANG(?itemdesc)) = "fr") })
OPTIONAL { ?item wdt:P81 ?ligne. } MINUS { ?item (wdt:P576|wdt:P582|wdt:P3999) ?dispar. }
MINUS {
?item wdt:P5817 ?interdit. VALUES ?interdit {
wd:Q811683
wd:Q63065035
wd:Q12377751
wd:Q55653430
wd:Q30108381
wd:Q55570340
wd:Q11639308 }
} } } group by ?item
List of airports poorly filled[edit]
List of railways stations poorly filled[edit]
Check wiki airport element having neither IATA nor ICAO nor FAA LID[edit]
SELECT DISTINCT ?airport ?airportlabel ?pays ?paysLabel WHERE {
?airport (wdt:P31/wdt:P279*) wd:Q62447.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,fr,de,kk". }
FILTER(NOT EXISTS { ?airport wdt:P239 ?icao. })
FILTER(NOT EXISTS { ?airport wdt:P238 ?iata. })
FILTER(NOT EXISTS { ?airport wdt:P240 ?FAA. })
FILTER(NOT EXISTS { ?airport wdt:P5699 ?tc_cad.})
FILTER(NOT EXISTS { ?airport wdt:P5746 ?DGAC.})
FILTER(NOT EXISTS { ?airport wdt:P5851 ?russ. })
FILTER(NOT EXISTS { ?airport wdt:P6120 ?argent. })
MINUS { ?airport (wdt:P576|wdt:P582|wdt:P3999) ?dispar. }# remove items with P576 (dissolved, abolished or demolished) as a main property
MINUS {
?airport wdt:P5817 ?interdit.
VALUES ?interdit {
wd:Q811683
wd:Q63065035
wd:Q12377751
wd:Q55653430
wd:Q30108381
wd:Q55570340
wd:Q11639308
}
}
FILTER NOT EXISTS { ?airport p:P239 [rdf:type wdno:P239].} #we do not want the ?item if ICAO has a <no value>
MINUS {?airport wdt:P31/wdt:P279* wd:Q695850.} # exclude military airports
MINUS {?airport wdt:P31/wdt:P279* wd:Q2265915.} # exclude vol à voile
MINUS {?airport wdt:P31/wdt:P279* wd:Q1311670.} # exclude railways stations
MINUS {?airport a wdno:P17.} #exclude airports that aren't physically based in a country
MINUS {?airport wdt:P31/wdt:P279* wd:Q7373622.} # exclude Royal Air Force
MINUS {?airport (wdt:P31/wdt:P279*) wd:Q782667. } # exclude motorways where plane can land
minus {?airport wdt:P31/wdt:P279* wd:Q502074.} # exclude héliports
minus {?airport wdt:P31/wdt:P279* wd:Q44665966.} # exclude airports in project
OPTIONAL {?airport wdt:P17 ?pays. }
} order by ?paysLabel
Dédoublonnage aérodromes prrrrt[edit]
SELECT DISTINCT ?pays ?paysLabel ?item ?itemLabel ?itemDescription ?sitelink
WHERE {
?item (wdt:P31/wdt:P279*) wd:Q62447.
optional{ ?item wdt:P17 ?pays}
MINUS { ?item wdt:P625 ?coord. }
MINUS { ?item wdt:P576 _:b2. } # remove items with P576 (dissolved, abolished or demolished) as a main property
MINUS { ?item wdt:P582 _:b3. } # remove items with P582 (end date) as a main property
MINUS { ?item (wdt:P31/wdt:P279*) wd:Q695850. } # exclude military airports
MINUS { ?item (wdt:P31/wdt:P279*) wd:Q1311670. } # exclude railways stations
MINUS { ?item (wdt:P31/wdt:P279*) wd:Q7373622. } # exclude Royal Air Force
MINUS { ?item (wdt:P31/wdt:P279*) wd:Q502074. } # exclude héliports
MINUS { ?item wdt:P31/wdt:P279* wd:Q2265915.} # exclude vol à voile/gliders
MINUS { ?item (wdt:P31/wdt:P279*) wd:Q44665966. } # exclude airports being build
MINUS { ?item (wdt:P31/wdt:P279*) wd:Q782667. } # exclude motorways where plane can land
MINUS { ?item a wdno:P17.} # exclude airports that aren't physically based in a country
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en,ms". }
}
Airports with more than 1 coordinates[edit]
SELECT ?item ?itemLabel ?coord1 ?coord2 ?distance ?rank1 ?rank2 WITH {
SELECT DISTINCT ?item ?coord1 ?coord2 ?rank1 ?rank2 WHERE {
?item (wdt:P31/wdt:P279*) wd:Q62447.
hint:Prior hint:gearing "forward".
?item p:P625 ?stat1 . ?stat1 ps:P625 ?coord1 . ?stat1 wikibase:rank ?rank1 .
?item p:P625 ?stat2 . ?stat2 ps:P625 ?coord2 . ?stat2 wikibase:rank ?rank2 .
filter ( str(?stat1) < str(?stat2) ) . # not the same
filter ( str(?rank1) = str(?rank2) ) . # are the same
}
} AS %if WHERE {
include %if
BIND(geof:distance(?coord1, ?coord2) as ?distance)
SERVICE wikibase:label { bd:serviceParam wikibase:language "da,en,[AUTO_LANGUAGE]". }
}
ORDER BY ?itemLabel
Items with more than 1 coordinates[edit]
https://w.wiki/5wNH https://w.wiki/5wNE
Airports not having a country set[edit]
SELECT ?airport ?coords ?pays ?paysLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?airport (wdt:P31/wdt:P279*) wd:Q62447.
MINUS { ?airport wdt:P576 _:b2. }
MINUS { ?airport wdt:P582 _:b3. }
OPTIONAL { ?airport wdt:P625 ?coords. }
OPTIONAL { ?airport wdt:P17 ?pays. }
MINUS { ?airport wdt:P30 wd:Q51. }
FILTER(!BOUND(?pays))
}
Dédoublonnage gares indiennes[edit]
SELECT DISTINCT ?item1 ?item1Label ?item2 ?item2Label ?value
{
?item1 wdt:P5696 ?value .
?item2 wdt:P5696 ?value .
FILTER( ?item1 != ?item2 && STR( ?item1 ) < STR( ?item2 ) ) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,en" } .
}
Colombie fait[edit]
PREFIX wdno: <http://www.wikidata.org/prop/novalue/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?airport ?airportLabel (SAMPLE(?coord) AS ?coord) ?ICAO ?IATA WHERE {
?airport (wdt:P31/wdt:P279*) wd:Q62447.
?airport wdt:P17 wd:Q739 .
MINUS { ?airport wdt:P576 _:b2. } # remove items with P576 (dissolved, abolished or demolished) as a main property
MINUS { ?airport wdt:P582 _:b3. } # remove items with P582 (end date) as a main property
MINUS { ?item wdt:P31/wdt:P279* wd:Q44665966.} # exclude airports being build
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr,es,en,fr,[AUTO_LANGUAGE]". }
OPTIONAL { ?airport wdt:P625 ?coord. }
OPTIONAL { ?airport wdt:P239 ?ICAO. }
OPTIONAL { ?airport wdt:P238 ?IATA.}
}
GROUP BY ?airport ?airportLabel ?ICAO ?IATA
ORDER BY ?coord
Objects thare outside the box of a country[edit]
#title:Buildings that are not a part of a bounding box covering the mainland of a country
#defaultView:Map
SELECT ?item ?itemLabel ?coords WITH { SELECT * WHERE {
VALUES ?country { wd:Q948 } # change your country here, check that the bounding box only covers its mainland
?country p:P1332 [ a wikibase:BestRank; psv:P1332 [ wikibase:geoLatitude ?nmp_lat ] ].
?country p:P1333 [ a wikibase:BestRank; psv:P1333 [ wikibase:geoLatitude ?smp_lat ] ].
?country p:P1334 [ a wikibase:BestRank; psv:P1334 [ wikibase:geoLongitude ?emp_long ] ].
?country p:P1335 [ a wikibase:BestRank; psv:P1335 [ wikibase:geoLongitude ?wmp_long ] ].
} } AS %a WITH { SELECT distinct ?item ?coords
WHERE {
INCLUDE %a
?item wdt:Q41 ?country;
wdt:P31/wdt:P279* wd:Q811979#architectural thing
;wdt:P625 ?coords;#its coordinates
p:P625 [ a wikibase:BestRank; psv:P625 ?coord_vn ] .
?coord_vn wikibase:geoLatitude ?lat. hint:Prior hint:rangeSafe true.
?coord_vn wikibase:geoLongitude ?long. hint:Prior hint:rangeSafe true.
FILTER(?lat > ?nmp_lat || ?lat < ?smp_lat || ?long > ?emp_long || ?long < ?wmp_long)
}
LIMIT 20000#change values here, small value if big country eg 250, bigger value if medium country, huge value if very small country
} AS %b WHERE { INCLUDE %a INCLUDE %b
# Try to remove things here to ensure it runs after named subquery b
FILTER NOT EXISTS { ?item wdt:P17 ?country2. FILTER(?country2 != ?country ) }
MINUS { ?item wdt:P5816 wd:Q19860854 . } MINUS { ?item (wdt:P576|wdt:P3999) ?dispar. }#on ne veut pas les disparus
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .} }