SlideShare une entreprise Scribd logo
1  sur  39
위키데이터 개론
김정민
발표자는?
2
• 본업: 클라우드 컴퓨팅 운영+개발
• 코딩德
• 위키백과 사용자 2007년~
• 한국어 위키백과 관리자 2010년~
• 관심분야: Cloud, 리눅스, PHP, 미디어위키, HTML5
3
차례 • 위키데이터란?
• 핵심개념 Q
• 핵심개념 P
• 시맨틱 웹 활용하기
위키데이터? 한마디로…
위키미디어 재단에서 운영하는 자유 지식 베이스
(위키)지식을 머신 리더블 데이터로 정리하는 공개DB
4
cf. Dbpedia, Freebase와 다른 점은?
machine readable, machine understandable
바코드 로고?
5
위키데이터의 시작 2012년 투자
단체 분야
앨런 인공지능 연구소 인공지능
고든 앤 베티 무어 재단 데이터 과학
구글 검색엔진
cf. 시맨틱 웹?
위키데이터? 기술적으로…
위키미디어 재단에서 운영하는, 자유 지식 베이스를 위한 웹서버
미디어위키 + 위키베이스
위키베이스
• 미디어위키 확장기능(플러그인) 모음
• 특히 Wikibase Repository가 핵심(서버 기능)
다른 프로젝트(예: 위키백과)에는 이것이 없음
• http://wikiba.se/
6
cf. 시맨틱 위키?
다언어*
• 메타위키
• 위키미디어 공용
• 위키데이터
• 위키스피시즈
• 위키인큐베이터
• 미디어위키
위키데이터? 프로젝트 비교
7
언어별
• 위키백과
• 위키낱말사전
• 위키문헌
• 위키배움터
• 위키인용집
• 위키책
* Multilingual. 언어별 서브도메인을 부여하지 않음
8
문서 수 비교 위키백과 vs 위키데이터
4.8
17.3
0
5
10
15
20
'01 '02 '03 '04 '05 '06 '07 '08 '09 '10 '11 '12 '13 '14 '15
문서수(단위:백만개)
연도 ( 1월 기준 )
위키백과 (영어판) 위키데이터
http://stats.wikimedia.org/EN/TablesWikipediaEN.htm
http://stats.wikimedia.org/wikispecial/EN/TablesWikipediaWIKIDATA.htm
어떻게 정리하나? ★★★★★
한국어 영어 설명 식별자
개체 Entity 항목 + 속성 + 쿼리
항목 Item 실제 물건, 사람, 개념, 사건 등 Q번호
속성 Property 항목의 속성, Item간의 연결 P번호
쿼리 Query 사전정의된 질의문
9
Q1 생성일 2012-10-29
P6 생성일 2013-02-04
위키데이터? 발전 단계
10
1단계 2단계 3단계
• Item 활성화
• 인터위키 링크 수용
• Property 활성화
• Infobox 정보 수용
• Query 활성화
2013년
인터위키 수용 완료
진행 중 예정, 테스트 중
Item ☞ Q
11
※ 정식명칭은 Item이지만 간단히 Q라고 부르겠음
Q? 물건, 사람, 개념, 사건 등
12
• “항목”
• “어떤 것”
• 추상적인 것 포함
• 식별자: Q번호
• [[Q76]]
예시 분류해보자… 물건, 사람, 사건, 개념
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
이름으로 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/버락_오바마]]
15
http://www.wikidata.org/wiki/Q76 ★
http://www.wikidata.org/entity/Q76
http://www.wikidata.org/w/index.php?title=Q76
http://www.wikidata.org/wiki/Special:EntityData/Q76
http://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번호를 알 때
Q에는 어떤 정보가 있나?
16
Q76
영어
Q76
한국어
언어설정
Q에는 어떤 내용이 있나? Q의 기본정보
17
Q76
영어
Q76
한국어
별칭
alias ( a.k.a )
설명
description
링크
이하는 P관련 좀 있다가 설명…
레이블
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
인터위키 수용 Q를 보자!
언어·프로젝트별 상호링크
한국어
영어
일본어
중국어 영어
일본어
중국어
한국어 Q
위키데이터 중앙링크*
* 위키백과 뿐만 아니라 모든 위키미디어 프로젝트들에 해당됨
Q번호는 언제 생성되나?
20
• 위키데이터에 직접 등록할 때
• 위키백과 등에서 인터위키를 만들 때
위키문서링크?
사이트 + 문서
예: 영어 위키백과의 버락 오바마
사이트: 위키백과, 위키문헌, 위키뉴스, 위키책, 위키데이터, 위키미디어 공용 등
1개 이상의 위키문서링크 필수
• Q번호는 자동부여됨 AUTO INCREMENT 개념
• 하나의 문서는 1개의 Q번호에만 연결가능 중복 등록 불가
• 일반사용자는 넘겨주기(REDIRECT) 생성·편집 불가
버락
오바마
Barack
Obama
Q76 Q123
バラク・
オバマ
xo oo
위키백과에 새 문서를 만들었을 때? ( X )
Property ☞ P
21
22
P? 속성
• Item*의 속성
• Item간 연결가능**
• 식별자: P번호
• [[Property:P22]]
• [[P:P22]]
* 정확히는 Entity
** P-P, Q-value 연결도 가능
23
http://www.wikidata.org/wiki/Property:P22 ★
http://www.wikidata.org/wiki/P:P22
http://www.wikidata.org/entity/P22
http://www.wikidata.org/w/index.php?title=P:P22
http://www.wikidata.org/wiki/Special:EntityData/P22
http://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
검색창 입력
간단한 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
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 같은 의미 사례
P 연결 예시
26http://www.wikidata.org/wiki/Wikidata:Introduction
P번호 레이블
P6 정부 수반
P131 소재 행정 구역
P625 위치 좌표
P1082 소재 행정 구역
P25 어머니
P1082
P6
P131
P131
P625
P로 연결된 것들 중 Item이 아닌 것?
사용한 Property 목록
P 시점별 데이터 샌프란시스코(Q62)의 P
27
인구 population (P1082) 시장 head of government (P6)
어느 것이 최신인가?
28
어디에 쓰나?
29
시맨틱 웹!
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”
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
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
위키데이터 RDF 모델
제인 벨슨
더글러스 애덤스
배우자
시작시각 종료시각
소급 그레고리력
제목
약어 영어 한국어
s statement 진술
v value 값
q qualifier 한정자
r reference 참고문헌
P 상세더글러스 애덤스(Q42)의 배우자(P26)
34
[출처 필요] references
샌프란시스코(Q62)의 인구(P1082)
버락 오바마(Q62)의 생년월일(P569)
http://ko.wikipedia.org/wiki/위키백과:출처_밝히기
Q14527788
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
위키데이터 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
위키데이터의 미래
가장 크고 아름다운 시맨틱 웹 구현체
• 빅데이터 기술과 만나면…
• 자연어 처리 기술과 만나면…
• TTS, 음성인식 기술과 만나면…
“ㅇㅇㅇ은 모든 것을 알고 있다.”
38
<끝>
감사합니다
위키데이터
https://en.wikipedia.org/wiki/Wikidata
https://en.wikipedia.org/wiki/Wikipedia:Wikidata
https://meta.wikimedia.org/wiki/Wikidata/Deployment_Questions
http://www.slideshare.net/MagnusManske/20140227-wikidata-talk-cambridge
http://meta.wikimedia.org/wiki/Wikidata/Development/RDF
http://tools.wmflabs.org/wikidata-exports/rdf/
위키베이스
https://www.wikidata.org/wiki/Special:Version
http://wikiba.se/
시맨틱 웹
https://en.wikipedia.org/wiki/Semantic_Web
https://en.wikipedia.org/wiki/Semantic_Web_Stack
SPARQL
https://commons.wikimedia.org/wiki/File:Wikidata%27s_SPARQL_introduction_presentation.pdf
https://www.mediawiki.org/wiki/Wikibase/Indexing/SPARQL_Query_Examples
39
참고 자료

