User:Salgo60/ListeriaNobelData3

From Wikidata
Jump to navigation Jump to search

SPARQL in action: Comparing 2 datasets using federated SPARQL[edit]

See also:

Lesson learned[edit]

  • data.nobelprize.org feels like having good sources BUT they don't have sources/references for facts ==> problem understand if Wikidata should change a fact or not
  • data.nobelprize.org has no support for calendar dates Julian/Gregorian
    • ==> we need to guess if a mismatch is because of an error or just the lack of support in the software e.g.
  • Wikidata is fast updating when people passed away see list
  • as Wikidata has no standard of describing a source its difficult to understand what Trust this source has see my blogpost

Listeria checking diffs dates Wikidata and Nobelprize.org[edit]

An empty list is a good list

Below a Federated search Wikidata <-> data.nobelprize.org displaying differencies ordered by desc death date in Wikidata

  • Birth dates
    • NobelBirth <-> WDBirth
  • Death dates
    • NobelDeath <-> WDDeath

This list is periodically updated by a bot. Manual changes to the list will be removed on the next update!

WDQS | PetScan | YASGUI | TABernacle | Find images Recent changes
image ?item ?nobelid ?laureatenobeluri ?wdbirth ?nobelbirth ?wddeath ?nobeldeath
RiccardoGiacconi.jpg
Riccardo Giacconi 755 http://data.nobelprize.org/resource/laureate/755 1931-10-06 1931-10-06 2018-12-09
Aaron Klug 1979.jpg
Aaron Klug 259 http://data.nobelprize.org/resource/laureate/259 1926-08-11 1926-08-11 2018-11-20
Osamu Shimomura-press conference Dec 06th, 2008-2.jpg
Osamu Shimomura 829 http://data.nobelprize.org/resource/laureate/829 1928-08-27 1928-08-27 2018-10-19
Thomas A. Steitz.jpg
Thomas A. Steitz 842 http://data.nobelprize.org/resource/laureate/842 1940-08-23 1940-08-23 2018-10-09
Charles K. Kao cropped 2.jpg
Charles K. Kao 838 http://data.nobelprize.org/resource/laureate/838 1933-11-04 1933-11-04 2018-09-23
Kofi Annan 2012 (cropped).jpg
Kofi Annan 749 http://data.nobelprize.org/resource/laureate/749 1938-04-08 1938-04-08 2018-08-18
Peter Gruenberg 01.jpg
Peter Grünberg 815 http://data.nobelprize.org/resource/laureate/815 1939-05-18 1939-05-18 2018-04-07 2018-04-09
Shimon Peres in Brazil-cropped.jpg
Shimon Peres 558 http://data.nobelprize.org/resource/laureate/558 1923-08-02 1923-08-16 2016-09-28 2016-09-28
Richard Fred Heck cropped.jpg
Richard F. Heck 851 http://data.nobelprize.org/resource/laureate/851 1931-08-15 1931-08-15 2015-10-10 2015-10-09
Nobel2004chemistrylaurets-Rose.jpg
Irwin Rose 781 http://data.nobelprize.org/resource/laureate/781 1926-07-16 1926-07-16 2015-06-02 2015-06-03
Robert William Fogel.jpg
Robert Fogel 709 http://data.nobelprize.org/resource/laureate/709 1926-07-01 1927-07-01 2013-06-11 2013-06-11
CHARPAK Georges-24x50-2005 cropped.JPG
Georges Charpak 142 http://data.nobelprize.org/resource/laureate/142 1924-03-08 1924-08-01 2010-09-29 2010-09-29
Kim Dae-jung (Cropped).png
Kim Dae-jung 725 http://data.nobelprize.org/resource/laureate/725 1924-01-06 1925-12-03 2009-08-18 2009-08-18
Trygve Haavelmo.jpg
Trygve Haavelmo 703 http://data.nobelprize.org/resource/laureate/703 1911-12-13 1911-12-13 1999-07-28 1999-07-26
Isaac Bashevis Singer (upright).jpg
Isaac Bashevis Singer 654 http://data.nobelprize.org/resource/laureate/654 1902-11-21 1904-07-14 1991-07-24 1991-07-24
Nikolay Semyonov Nobel.jpg
Nikolay Semyonov 220 http://data.nobelprize.org/resource/laureate/220 1896-04-15 1896-04-03 1986-09-25 1986-09-25
James Rainwater 2.jpg
James Rainwater 104 http://data.nobelprize.org/resource/laureate/104 1917-12-09 1917-12-09 1986-05-31 1986-03-31
Pyotr L Kapitsa Russian physicist 1964.jpg
Pyotr Kapitsa 110 http://data.nobelprize.org/resource/laureate/110 1894-07-08 1894-07-09 1984-04-08 1984-04-08
1924 Karl Manne Siegbahn.jpg
Manne Siegbahn 29 http://data.nobelprize.org/resource/laureate/29 1886-12-03 1886-12-03 1978-09-24 1978-09-26
Edgar Douglas Adrian nobel.jpg
Edgar Adrian, 1st Baron Adrian 324 http://data.nobelprize.org/resource/laureate/324 1889-11-30 1889-11-30 1977-08-04 1977-08-08
Cyril Norman Hinshelwood Nobel.jpg
Cyril Norman Hinshelwood 219 http://data.nobelprize.org/resource/laureate/219 1897-06-19 1897-05-19 1967-10-09 1967-10-09
Bundesarchiv Bild 183-U0205-502, Max von Laue.jpg
Max von Laue 19 http://data.nobelprize.org/resource/laureate/19 1879-10-09 1879-10-09 1960-04-24 1960-04-23
Ludwig Quidde nobel.jpg
Ludwig Quidde 493 http://data.nobelprize.org/resource/laureate/493 1858-03-23 1858-03-23 1941-03-05 1941-03-04
Ivan Pavlov nobel.jpg
Ivan Pavlov 296 http://data.nobelprize.org/resource/laureate/296 1849-09-26 1849-09-14 1936-02-27 1936-02-27
Richard Adolf Zsigmondy LOC.jpg
Richard Adolf Zsigmondy 182 http://data.nobelprize.org/resource/laureate/182 1865-04-01 1865-04-01 1929-09-23 1929-09-24
Rudolf Christoph Eucken.jpg
Rudolf Christoph Eucken 578 http://data.nobelprize.org/resource/laureate/578 1846-01-05 1846-01-05 1926-09-15 1926-09-14
Léon Bourgeois.jpg
Léon Bourgeois 484 http://data.nobelprize.org/resource/laureate/484 1851-05-29 1851-05-21 1925-09-29 1925-09-29
Venki Ramakrishnan.jpg
Venkatraman Ramakrishnan 841 http://data.nobelprize.org/resource/laureate/841 1952-01-01
Donna Strickland, OSA Holiday Party 2012.jpg
Donna Strickland 962 http://data.nobelprize.org/resource/laureate/962 1959-05-27
MoYan Hamburg 2008.jpg
Mo Yan 880 http://data.nobelprize.org/resource/laureate/880 1955-02-17 1955-02-02
CNYang.jpg
Yang Chen Ning 68 http://data.nobelprize.org/resource/laureate/68 1922-10-01 1922-09-22
Paul Romer, 2005 (cropped).jpg
Paul M. Romer 969 http://data.nobelprize.org/resource/laureate/969 1955-11-07
William Nordhaus 968 http://data.nobelprize.org/resource/laureate/968 1941-05-31
Denis Mukwege par Claude Truong-Ngoc novembre 2014.jpg
Denis Mukwege 966 http://data.nobelprize.org/resource/laureate/966 1955-03-01
Nadia Murad, 2015 (cropped).jpg
Nadia Murad 967 http://data.nobelprize.org/resource/laureate/967 1993-01-01
Susumu Tonegawa Photo.jpg
Susumu Tonegawa 436 http://data.nobelprize.org/resource/laureate/436 1939-09-06 1939-09-05
Craig Mello 01.JPG
Craig Mello 803 http://data.nobelprize.org/resource/laureate/803 1960-10-18 1960-10-19
Nobel Prize 2011-Press Conference KVA-DSC 7744.jpg
Saul Perlmutter 864 http://data.nobelprize.org/resource/laureate/864 1959-09-22
George P. Smith 964 http://data.nobelprize.org/resource/laureate/964 1941-03-10
A Michael Spence.jpg
Michael Spence 745 http://data.nobelprize.org/resource/laureate/745 1943-11-07 1942-11-30
End of automatically generated list.

