Merge pull request #1167 from wetneb/freebase-cleanup

Freebase cleanup
This commit is contained in:
Thad Guidry 2017-02-09 20:11:36 -06:00 committed by GitHub
commit 4b23496be0
15 changed files with 6 additions and 327 deletions

View File

@ -69,7 +69,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<p>
OpenRefine is a power tool for working with messy data. Use it to improve data consistency,
link it to data registries like Freebase, augment it with data from other sources, transform it
link it to data registries like Wikidata, augment it with data from other sources, transform it
into different formats for other tools to consume, and contribute it to back to the original
sources. OpenRefine is not a web service but a desktop app that runs on your own computer,
so you can process sensitive data with privacy.

View File

@ -353,18 +353,8 @@
"wd-recon-lang": "en",
"recon-col": "Reconcile column",
"pick-service": "Pick a Service or Extension on Left",
"add-recon-srv": "Add Namespaced Reconciliation Service",
"namespace": "Namespace",
"ent-type": "Type of Entities (optional)",
"add-std-srv": "Add Standard Reconciliation Service",
"enter-url": "Enter the service's URL",
"specify-ns": "Please specify a namespace.",
"cell-contains": "Each cell contains:",
"fb-id": "a Freebase ID, e.g., /en/solar_system",
"fb-guid": "a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
"fb-key": "a Freebase key in",
"fb-en-ns": "the Wikipedia English namespace",
"this-ns": "this namespace:",
"max-candidates" : "Maximum number of candidates to return",
"service-title": "Services"
},
@ -658,7 +648,6 @@
"remove-all": "Remove All",
"perform-op": "Perform Operations",
"add-std-svc": "Add Standard Service",
"add-named-svc": "Add Namespaced Service",
"start-recon": "Start Reconciling",
"add-service": "Add Service",
"dont-reconcile": "Don't Reconcile Cell",

View File

@ -353,18 +353,8 @@
"wd-recon-lang": "en",
"recon-col": "Reconcile column",
"pick-service": "Pick a Service or Extension on Left",
"add-recon-srv": "Add Namespaced Reconciliation Service",
"namespace": "Namespace",
"ent-type": "Type of Entities (optional)",
"add-std-srv": "Add Standard Reconciliation Service",
"enter-url": "Enter the service's URL",
"specify-ns": "Please specify a namespace.",
"cell-contains": "Each cell contains:",
"fb-id": "a Freebase ID, e.g., /en/solar_system",
"fb-guid": "a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
"fb-key": "a Freebase key in",
"fb-en-ns": "the Wikipedia English namespace",
"this-ns": "this namespace:",
"max-candidates" : "Maximum number of candidates to return",
"service-title": "Services"
},
@ -658,7 +648,6 @@
"remove-all": "Remove All",
"perform-op": "Perform Operations",
"add-std-svc": "Add Standard Service",
"add-named-svc": "Add Namespaced Service",
"start-recon": "Start Reconciling",
"add-service": "Add Service",
"dont-reconcile": "Don't Reconcile Cell",

View File

@ -353,18 +353,8 @@
"wd-recon-lang": "es",
"recon-col": "Cotejar columna",
"pick-service": "Seleccione un servicio o extensión a la izquierda",
"add-recon-srv": "Agregar servicio namespace",
"namespace": "Espacio de nombres",
"ent-type": "Clase de la entidad (opcional)",
"add-std-srv": "Agregar servicio estándar",
"enter-url": "Ingrese la uRL del servicio",
"specify-ns": "Por favor especifique un namespace.",
"cell-contains": "Cada celda contiene:",
"fb-id": "un ID de Freebase, p. ej., /en/solar_system",
"fb-guid": "un GUID de Freebase GUID, p. ej., #9202a8c04000641f80000000000354ae",
"fb-key": "una llave de Freebase en",
"fb-en-ns": "El namespace de Wikipedia en Inglés",
"this-ns": "este namespace:",
"max-candidates" : "Máximo número de candidatos a devolver",
"service-title": "Servicios"
},
@ -658,7 +648,6 @@
"remove-all": "Remover todos",
"perform-op": "Ejecutar Operaciones",
"add-std-svc": "Agregar servicio estándar",
"add-named-svc": "Agregar servicio con espacio de nombres",
"start-recon": "Cotejar",
"add-service": "Agragar servicio",
"dont-reconcile": "No reconciliar celdas",