Contenu connexe

Tendances

Tendances (20)

RESTfulとは
RESTfulとはRESTfulとは
RESTfulとは
 
Redmine にいろいろ埋め込んでみた
Redmine にいろいろ埋め込んでみたRedmine にいろいろ埋め込んでみた
Redmine にいろいろ埋め込んでみた
 
Unified JVM Logging
Unified JVM LoggingUnified JVM Logging
Unified JVM Logging
 
モダン PHP テクニック 12 選 ―PsalmとPHP 8.1で今はこんなこともできる!―
モダン PHP テクニック 12 選 ―PsalmとPHP 8.1で今はこんなこともできる!―モダン PHP テクニック 12 選 ―PsalmとPHP 8.1で今はこんなこともできる!―
モダン PHP テクニック 12 選 ―PsalmとPHP 8.1で今はこんなこともできる!―
 
PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
PacemakerのMaster/Slave構成の基本と事例紹介(DRBD、PostgreSQLレプリケーション) @Open Source Confer...
 
並列クエリを実行するPostgreSQLのアーキテクチャ
並列クエリを実行するPostgreSQLのアーキテクチャ並列クエリを実行するPostgreSQLのアーキテクチャ
並列クエリを実行するPostgreSQLのアーキテクチャ
 
View customize pluginを使いこなす
View customize pluginを使いこなすView customize pluginを使いこなす
View customize pluginを使いこなす
 
