2017-09-13 2 views
1

특정 인물의 수명에 대한 데이터를 검색하려고합니다. 얼마 전에 살았던 사람들의 경우 문제가됩니다. 예를 들어 Pythagorasdate of birth (P569)에 대해 "빈 노드"라고 불리는 것 같습니다. 그러나이 공백 노드는 다른 노드를 참조합니다. earliest date (P1319)에는 잘 작동하는 데이터가 있습니다.Wikidata의 빈 노드에서 데이터 가져 오기

하지만 어떤 이유로 나는 해당 노드를 검색 할 수 없습니다. My first try looked like this하지만 completly 빈 결과 집합의 결과가 어떻게 든 것을 :

SELECT DISTINCT ?person ?name ?dateofbirth ?earliestdateofbirth WHERE { 
    ?person wdt:P31 wd:Q5.   # This thing is Human 
    ?person rdfs:label ?name.  # Name for better conformation 
    ?person wdt:P569 ?dateofbirth. # Birthday may result in a blank node 
    ?dateofbirth wdt:P1319 ?earliestdateofbirth # Problem: Plausbible Birth 
} 

그때 내가 but this also ends with a empty result set 위 한 명시 적 탐색을위한 "바로 가기"- 구문의 일종으로 ?person wdt:P569/wdt:P1319 ?earliestdateofbirth를 사용하여 제안 다른 구문을 발견했다.

SELECT DISTINCT ?person ?name ?dateofbirth ?earliestdateofbirth WHERE { 
    ?person wdt:P31 wd:Q5.   # Is Human 
    ?person rdfs:label ?name.  # Name for better conformation 
    ?person wdt:P569/wdt:P1319 ?earliestdateofbirth. 
} 

그래서 어떻게 위키 데이터에 (내 경우 특히 초기의 생일에) 빈 노드가 참조하는 노드에 액세스합니까?

답변

2

그러나이 빈 노드가 다른 노드를 참조 ...

상황이 약간 다릅니다. earliest date 속성은 _:t550690019의 속성이 아니며 wd:Q10261 wdt:P569 _:t550690019의 속성입니다.

Wikidata data model에서 이러한 주석은 qualifiers을 사용하여 표현됩니다.

Wikidata data model

당신의 쿼리가 있어야한다 :

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!

그런데

은 (생년월일이 알려진 경우에 사용) 시간 정밀도은 아직 다른 한정자 :

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

내가 바보가 된 기분,하지만 바로 그것을 발견 할 수 : 그것은 작동하지 않습니다,하지만 당신의 쿼리가 다른 무엇을합니까? 'FILTER'와'VALUES'는 그것을 더 많이 제한하는 것처럼 보입니다. –

+0

조심스럽게보세요 :). 몇 분 후에 설명 하겠지만, 이제는 좋은 링크를 찾고 있습니다. –

+0

아, 'P569'와'P1319'에 다른 접두어를 사용하고 있습니다. 좋은 링크가있어서 기쁩니다! –

관련 문제