위키데이터 개론

39
위위위위위 위위 김김김

Upload: jeongmin-kim

Post on 24-Jan-2017

1.663 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: 위키데이터 개론

위키데이터 개론김정민

Page 2: 위키데이터 개론

2

발표자는 ?

• 본업 : 클라우드 컴퓨팅 운영 + 개발• 코딩德 • 위키백과 사용자 2007 년 ~

• 한국어 위키백과 관리자 2010 년 ~

• 관심분야 : Cloud, 리눅스 , PHP, 미디어위키 ,

HTML5

Page 3: 위키데이터 개론

3

차례 • 위키데이터란 ?• 핵심개념 Q• 핵심개념 P• 시맨틱 웹 활용하기

Page 4: 위키데이터 개론

4

위키데이터 ? 한마디로…

위키미디어 재단에서 운영하는 자유 지식 베이스( 위키 ) 지식을 머신 리더블 데이터로 정리하는 공개 DB

cf. Dbpedia, Freebase 와 다른 점은 ?

machine readable, machine understandable

바코드 로고 ?

Page 5: 위키데이터 개론

5

위키데이터의 시작 2012 년 투자

단체 분야앨런 인공지능 연구소 인공지능고든 앤 베티 무어 재단 데이터 과학구글 검색엔진

cf. 시맨틱 웹 ?

Page 6: 위키데이터 개론

6

위키데이터 ? 기술적으로…

위키미디어 재단에서 운영하는 , 자유 지식 베이스를 위한 웹서버미디어위키 + 위키베이스

위키베이스• 미디어위키 확장기능 ( 플러그인 ) 모음• 특히 Wikibase Repository 가 핵심 ( 서버 기능 ) 다른 프로젝트 ( 예 : 위키백과 ) 에는 이것이 없음• http://wikiba.se/

cf. 시맨틱 위키 ?

Page 7: 위키데이터 개론

7

다언어 *

• 메타위키• 위키미디어 공용• 위키데이터• 위키스피시즈• 위키인큐베이터• 미디어위키

위키데이터 ? 프로젝트 비교

언어별• 위키백과• 위키낱말사전• 위키문헌• 위키배움터• 위키인용집• 위키책

* Multilingual. 언어별 서브도메인을 부여하지 않음

Page 8: 위키데이터 개론

8

문서 수 비교 위키백과 vs 위키데이터

'01 '02 '03 '04 '05 '06 '07 '08 '09 '10 '11 '12 '13 '14 '150

5

10

15

20

4.8

17.3

위키백과 ( 영어판 ) 위키데이터

연도 ( 1 월 기준 )

문서 수

(단위:

백만개

)

http://stats.wikimedia.org/EN/TablesWikipediaEN.htmhttp://stats.wikimedia.org/wikispecial/EN/Ta-blesWikipediaWIKIDATA.htm

Page 9: 위키데이터 개론

9

어떻게 정리하나 ? ★★★★★

한국어 영어 설명 식별자개체 Entity 항목 + 속성 + 쿼리항목 Item 실제 물건 , 사람 , 개념 , 사건 등 Q 번호속성 Property 항목의 속성 , Item 간의 연결 P 번호쿼리 Query 사전정의된 질의문

Q1 생성일 2012-10-29P6 생성일 2013-02-04

Page 10: 위키데이터 개론

10

위키데이터 ? 발전 단계

1 단계 2 단계 3 단계• Item 활성화• 인터위키 링크 수용

• Property 활성화• Infobox 정보 수용 • Query 활성화

2013 년인터위키 수용 완료 진행 중 예정 , 테스트 중

Page 11: 위키데이터 개론

11

Item Q☞※ 정식명칭은 Item 이지만 간단히 Q 라고 부르겠음

Page 12: 위키데이터 개론

12

Q? 물건 , 사람 , 개념 , 사건 등

• “ 항목”• “ 어떤 것”• 추상적인 것 포함• 식별자 : Q 번호• [[Q76]]

표제어가

될만한 것 ???

Page 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

Page 14: 위키데이터 개론

14

이름으로 Q 번호 찾기 문서제목을 알 때

http://www.wikidata.org/wiki/Special:ItemByTitle/en-wiki/Barack_Obamahttp://www.wikidata.org/wiki/Special:ItemByTitle/kowiki/ 버락 _ 오바마

[[d:Special:ItemByTitle/enwiki/Barack_Obama]][[d:Special:ItemByTitle/kowiki/ 버락 _ 오바마 ]]

Page 15: 위키데이터 개론

15

http://www.wikidata.org/wiki/Q76 ★http://www.wikidata.org/entity/Q76http://www.wikidata.org/w/index.php?title=Q76http://www.wikidata.org/wiki/Special:EntityData/Q76http://www.wikidata.org/wiki/Special:EntityData/Q76.json위키백과 등에서 [[d:Q76]] 또는 [[wikidata:Q76]]