IBM JVM 소개 - Oracle JVM 과 비교
IBM JVM 소개 - Oracle JVM 과 비교IBM JVM 소개 - Oracle JVM 과 비교
IBM JVM 소개 - Oracle JVM 과 비교
 
로그 기깔나게 잘 디자인하는 법
로그 기깔나게 잘 디자인하는 법로그 기깔나게 잘 디자인하는 법
로그 기깔나게 잘 디자인하는 법
 
導入から 10 年、PHP の trait は滅びるべきなのか その適切な使いどころと弱点、将来について
導入から 10 年、PHP の trait は滅びるべきなのか その適切な使いどころと弱点、将来について導入から 10 年、PHP の trait は滅びるべきなのか その適切な使いどころと弱点、将来について
導入から 10 年、PHP の trait は滅びるべきなのか その適切な使いどころと弱点、将来について
 
オンライン広告入札システムとZGC ( JJUG CCC 2021 Spring )
オンライン広告入札システムとZGC ( JJUG CCC 2021 Spring )オンライン広告入札システムとZGC ( JJUG CCC 2021 Spring )
オンライン広告入札システムとZGC ( JJUG CCC 2021 Spring )
 
Yahoo! JAPANのデータパイプラインで起きた障害とチューニング - Apache Kafka Meetup Japan #5 -
Yahoo! JAPANのデータパイプラインで起きた障害とチューニング - Apache Kafka Meetup Japan #5 -Yahoo! JAPANのデータパイプラインで起きた障害とチューニング - Apache Kafka Meetup Japan #5 -
Yahoo! JAPANのデータパイプラインで起きた障害とチューニング - Apache Kafka Meetup Japan #5 -
 
スイッチ・ルータのしくみ
スイッチ・ルータのしくみスイッチ・ルータのしくみ
スイッチ・ルータのしくみ
 
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 2.3.0対応)
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 2.3.0対応)NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 2.3.0対応)
NGSIv1 を知っている開発者向けの NGSIv2 の概要 (Orion 2.3.0対応)
 
RDFチェックツール「rdflint」のご紹介
RDFチェックツール「rdflint」のご紹介RDFチェックツール「rdflint」のご紹介
RDFチェックツール「rdflint」のご紹介
 
クラウドネイティブ時代の分散トレーシング - Distributed Tracing in a Cloud Native Age
クラウドネイティブ時代の分散トレーシング - Distributed Tracing in a Cloud Native Ageクラウドネイティブ時代の分散トレーシング - Distributed Tracing in a Cloud Native Age
クラウドネイティブ時代の分散トレーシング - Distributed Tracing in a Cloud Native Age
 
Redmine 4.2で作るヘルプデスク向け問い合わせ受付・管理システム
Redmine 4.2で作るヘルプデスク向け問い合わせ受付・管理システムRedmine 4.2で作るヘルプデスク向け問い合わせ受付・管理システム
Redmine 4.2で作るヘルプデスク向け問い合わせ受付・管理システム
 
