Retrieving data from blank nodes in Wikidata

前端 未结 1 1128
耶瑟儿~
耶瑟儿~ 2020-12-07 04:22

I am attempting to retrieve data about the lifespans of certain people. This is problematic in cases of people that have lived a while ago. The dataset for e.g. Pythagoras s

1条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-07 04:56

    But this blank node references another node…

    Things are slightly different. The earliest date property is not a property of _:t550690019, but rather is a property of the statement wd:Q10261 wdt:P569 _:t550690019.

    In the Wikidata data model, these annotations are expressed using qualifiers.

    Your query should be:

    SELECT DISTINCT ?person ?name ?dateofbirth ?earliestdateofbirth WHERE {
      VALUES (?person) {(wd:Q10261)}
      ?person wdt:P31 wd:Q5.         # --Is human
      ?person rdfs:label ?name.      # --Name for better conformation
      ?person p:P569/pq:P1319 ?earliestdateofbirth. 
      FILTER (lang(?name) = "en")
    }
    

    Try it!


    By the way, time precision (which is used when date of birth is known) is yet another qualifier:

    SELECT ?person ?personLabel ?value ?precisionLabel {
      VALUES (?person) {(wd:Q859) (wd:Q9235)}
      ?person  wdt:P31  wd:Q5 ;
               p:P569/psv:P569  [ wikibase:timeValue  ?value ;
                                  wikibase:timePrecision  ?precisionInteger ]
      {
      SELECT ?precision (xsd:integer(?precisionDecimal) AS ?precisionInteger) {
        ?precision  wdt:P2803  ?precisionDecimal .
      }
      }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    }
    

    Try it!

    0 讨论(0)
提交回复
热议问题