View File

@ -353,18 +353,8 @@
"wd-recon-lang": "fr",
"recon-col": "Réconcilier la colonne",
"pick-service": "Choisir un service ou une extension à gauche",
"add-recon-srv": "Ajouter un service de réconciliation avec un espace de noms",
"namespace": "Espace de noms",
"ent-type": "Type des entités (facultatif)",
"add-std-srv": "Ajouter un service de réconciliation standard",
"enter-url": "Indiquer lURL du service",
"specify-ns": "Merci dindiquer un espace de nom.",
"cell-contains": "Chaque cellule contient :",
"fb-id": "un ID Freebase, par exemple /en/solar_system",
"fb-guid": "un GUID Freebase, par exemple #9202a8c04000641f80000000000354ae",
"fb-key": "une clé Freebase",
"fb-en-ns": "lespace de noms Wikipedia English",
"this-ns": "cet espace de noms :",
"max-candidates" : "Nombre maximal de candidats renvoyés",
"service-title": "Services"
},
@ -658,7 +648,6 @@
"remove-all": "Tout supprimer",
"perform-op": "Lancer les opérations",
"add-std-svc": "Ajouter un service standard",
"add-named-svc": "Ajouter un service avec un espace de noms",
"start-recon": "Démarrer la réconciliation",
"add-service": "Ajouter un service",
"dont-reconcile": "Ne pas réconcilier la cellule",

View File

@ -353,18 +353,8 @@
"wd-recon-lang": "it",
"recon-col": "Riconcilia la colonna",
"pick-service": "Seleziona un Servizio o Estensione sulla Sinistra",
"add-recon-srv": "Aggiungi un servizio di riconciliazione con Namespace",
"namespace": "Namespace",
"ent-type": "Tipo di entità (opzionale)",
"add-std-srv": "Aggiungi un Servizio di Riconciliazione Standard",
"enter-url": "Inserisci l'URL del servizio",
"specify-ns": "Specifica uno Namespace.",
"cell-contains": "Ogni cella contiene:",
"fb-id": "un Freebase ID, es: /en/solar_system",
"fb-guid": "un Freebase GUID, es: #9202a8c04000641f80000000000354ae",
"fb-key": "Una chiave Freebase nel",
"fb-en-ns": "namespace di Wikipedia inglese",
"this-ns": "questo namespace:",
"max-candidates" : "Maximum number of candidates to return [TODO - translate]",
"service-title": "Servizi"
},
@ -658,7 +648,6 @@
"remove-all": "Rimuovi tutti",
"perform-op": "Esegui le operazioni",
"add-std-svc": "Aggiungi un servizio standard",
"add-named-svc": "Aggiungi un servizio con namespace",
"start-recon": "Inizia la riconciliazione",
"add-service": "Aggiungi servizio",
"dont-reconcile": "Non riconciliare la cella",

View File

@ -353,18 +353,8 @@
"wd-recon-lang": "jp",
"recon-col": "カラムを名寄せ",
"pick-service": "左からサービスかエクステンションを選択",
"add-recon-srv": "名前空間名寄せサービスを追加",
"namespace": "名前空間",
"ent-type": "エンティティーのタイプ (optional)",
"add-std-srv": "標準的な名寄せサービスを追加",
"enter-url": "サービスのURLを入力",
"specify-ns": "名前空間を指定してください。",
"cell-contains": "各セルは含む:",
"fb-id": "Freebase ID, e.g., /en/solar_system",
"fb-guid": "Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
"fb-key": "Freebase key in",
"fb-en-ns": "英語版Wikipediaの名前空間",
"this-ns": "この名前空間:",
"max-candidates" : "返却される候補の最大値",
"service-title": "サービス"
},
@ -658,7 +648,6 @@
"remove-all": "すべて削除",
"perform-op": "操作を実行",
"add-std-svc": "標準サービスを追加",
"add-named-svc": "名前空間サービスを追加",
"start-recon": "名寄せ開始",
"add-service": "サービスを追加",
"dont-reconcile": "セルを名寄せしない",

View File