JSON:APIについてざっくり入門
JSON:APIについてざっくり入門JSON:APIについてざっくり入門
JSON:APIについてざっくり入門
 
Bitbucketを活用したコードレビュー改善事例
Bitbucketを活用したコードレビュー改善事例Bitbucketを活用したコードレビュー改善事例
Bitbucketを活用したコードレビュー改善事例
 
Redmineチューニングの実際と限界(旧資料) - Redmine performance tuning(old), See Below.
Redmineチューニングの実際と限界(旧資料) - Redmine performance tuning(old), See Below.Redmineチューニングの実際と限界(旧資料) - Redmine performance tuning(old), See Below.
Redmineチューニングの実際と限界(旧資料) - Redmine performance tuning(old), See Below.
 

En vedette

시맨틱 미디어위키: 위키의 새로운 시작
시맨틱 미디어위키: 위키의 새로운 시작시맨틱 미디어위키: 위키의 새로운 시작
시맨틱 미디어위키: 위키의 새로운 시작
Haklae Kim
 
Introduction to question answering for linked data & big data
Introduction to question answering for linked data & big dataIntroduction to question answering for linked data & big data
Introduction to question answering for linked data & big data
Andre Freitas
 

En vedette (9)

시맨틱 미디어위키: 위키의 새로운 시작
시맨틱 미디어위키: 위키의 새로운 시작시맨틱 미디어위키: 위키의 새로운 시작
시맨틱 미디어위키: 위키의 새로운 시작
 
Introduction to question answering for linked data & big data
Introduction to question answering for linked data & big dataIntroduction to question answering for linked data & big data
Introduction to question answering for linked data & big data
 
An Ambitious Wikidata Tutorial
An Ambitious Wikidata TutorialAn Ambitious Wikidata Tutorial
An Ambitious Wikidata Tutorial
 
Deep Reasoning
Deep ReasoningDeep Reasoning
Deep Reasoning
 
그런데 스타트업이 뭐더라
그런데 스타트업이 뭐더라그런데 스타트업이 뭐더라
그런데 스타트업이 뭐더라
 
Differentiable Neural Computer
Differentiable Neural ComputerDifferentiable Neural Computer
Differentiable Neural Computer
 
Summernote 이야기 - 홍영택님(@hackerwins)
Summernote 이야기 - 홍영택님(@hackerwins)Summernote 이야기 - 홍영택님(@hackerwins)
Summernote 이야기 - 홍영택님(@hackerwins)
 
딥러닝을 이용한 자연어처리의 연구동향
딥러닝을 이용한 자연어처리의 연구동향딥러닝을 이용한 자연어처리의 연구동향
딥러닝을 이용한 자연어처리의 연구동향
 
텐서플로우 설치도 했고 튜토리얼도 봤고 기초 예제도 짜봤다면 TensorFlow KR Meetup 2016
텐서플로우 설치도 했고 튜토리얼도 봤고 기초 예제도 짜봤다면 TensorFlow KR Meetup 2016텐서플로우 설치도 했고 튜토리얼도 봤고 기초 예제도 짜봤다면 TensorFlow KR Meetup 2016
텐서플로우 설치도 했고 튜토리얼도 봤고 기초 예제도 짜봤다면 TensorFlow KR Meetup 2016
 

