Fetch famous people from Wikipedia API

后端 未结 3 1763
别那么骄傲
别那么骄傲 2021-01-27 01:27

I\'m trying to fetch people who are still alive from Wikipedia API but I haven\'t figured out how to do it.

I found this question which is the same as mine and as far as

3条回答
  •  走了就别回头了
    2021-01-27 02:09

    Please look at the following query:

    SELECT distinct ?item ?itemLabel ?itemDescription (SAMPLE(?DR) as ?DR) (SAMPLE(?RIP) as ?RIP) (SAMPLE(?image)as ?image) (SAMPLE(?article)as ?article) WHERE {
      ?item wdt:P31 wd:Q5.
      ?item ?label "Ronaldo"@en.  
      ?article schema:about ?item .
      ?article schema:inLanguage "en" .
      ?article schema:isPartOf .  
      OPTIONAL{?item wdt:P569 ?DR .} # P569 : Date of birth
      OPTIONAL{?item wdt:P570 ?RIP .}     # P570 : Date of death
      OPTIONAL{?item wdt:P18 ?image .}     # P18 : image  
    
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }    
    }
    GROUP BY ?item ?itemLabel ?itemDescription
    

    Query on Wikidata.

    You can add Filter on death date to see only alive people.

提交回复
热议问题