Query to check diff[edit]

PREFIX      dbpprop:  <http://dbpedia.org/property/>
PREFIX      foaf:  <http://xmlns.com/foaf/0.1/>
SELECT ?NobelId ?item ?LaureateNobelUri ?NobelBirth  ?WDBirth ?NobelDeath ?WDDeath 
with
{SELECT ?NobelId ?item ?LaureateNobelUri ?NobelBirth ?NobelDeath ?WDBirth ?WDDeath{
  SERVICE <http://data.nobelprize.org/sparql>  {
      SELECT distinct ?NobelId ?LaureateNobelUri ?NobelBirth ?NobelDeath ?NobelGender WHERE {        
      ?LaureateNobelUri <http://data.nobelprize.org/terms/laureateAward> ?NobelAwardid.
      BIND(REPLACE(str(?LaureateNobelUri),"http://data.nobelprize.org/resource/laureate/","") AS ?NobelId)
      OPTIONAL{ ?LaureateNobelUri foaf:birthday ?NobelBirth}
      OPTIONAL{ ?LaureateNobelUri dbpprop:dateOfDeath ?NobelDeath}
      }
   }
  } 
 } as %i where
{
  include %i
  ?item wdt:P2888 ?LaureateNobelUri . 
  OPTIONAL{ ?item wdt:P569 ?birthDate.}
  OPTIONAL{ ?item wdt:P570 ?diedDate.}
  BIND (SUBSTR(CONCAT("0",STR(DAY(?birthDate))),STRLEN(STR(DAY(?birthDate))),2) AS ?birthDay)
  BIND (SUBSTR(CONCAT("0",STR(MONTH(?birthDate))),STRLEN(STR(MONTH(?birthDate))),2) AS ?birthMonth)
  BIND (CONCAT(STR(YEAR(?birthDate)),"-",?birthMonth,"-",?birthDay) AS ?WDBirth)
  BIND (SUBSTR(CONCAT("0",STR(DAY(?diedDate))),STRLEN(STR(DAY(?diedDate))),2) AS ?diedDay)
  BIND (SUBSTR(CONCAT("0",STR(MONTH(?diedDate))),STRLEN(STR(MONTH(?diedDate))),2) AS ?diedMonth)
  BIND (CONCAT(STR(YEAR(?diedDate)),"-",?diedMonth,"-",?diedDay) AS ?WDDeath)
  FILTER (
        !(BOUND(?NobelBirth) = BOUND(?WDBirth))
    ||
        !(BOUND(?NobelDeath) = BOUND(?WDDeath))
    ||
        !(str(?WDBirth) = str(?NobelBirth))
    ||
        !(str(?WDDeath) = str(?NobelDeath))
  )
}
 order by desc(xsd:integer(?NobelId))

