query-062a080fe021c3f014c6570bafcaab38

rq turtle/ttl

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

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

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v8("?item"):::projected v9("?pr1") v4("?pr2") v1("?prec1"):::projected v5("?prec2"):::projected v10("?ref1") v11("?ref2") v7("?statement1") v6("?statement2") v2("?val1"):::projected v3("?val2"):::projected a4((" ")) a5((" ")) a1((" ")) a2((" ")) a3((" ")) c5(["wikibase:PreferredRank"]):::iri f0[["(?prec1 = '9^^xsd:integer' || month-from-dateTime(?val1) = month-from-dateTime(?val2))"]] f0 --> v1 f0 --> v2 f0 --> v3 f1[["year-from-dateTime(?val1) = year-from-dateTime(?val2)"]] f1 --> v2 f1 --> v3 f2[["?pr2 != 'p:reference/P143'"]] f2 --> v4 f3[["?prec1 < ?prec2"]] f3 --> v1 f3 --> v5 f4[["?statement2 != ?statement1"]] f4 --> v6 f4 --> v7 v8 --"p:P569"--> v7 v8 --"p:P569"--> v6 subgraph minus5["MINUS"] style minus5 stroke-width:6px,fill:pink,stroke:red; v8 --"p:P569"--> a1 a1 --"wikibase:rank"--> c5 end a2 --"wikibase:timeValue"--> v2 a2 --"wikibase:timePrecision"--> v1 v7 --"p:statement/value/P569"--> a2 a3 --"wikibase:timeValue"--> v3 a3 --"wikibase:timePrecision"--> v5 v6 --"p:statement/value/P569"--> a3 subgraph minus6["MINUS"] style minus6 stroke-width:6px,fill:pink,stroke:red; f7[["?pr1 != 'p:reference/P143'"]] f7 --> v9 v7 --"prov:wasDerivedFrom"--> v10 v10 -->v9--> a4 end v6 --"prov:wasDerivedFrom"--> v11 v11 -->v4--> a5