12. Q? 물건, 사람, 개념, 사건 등
12
• “항목”
• “어떤 것”
• 추상적인 것 포함
• 식별자: Q번호
• [[Q76]]
13. 예시 분류해보자… 물건, 사람, 사건, 개념
13
영어 이름* Q번호 영어 이름 Q번호
Barack Obama Q76 love Q316
Park Geun-hye Q138048 peace Q454
The Wealth of Nations Q233562 Earth Q2
Hunminjeongeum Q18990 South Korea Q884
September 11 attacks Q10806 Hussein Onyango Obama Q15982328
Korean War Q8663
birth certificate of
Barack Obama
Q14527788
Q번호는 있지만 위키백과에는 없는 문서는?
Notability(기록필요성; 저명성) 문제는?
* 정식명칭은 label
14. 이름으로 Q번호 찾기 문서제목을 알 때
14
http://www.wikidata.org/wiki/Special:ItemByTitle/enwiki/Barack_Obama
http://www.wikidata.org/wiki/Special:ItemByTitle/kowiki/버락_오바마
[[d:Special:ItemByTitle/enwiki/Barack_Obama]]
[[d:Special:ItemByTitle/kowiki/버락_오바마]]
17. Q에는 어떤 내용이 있나? Q의 기본정보
17
Q76
영어
Q76
한국어
별칭
alias ( a.k.a )
설명
description
링크
이하는 P관련 좀 있다가 설명…
레이블
18. 18
구분
영어 한국어
label description 레이블 설명
Q2 Earth
third planet closest to the
Sun in the Solar System
지구 태양계의 셋째 행성
Q42 Douglas Adams English writer 더글러스 애덤스 영국의 작가
Q64 Berlin
capital city and state of Ge
rmany
베를린 독일의 수도
Q80 Tim Berners-Lee Web developer 팀 버너스리
Q148
People's Republic
of China
state in East Asia 중화인민공화국
동아시아의 국가 (+ a.k.a.
“중국”)
Q153 ethanol type of alcohol compound 에탄올
Q316 love
strong, positive emotion b
ased on affection
사랑
Q405 Moon
only natural satellite of Ear
th
달 지구의 자연위성
Q897511 cryptanalysis science 암호해독
Q4489310 Turing reduction
2015-11-20 현재 빈 곳
Q 직접 편집해보기 실습예시
실습 더 해보기 http://www.wikidata.org/wiki/Wikidata:Tours/ko
19. 19
인터위키 수용 Q를 보자!
언어·프로젝트별 상호링크
한국어
영어
일본어
중국어 영어
일본어
중국어
한국어 Q
위키데이터 중앙링크*
* 위키백과 뿐만 아니라 모든 위키미디어 프로젝트들에 해당됨
20. Q번호는 언제 생성되나?
20
• 위키데이터에 직접 등록할 때
• 위키백과 등에서 인터위키를 만들 때
위키문서링크?
사이트 + 문서
예: 영어 위키백과의 버락 오바마
사이트: 위키백과, 위키문헌, 위키뉴스, 위키책, 위키데이터, 위키미디어 공용 등
1개 이상의 위키문서링크 필수
• Q번호는 자동부여됨 AUTO INCREMENT 개념
• 하나의 문서는 1개의 Q번호에만 연결가능 중복 등록 불가
• 일반사용자는 넘겨주기(REDIRECT) 생성·편집 불가
버락
오바마
Barack
Obama
Q76 Q123
バラク・
オバマ
xo oo
위키백과에 새 문서를 만들었을 때? ( X )
24. 간단한 Q, P 예시
24
Q76
Barack Obama
Q138048
Park Geun-hye
Q405
Moon
Q6495593
Barack Obama, Sr.
Q15982328
Hussein OnyangoObama
Q14356
Park Chung-hee
Q6784157
Park Seong-bin
(P22) father
(P40) child
Q2
Earth
Q525
Sun
astronomical body (P397)
child astronomical body (P398)
P22 ↑ ↓ P40
P22 ↑ ↓ P40
P22 ↑ ↓ P40
P22 ↑ ↓ P40
P397 ↑ ↓ P398
P397 ↑ ↓ P398
25. Q번호와 P번호 관계?
25
Q번호 레이블 P번호 레이블
Q21 잉글랜드 P21 성별
Q22 스코틀랜드 P22 아버지
Q23 조지 워싱턴 P23 (없음)
Q24 잭 바우어 P24 (없음)
Q25 웨일스 P25 어머니
• Q번호와 P번호는 독립적임
• 같은 숫자라도 관련 없음
Q290
성별
P21
성별
Q7565
아버지
P22
아버지
Wikidata property (P1687)
subject item of this property (P1629)
• Q와 P에 둘다 있는 경우도 있음
P1687 ↑ ↓ P1629
P1687 ↑ ↓ P1629
Q · P 같은 번호 사례 Q · P 같은 의미 사례
32. 32
SPARQL 예시
PREFIX ex: <http://example.org/>
SELECT ?animal WHERE
{ ?animal a ex:animal . }
animal
<http://example.org/dog1>
<http://example.org/cat1>
<http://example.org/cat2>
SPARQL 쿼리 쿼리 결과
http://en.wikipedia.org/wiki/RDF_Schema
33. 33
위키데이터 RDF 모델
제인 벨슨
더글러스 애덤스
배우자
시작시각 종료시각
소급 그레고리력
제목
약어 영어 한국어
s statement 진술
v value 값
q qualifier 한정자
r reference 참고문헌
P 상세더글러스 애덤스(Q42)의 배우자(P26)
35. 35
위키데이터 SPARQL 예시 #1
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?politician ?cause ?politician_label ?cause_of_death_label WHERE {
?politician wdt:P106 wd:Q82955 . # find items that have "occupation
(P106): politician (Q82955)"
?politician wdt:P509 ?cause . # with a P509 (cause of death) claim
?cause wdt:P279* wd:Q12078 . # ... where the cause is a subclass
of (P279*) cancer (Q12078)
# ?politician wdt:P39 wd:Q11696 . # Uncomment this line to include only
U.S. Presidents
OPTIONAL {?politician rdfs:label ?politician_label filter
(lang(?politician_label) = "en") .}
OPTIONAL {?cause rdfs:label ?cause_of_death_label filter
(lang(?cause_of_death_label) = "en").}
}
ORDER BY ASC (?politician)
Total results: 557, duration: 633 ms.
암으로 사망한 정치인 목록
politician cause politician_label cause_of_death_label
Q1027427 Q189588 John R. Fellows stomach cancer
Q1028400 Q3242950Károly Grósz kidney cancer
Q10320767Q189588 Luiz Gushiken stomach cancer
Q10376143Q47912 Sérgio Guerra lung cancer
Q1064774 Q47912 Charles Hayes lung cancer
Q10664 Q188874 Neville Chamberlain colorectal cancer
Q10664 Q5526839Neville Chamberlain gastrointestinal cancer
….
사용한 Q: politician (Q82955), cancer (Q12078)
사용한 P: occupation (P106), subclass of (P279), cause of death (P509)
36. 36
위키데이터 SPARQL 예시 #2
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX q: <http://www.wikidata.org/prop/qualifier/>
PREFIX v: <http://www.wikidata.org/prop/statement/>
SELECT DISTINCT ?city ?cityLabel ?mayor ?mayorLabel WHERE {
?city wdt:P31/wdt:P279* wd:Q515 . # find instances of subclasses of city
?city p:P6 ?statement . # with a P6 (head of goverment) statement
?statement v:P6 ?mayor . # ... that has the value ?mayor
?mayor wdt:P21 wd:Q6581072 . # ... where the ?mayor has P21 (sex or gender)
female
FILTER NOT EXISTS { ?statement q:P582 ?x } # ... but the statement has no P582
(end date) qualifier
# Now select the population value of the ?city
# (wdt: properties use only statements of "preferred" rank if any, usually meaning
"current population")
?city wdt:P1082 ?population .
# Optionally, find English labels for city and mayor:
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
} ORDER BY DESC(?population) LIMIT 10
Total results: 10, duration: 7180 ms.
city cityLabel mayor mayorLabel
Q2807 Madrid Q19592761 Manuela Carmena
Q90 Paris Q2851133 Anne Hidalgo
Q16555 Houston Q213847 Annise Parker
Q1563 Havana Q6774124 Marta Hernández Romero
Q270 Warsaw Q271902 Hanna Gronkiewicz-Waltz
Q1492 Barcelona Q4779594 Ada Colau
Q472 Sofia Q444718 Yordanka Fandakova
Q1085 Prague Q18104657 Adriana Krnáčová
Q365 Cologne Q19285371 Henriette Reker
Q23197 Nashville Q16164719 Megan Barry
여성시장이 재직중인 가장 큰 도시 목록 TOP 10
사용한 Q: city (Q515), female (Q6581072)
사용한 P: instance of (P31), subclass of (P279), head of government (P6),
sex or gender (P21), end time (P582), population (P1082)
37. 37
위키데이터의 미래
가장 크고 아름다운 시맨틱 웹 구현체
• 빅데이터 기술과 만나면…
• 자연어 처리 기술과 만나면…
• TTS, 음성인식 기술과 만나면…
“ㅇㅇㅇ은 모든 것을 알고 있다.”