Try it!

As filter with the operator Or dont work in Listeria ==> rewrite logic with AND operator

PREFIX      dbpprop:  <http://dbpedia.org/property/>
PREFIX      foaf:  <http://xmlns.com/foaf/0.1/>
SELECT ?NobelId ?item ?LaureateNobelUri ?NobelBirth  ?WDBirth ?NobelDeath ?WDDeath 
with
{SELECT ?NobelId ?item ?LaureateNobelUri ?NobelBirth ?NobelDeath ?WDBirth ?WDDeath{
  SERVICE <http://data.nobelprize.org/sparql>  {
      SELECT distinct ?NobelId ?LaureateNobelUri ?NobelBirth ?NobelDeath ?NobelGender WHERE {        
      ?LaureateNobelUri <http://data.nobelprize.org/terms/laureateAward> ?NobelAwardid.
      BIND(REPLACE(str(?LaureateNobelUri),"http://data.nobelprize.org/resource/laureate/","") AS ?NobelId)
      OPTIONAL{ ?LaureateNobelUri foaf:birthday ?NobelBirth}
      OPTIONAL{ ?LaureateNobelUri dbpprop:dateOfDeath ?NobelDeath}
      }
   }
  } 
 } as %i where
{
  include %i
  ?item wdt:P2888 ?LaureateNobelUri . 
  OPTIONAL{ ?item wdt:P569 ?birthDate.}
  OPTIONAL{ ?item wdt:P570 ?diedDate.}
  BIND (SUBSTR(CONCAT("0",STR(DAY(?birthDate))),STRLEN(STR(DAY(?birthDate))),2) AS ?birthDay)
  BIND (SUBSTR(CONCAT("0",STR(MONTH(?birthDate))),STRLEN(STR(MONTH(?birthDate))),2) AS ?birthMonth)
  BIND (CONCAT(STR(YEAR(?birthDate)),"-",?birthMonth,"-",?birthDay) AS ?WDBirth)
  BIND (SUBSTR(CONCAT("0",STR(DAY(?diedDate))),STRLEN(STR(DAY(?diedDate))),2) AS ?diedDay)
  BIND (SUBSTR(CONCAT("0",STR(MONTH(?diedDate))),STRLEN(STR(MONTH(?diedDate))),2) AS ?diedMonth)
  BIND (CONCAT(STR(YEAR(?diedDate)),"-",?diedMonth,"-",?diedDay) AS ?WDDeath)
  FILTER (!(
        (BOUND(?NobelBirth) = BOUND(?WDBirth))
    &&
        (BOUND(?NobelDeath) = BOUND(?WDDeath))
    &&
        (str(?WDBirth) = str(?NobelBirth))
    &&
        (str(?WDDeath) = str(?NobelDeath)))
  )
}
 order by desc(xsd:integer(?NobelId))

