query-062a080fe021c3f014c6570bafcaab38
MatSuBot 7) logs • contribs • talk (Matěj Suchánek Operator: )xtools • User rights • User rights log • Block log • SUL • new lexemes • new items • contribs • talk (MatSuBot Remove/deprecate less precise dates without reliable source. Task: Pywikibot, SPARQL (not yet written). Code: The number of sourced statements is growing as we are matching our entities against other datasets and import their data. Sometimes the data is different from what's been imported from Wikipedia infoboxes before. This violates constraints like Single value and should be sorted out. Function details:). PreferentialBot, uses day precision and is inside the former. The bot would either remove the less precise statement, made it deprecated or made the more precise statement preferred (which could be integrated to (Q20666306)BnF authorities has two dates of birth: 1258 and 11 November 1258. The former was imported from a Wikipedia edition and is less precise, the latter was imported from (Q72083)Trần Nhân Tông , from less reliable sources (or without source). For example, (P569)date of birth My proposal is to have a bot which removes less precise time values, such as Sample query: multi precision dates query Wikidata:Requests_for_permissions/Bot/MatSuBot_7A query where date of birth (P569) (or date of death (P570) ) has 2 values (or more) one a year and one a more precise date with the same year.
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT ?item ?val1 ?prec1 ?val2 ?prec2 {
?item p:P569 ?statement1 .
?item p:P569 ?statement2 FILTER( ?statement2 != ?statement1 ) . # more than one statement
MINUS { ?item p:P569/wikibase:rank wikibase:PreferredRank } .
?statement1 psv:P569 [ wikibase:timeValue ?val1; wikibase:timePrecision ?prec1 ] .
?statement2 psv:P569 [ wikibase:timeValue ?val2; wikibase:timePrecision ?prec2 ] .
FILTER( ?prec1 < ?prec2 ) . # different precision
MINUS {
?statement1 prov:wasDerivedFrom ?ref1 .
?ref1 ?pr1 [] .
FILTER( ?pr1 != pr:P143 ) . # the less precise statement is without real source
} .
?statement2 prov:wasDerivedFrom ?ref2 .
?ref2 ?pr2 [] .
FILTER( ?pr2 != pr:P143 ) . # the more precise statement does have it
FILTER( YEAR( ?val1 ) = YEAR( ?val2 ) ) .
FILTER( ?prec1 = 9 || MONTH( ?val1 ) = MONTH( ?val2 ) ) . # one time value is inside the other one
}
Query found at
- https://www.wikidata.org/wiki/User:Jarekt/queries
- https://www.wikidata.org/wiki/Wikidata:Requests_for_permissions/Bot/MatSuBot_7