Retrieving data from blank nodes in Wikidata

余生长醉 提交于 2019-11-28 14:30: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!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!