Try it!

Next step[edit]

We should also inform of calendar model used and sources

PREFIX      dbpprop:  <http://dbpedia.org/property/>
PREFIX      foaf:  <http://xmlns.com/foaf/0.1/>
SELECT ?NobelId ?item ?LaureateNobelUri ?NobelBirth  ?WDBirth ?NobelDeath ?WDDeath ?statedin (?cm AS ?CalendarModel) (?p854 AS ?refURL) (?p143 AS ?ImportedFromWikipedia)
with
{SELECT ?NobelId ?item ?LaureateNobelUri ?NobelBirth ?NobelDeath ?WDBirth ?WDDeath ?statedin ?cm ?p854 ?p143{
  SERVICE <http://data.nobelprize.org/sparql>  {
      SELECT distinct ?NobelId ?LaureateNobelUri ?NobelBirth ?NobelDeath ?NobelGender WHERE {        
      ?LaureateNobelUri <http://data.nobelprize.org/terms/laureateAward> ?NobelAwardid.
      BIND(REPLACE(str(?LaureateNobelUri),"http://data.nobelprize.org/resource/laureate/","") AS ?NobelId)
      OPTIONAL{ ?LaureateNobelUri foaf:birthday ?NobelBirth}
      OPTIONAL{ ?LaureateNobelUri dbpprop:dateOfDeath ?NobelDeath}
      }
   }
  } 
 } as %i where
{
  include %i
  ?item wdt:P2888 ?LaureateNobelUri . 
  OPTIONAL{ ?item wdt:P569 ?birthDate.}
  OPTIONAL{  ?item p:P569 [ prov:wasDerivedFrom ?ref; psv:P569 [wikibase:timeCalendarModel ?cm ]] . 
     OPTIONAL { ?ref pr:P248 ?statedin }
     OPTIONAL { ?ref pr:P143 ?p143 }
     OPTIONAL { ?ref pr:P854 ?p854 } 
  }
  OPTIONAL{ ?item wdt:P570 ?diedDate.}
  BIND (SUBSTR(CONCAT("0",STR(DAY(?birthDate))),STRLEN(STR(DAY(?birthDate))),2) AS ?birthDay)
  BIND (SUBSTR(CONCAT("0",STR(MONTH(?birthDate))),STRLEN(STR(MONTH(?birthDate))),2) AS ?birthMonth)
  BIND (CONCAT(STR(YEAR(?birthDate)),"-",?birthMonth,"-",?birthDay) AS ?WDBirth)
  BIND (SUBSTR(CONCAT("0",STR(DAY(?diedDate))),STRLEN(STR(DAY(?diedDate))),2) AS ?diedDay)
  BIND (SUBSTR(CONCAT("0",STR(MONTH(?diedDate))),STRLEN(STR(MONTH(?diedDate))),2) AS ?diedMonth)
  BIND (CONCAT(STR(YEAR(?diedDate)),"-",?diedMonth,"-",?diedDay) AS ?WDDeath)
  FILTER (!(
        (BOUND(?NobelBirth) = BOUND(?WDBirth))
    &&
        (BOUND(?NobelDeath) = BOUND(?WDDeath))
    &&
        (str(?WDBirth) = str(?NobelBirth))
    &&
        (str(?WDDeath) = str(?NobelDeath)))
  )
}
 order by desc(xsd:integer(?NobelId))

Try it!