@ -353,18 +353,8 @@
"wd-recon-lang": "zh",
"recon-col": "搭配列",
"pick-service": "在左侧选择一个服务或扩展",
"add-recon-srv": "添加具命名空间的搭配服务",
"namespace": "命名空间",
"ent-type": "实体类型 (可选)",
"add-std-srv": "添加标准搭配服务",
"enter-url": "键入一个服务的URL",
"specify-ns": "请指定一个命名空间.",
"cell-contains": "各个包含以下内容的单元格:",
"fb-id": "a Freebase ID, e.g., /en/solar_system",
"fb-guid": "a Freebase GUID, e.g., #9202a8c04000641f80000000000354ae",
"fb-key": "a Freebase key in",
"fb-en-ns": "英文维基命名空间",
"this-ns": "该命名空间:",
"max-candidates" : "最大候选服务返回数量",
"service-title": "Services"
@ -659,7 +649,6 @@
"remove-all": "全部移除",
"perform-op": "执行这些操作",
"add-std-svc": "添加标准服务",
"add-named-svc": "添加命名空间服务",
"start-recon": "开始搭配",
"add-service": "添加服务",
"dont-reconcile": "不搭配单元格",

View File

@ -1,141 +0,0 @@
/*
Copyright 2010, Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function ReconFreebaseQueryPanel(column, service, container) {
this._column = column;
this._service = service;
this._container = container;
this._constructUI();
}
ReconFreebaseQueryPanel.prototype.activate = function() {
this._panel.show();
};
ReconFreebaseQueryPanel.prototype.deactivate = function() {
this._panel.hide();
};
ReconFreebaseQueryPanel.prototype.dispose = function() {
this._panel.remove();
this._panel = null;
this._column = null;
this._service = null;
this._container = null;
};
ReconFreebaseQueryPanel.prototype._constructUI = function() {
var self = this;
this._panel = $(DOM.loadHTML("core", "scripts/reconciliation/freebase-query-panel.html")).appendTo(this._container);
this._elmts = DOM.bind(this._panel);
this._elmts.or_recon_contain.html($.i18n._('core-recon')["cell-contains"]);
this._elmts.or_recon_fbId.html($.i18n._('core-recon')["fb-id"]);
this._elmts.or_recon_fbGuid.html($.i18n._('core-recon')["fb-guid"]);
this._elmts.or_recon_fbKey.html($.i18n._('core-recon')["fb-key"]);
this._elmts.or_recon_fbEnNs.html($.i18n._('core-recon')["fb-en-ns"]);
this._elmts.or_recon_thisNs.html($.i18n._('core-recon')["this-ns"]);
this._wireEvents();
};
ReconFreebaseQueryPanel.prototype._wireEvents = function() {
var self = this;
this._elmts.strictNamespaceInput
.suggest({ filter : '(all type:/type/namespace)' })
.bind("fb-select", function(e, data) {
self._panel.find('input[name="recon-dialog-strict-choice"][value="key"]').attr("checked", "true");
self._panel.find('input[name="recon-dialog-strict-namespace-choice"][value="other"]').attr("checked", "true");
});
};
ReconFreebaseQueryPanel.prototype.start = function() {
var bodyParams;
var match = $('input[name="recon-dialog-strict-choice"]:checked')[0].value;
if (match == "key") {
var namespaceChoice = $('input[name="recon-dialog-strict-namespace-choice"]:checked')[0];
var namespace;
if (namespaceChoice.value == "other") {
var suggest = this._elmts.strictNamespaceInput.data("data.suggest");
if (!suggest) {
alert($.i18n._('core-recon')["specify-ns"]);
return;
}
namespace = {
id: suggest.id,
name: suggest.name
};
} else {
namespace = {
id: namespaceChoice.value,
name: namespaceChoice.getAttribute("nsName")
};
}
bodyParams = {
columnName: this._column.name,
config: JSON.stringify({
mode: "freebase/strict",
match: "key",
namespace: namespace
})
};
} else if (match == "id") {
bodyParams = {
columnName: this._column.name,
config: JSON.stringify({
mode: "freebase/strict",
match: "id"
})
};
} else if (match == "guid") {
bodyParams = {
columnName: this._column.name,
config: JSON.stringify({
mode: "freebase/strict",
match: "guid"
})
};
}
Refine.postCoreProcess(
"reconcile",
{},
bodyParams,
{ cellsChanged: true, columnStatsChanged: true }
);
};

View File

@ -23,7 +23,6 @@
<tr>
<td align="left">
<button class="button" bind="addStandardServiceButton"></button>
<button class="button" bind="addNamespacedServiceButton"></button>
</td>
<td align="right">
<button class="button" bind="reconcileButton"></button>
@ -31,4 +30,4 @@
</td>
</table>
</div>
</div>
</div>

View File

@ -49,12 +49,10 @@ ReconDialog.prototype._createDialog = function() {
this._elmts.servicePanelMessage.html($.i18n._('core-recon')["pick-service"]);
this._elmts.serviceListTitle.html($.i18n._('core-recon')["service-title"]);
this._elmts.addStandardServiceButton.html($.i18n._('core-buttons')["add-std-svc"]+"...");
this._elmts.addNamespacedServiceButton.html($.i18n._('core-buttons')["add-named-svc"]+"...");
this._elmts.reconcileButton.html($.i18n._('core-buttons')["start-recon"]);
this._elmts.cancelButton.html($.i18n._('core-buttons')["cancel"]);
this._elmts.addStandardServiceButton.click(function() { self._onAddStandardService(); });
this._elmts.addNamespacedServiceButton.click(function() { self._onAddNamespacedService(); });
this._elmts.reconcileButton.click(function() { self._onOK(); });
this._elmts.cancelButton.click(function() { self._dismiss(); });
@ -227,46 +225,4 @@ ReconDialog.prototype._onAddStandardService = function() {
elmts.input.focus().select();
};
ReconDialog.prototype._onAddNamespacedService = function() {
var self = this;
var dialog = $(DOM.loadHTML("core", "scripts/reconciliation/add-namespaced-service-dialog.html"));
var elmts = DOM.bind(dialog);
elmts.dialogHeader.html($.i18n._('core-recon')["add-recon-srv"]);
elmts.or_recon_namespace.html($.i18n._('core-recon')["namespace"]+":");
elmts.or_recon_entType.html($.i18n._('core-recon')["ent-type"]+":");
elmts.addButton.html($.i18n._('core-buttons')["add-service"]);
elmts.cancelButton.html($.i18n._('core-buttons')["cancel"]);
var level = DialogSystem.showDialog(dialog);
var dismiss = function() {
DialogSystem.dismissUntil(level - 1);
};
elmts.namespaceInput
.suggest({ filter : '(all type:/type/namespace)' })
.bind("fb-select", function(e, data) {
elmts.typeInput.focus();
});
elmts.typeInput.suggestT({ filter : '(all type:/type/type)' });
elmts.cancelButton.click(dismiss);
elmts.addButton.click(function() {
var namespaceData = elmts.namespaceInput.data("data.suggest");
var typeData = elmts.typeInput.data("data.suggest");
if (namespaceData) {
var url = "http://reconcile.freebaseapps.com/namespace_reconcile?namespace="
+ encodeURIComponent(namespaceData.id);
if (typeData) {
url += "&type=" + typeData.id;
}
ReconciliationManager.registerStandardService(url, function(index) {
self._refresh(index);
});
}
dismiss();
});
elmts.namespaceInput.focus().data("suggest").textchange();
};

View File

@ -37,18 +37,6 @@ var ReconciliationManager = {
_urlMap : {}
};
ReconciliationManager.isFreebaseId = function(s) {
return s == "http://rdf.freebase.com/ns/type.object.id";
};
ReconciliationManager.isFreebaseMid = function(s) {
return s == "http://rdf.freebase.com/ns/type.object.mid";
};
ReconciliationManager.isFreebaseIdOrMid = function(s) {
return ReconciliationManager.isFreebaseMid(s) || ReconciliationManager.isFreebaseId(s);
};
ReconciliationManager._rebuildMap = function() {
var map = {};
$.each(ReconciliationManager.getAllServices(), function(i, service) {

View File

@ -222,8 +222,6 @@ ReconStandardServicePanel.prototype._wireEvents = function() {
suggestOptions.key = null;
suggestOptions.query_param_name = "prefix";
input.suggestT(suggestOptions);
} else if (this._isInFreebaseSchemaSpace()) {
input.suggestT({ filter : '(all type:/type/type)' });
}
input.bind("fb-select", function(e, data) {
@ -251,22 +249,9 @@ ReconStandardServicePanel.prototype._rewirePropertySuggests = function(type) {
suggestOptions.ac_param = { schema: typeof type == "string" ? type : type.id };
}
inputs.suggestP(suggestOptions);
} else if (this._isInFreebaseSchemaSpace()) {
var namespace = (type) ? (typeof type == "string" ? type : type.id) : "/common/topic"
inputs.suggestP({
filter : '(should (any namespace:/type/object namespace:' + namespace + '))'
});
}
};
ReconStandardServicePanel.prototype._isInFreebaseIdentifierSpace = function() {
return ReconciliationManager.isFreebaseIdOrMid(this._service.identifierSpace);
};
ReconStandardServicePanel.prototype._isInFreebaseSchemaSpace = function() {
return ReconciliationManager.isFreebaseId(this._service.schemaSpace);
};
ReconStandardServicePanel.prototype.start = function() {
var self = this;

View File

@ -33,16 +33,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var CustomSuggest = {};
// Default API key for Refine to use for freebase suggest widget
//CustomSuggest.setFreebaseAPIKey("AIzaSyBBTAtJ31v_jlg_ImbQuBNnAaAyrHzRyW8"); // Google key
CustomSuggest.FREEBASE_API_KEY = "AIzaSyBAZ_EjMPKlOzyyZXv6JKXPPwJFISVji3M"; // OpenRefine default key
CustomSuggest.setFreebaseAPIKey = function(freebaseAPIKey) {
$.suggest.suggest.defaults.key = freebaseAPIKey;
$.suggest.suggestT.defaults.key = freebaseAPIKey;
$.suggest.suggestP.defaults.key = freebaseAPIKey;
};
(function() {
/*
@ -168,18 +158,4 @@ CustomSuggest.setFreebaseAPIKey = function(freebaseAPIKey) {
}
);
// Use Freebase API Key
$.ajax("command/core/get-preference",
{
async: false,
data: {name: "freebase.api.key"},
success: function(data) {
if (data.value && data.value != "null") {
CustomSuggest.setFreebaseAPIKey(data.value);
} else {
CustomSuggest.setFreebaseAPIKey(CustomSuggest.FREEBASE_API_KEY);
}
}
}
);
})();
})();

View File

@ -106,8 +106,6 @@ DataTableCellUI.prototype._render = function() {
if (service && (service.view) && (service.view.url)) {
a.attr("href", encodeURI(service.view.url.replace("{{id}}", match.id)));
} else if (ReconciliationManager.isFreebaseIdOrMid(r.identifierSpace)) {
a.attr("href", "http://www.freebase.com/view" + match.id);
}
$('<span> </span>').appendTo(divContent);
@ -150,17 +148,13 @@ DataTableCellUI.prototype._render = function() {
if ((service) && (service.view) && (service.view.url)) {
a.attr("href", encodeURI(service.view.url.replace("{{id}}", candidate.id)));
} else if (ReconciliationManager.isFreebaseIdOrMid(r.identifierSpace)) {
a.attr("href", "http://www.freebase.com/view" + candidate.id);
}
var preview = null;
if ((service) && (service.preview)
&& service.preview.url.indexOf("http://www.freebase.com/widget/topic") < 0) {
if ((service) && (service.preview)) {
preview = service.preview;
} else if (ReconciliationManager.isFreebaseIdOrMid(r.identifierSpace)) {
preview = DataTableCellUI.internalPreview;
}
if (preview) {
a.click(function(evt) {
if (!evt.metaKey && !evt.ctrlKey) {
@ -207,8 +201,6 @@ DataTableCellUI.prototype._render = function() {
if ((service) && (service.suggest) && (service.suggest.entity)) {
suggestOptions = service.suggest.entity;
addSuggest = true;
} else if (ReconciliationManager.isFreebaseIdOrMid(r.identifierSpace)) {
addSuggest = true;
}
var extraChoices = $('<div>').addClass("data-table-recon-extra").appendTo(divContent);
@ -436,6 +428,7 @@ DataTableCellUI.prototype._postProcessSeveralCells = function(command, params, b
);
};
// TODO delete this
DataTableCellUI.internalPreview = {
srchurl: 'https://www.googleapis.com/freebase/v1/search?filter=(all mid:${id})'
+ '&output=(notable:/client/summary (description citation provenance) type)'