{     "entities":{        "Q76":{           "pageid":205,         "ns":0,         "title":"Q76",         "lastrevid":270428856,         "modified":"2015-11-10T17:03:19Z",         "type":"item",         "id":"Q76",         "labels":{              "en":{                 "language":"en",               "value":"Barack Obama"            },…

Q 페이지 바로 가기 Q 번호를 알 때

Page 16: 위키데이터 개론

16

Q 에는 어떤 정보가 있나 ?

Q76영어

Q76한국어 언어설정

Page 17: 위키데이터 개론

17

Q 에는 어떤 내용이 있나 ? Q 의 기본정보

Q76영어

Q76한국어별칭alias ( a.k.a )

설명description

링크

이하는 P 관련 좀 있다가 설명…

레이블

Page 18: 위키데이터 개론

18

구분 영어 한국어label description 레이블 설명

Q2 Earththird planet closest to the Sun in the Solar Sys-tem

지구 태양계의 셋째 행성Q42 Douglas Adams English writer 더글러스 애덤스 영국의 작가Q64 Berlin capital city and state of

Germany 베를린 독일의 수도Q80 Tim Berners-Lee Web developer 팀 버너스리  Q148 People's Repub-

lic of China state in East Asia 중화인민공화국 동아시아의 국가 (+ a.k.a. “ 중국” )

Q153 ethanol type of alcohol com-pound 에탄올  

Q316 love strong, positive emotion based on affection 사랑  

Q405 Moon only natural satellite of Earth 달 지구의 자연위성

Q897511 cryptanalysis science 암호해독  Q4489310 Turing reduction      2015-11-20 현재 빈 곳

Q 직접 편집해보기 실습예시

실습 더 해보기 http://www.wikidata.org/wiki/Wikidata:Tours/ko

Page 19: 위키데이터 개론

19

인터위키 수용 Q 를 보자 !

언어 · 프로젝트별 상호링크

한국어영어

일본어중국어 영어

일본어중국어

한국어 Q

위키데이터 중앙링크 *

* 위키백과 뿐만 아니라 모든 위키미디어 프로젝트들에 해당됨

Page 20: 위키데이터 개론

20

Q 번호는 언제 생성되나 ?

• 위키데이터에 직접 등록할 때• 위키백과 등에서 인터위키를 만들 때

위키문서링크 ?사이트 + 문서예 : 영어 위키백과의 버락 오바마사이트 : 위키백과 , 위키문헌 , 위키뉴스 , 위키책 , 위키데이터 , 위키미디어 공용 등

1 개 이상의 위키문서링크 필수

• Q 번호는 자동부여됨 AUTO INCREMENT 개념

• 하나의 문서는 1 개의 Q 번호에만 연결가능 중복

등록 불가• 일반사용자는 넘겨주기 (REDIRECT) 생성 · 편집 불가

버락오바마Barack Obama

Q76 Q123

バラク・オバマ

xo oo

위키백과에 새 문서를 만들었을 때 ? ( X )

Page 21: 위키데이터 개론

21

Property P☞

Page 22: 위키데이터 개론

22

P? 속성

• Item* 의 속성• Item 간 연결가능 **

• 식별자 : P 번호• [[Property:P22]]

• [[P:P22]]* 정확히는 Entity

** P-P, Q-value 연결도 가능

Page 23: 위키데이터 개론

23

http://www.wikidata.org/wiki/Property:P22 ★http://www.wikidata.org/wiki/P:P22http://www.wikidata.org/entity/P22http://www.wikidata.org/w/index.php?title=P:P22http://www.wikidata.org/wiki/Special:EntityData/P22http://www.wikidata.org/wiki/Special:EntityData/P22.json위키백과 검색창에 d:P:P22 ( wikidata:P:P22 )

P 페이지 바로 가기 P 번호를 알 때

Q 페이지 https://www.wikidata.org/wiki/Q76P 페이지 https://www.wikidata.org/wiki/Property:P22

검색창 입력

Page 24: 위키데이터 개론

24

간단한 Q, P 예시

Q76Barack Obama

Q138048Park Geun-hye

Q405Moon

Q6495593Barack Obama, Sr.

Q15982328Hussein Onyango Obama

Q14356Park Chung-hee

Q6784157Park Seong-bin

(P22) father(P40) child

Q2Earth

Q525Sun

astronomical body (P397)child astronomical body (P398)

P22 ↑ ↓ P40

P22 ↑ ↓ P40

P22 ↑ ↓ P40

P22 ↑ ↓ P40

P397 ↑ ↓ P398

P397 ↑ ↓ P398

Page 25: 위키데이터 개론

25

Q 번호와 P 번호 관계 ?

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 ↑ ↓ P1629P1687 ↑ ↓ P1629

Q · P 같은 번호 사례 Q · P 같은 의미 사례

Page 26: 위키데이터 개론

26

P 연결 예시

http://www.wikidata.org/wiki/Wikidata:Introduction

P 번호 레이블P6 정부 수반P131 소재 행정 구역P625 위치 좌표P1082 소재 행정 구역P25 어머니

P1082

P6

P131

P131

P625

P 로 연결된 것들 중 Item 이 아닌 것 ?

사용한 Property 목록

Page 27: 위키데이터 개론

P 시점별 데이터 샌프란시스코 (Q62) 의 P

27

인구 population (P1082) 시장 head of government (P6)

어느 것이 최신인가 ?

Page 28: 위키데이터 개론

28

어디에 쓰나 ?

Page 29: 위키데이터 개론

29

시맨틱 웹 !

Page 30: 위키데이터 개론

30

시맨틱 웹 RDF, SPARQL…

시맨틱 웹 스택http://en.wikipedia.org/wiki/Semantic_Web_Stack

cf. OSI 7 계층 , 솔루션 스택

RDF Resource Desciription Framework• 웹자원 표현 규격 . W3C 제안• 구조화된 메타데이터 활용의 기반• 머신리더블 정보교환 가능의 기반

SPARQL SPARQL Protocol and RDF Query Language• RDF 형식에 대한 쿼리 언어• “ 시맨틱 웹에서의 SQL”

Page 31: 위키데이터 개론

31

RDF 예시• Dog1 is an animal• Cat1 is a cat• Cats are animals• Zoos host animals• Zoo1 hosts the Cat2

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@prefix ex: <http://example.org/> .@prefix zoo: <http://example.org/zoo/> .ex:dog1 rdf:type ex:animal .ex:cat1 rdf:type ex:cat .ex:cat rdfs:subClassOf ex:animal .zoo:host rdfs:range ex:animal .ex:zoo1 zoo:host ex:cat2 .http://en.wikipedia.org/wiki/RDF_Schema

Page 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

Page 33: 위키데이터 개론

33

위키데이터 RDF 모델

제인 벨슨

더글러스 애덤스배우자

시작시각종료시각

소급 그레고리력

제목

약어 영어 한국어s statement 진술v value 값q qualifier 한정자r reference 참고문헌

P 상세더글러스 애덤스 (Q42) 의 배우자 (P26)

Page 34: 위키데이터 개론

34

[ 출처 필요 ] references

샌프란시스코 (Q62) 의 인구 (P1082)

버락 오바마 (Q62) 의 생년월일 (P569)

http://ko.wikipedia.org/wiki/ 위키백과 : 출처 _ 밝히기

Q14527788

Page 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.

암으로 사망한 정치인 목록politi-cian cause politician_label cause_of_death_la

belQ1027427

Q189588 John R. Fellows stomach cancer

Q1028400

Q3242950 Károly Grósz kidney cancer

Q10320767

Q189588 Luiz Gushiken stomach cancer

Q10376143 Q47912 Sérgio Guerra lung cancerQ1064774 Q47912 Charles Hayes lung cancer

Q10664 Q188874

Neville Chamber-lain colorectal cancer

Q10664 Q5526839

Neville Chamber-lain

gastrointestinal cancer

….사용한 Q: politician (Q82955), cancer (Q12078)사용한 P: occupation (P106), subclass of (P279), cause of death (P509)

Page 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 cityLa-bel mayor mayorLabel

Q2807 Madrid Q19592761 Manuela Carmena

Q90 Paris Q2851133 Anne HidalgoQ16555 Houston Q213847 Annise ParkerQ1563 Havana Q6774124 Marta Hernández RomeroQ270 Warsaw Q271902 Hanna Gronkiewicz-WaltzQ1492 Barcelona Q4779594 Ada ColauQ472 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)

Page 37: 위키데이터 개론

37

위키데이터의 미래

가장 크고 아름다운 시맨틱 웹 구현체

• 빅데이터 기술과 만나면…• 자연어 처리 기술과 만나면…• TTS, 음성인식 기술과 만나면…

Phas

e 1: It

em

Phas

e 2: P

rope

rty

Phas

e 3: Q

uery

“ ㅇㅇㅇ은 모든 것을 알고 있다 .”

Deep thought?

Page 38: 위키데이터 개론

38

< 끝 >감사합니다

Page 39: 위키데이터 개론

39

위키데이터https://en.wikipedia.org/wiki/Wikidatahttps://en.wikipedia.org/wiki/Wikipedia:Wikidatahttps://meta.wikimedia.org/wiki/Wikidata/Deployment_Questionshttp://www.slideshare.net/MagnusManske/20140227-wikidata-talk-cambridgehttp://meta.wikimedia.org/wiki/Wikidata/Development/RDFhttp://tools.wmflabs.org/wikidata-exports/rdf/

위키베이스https://www.wikidata.org/wiki/Special:Versionhttp://wikiba.se/

시맨틱 웹https://en.wikipedia.org/wiki/Semantic_Webhttps://en.wikipedia.org/wiki/Semantic_Web_Stack

SPARQLhttps://commons.wikimedia.org/wiki/File:Wikidata%27s_SPARQL_introduction_presentation.pdfhttps://www.mediawiki.org/wiki/Wikibase/Indexing/SPARQL_Query_Examples

참고 자료