위키데이터 개론

  • 2. 발표자는? 2 • 본업: 클라우드 컴퓨팅 운영+개발 • 코딩德 • 위키백과 사용자 2007년~ • 한국어 위키백과 관리자 2010년~ • 관심분야: Cloud, 리눅스, PHP, 미디어위키, HTML5
  • 3. 3 차례 • 위키데이터란? • 핵심개념 Q • 핵심개념 P • 시맨틱 웹 활용하기
  • 4. 위키데이터? 한마디로… 위키미디어 재단에서 운영하는 자유 지식 베이스 (위키)지식을 머신 리더블 데이터로 정리하는 공개DB 4 cf. Dbpedia, Freebase와 다른 점은? machine readable, machine understandable 바코드 로고?
  • 5. 5 위키데이터의 시작 2012년 투자 단체 분야 앨런 인공지능 연구소 인공지능 고든 앤 베티 무어 재단 데이터 과학 구글 검색엔진 cf. 시맨틱 웹?
  • 6. 위키데이터? 기술적으로… 위키미디어 재단에서 운영하는, 자유 지식 베이스를 위한 웹서버 미디어위키 + 위키베이스 위키베이스 • 미디어위키 확장기능(플러그인) 모음 • 특히 Wikibase Repository가 핵심(서버 기능) 다른 프로젝트(예: 위키백과)에는 이것이 없음 • http://wikiba.se/ 6 cf. 시맨틱 위키?
  • 7. 다언어* • 메타위키 • 위키미디어 공용 • 위키데이터 • 위키스피시즈 • 위키인큐베이터 • 미디어위키 위키데이터? 프로젝트 비교 7 언어별 • 위키백과 • 위키낱말사전 • 위키문헌 • 위키배움터 • 위키인용집 • 위키책 * Multilingual. 언어별 서브도메인을 부여하지 않음
  • 8. 8 문서 수 비교 위키백과 vs 위키데이터 4.8 17.3 0 5 10 15 20 '01 '02 '03 '04 '05 '06 '07 '08 '09 '10 '11 '12 '13 '14 '15 문서수(단위:백만개) 연도 ( 1월 기준 ) 위키백과 (영어판) 위키데이터 http://stats.wikimedia.org/EN/TablesWikipediaEN.htm http://stats.wikimedia.org/wikispecial/EN/TablesWikipediaWIKIDATA.htm
  • 9. 어떻게 정리하나? ★★★★★ 한국어 영어 설명 식별자 개체 Entity 항목 + 속성 + 쿼리 항목 Item 실제 물건, 사람, 개념, 사건 등 Q번호 속성 Property 항목의 속성, Item간의 연결 P번호 쿼리 Query 사전정의된 질의문 9 Q1 생성일 2012-10-29 P6 생성일 2013-02-04
  • 10. 위키데이터? 발전 단계 10 1단계 2단계 3단계 • Item 활성화 • 인터위키 링크 수용 • Property 활성화 • Infobox 정보 수용 • Query 활성화 2013년 인터위키 수용 완료 진행 중 예정, 테스트 중
  • 11. Item ☞ Q 11 ※ 정식명칭은 Item이지만 간단히 Q라고 부르겠음
  • 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/버락_오바마]]
  • 15. 15 http://www.wikidata.org/wiki/Q76 ★ http://www.wikidata.org/entity/Q76 http://www.wikidata.org/w/index.php?title=Q76 http://www.wikidata.org/wiki/Special:EntityData/Q76 http://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번호를 알 때
  • 16. Q에는 어떤 정보가 있나? 16 Q76 영어 Q76 한국어 언어설정
  • 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 )
  • 22. 22 P? 속성 • Item*의 속성 • Item간 연결가능** • 식별자: P번호 • [[Property:P22]] • [[P:P22]] * 정확히는 Entity ** P-P, Q-value 연결도 가능
  • 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 같은 의미 사례
  • 26. P 연결 예시 26http://www.wikidata.org/wiki/Wikidata:Introduction P번호 레이블 P6 정부 수반 P131 소재 행정 구역 P625 위치 좌표 P1082 소재 행정 구역 P25 어머니 P1082 P6 P131 P131 P625 P로 연결된 것들 중 Item이 아닌 것? 사용한 Property 목록
  • 27. P 시점별 데이터 샌프란시스코(Q62)의 P 27 인구 population (P1082) 시장 head of government (P6) 어느 것이 최신인가?
  • 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”
  • 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
  • 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)
  • 34. 34 [출처 필요] references 샌프란시스코(Q62)의 인구(P1082) 버락 오바마(Q62)의 생년월일(P569) http://ko.wikipedia.org/wiki/위키백과:출처_밝히기 Q14527788
  • 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, 음성인식 기술과 만나면… “ㅇㅇㅇ은 모든 것을 알고 있다.”