Migrating Freebase to Wikidata
Denny Vrandečić,1 Thomas Pellissier-Tanon,1 �Sebastian Schaffert,2 Thomas Steiner3
1 Google, San Francisco, United States
{vrandecic,thomaspt}@google.com @vrandezo @Tpt93
2 Google, Zurich, Switzerland
schaffert@google.com @SSchaffert
3 Google, Hamburg, Germany
tomac@google.com @tomayac
Freebase
Google Confidential and Proprietary
Wikidata
Google Confidential and Proprietary
Structured Data
Google Confidential and Proprietary
Freebase Homepage
Google Confidential and Proprietary
Freebase Item Page
Google Confidential and Proprietary
Wikidata Homepage
Google Confidential and Proprietary
Wikidata Item Page
Google Confidential and Proprietary
Freebase Shutdown
Google Confidential and Proprietary
Migration
Google Confidential and Proprietary
Primary Sources Tool
Objective: add proper sources (references) to statements:
<subject> <predicate> <object> ⇒ according to <source>
<Hamburg> <head of government> <Olaf Scholz> ⇒ according to ⏎
<http://www.olafscholz.hamburg/main>
Google Confidential and Proprietary
Architecture
Google Confidential and Proprietary
“Hey Freebase! Do you have data about Q1055 (Hamburg) that I haven’t?”
“Hey Wikidata! Yeah, I know that Q1055 has a foo whose value is bar, according to baz.”
<Q1055> <foo> <bar> ⇒ according to <baz>
Knowledge Vault
for sources
Knowledge Vault: Facts from Unstructured Text
Google Confidential and Proprietary
Creating a User Script
Google Confidential and Proprietary
common.js file for programming logic: https://en.wikipedia.org/wiki/Special:MyPage/common.js
common.css file for styling: https://en.wikipedia.org/wiki/Special:MyPage/common.css
Giving Wikipedia/Wikidata a code.talks visual makeover…
Creating a User Script
Google Confidential and Proprietary
Creating an xkcd #37 Moment on Wikipedia…
Primary Sources Tool
Google Confidential and Proprietary
Primary Sources Tool — Back-end
Google Confidential and Proprietary
Primary Sources Tool — Front-end
Google Confidential and Proprietary
MediaWiki API
Google Confidential and Proprietary
MediaWiki API — Getting Data
Google Confidential and Proprietary
// https://www.wikidata.org/w/api.php?action=help&modules=wbgetclaims
function getClaims(subject, predicate, callback) {
var api = new mw.Api();
api.get({
action: 'wbgetclaims',
entity: subject,
property: predicate
}).done(function(data) {
return callback(null, data.claims[predicate] || []);
}).fail(function(error) {
return callback(error);
});
}
MediaWiki API — Editing Data
Google Confidential and Proprietary
// https://www.wikidata.org/w/api.php?action=help ⏎
// &modules=wbsetreference
function createClaimWithReference(subject, predicate, object,
qualifiers, sourceSnaks) {
var value = (tsvValueToJson(object)).value;
var api = new mw.Api();
return createClaim(subject, predicate, object, qualifiers)
.then(function(data) {
return api.post({
action: 'wbsetreference',
statement: data.claim.id,
snaks: JSON.stringify(formatSourceForSave(sourceSnaks)),
token: mw.user.tokens.get('editToken'),
summary: WIKIDATA_API_COMMENT
});
});
}
Primary Sources Tool Gadget (Grown-up User Script)
Google Confidential and Proprietary
Problem: Pages Based on Wikipedia Contents
Google Confidential and Proprietary
Live Demo
Google Confidential and Proprietary
Thanks
Google Confidential and Proprietary