From d96760581656e083139938f0971abe6b90b32c96 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Tue, 7 Feb 2017 23:29:43 +0000 Subject: [PATCH 1/2] Change default reconciliation service to Wikidata --- .../core/langs/translation-default.json | 3 ++- .../modules/core/langs/translation-en.json | 3 ++- .../modules/core/langs/translation-es.json | 3 ++- .../modules/core/langs/translation-fr.json | 3 ++- .../modules/core/langs/translation-it.json | 3 ++- .../modules/core/langs/translation-jp.json | 3 ++- .../modules/core/langs/translation-zh.json | 3 ++- .../scripts/reconciliation/recon-manager.js | 26 ++++++++++++++++--- 8 files changed, 36 insertions(+), 11 deletions(-) diff --git a/main/webapp/modules/core/langs/translation-default.json b/main/webapp/modules/core/langs/translation-default.json index 425157c9f..df4405c5f 100644 --- a/main/webapp/modules/core/langs/translation-default.json +++ b/main/webapp/modules/core/langs/translation-default.json @@ -350,7 +350,8 @@ "as-property": "As Property", "contact-service": "Contacting reconciliation service", "error-contact": "Error contacting recon service", - "fb-recon": "Freebase Query-based Reconciliation", + "wd-recon": "Wikidata Reconciliation", + "wd-recon-lang": "en", "recon-col": "Reconcile column", "pick-service": "Pick a Service or Extension on Left", "add-recon-srv": "Add Namespaced Reconciliation Service", diff --git a/main/webapp/modules/core/langs/translation-en.json b/main/webapp/modules/core/langs/translation-en.json index ab8737628..a70b84cd0 100644 --- a/main/webapp/modules/core/langs/translation-en.json +++ b/main/webapp/modules/core/langs/translation-en.json @@ -350,7 +350,8 @@ "as-property": "As Property", "contact-service": "Contacting reconciliation service", "error-contact": "Error contacting recon service", - "fb-recon": "Freebase Query-based Reconciliation", + "wd-recon": "Wikidata Reconciliation", + "wd-recon-lang": "en", "recon-col": "Reconcile column", "pick-service": "Pick a Service or Extension on Left", "add-recon-srv": "Add Namespaced Reconciliation Service", diff --git a/main/webapp/modules/core/langs/translation-es.json b/main/webapp/modules/core/langs/translation-es.json index 395d2bdbf..368060fc8 100644 --- a/main/webapp/modules/core/langs/translation-es.json +++ b/main/webapp/modules/core/langs/translation-es.json @@ -350,7 +350,8 @@ "as-property": "Como propiedad", "contact-service": "Contactando al servicio", "error-contact": "Error contactando al servicio", - "fb-recon": "Freebase basado en consulta", + "wd-recon": "Wikidata", + "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", diff --git a/main/webapp/modules/core/langs/translation-fr.json b/main/webapp/modules/core/langs/translation-fr.json index da332f41c..1b19457b7 100644 --- a/main/webapp/modules/core/langs/translation-fr.json +++ b/main/webapp/modules/core/langs/translation-fr.json @@ -350,7 +350,8 @@ "as-property": "Comme propriété", "contact-service": "Connexion au service de réconciliation", "error-contact": "Erreur lors de la connexion au service de réconciliation", - "fb-recon": "Réconciliation basée sur des requêtes Freebase", + "wd-recon": "Réconciliation Wikidata", + "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", diff --git a/main/webapp/modules/core/langs/translation-it.json b/main/webapp/modules/core/langs/translation-it.json index 8a49215cd..37457a582 100644 --- a/main/webapp/modules/core/langs/translation-it.json +++ b/main/webapp/modules/core/langs/translation-it.json @@ -350,7 +350,8 @@ "as-property": "Come Proprietà", "contact-service": "Contattando il servizio di riconciliazione", "error-contact": "Errore durante il contatto del servizio di riconciliazione", - "fb-recon": "Riconciliazione Freebase basata su query", + "wd-recon": "Riconciliazione Wikidata", + "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", diff --git a/main/webapp/modules/core/langs/translation-jp.json b/main/webapp/modules/core/langs/translation-jp.json index b9de5c5cb..110880dc2 100644 --- a/main/webapp/modules/core/langs/translation-jp.json +++ b/main/webapp/modules/core/langs/translation-jp.json @@ -350,7 +350,8 @@ "as-property": "プロパティ", "contact-service": "名寄せサービスにコンタクト中", "error-contact": "名寄せサービスのコンタクトにエラー", - "fb-recon": "Freebase Query-based Reconciliation", + "wd-recon": "Wikidata Reconciliation", + "wd-recon-lang": "jp", "recon-col": "カラムを名寄せ", "pick-service": "左からサービスかエクステンションを選択", "add-recon-srv": "名前空間名寄せサービスを追加", diff --git a/main/webapp/modules/core/langs/translation-zh.json b/main/webapp/modules/core/langs/translation-zh.json index f9d3e0634..8ae6a3849 100644 --- a/main/webapp/modules/core/langs/translation-zh.json +++ b/main/webapp/modules/core/langs/translation-zh.json @@ -350,7 +350,8 @@ "as-property": "作为属性", "contact-service": "正在访问搭配服务", "error-contact": "在访问搭配服务时出现异常", - "fb-recon": "基于query的Freebase搭配", + "wd-recon": "基于query的Wikidata搭配", + "wd-recon-lang": "zh", "recon-col": "搭配列", "pick-service": "在左侧选择一个服务或扩展", "add-recon-srv": "添加具命名空间的搭配服务", diff --git a/main/webapp/modules/core/scripts/reconciliation/recon-manager.js b/main/webapp/modules/core/scripts/reconciliation/recon-manager.js index ea9f14abd..a1c0ea412 100644 --- a/main/webapp/modules/core/scripts/reconciliation/recon-manager.js +++ b/main/webapp/modules/core/scripts/reconciliation/recon-manager.js @@ -140,10 +140,28 @@ ReconciliationManager.save = function(f) { }; (function() { - ReconciliationManager.customServices.push({ - "name" : $.i18n._('core-recon')["fb-recon"], - "ui" : { "handler" : "ReconFreebaseQueryPanel" } - }); + var lang = $.i18n._('core-recon')["wd-recon-lang"]; + ReconciliationManager.customServices.push( + {"suggest": + {"property": + {"service_url": "https://tools.wmflabs.org/openrefine-wikidata", + "service_path": "/"+lang+"/suggest/property"}, + "type": + {"service_url": "https://tools.wmflabs.org/openrefine-wikidata", + "service_path": "/"+lang+"/suggest/type"}, + "entity": {"service_url": "https://tools.wmflabs.org/openrefine-wikidata", + "service_path": "/"+lang+"/suggest/entity"}}, + "view": + {"url": "https://www.wikidata.org/wiki/{{id}}"}, + "preview": + {"height": 90, + "url": "https://tools.wmflabs.org/openrefine-wikidata/"+lang+"/preview?id={{id}}", + "width": 320}, + "name": $.i18n._('core-recon')["wd-recon"], + "url" : "https://tools.wmflabs.org/openrefine-wikidata/"+lang+"/api", + "ui" : { "handler": "ReconStandardServicePanel" }, + }); + var cs = ReconciliationManager.customServices; $.ajax({ async: false, From 5d8d37224451001b408aae1d8e6f6237550eff3e Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Tue, 7 Feb 2017 23:59:12 +0000 Subject: [PATCH 2/2] Simpler version --- .../core/langs/translation-default.json | 1 - .../modules/core/langs/translation-en.json | 1 - .../modules/core/langs/translation-es.json | 1 - .../modules/core/langs/translation-fr.json | 1 - .../modules/core/langs/translation-it.json | 1 - .../modules/core/langs/translation-jp.json | 1 - .../modules/core/langs/translation-zh.json | 1 - .../scripts/reconciliation/recon-manager.js | 31 +++---------------- 8 files changed, 4 insertions(+), 34 deletions(-) diff --git a/main/webapp/modules/core/langs/translation-default.json b/main/webapp/modules/core/langs/translation-default.json index df4405c5f..ed2f48c33 100644 --- a/main/webapp/modules/core/langs/translation-default.json +++ b/main/webapp/modules/core/langs/translation-default.json @@ -350,7 +350,6 @@ "as-property": "As Property", "contact-service": "Contacting reconciliation service", "error-contact": "Error contacting recon service", - "wd-recon": "Wikidata Reconciliation", "wd-recon-lang": "en", "recon-col": "Reconcile column", "pick-service": "Pick a Service or Extension on Left", diff --git a/main/webapp/modules/core/langs/translation-en.json b/main/webapp/modules/core/langs/translation-en.json index a70b84cd0..b8a3fef78 100644 --- a/main/webapp/modules/core/langs/translation-en.json +++ b/main/webapp/modules/core/langs/translation-en.json @@ -350,7 +350,6 @@ "as-property": "As Property", "contact-service": "Contacting reconciliation service", "error-contact": "Error contacting recon service", - "wd-recon": "Wikidata Reconciliation", "wd-recon-lang": "en", "recon-col": "Reconcile column", "pick-service": "Pick a Service or Extension on Left", diff --git a/main/webapp/modules/core/langs/translation-es.json b/main/webapp/modules/core/langs/translation-es.json index 368060fc8..898d50396 100644 --- a/main/webapp/modules/core/langs/translation-es.json +++ b/main/webapp/modules/core/langs/translation-es.json @@ -350,7 +350,6 @@ "as-property": "Como propiedad", "contact-service": "Contactando al servicio", "error-contact": "Error contactando al servicio", - "wd-recon": "Wikidata", "wd-recon-lang": "es", "recon-col": "Cotejar columna", "pick-service": "Seleccione un servicio o extensión a la izquierda", diff --git a/main/webapp/modules/core/langs/translation-fr.json b/main/webapp/modules/core/langs/translation-fr.json index 1b19457b7..dc7079c97 100644 --- a/main/webapp/modules/core/langs/translation-fr.json +++ b/main/webapp/modules/core/langs/translation-fr.json @@ -350,7 +350,6 @@ "as-property": "Comme propriété", "contact-service": "Connexion au service de réconciliation", "error-contact": "Erreur lors de la connexion au service de réconciliation", - "wd-recon": "Réconciliation Wikidata", "wd-recon-lang": "fr", "recon-col": "Réconcilier la colonne", "pick-service": "Choisir un service ou une extension à gauche", diff --git a/main/webapp/modules/core/langs/translation-it.json b/main/webapp/modules/core/langs/translation-it.json index 37457a582..8e7f5e6d7 100644 --- a/main/webapp/modules/core/langs/translation-it.json +++ b/main/webapp/modules/core/langs/translation-it.json @@ -350,7 +350,6 @@ "as-property": "Come Proprietà", "contact-service": "Contattando il servizio di riconciliazione", "error-contact": "Errore durante il contatto del servizio di riconciliazione", - "wd-recon": "Riconciliazione Wikidata", "wd-recon-lang": "it", "recon-col": "Riconcilia la colonna", "pick-service": "Seleziona un Servizio o Estensione sulla Sinistra", diff --git a/main/webapp/modules/core/langs/translation-jp.json b/main/webapp/modules/core/langs/translation-jp.json index 110880dc2..86ca6b8c7 100644 --- a/main/webapp/modules/core/langs/translation-jp.json +++ b/main/webapp/modules/core/langs/translation-jp.json @@ -350,7 +350,6 @@ "as-property": "プロパティ", "contact-service": "名寄せサービスにコンタクト中", "error-contact": "名寄せサービスのコンタクトにエラー", - "wd-recon": "Wikidata Reconciliation", "wd-recon-lang": "jp", "recon-col": "カラムを名寄せ", "pick-service": "左からサービスかエクステンションを選択", diff --git a/main/webapp/modules/core/langs/translation-zh.json b/main/webapp/modules/core/langs/translation-zh.json index 8ae6a3849..4eaace1ee 100644 --- a/main/webapp/modules/core/langs/translation-zh.json +++ b/main/webapp/modules/core/langs/translation-zh.json @@ -350,7 +350,6 @@ "as-property": "作为属性", "contact-service": "正在访问搭配服务", "error-contact": "在访问搭配服务时出现异常", - "wd-recon": "基于query的Wikidata搭配", "wd-recon-lang": "zh", "recon-col": "搭配列", "pick-service": "在左侧选择一个服务或扩展", diff --git a/main/webapp/modules/core/scripts/reconciliation/recon-manager.js b/main/webapp/modules/core/scripts/reconciliation/recon-manager.js index a1c0ea412..11d36ac08 100644 --- a/main/webapp/modules/core/scripts/reconciliation/recon-manager.js +++ b/main/webapp/modules/core/scripts/reconciliation/recon-manager.js @@ -141,27 +141,6 @@ ReconciliationManager.save = function(f) { (function() { var lang = $.i18n._('core-recon')["wd-recon-lang"]; - ReconciliationManager.customServices.push( - {"suggest": - {"property": - {"service_url": "https://tools.wmflabs.org/openrefine-wikidata", - "service_path": "/"+lang+"/suggest/property"}, - "type": - {"service_url": "https://tools.wmflabs.org/openrefine-wikidata", - "service_path": "/"+lang+"/suggest/type"}, - "entity": {"service_url": "https://tools.wmflabs.org/openrefine-wikidata", - "service_path": "/"+lang+"/suggest/entity"}}, - "view": - {"url": "https://www.wikidata.org/wiki/{{id}}"}, - "preview": - {"height": 90, - "url": "https://tools.wmflabs.org/openrefine-wikidata/"+lang+"/preview?id={{id}}", - "width": 320}, - "name": $.i18n._('core-recon')["wd-recon"], - "url" : "https://tools.wmflabs.org/openrefine-wikidata/"+lang+"/api", - "ui" : { "handler": "ReconStandardServicePanel" }, - }); - var cs = ReconciliationManager.customServices; $.ajax({ async: false, @@ -169,15 +148,13 @@ ReconciliationManager.save = function(f) { name: "reconciliation.standardServices" }), success: function(data) { - if (data.value && data.value != "null") { + if (data.value && data.value != "null" && data.value != "[]") { ReconciliationManager.standardServices = JSON.parse(data.value); ReconciliationManager._rebuildMap(); } else { - // FIXME: Standard recon service needs to be replaced -// ReconciliationManager.registerStandardService( -// "http://reconcile.freebaseapps.com/reconcile" -// "http://standard-reconcile.freebaseapps.com/reconcile" -// ); + ReconciliationManager.registerStandardService( + "https://tools.wmflabs.org/openrefine-wikidata/"+lang+"/api" + ); } }, dataType: "json"