WikidataBuilder has uploaded a new change for review.
https://gerrit.wikimedia.org/r/295329
Change subject: New Wikidata Build - 2016-06-21T10:00:01+0000
......................................................................
New Wikidata Build - 2016-06-21T10:00:01+0000
Change-Id: I34484f67c8e344d75347a0a92c486092f4e6b955
---
M composer.lock
M extensions/PropertySuggester/PropertySuggesterHooks.php
M extensions/PropertySuggester/README.md
A extensions/PropertySuggester/i18n/de.json
A extensions/PropertySuggester/i18n/es.json
A extensions/PropertySuggester/i18n/fr.json
A extensions/PropertySuggester/i18n/gl.json
A extensions/PropertySuggester/i18n/he.json
A extensions/PropertySuggester/i18n/id.json
A extensions/PropertySuggester/i18n/it.json
A extensions/PropertySuggester/i18n/mk.json
M extensions/PropertySuggester/i18n/qqq.json
A extensions/PropertySuggester/i18n/ru.json
A extensions/PropertySuggester/i18n/uk.json
A extensions/PropertySuggester/i18n/zh-hans.json
M extensions/PropertySuggester/maintenance/UpdateTable.php
M extensions/PropertySuggester/modules/ext.PropertySuggester.EntitySelector.js
M extensions/PropertySuggester/src/PropertySuggester/SuggesterParamsParser.php
M
extensions/PropertySuggester/src/PropertySuggester/Suggesters/SimpleSuggester.php
M extensions/PropertySuggester/src/PropertySuggester/SuggestionGenerator.php
M
extensions/PropertySuggester/src/PropertySuggester/UpdateTable/Importer/BasicImporter.php
M
extensions/PropertySuggester/tests/phpunit/PropertySuggester/GetSuggestionsTest.php
A
extensions/PropertySuggester/tests/phpunit/PropertySuggester/PropertySuggesterHooksTest.php
M
extensions/PropertySuggester/tests/phpunit/PropertySuggester/ResultBuilderTest.php
M
extensions/PropertySuggester/tests/phpunit/PropertySuggester/SuggestionGeneratorTest.php
A extensions/Wikibase/client/i18n/sat.json
M extensions/Wikibase/client/includes/WikibaseClient.php
M extensions/Wikibase/lib/i18n/fi.json
M extensions/Wikibase/lib/includes/Interactors/TermIndexSearchInteractor.php
M extensions/Wikibase/lib/includes/TermIndexEntry.php
M extensions/Wikibase/lib/tests/phpunit/Store/TermIndexTest.php
A extensions/Wikibase/repo/i18n/sat.json
M extensions/Wikibase/repo/includes/Api/SetReference.php
M extensions/Wikibase/repo/includes/WikibaseRepo.php
M extensions/Wikibase/repo/tests/phpunit/includes/Api/SetReferenceTest.php
M
extensions/Wikibase/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
M extensions/Wikibase/repo/tests/phpunit/includes/WikibaseRepoTest.php
M vendor/composer/installed.json
38 files changed, 496 insertions(+), 188 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikidata
refs/changes/29/295329/1
diff --git a/composer.lock b/composer.lock
index 6bc5c08..c47b190 100644
--- a/composer.lock
+++ b/composer.lock
@@ -813,16 +813,16 @@
},
{
"name": "propertysuggester/property-suggester",
- "version": "3.0.1",
+ "version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/Wikidata-lib/PropertySuggester.git",
- "reference": "c267839dbf9e1369053999ebee996bff7c87f3ee"
+ "reference": "fdb33b593b96a890145c6ae008333768fb4f0d3c"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/Wikidata-lib/PropertySuggester/zipball/c267839dbf9e1369053999ebee996bff7c87f3ee",
- "reference": "c267839dbf9e1369053999ebee996bff7c87f3ee",
+ "url":
"https://api.github.com/repos/Wikidata-lib/PropertySuggester/zipball/fdb33b593b96a890145c6ae008333768fb4f0d3c",
+ "reference": "fdb33b593b96a890145c6ae008333768fb4f0d3c",
"shasum": ""
},
"require": {
@@ -856,7 +856,7 @@
"wikibase",
"wikidata"
],
- "time": "2016-03-16 11:16:15"
+ "time": "2016-06-20 17:44:28"
},
{
"name": "serialization/serialization",
@@ -1570,12 +1570,12 @@
"source": {
"type": "git",
"url":
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git",
- "reference": "ec1396d91432627aedd33cef4cf020045df36322"
+ "reference": "ca948d8eb949433d105fbf51448b902c89cb652e"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/ec1396d91432627aedd33cef4cf020045df36322",
- "reference": "ec1396d91432627aedd33cef4cf020045df36322",
+ "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/ca948d8eb949433d105fbf51448b902c89cb652e",
+ "reference": "ca948d8eb949433d105fbf51448b902c89cb652e",
"shasum": ""
},
"require": {
@@ -1647,7 +1647,7 @@
"wikibaserepo",
"wikidata"
],
- "time": "2016-06-18 20:51:04"
+ "time": "2016-06-20 20:24:18"
},
{
"name": "wikibase/wikimedia-badges",
diff --git a/extensions/PropertySuggester/PropertySuggesterHooks.php
b/extensions/PropertySuggester/PropertySuggesterHooks.php
index bdf6414..75f18d1 100644
--- a/extensions/PropertySuggester/PropertySuggesterHooks.php
+++ b/extensions/PropertySuggester/PropertySuggesterHooks.php
@@ -1,5 +1,6 @@
<?php
+use Wikibase\DataModel\Entity\Item;
use Wikibase\Repo\WikibaseRepo;
final class PropertySuggesterHooks {
@@ -19,7 +20,15 @@
}
$entityNamespaceLookup =
WikibaseRepo::getDefaultInstance()->getEntityNamespaceLookup();
- $itemNamespace = $entityNamespaceLookup->getEntityNamespace(
CONTENT_MODEL_WIKIBASE_ITEM );
+ $itemNamespace = $entityNamespaceLookup->getEntityNamespace(
Item::ENTITY_TYPE );
+
+ if ( $itemNamespace === false ) {
+ // try looking up namespace by content model, for any
instances of PropertySuggester
+ // running with older Wikibase prior to ef622b1bc.
+ $itemNamespace =
$entityNamespaceLookup->getEntityNamespace(
+ CONTENT_MODEL_WIKIBASE_ITEM
+ );
+ }
if ( $out->getTitle()->getNamespace() !== $itemNamespace ) {
return true;
diff --git a/extensions/PropertySuggester/README.md
b/extensions/PropertySuggester/README.md
index 3666f94..b54fff6 100644
--- a/extensions/PropertySuggester/README.md
+++ b/extensions/PropertySuggester/README.md
@@ -45,6 +45,10 @@
## Release notes
+### 3.0.2 (2016-06-20)
+* Adapt entity type for namespaces
+* Minor cleanups
+
### 3.0.1 (2016-03-14)
* Defined compatibility with Wikibase DataModel ~6.0
diff --git a/extensions/PropertySuggester/i18n/de.json
b/extensions/PropertySuggester/i18n/de.json
new file mode 100644
index 0000000..d0e0d41
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/de.json
@@ -0,0 +1,18 @@
+{
+ "@metadata": {
+ "authors": [
+ "Metalhead64"
+ ]
+ },
+ "propertysuggester-desc": "Schlägt Eigenschaften beim Hinzufügen von
Wikibase-Aussagen vor.",
+ "apihelp-wbsgetsuggestions-example-1": "Ruft Vorschläge für das Objekt
Q4 ab",
+ "apihelp-wbsgetsuggestions-example-2": "Ruft Vorschläge für das Objekt
Q4 von Rang 10 bis 15 ab",
+ "apihelp-wbsgetsuggestions-example-4": "Ruft Vorschläge für den
Qualifikator ab, die mit P21 verwendet werden.",
+ "apihelp-wbsgetsuggestions-example-5": "Ruft Vorschläge für die
Einzelnachweise ab, die mit P21 verwendet werden.",
+ "apihelp-wbsgetsuggestions-param-context": "Entweder Objekt,
Einzelnachweis oder Qualifikator.",
+ "apihelp-wbsgetsuggestions-param-continue": "Versatz, wo eine Suche
fortgeführt werden soll.",
+ "apihelp-wbsgetsuggestions-param-language": "Sprache für das Ergebnis.",
+ "apihelp-wbsgetsuggestions-param-limit": "Maximale Anzahl der
Ergebnisse.",
+ "apihelp-wbsgetsuggestions-param-search": "Sucht nach diesem Text.",
+ "apihelp-wbsgetsuggestions-param-size": "Gibt die Anzahl der
zurückzugebenden Vorschläge an."
+}
diff --git a/extensions/PropertySuggester/i18n/es.json
b/extensions/PropertySuggester/i18n/es.json
new file mode 100644
index 0000000..6bdc7cf
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/es.json
@@ -0,0 +1,23 @@
+{
+ "@metadata": {
+ "authors": [
+ "AlvaroMolina",
+ "Macofe"
+ ]
+ },
+ "propertysuggester-desc": "Sugiere propiedades cuando se añaden
declaraciones de Wikibase.",
+ "apihelp-wbsgetsuggestions-description": "Módulo API para obtener
sugerencias de propiedades adicionales para agregar a un Wikibase entidad. El
módulo API está destinado principalmente para su uso por el suggester widget
cuando los usuarios están editando Wikibase entidades.",
+ "apihelp-wbsgetsuggestions-example-1": "Obtener sugerencias para la
entidad Q4",
+ "apihelp-wbsgetsuggestions-example-2": "Obtener sugerencias para la
entidad Q4 en el intervalo 10 a 15",
+ "apihelp-wbsgetsuggestions-example-3": "Obtener sugerencias para la
combinación de propiedades P21 y P31",
+ "apihelp-wbsgetsuggestions-example-4": "Obtener sugerencias para la
clasificación que se utilizan con P21",
+ "apihelp-wbsgetsuggestions-example-5": "Obtener sugerencias para las
referencias que se utilizan con P21",
+ "apihelp-wbsgetsuggestions-param-context": "Cualquiera de los
elementos, de referencia o de clasificación.",
+ "apihelp-wbsgetsuggestions-param-continue": "Desplazamiento desde donde
continuar una búsqueda.",
+ "apihelp-wbsgetsuggestions-param-entity": "Sugerir propiedades para la
entidad dada, basado en la lista de propiedades existentes de la entidad.",
+ "apihelp-wbsgetsuggestions-param-language": "Idioma del resultado.",
+ "apihelp-wbsgetsuggestions-param-limit": "Número máximo de resultados.",
+ "apihelp-wbsgetsuggestions-param-properties": "Sugerir propiedades
adicionales para la lista dada de propiedades.",
+ "apihelp-wbsgetsuggestions-param-search": "Buscar este texto.",
+ "apihelp-wbsgetsuggestions-param-size": "Especificar el número de
sugerencias que se devolverán."
+}
diff --git a/extensions/PropertySuggester/i18n/fr.json
b/extensions/PropertySuggester/i18n/fr.json
new file mode 100644
index 0000000..92d5ce3
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/fr.json
@@ -0,0 +1,24 @@
+{
+ "@metadata": {
+ "authors": [
+ "Gomoko",
+ "Verdy p",
+ "Wladek92"
+ ]
+ },
+ "propertysuggester-desc": "Suggère des propriétés lors de l’ajout
d’instructions Wikibase.",
+ "apihelp-wbsgetsuggestions-description": "Module de l’API pour obtenir
des suggestions de propriétés supplémentaires à ajouter à une entité de
Wikibase. Le module de l’API est tout d’abord conçu pour une utilisation par le
widget de suggestion quand les utilisateurs modifient les entités de Wikibase.",
+ "apihelp-wbsgetsuggestions-example-1": "Obtenir des suggestions pour
l’entité Q4",
+ "apihelp-wbsgetsuggestions-example-2": "Obtenir des suggestions pour
l’entité Q4 du rang 10 à 15",
+ "apihelp-wbsgetsuggestions-example-3": "Obtenir des suggestions pour la
combinaison des propriétés P21 et P31",
+ "apihelp-wbsgetsuggestions-example-4": "Obtenir des suggestions pour le
qualificatif qui sont utilisés avec P21",
+ "apihelp-wbsgetsuggestions-example-5": "Obtenir des suggestions pour
les références qui sont utilisées avec P21",
+ "apihelp-wbsgetsuggestions-param-context": "Soit un élément, une
référence ou un qualificatif.",
+ "apihelp-wbsgetsuggestions-param-continue": "Décalage à partir duquel
continuer une recherche.",
+ "apihelp-wbsgetsuggestions-param-entity": "Suggérer des propriétés pour
l’entité donnée, basées sur la liste existante des propriétés que l’entité a
déjà.",
+ "apihelp-wbsgetsuggestions-param-language": "Langue pour le résultat.",
+ "apihelp-wbsgetsuggestions-param-limit": "Nombre maximum de résultats.",
+ "apihelp-wbsgetsuggestions-param-properties": "Proposer des propriétés
supplémentaires pour la liste donnée des propriétés.",
+ "apihelp-wbsgetsuggestions-param-search": "Rechercher ce texte.",
+ "apihelp-wbsgetsuggestions-param-size": "Spécifier le nombre de
suggestions devant être retournées."
+}
diff --git a/extensions/PropertySuggester/i18n/gl.json
b/extensions/PropertySuggester/i18n/gl.json
new file mode 100644
index 0000000..b08d5ff
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/gl.json
@@ -0,0 +1,22 @@
+{
+ "@metadata": {
+ "authors": [
+ "Elisardojm"
+ ]
+ },
+ "propertysuggester-desc": "Suxire propiedades cando se engaden
declaracións de Wikibase.",
+ "apihelp-wbsgetsuggestions-description": "Módulo API para obter
suxestións de propiedades adicionais para engadir a unha entidade de Wikibase.
O módulo API está destinado principalmente para o seu uso polo widget de
suxestións cando os usuarios están modificando entidades de Wikibase.",
+ "apihelp-wbsgetsuggestions-example-1": "Obter suxestións para a
entidade Q4",
+ "apihelp-wbsgetsuggestions-example-2": "Obter suxestión para a entidade
Q4 do rango 10 ó 15",
+ "apihelp-wbsgetsuggestions-example-3": "Obter suxestións para a
combinación das propiedades P21 e P31",
+ "apihelp-wbsgetsuggestions-example-4": "Obter suxestións para os
cualificadores que son usados con P21",
+ "apihelp-wbsgetsuggestions-example-5": "Obter suxestións para as
referencias que se usan con P21",
+ "apihelp-wbsgetsuggestions-param-context": "Calquera elemento,
referencia ou cualificador.",
+ "apihelp-wbsgetsuggestions-param-continue": "Desprazamento desde onde
continuar unha busca.",
+ "apihelp-wbsgetsuggestions-param-entity": "Suxerir propiedades para a
entidade indicada, baseadas na lista de existende de propiedades que xa ten a
entidade.",
+ "apihelp-wbsgetsuggestions-param-language": "Idioma para o resultado.",
+ "apihelp-wbsgetsuggestions-param-limit": "Número máximo de resultados.",
+ "apihelp-wbsgetsuggestions-param-properties": "Suxerir propiedades
adicionais para a lista dada de propiedades.",
+ "apihelp-wbsgetsuggestions-param-search": "Buscar este texto.",
+ "apihelp-wbsgetsuggestions-param-size": "Indicar o número de suxestión
a devolver."
+}
diff --git a/extensions/PropertySuggester/i18n/he.json
b/extensions/PropertySuggester/i18n/he.json
new file mode 100644
index 0000000..2ffb30e
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/he.json
@@ -0,0 +1,14 @@
+{
+ "@metadata": {
+ "authors": [
+ "Amire80",
+ "Guycn2"
+ ]
+ },
+ "apihelp-wbsgetsuggestions-example-3": "קבלת הצעות עבור השילוב של
המאפיינים P21 ו־P31",
+ "apihelp-wbsgetsuggestions-param-language": "השפה של התוצאה.",
+ "apihelp-wbsgetsuggestions-param-limit": "מספר התוצאות המרבי.",
+ "apihelp-wbsgetsuggestions-param-properties": "לציין מאפיינים נוספים
עבור רשימת המאפיינים הנתונה.",
+ "apihelp-wbsgetsuggestions-param-search": "לחפש את הטקסט הזה.",
+ "apihelp-wbsgetsuggestions-param-size": "ציינו את מספר ההצעות שיוצגו."
+}
diff --git a/extensions/PropertySuggester/i18n/id.json
b/extensions/PropertySuggester/i18n/id.json
new file mode 100644
index 0000000..9faf921
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/id.json
@@ -0,0 +1,22 @@
+{
+ "@metadata": {
+ "authors": [
+ "Rachmat.Wahidi"
+ ]
+ },
+ "propertysuggester-desc": "Sarankan atribut ketika menambahkan
pernyataan Wikibase.",
+ "apihelp-wbsgetsuggestions-description": "Modul API untuk mendapatkan
saran atribut tambahan untuk menambahkan ke entitas Wikibase. Modul API itu
pada awalnya ditujukan untuk digunakan oleh gawit saran ketika pengguna
menyunting entitas Wikibase.",
+ "apihelp-wbsgetsuggestions-example-1": "Dapatkan saranan untuk entitas
Q4",
+ "apihelp-wbsgetsuggestions-example-2": "Dapatkan saran untuk entitas Q4
dari peringkat 10 ke 15",
+ "apihelp-wbsgetsuggestions-example-3": "Dapatkan saran untuk kombinasi
atribut P21 dan P31",
+ "apihelp-wbsgetsuggestions-example-4": "Dapatkan saran untuk penjelas
yang digunakan dengan P21",
+ "apihelp-wbsgetsuggestions-example-5": "Dapatkan saran untuk referensi
yang digunakan dengan P21",
+ "apihelp-wbsgetsuggestions-param-context": "Butir, referensi atau
penjelas.",
+ "apihelp-wbsgetsuggestions-param-continue": "Ofset di mana pencarian
akan dilanjutkan.",
+ "apihelp-wbsgetsuggestions-param-entity": "Sarankan atribut untuk
entitas yang diberikan, menurut daftar yang ada dari atribut yang dimiliki
entitas.",
+ "apihelp-wbsgetsuggestions-param-language": "Bahasa untuk hasil.",
+ "apihelp-wbsgetsuggestions-param-limit": "Jumlah hasil maksimal.",
+ "apihelp-wbsgetsuggestions-param-properties": "Sarankan atribut
tambahan untuk daftar atribut yang diberikan.",
+ "apihelp-wbsgetsuggestions-param-search": "Cari untuk teks ini.",
+ "apihelp-wbsgetsuggestions-param-size": "Tentukan jumlah saran yang
harus dihasilkan."
+}
diff --git a/extensions/PropertySuggester/i18n/it.json
b/extensions/PropertySuggester/i18n/it.json
new file mode 100644
index 0000000..a6be7fc
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/it.json
@@ -0,0 +1,16 @@
+{
+ "@metadata": {
+ "authors": [
+ "Beta16"
+ ]
+ },
+ "apihelp-wbsgetsuggestions-example-1": "Ottieni suggerimenti per
l'entità Q4",
+ "apihelp-wbsgetsuggestions-example-3": "Ottieni suggerimenti per la
combinazione di proprietà P21 e P31",
+ "apihelp-wbsgetsuggestions-example-4": "Ottieni suggerimenti per i
qualificatori che vengono utilizzati con P21",
+ "apihelp-wbsgetsuggestions-example-5": "Ottieni suggerimenti per i
riferimenti che vengono utilizzati con P21",
+ "apihelp-wbsgetsuggestions-param-language": "Lingua per il risultato.",
+ "apihelp-wbsgetsuggestions-param-limit": "Numero massimo di risultati.",
+ "apihelp-wbsgetsuggestions-param-properties": "Suggerisci ulteriori
proprietà per l'elenco delle proprietà indicate",
+ "apihelp-wbsgetsuggestions-param-search": "Ricerca di questo testo.",
+ "apihelp-wbsgetsuggestions-param-size": "Specifica il numero di
suggerimenti da restituire."
+}
diff --git a/extensions/PropertySuggester/i18n/mk.json
b/extensions/PropertySuggester/i18n/mk.json
new file mode 100644
index 0000000..4d8cdd5
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/mk.json
@@ -0,0 +1,22 @@
+{
+ "@metadata": {
+ "authors": [
+ "Bjankuloski06"
+ ]
+ },
+ "propertysuggester-desc": "Предлага својства кога се ставаат искази во
Викибазата",
+ "apihelp-wbsgetsuggestions-description": "Приложнички модул за добивање
на предлози за дополниителни својства што би се додале кон единица на
Викибазата. Наменет е претежно за употреба во алатката Предлагач кога
корисниците уредуваат единици на Викибазата.",
+ "apihelp-wbsgetsuggestions-example-1": "Дај предлози за единицата Q4",
+ "apihelp-wbsgetsuggestions-example-2": "Дај предлози за единицата Q4 од
ранг 10 до 15",
+ "apihelp-wbsgetsuggestions-example-3": "Дај предлози за комбинацијата
на својства P21 и P31",
+ "apihelp-wbsgetsuggestions-example-4": "Дај предлози за определницата
што се користат со P21",
+ "apihelp-wbsgetsuggestions-example-5": "Дај предлози за наводи што се
користат со P21",
+ "apihelp-wbsgetsuggestions-param-context": "Предмет, навод или
определница.",
+ "apihelp-wbsgetsuggestions-param-continue": "Од каде да се продолжи со
пребарувањето",
+ "apihelp-wbsgetsuggestions-param-entity": "Предложи својства за дадена
единица, на основа на постоечки список на својства што ги има единицата.",
+ "apihelp-wbsgetsuggestions-param-language": "Јазик за исходот.",
+ "apihelp-wbsgetsuggestions-param-limit": "Макс. број на резултати.",
+ "apihelp-wbsgetsuggestions-param-properties": "Предложи дополнителни
својства за дадениот список на својства.",
+ "apihelp-wbsgetsuggestions-param-search": "Пребарај го текстов.",
+ "apihelp-wbsgetsuggestions-param-size": "Укажете колку предлози да се
дадат."
+}
diff --git a/extensions/PropertySuggester/i18n/qqq.json
b/extensions/PropertySuggester/i18n/qqq.json
index e5aec0f..77520ce 100644
--- a/extensions/PropertySuggester/i18n/qqq.json
+++ b/extensions/PropertySuggester/i18n/qqq.json
@@ -1,23 +1,23 @@
{
- "@metadata": {
- "authors": [
- "Christian Dullweber",
- "Katie Filbert"
- ]
- },
- "propertysuggester-desc":
"{{desc|name=PropertySuggester|url=http://www.mediawiki.org/wiki/Extension:PropertySuggester}}",
- "apihelp-wbsgetsuggestions-description":
"{{doc-apihelp-description|wbsgetsuggestions}}",
- "apihelp-wbsgetsuggestions-example-1":
"{{doc-apihelp-example|wbsgetsuggestions}}",
- "apihelp-wbsgetsuggestions-example-2":
"{{doc-apihelp-example|wbsgetsuggestions}}",
- "apihelp-wbsgetsuggestions-example-3":
"{{doc-apihelp-example|wbsgetsuggestions}}",
- "apihelp-wbsgetsuggestions-example-4":
"{{doc-apihelp-example|wbsgetsuggestions}}",
- "apihelp-wbsgetsuggestions-example-5":
"{{doc-apihelp-example|wbsgetsuggestions}}",
- "apihelp-wbsgetsuggestions-param-context":
"{{doc-apihelp-param|wbgetsuggestions|context}}",
- "apihelp-wbsgetsuggestions-param-continue":
"{{doc-apihelp-param|wbgetsuggestions|continue}}",
- "apihelp-wbsgetsuggestions-param-entity":
"{{doc-apihelp-param|wbgetsuggestions|entity}}",
- "apihelp-wbsgetsuggestions-param-language":
"{{doc-apihelp-param|wbgetsuggestions|language}}",
- "apihelp-wbsgetsuggestions-param-limit":
"{{doc-apihelp-param|wbgetsuggestions|limit}}",
- "apihelp-wbsgetsuggestions-param-properties":
"{{doc-apihelp-param|wbgetsuggestions|properties}}",
- "apihelp-wbsgetsuggestions-param-search":
"{{doc-apihelp-param|wbgetsuggestions|search}}",
- "apihelp-wbsgetsuggestions-param-size":
"{{doc-apihelp-param|wbgetsuggestions|size}}"
+ "@metadata": {
+ "authors": [
+ "Christian Dullweber",
+ "Katie Filbert"
+ ]
+ },
+ "propertysuggester-desc":
"{{desc|name=PropertySuggester|url=http://www.mediawiki.org/wiki/Extension:PropertySuggester}}",
+ "apihelp-wbsgetsuggestions-description":
"{{doc-apihelp-description|wbsgetsuggestions}}",
+ "apihelp-wbsgetsuggestions-example-1":
"{{doc-apihelp-example|wbsgetsuggestions}}",
+ "apihelp-wbsgetsuggestions-example-2":
"{{doc-apihelp-example|wbsgetsuggestions}}",
+ "apihelp-wbsgetsuggestions-example-3":
"{{doc-apihelp-example|wbsgetsuggestions}}",
+ "apihelp-wbsgetsuggestions-example-4":
"{{doc-apihelp-example|wbsgetsuggestions}}",
+ "apihelp-wbsgetsuggestions-example-5":
"{{doc-apihelp-example|wbsgetsuggestions}}",
+ "apihelp-wbsgetsuggestions-param-context":
"{{doc-apihelp-param|wbgetsuggestions|context}}",
+ "apihelp-wbsgetsuggestions-param-continue":
"{{doc-apihelp-param|wbgetsuggestions|continue}}",
+ "apihelp-wbsgetsuggestions-param-entity":
"{{doc-apihelp-param|wbgetsuggestions|entity}}",
+ "apihelp-wbsgetsuggestions-param-language":
"{{doc-apihelp-param|wbgetsuggestions|language}}",
+ "apihelp-wbsgetsuggestions-param-limit":
"{{doc-apihelp-param|wbgetsuggestions|limit}}",
+ "apihelp-wbsgetsuggestions-param-properties":
"{{doc-apihelp-param|wbgetsuggestions|properties}}",
+ "apihelp-wbsgetsuggestions-param-search":
"{{doc-apihelp-param|wbgetsuggestions|search}}",
+ "apihelp-wbsgetsuggestions-param-size":
"{{doc-apihelp-param|wbgetsuggestions|size}}"
}
diff --git a/extensions/PropertySuggester/i18n/ru.json
b/extensions/PropertySuggester/i18n/ru.json
new file mode 100644
index 0000000..b127c2b
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/ru.json
@@ -0,0 +1,22 @@
+{
+ "@metadata": {
+ "authors": [
+ "Alexandr Efremov"
+ ]
+ },
+ "propertysuggester-desc": "Выводит предложения свойств при добавлении
утверждений Викибазы.",
+ "apihelp-wbsgetsuggestions-description": "Модуль API для получения
предложений дополнительных свойств, которые можно было бы добавить к сущности
Викибазы. Модуль API предназначен в первую очередь для того, чтобы его мог
использовать виджет предложений, когда пользователи редактируют сущности
Викибазы.",
+ "apihelp-wbsgetsuggestions-example-1": "Получить предложения для
сущности Q4",
+ "apihelp-wbsgetsuggestions-example-2": "Получить предложения для
сущности Q4 от 10 до 15 ранга",
+ "apihelp-wbsgetsuggestions-example-3": "Получить предложения для
комбинации свойств P21 и P31",
+ "apihelp-wbsgetsuggestions-example-4": "Получить предложения для
уточнения, что используются с P21",
+ "apihelp-wbsgetsuggestions-example-5": "Получить предложения для ссылок
на источники, используемые P21",
+ "apihelp-wbsgetsuggestions-param-context": "Элемент, ссылка на
источник, или уточнения.",
+ "apihelp-wbsgetsuggestions-param-continue": "Смещение, с которого
продолжить поиск.",
+ "apihelp-wbsgetsuggestions-param-entity": "Предложить свойства для
заданной сущности на основе имеющегося списка свойств, которые имеет эта
сущность.",
+ "apihelp-wbsgetsuggestions-param-language": "Язык результата.",
+ "apihelp-wbsgetsuggestions-param-limit": "Максимальное количество
результатов.",
+ "apihelp-wbsgetsuggestions-param-properties": "Предложить
дополнительные свойства для заданного списка свойств.",
+ "apihelp-wbsgetsuggestions-param-search": "Искать этот текст.",
+ "apihelp-wbsgetsuggestions-param-size": "Указать количество
предложений, которые надо вывести."
+}
diff --git a/extensions/PropertySuggester/i18n/uk.json
b/extensions/PropertySuggester/i18n/uk.json
new file mode 100644
index 0000000..039acb3
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/uk.json
@@ -0,0 +1,22 @@
+{
+ "@metadata": {
+ "authors": [
+ "Piramidion"
+ ]
+ },
+ "propertysuggester-desc": "Виводить пропозиції властивостей при
додаванні тверджень Вікібази.",
+ "apihelp-wbsgetsuggestions-description": "Модуль API для отримання
пропозицій додаткових властивостей, які можна було б додати до сутності
Вікібази. Модуль API призначений в першу чергу для того, аби його міг
використовувати віджет пропозицій, коли користувачі редагують сутності
Вікібази.",
+ "apihelp-wbsgetsuggestions-example-1": "Отримати пропозиції для
сутності Q4",
+ "apihelp-wbsgetsuggestions-example-2": "Отримати пропозиції для
сутності Q4 від 10 до 15 рангу",
+ "apihelp-wbsgetsuggestions-example-3": "Отримати пропозиції для
комбінації властивостей P21 та P31",
+ "apihelp-wbsgetsuggestions-example-4": "Отримати пропозиції для
уточнення, що використовуються з P21",
+ "apihelp-wbsgetsuggestions-example-5": "Отримати пропозиції для
посилань на джерела, що використовуються з P21",
+ "apihelp-wbsgetsuggestions-param-context": "Елемент, посилання на
джерело, або уточнення.",
+ "apihelp-wbsgetsuggestions-param-continue": "Зміщення, з якого
продовжити пошук.",
+ "apihelp-wbsgetsuggestions-param-entity": "Запропонувати властивості
для заданої сутності на основі наявного списку властивостей, які має ця
сутність.",
+ "apihelp-wbsgetsuggestions-param-language": "Мова результату.",
+ "apihelp-wbsgetsuggestions-param-limit": "Максимальна кількість
результатів.",
+ "apihelp-wbsgetsuggestions-param-properties": "Запропонувати додаткові
властивості для заданого списку властивостей.",
+ "apihelp-wbsgetsuggestions-param-search": "Шукати цей текст.",
+ "apihelp-wbsgetsuggestions-param-size": "Вказати кількість пропозицій,
які треба вивести."
+}
diff --git a/extensions/PropertySuggester/i18n/zh-hans.json
b/extensions/PropertySuggester/i18n/zh-hans.json
new file mode 100644
index 0000000..8121d49
--- /dev/null
+++ b/extensions/PropertySuggester/i18n/zh-hans.json
@@ -0,0 +1,22 @@
+{
+ "@metadata": {
+ "authors": [
+ "Liuxinyu970226"
+ ]
+ },
+ "propertysuggester-desc": "当添加Wikibase声明时建议属性。",
+ "apihelp-wbsgetsuggestions-description":
"用于获取添加至Wikibase实体的额外属性建议的API模块。API模块主要在用户编辑Wikibase实体时,由建议器小部件使用。",
+ "apihelp-wbsgetsuggestions-example-1": "获取用于实体Q4的建议",
+ "apihelp-wbsgetsuggestions-example-2": "获取实体Q4从第10名到第15名之间的建议",
+ "apihelp-wbsgetsuggestions-example-3": "为属性组合P21和P31提供建议",
+ "apihelp-wbsgetsuggestions-example-4": "获取用于与P21一起使用的限定符的建议",
+ "apihelp-wbsgetsuggestions-example-5": "获取用于与P21一起使用的参考文献的建议",
+ "apihelp-wbsgetsuggestions-param-context": "项、参考文献或限定符之一。",
+ "apihelp-wbsgetsuggestions-param-continue": "继续搜索的偏移。",
+ "apihelp-wbsgetsuggestions-param-entity": "为指定实体建议属性,基于实体现有的属性列表。",
+ "apihelp-wbsgetsuggestions-param-language": "用于结果的语言。",
+ "apihelp-wbsgetsuggestions-param-limit": "结果的最大值。",
+ "apihelp-wbsgetsuggestions-param-properties": "为提供的属性列表建议额外属性。",
+ "apihelp-wbsgetsuggestions-param-search": "搜索此文本。",
+ "apihelp-wbsgetsuggestions-param-size": "指定要返回的建议数量。"
+}
diff --git a/extensions/PropertySuggester/maintenance/UpdateTable.php
b/extensions/PropertySuggester/maintenance/UpdateTable.php
index faf534a..688d12d 100644
--- a/extensions/PropertySuggester/maintenance/UpdateTable.php
+++ b/extensions/PropertySuggester/maintenance/UpdateTable.php
@@ -8,7 +8,6 @@
use PropertySuggester\UpdateTable\ImportContext;
use UnexpectedValueException;
-
$basePath = getenv( 'MW_INSTALL_PATH' ) !== false ? getenv( 'MW_INSTALL_PATH'
) : __DIR__ . '/../../..';
require_once $basePath . '/maintenance/Maintenance.php';
@@ -44,7 +43,7 @@
$tableName = 'wbs_propertypairs';
- wfWaitForSlaves();
+ wfGetLBFactory()->waitForReplication();
$lb = wfGetLB();
$this->clearTable( $lb, $tableName );
@@ -102,7 +101,7 @@
} else {
do {
$db->commit( __METHOD__, 'flush' );
- wfWaitForSlaves();
+ wfGetLBFactory()->waitForReplication();
$this->output( "Deleting a batch\n" );
$table = $db->tableName( $tableName );
$db->query( "DELETE FROM $table LIMIT
$this->mBatchSize" );
@@ -113,5 +112,5 @@
}
-$maintClass = 'PropertySuggester\Maintenance\UpdateTable';
+$maintClass = UpdateTable::class;
require_once RUN_MAINTENANCE_IF_MAIN;
diff --git
a/extensions/PropertySuggester/modules/ext.PropertySuggester.EntitySelector.js
b/extensions/PropertySuggester/modules/ext.PropertySuggester.EntitySelector.js
index 5a5b02d..c740b00 100644
---
a/extensions/PropertySuggester/modules/ext.PropertySuggester.EntitySelector.js
+++
b/extensions/PropertySuggester/modules/ext.PropertySuggester.EntitySelector.js
@@ -5,7 +5,7 @@
* @see ui.suggester._request
*/
-( function( $, util, mw ) {
+( function( $ ) {
'use strict';
var Item = $.wikibase.entityselector.Item;
@@ -165,4 +165,4 @@
Item: Item
} );
-}( jQuery, util, mediaWiki ) );
+}( jQuery ) );
diff --git
a/extensions/PropertySuggester/src/PropertySuggester/SuggesterParamsParser.php
b/extensions/PropertySuggester/src/PropertySuggester/SuggesterParamsParser.php
index b1522e9..26729af 100644
---
a/extensions/PropertySuggester/src/PropertySuggester/SuggesterParamsParser.php
+++
b/extensions/PropertySuggester/src/PropertySuggester/SuggesterParamsParser.php
@@ -22,7 +22,7 @@
private $defaultMinProbability;
/**
- * @param int $defaultSuggestionSearchLimit
+ * @param int $defaultSuggestionLimit
* @param float $defaultMinProbability
*/
public function __construct( $defaultSuggestionLimit,
$defaultMinProbability ) {
diff --git
a/extensions/PropertySuggester/src/PropertySuggester/Suggesters/SimpleSuggester.php
b/extensions/PropertySuggester/src/PropertySuggester/Suggesters/SimpleSuggester.php
index 56f00f8..7dea6d3 100644
---
a/extensions/PropertySuggester/src/PropertySuggester/Suggesters/SimpleSuggester.php
+++
b/extensions/PropertySuggester/src/PropertySuggester/Suggesters/SimpleSuggester.php
@@ -4,8 +4,11 @@
use LoadBalancer;
use InvalidArgumentException;
+use LogicException;
+use Wikibase\DataModel\Entity\EntityIdValue;
use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\PropertyId;
+use Wikibase\DataModel\Snak\PropertyValueSnak;
use ResultWrapper;
/**
@@ -22,7 +25,7 @@
private $deprecatedPropertyIds = array();
/**
- * @var int[]
+ * @var array Numeric property ids as keys, values are meaningless.
*/
private $classifyingPropertyIds = array();
@@ -128,7 +131,10 @@
* @return Suggestion[]
*/
public function suggestByPropertyIds( array $propertyIds, $limit,
$minProbability, $context ) {
- $numericIds = array_map( array( $this,
'getNumericIdFromPropertyId' ), $propertyIds );
+ $numericIds = array_map( function( PropertyId $propertyId ) {
+ return $propertyId->getNumericId();
+ }, $propertyIds );
+
return $this->getSuggestions( $numericIds, array(), $limit,
$minProbability, $context );
}
@@ -139,32 +145,41 @@
* @param int $limit
* @param float $minProbability
* @param string $context
+ * @throws LogicException
* @return Suggestion[]
*/
public function suggestByItem( Item $item, $limit, $minProbability,
$context ) {
- $statements = $item->getStatements()->toArray();
$ids = array();
$idTuples = array();
- foreach ( $statements as $statement ) {
- $numericPropertyId = $this->getNumericIdFromPropertyId(
$statement->getMainSnak()->getPropertyId() );
+
+ foreach ( $item->getStatements()->toArray() as $statement ) {
+ $mainSnak = $statement->getMainSnak();
+ $numericPropertyId =
$mainSnak->getPropertyId()->getNumericId();
$ids[] = $numericPropertyId;
+
if ( !isset(
$this->classifyingPropertyIds[$numericPropertyId] ) ) {
$idTuples[] = $this->buildTupleCondition(
$numericPropertyId, '0' );
- }
- else {
- if ( $statement->getMainSnak()->getType() ===
"value" ) {
- $dataValue =
$statement->getMainSnak()->getDataValue();
- $numericEntityId = ( int )substr(
$dataValue->getEntityId()->getSerialization(), 1 );
- $idTuples[] =
$this->buildTupleCondition( $numericPropertyId, $numericEntityId );
+ } elseif ( $mainSnak instanceof PropertyValueSnak ) {
+ $dataValue = $mainSnak->getDataValue();
+
+ if ( !( $dataValue instanceof EntityIdValue ) )
{
+ throw new LogicException(
+ "Property $numericPropertyId in
wgPropertySuggesterClassifyingPropertyIds"
+ . ' does not have value type
wikibase-entityid'
+ );
}
+
+ $numericEntityId =
$dataValue->getEntityId()->getNumericId();
+ $idTuples[] = $this->buildTupleCondition(
$numericPropertyId, $numericEntityId );
}
}
+
return $this->getSuggestions( $ids, $idTuples, $limit,
$minProbability, $context );
}
/**
- * @param int $a
- * @param int $b
+ * @param int $pid
+ * @param int $qid
* @return string
*/
private function buildTupleCondition( $pid, $qid ){
@@ -186,10 +201,6 @@
$resultArray[] = $suggestion;
}
return $resultArray;
- }
-
- private function getNumericIdFromPropertyId( PropertyId $propertyId ) {
- return $propertyId->getNumericId();
}
}
diff --git
a/extensions/PropertySuggester/src/PropertySuggester/SuggestionGenerator.php
b/extensions/PropertySuggester/src/PropertySuggester/SuggestionGenerator.php
index 1ae8ca3..595f19c 100644
--- a/extensions/PropertySuggester/src/PropertySuggester/SuggestionGenerator.php
+++ b/extensions/PropertySuggester/src/PropertySuggester/SuggestionGenerator.php
@@ -4,6 +4,7 @@
use PropertySuggester\Suggesters\SuggesterEngine;
use PropertySuggester\Suggesters\Suggestion;
+use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\ItemId;
use Wikibase\DataModel\Entity\Property;
use Wikibase\DataModel\Entity\PropertyId;
@@ -46,22 +47,23 @@
}
/**
- * @param string $itemIdString - An item id
+ * @param string $itemIdString
* @param int $limit
* @param float $minProbability
* @param string $context
* @throws \InvalidArgumentException
* @return array
*/
-
public function generateSuggestionsByItem( $itemIdString, $limit,
$minProbability, $context ) {
- $id = new ItemId( $itemIdString );
- $item = $this->entityLookup->getEntity( $id );
- if( $item == null ){
- throw new InvalidArgumentException( 'Item ' . $id . '
could not be found' );
+ $itemId = new ItemId( $itemIdString );
+ /** @var Item $item */
+ $item = $this->entityLookup->getEntity( $itemId );
+
+ if ( $item === null ) {
+ throw new InvalidArgumentException( 'Item ' .
$itemIdString . ' could not be found' );
}
- $suggestions = $this->suggester->suggestByItem( $item, $limit,
$minProbability, $context );
- return $suggestions;
+
+ return $this->suggester->suggestByItem( $item, $limit,
$minProbability, $context );
}
/**
diff --git
a/extensions/PropertySuggester/src/PropertySuggester/UpdateTable/Importer/BasicImporter.php
b/extensions/PropertySuggester/src/PropertySuggester/UpdateTable/Importer/BasicImporter.php
index 82f3f8e..1678ea9 100644
---
a/extensions/PropertySuggester/src/PropertySuggester/UpdateTable/Importer/BasicImporter.php
+++
b/extensions/PropertySuggester/src/PropertySuggester/UpdateTable/Importer/BasicImporter.php
@@ -56,7 +56,7 @@
if ( $data == false || ++$i % $batchSize == 0 ) {
$db->commit( __METHOD__, 'flush' );
- wfWaitForSlaves();
+ wfGetLBFactory()->waitForReplication();
$db->insert(
$importContext->getTargetTableName(), $accumulator );
if ( ! $importContext->isQuiet() ) {
print "$i rows inserted\n";
diff --git
a/extensions/PropertySuggester/tests/phpunit/PropertySuggester/GetSuggestionsTest.php
b/extensions/PropertySuggester/tests/phpunit/PropertySuggester/GetSuggestionsTest.php
index 908d566..2058912 100644
---
a/extensions/PropertySuggester/tests/phpunit/PropertySuggester/GetSuggestionsTest.php
+++
b/extensions/PropertySuggester/tests/phpunit/PropertySuggester/GetSuggestionsTest.php
@@ -2,6 +2,8 @@
namespace PropertySuggester;
+use ApiMain;
+use UsageException;
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\Property;
use Wikibase\Repo\WikibaseRepo;
@@ -31,12 +33,12 @@
/** @var GetSuggestions */
public $getSuggestions;
- public function setup() {
- parent::setup();
+ protected function setUp() {
+ parent::setUp();
$this->tablesUsed[] = 'wbs_propertypairs';
- $apiMain = $this->getMockBuilder( 'ApiMain' )
+ $apiMain = $this->getMockBuilder( ApiMain::class )
->disableOriginalConstructor()
->getMockForAbstractClass();
$this->getSuggestions = new GetSuggestions( $apiMain,
'wbgetsuggestion' );
@@ -128,8 +130,8 @@
'context' => 'delete all the things!'
);
- $this->setExpectedException( 'UsageException' );
- $res = $this->doApiRequest( $params );
+ $this->setExpectedException( UsageException::class );
+ $this->doApiRequest( $params );
}
public function testGetAllowedParams() {
diff --git
a/extensions/PropertySuggester/tests/phpunit/PropertySuggester/PropertySuggesterHooksTest.php
b/extensions/PropertySuggester/tests/phpunit/PropertySuggester/PropertySuggesterHooksTest.php
new file mode 100644
index 0000000..9477257
--- /dev/null
+++
b/extensions/PropertySuggester/tests/phpunit/PropertySuggester/PropertySuggesterHooksTest.php
@@ -0,0 +1,68 @@
+<?php
+
+namespace PropertySuggester;
+
+use MediaWikiTestCase;
+use PropertySuggesterHooks;
+use RequestContext;
+use Title;
+use Wikibase\DataModel\Entity\EntityId;
+use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\DataModel\Entity\PropertyId;
+use Wikibase\Repo\WikibaseRepo;
+
+/**
+ * @covers PropertySuggesterHooks
+ *
+ * @group PropertySuggester
+ * @group Wikibase
+ */
+class PropertySuggesterHooksTest extends MediaWikiTestCase {
+
+ public function testOnBeforePageDisplay_resourceLoaderModuleAdded() {
+ $title = $this->getTitleForId( new ItemId( 'Q1' ) );
+
+ $context = $this->getContext( $title );
+ $output = $context->getOutput();
+ $skin = $context->getSkin();
+
+ PropertySuggesterHooks::onBeforePageDisplay( $output, $skin );
+
+ $this->assertContains( 'ext.PropertySuggester.EntitySelector',
$output->getModules() );
+ }
+
+ /**
+ * @dataProvider
onBeforePageDisplay_resourceLoaderModuleNotAddedProvider
+ */
+ public function testOnBeforePageDisplay_resourceLoaderModuleNotAdded(
Title $title ) {
+ $context = $this->getContext( $title );
+ $output = $context->getOutput();
+ $skin = $context->getSkin();
+
+ PropertySuggesterHooks::onBeforePageDisplay( $output, $skin );
+
+ $this->assertNotContains(
'ext.PropertySuggester.EntitySelector', $output->getModules() );
+ }
+
+ public function
onBeforePageDisplay_resourceLoaderModuleNotAddedProvider() {
+ $title = $this->getTitleForId( new PropertyId( 'P1' ) );
+
+ return [
+ [ $this->getTitleForId( new PropertyId( 'P1' ) ) ],
+ [ Title::makeTitle( NS_HELP, 'Contents' ) ]
+ ];
+ }
+
+ private function getTitleForId( EntityId $entityId ) {
+ $entityContentFactory =
WikibaseRepo::getDefaultInstance()->getEntityContentFactory();
+ return $entityContentFactory->getTitleForId( $entityId );
+ }
+
+ private function getContext( Title $title ) {
+ $context = RequestContext::getMain();
+ $context->setTitle( $title );
+
+ return $context;
+ }
+
+}
diff --git
a/extensions/PropertySuggester/tests/phpunit/PropertySuggester/ResultBuilderTest.php
b/extensions/PropertySuggester/tests/phpunit/PropertySuggester/ResultBuilderTest.php
index 6beb1dd..e7f8a88 100644
---
a/extensions/PropertySuggester/tests/phpunit/PropertySuggester/ResultBuilderTest.php
+++
b/extensions/PropertySuggester/tests/phpunit/PropertySuggester/ResultBuilderTest.php
@@ -4,6 +4,8 @@
use ApiResult;
use MediaWikiTestCase;
+use Wikibase\Lib\Store\EntityTitleLookup;
+use Wikibase\TermIndex;
/**
* @covers PropertySuggester\ResultBuilder
@@ -22,8 +24,8 @@
public function setUp() {
parent::setUp();
- $entityTitleLookup = $this->getMock(
'Wikibase\Lib\Store\EntityTitleLookup' );
- $termIndex = $this->getMock( 'Wikibase\TermIndex' );
+ $entityTitleLookup = $this->getMock( EntityTitleLookup::class );
+ $termIndex = $this->getMock( TermIndex::class );
$result = new ApiResult( false ); // $maxSize, no limit
$this->resultBuilder = new ResultBuilder( $result, $termIndex,
$entityTitleLookup, '' );
diff --git
a/extensions/PropertySuggester/tests/phpunit/PropertySuggester/SuggestionGeneratorTest.php
b/extensions/PropertySuggester/tests/phpunit/PropertySuggester/SuggestionGeneratorTest.php
index 482b830..31ff3ae 100644
---
a/extensions/PropertySuggester/tests/phpunit/PropertySuggester/SuggestionGeneratorTest.php
+++
b/extensions/PropertySuggester/tests/phpunit/PropertySuggester/SuggestionGeneratorTest.php
@@ -35,7 +35,7 @@
protected $suggester;
/**
- * @var EntityLookup
+ * @var EntityLookup|PHPUnit_Framework_MockObject_MockObject
*/
protected $lookup;
@@ -47,9 +47,9 @@
public function setUp() {
parent::setUp();
- $this->lookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\EntityLookup' );
- $this->termIndex = $this->getMock( 'Wikibase\TermIndex' );
- $this->suggester = $this->getMock(
'PropertySuggester\Suggesters\SuggesterEngine' );
+ $this->lookup = $this->getMock( EntityLookup::class );
+ $this->termIndex = $this->getMock( TermIndex::class );
+ $this->suggester = $this->getMock( SuggesterEngine::class );
$this->suggestionGenerator = new SuggestionGenerator(
$this->lookup,
@@ -132,7 +132,6 @@
'item'
);
$this->assertEquals( $result1, array( 'foo' ) );
-
}
public function testGenerateSuggestionsWithItem() {
diff --git a/extensions/Wikibase/client/i18n/sat.json
b/extensions/Wikibase/client/i18n/sat.json
new file mode 100644
index 0000000..79f55b7
--- /dev/null
+++ b/extensions/Wikibase/client/i18n/sat.json
@@ -0,0 +1,11 @@
+{
+ "@metadata": {
+ "authors": [
+ "Albinus"
+ ]
+ },
+ "wikibase-rc-hide-wikidata-hide": "Danaṅ",
+ "wikibase-rc-hide-wikidata-show": "Uduḱme",
+ "wikibase-rc-wikibase-edit-letter": "Ḍ",
+ "wikibase-rc-wikibase-edit-title": "Toṅge"
+}
diff --git a/extensions/Wikibase/client/includes/WikibaseClient.php
b/extensions/Wikibase/client/includes/WikibaseClient.php
index 2e2cbf5..4037717 100644
--- a/extensions/Wikibase/client/includes/WikibaseClient.php
+++ b/extensions/Wikibase/client/includes/WikibaseClient.php
@@ -3,12 +3,9 @@
namespace Wikibase\Client;
use DataTypes\DataTypeFactory;
-use DataValues\BooleanValue;
use DataValues\Deserializers\DataValueDeserializer;
use DataValues\Geo\Values\GlobeCoordinateValue;
use DataValues\MonolingualTextValue;
-use DataValues\MultilingualTextValue;
-use DataValues\NumberValue;
use DataValues\QuantityValue;
use DataValues\Serializers\DataValueSerializer;
use DataValues\StringValue;
@@ -950,18 +947,15 @@
*/
private function getDataValueDeserializer() {
return new DataValueDeserializer( array(
- 'boolean' => BooleanValue::class,
- 'number' => NumberValue::class,
'string' => StringValue::class,
'unknown' => UnknownValue::class,
'globecoordinate' => GlobeCoordinateValue::class,
'monolingualtext' => MonolingualTextValue::class,
- 'multilingualtext' => MultilingualTextValue::class,
'quantity' => QuantityValue::class,
'time' => TimeValue::class,
'wikibase-entityid' => function( $value ) {
return isset( $value['id'] )
- ? $this->getEntityIdParser()->parse(
$value['id'] )
+ ? new EntityIdValue(
$this->getEntityIdParser()->parse( $value['id'] ) )
: EntityIdValue::newFromArray( $value );
},
) );
diff --git a/extensions/Wikibase/lib/i18n/fi.json
b/extensions/Wikibase/lib/i18n/fi.json
index 1b4a8fb..a1ac9d3 100644
--- a/extensions/Wikibase/lib/i18n/fi.json
+++ b/extensions/Wikibase/lib/i18n/fi.json
@@ -26,7 +26,8 @@
"wikibase-error-autocomplete-connection": "Kysely sivuston rajapinnalta
epäonnistui. Yritä myöhemmin uudelleen.",
"wikibase-error-autocomplete-response": "Palvelin vastasi: $1",
"wikibase-error-ui-no-external-page": "Määritettyä artikkelia ei
löytynyt vastaavalta sivustolta.",
- "wikibase-error-ui-edit-conflict": "Tapahtui muokkausristiriita.
Päivitä sivu ja tallenna uudelleen.",
+ "wikibase-error-ui-edit-conflict": "Tapahtui muokkausristiriita.
Tallenna muutoksesi paikallisesti, lataa uudelleen tämä sivu ja tallenna
muokkaukset uudelleen.",
+ "wikibase-language-fallback-transliteration-hint": "$1
(translitteroitu)",
"wikibase-quantitydetails-amount": "Summa",
"wikibase-quantitydetails-upperbound": "Yläraja",
"wikibase-quantitydetails-lowerbound": "Alaraja",
@@ -63,6 +64,7 @@
"datatypes-type-wikibase-item": "Kohde",
"datatypes-type-wikibase-property": "Ominaisuus",
"datatypes-type-commonsMedia": "Commonsin mediatiedosto",
+ "datatypes-type-external-id": "Ulkoinen tunniste",
"version-wikibase": "Wikibase",
"wikibase-time-precision-millennium": "$1. vuosituhat",
"wikibase-time-precision-century": "$1. vuosisata",
diff --git
a/extensions/Wikibase/lib/includes/Interactors/TermIndexSearchInteractor.php
b/extensions/Wikibase/lib/includes/Interactors/TermIndexSearchInteractor.php
index ff6d045..962152b 100644
--- a/extensions/Wikibase/lib/includes/Interactors/TermIndexSearchInteractor.php
+++ b/extensions/Wikibase/lib/includes/Interactors/TermIndexSearchInteractor.php
@@ -165,7 +165,7 @@
),
null,
$entityType,
- $this->getTermIndexOptions( $this->termSearchOptions )
+ $this->getTermIndexOptions()
);
$limit = $this->termSearchOptions->getLimit();
diff --git a/extensions/Wikibase/lib/includes/TermIndexEntry.php
b/extensions/Wikibase/lib/includes/TermIndexEntry.php
index 8724d02..1c9677d 100644
--- a/extensions/Wikibase/lib/includes/TermIndexEntry.php
+++ b/extensions/Wikibase/lib/includes/TermIndexEntry.php
@@ -211,11 +211,9 @@
}
/**
- * @since 0.5
- *
* @return int|null
*/
- public function getNumericId() {
+ private function getNumericId() {
return array_key_exists( 'entityId', $this->fields ) ?
$this->fields['entityId'] : null;
}
@@ -230,7 +228,8 @@
$numericId = $this->getNumericId();
if ( $entityType !== null && $numericId !== null ) {
- // TODO: This does not belong to a value object.
Provide entityId object to constructor, so service will be obsolete.
+ // TODO: This does not belong to a value object.
Introduce a TermIndexEntryFactory and
+ // encapsulate all knowledge about numeric IDs there.
if ( defined( 'WB_VERSION' ) ) {
$entityIdComposer =
WikibaseRepo::getDefaultInstance()->getEntityIdComposer();
} elseif ( defined( 'WBC_VERSION' ) ) {
diff --git a/extensions/Wikibase/lib/tests/phpunit/Store/TermIndexTest.php
b/extensions/Wikibase/lib/tests/phpunit/Store/TermIndexTest.php
index 5fd1833..dcad9b3 100644
--- a/extensions/Wikibase/lib/tests/phpunit/Store/TermIndexTest.php
+++ b/extensions/Wikibase/lib/tests/phpunit/Store/TermIndexTest.php
@@ -71,7 +71,7 @@
}
public function provideGetMatchingTerms() {
- list( $item0, $item1, $item2 ) = $this->getTestitems();
+ list( $item0, $item1, $item2 ) = $this->getTestItems();
return array(
'cross-language match' => array(
@@ -249,7 +249,7 @@
* @see provideGetMatchingTerms
*/
public function provideGetTopMatchingTerms() {
- list( $item0, $item1, $item2 ) = $this->getTestitems();
+ list( $item0, $item1, $item2 ) = $this->getTestItems();
return array(
'EXACT MATCH not prefix, case sensitive' => array(
diff --git a/extensions/Wikibase/repo/i18n/sat.json
b/extensions/Wikibase/repo/i18n/sat.json
new file mode 100644
index 0000000..73fcecf
--- /dev/null
+++ b/extensions/Wikibase/repo/i18n/sat.json
@@ -0,0 +1,9 @@
+{
+ "@metadata": {
+ "authors": [
+ "Albinus"
+ ]
+ },
+ "wikibase-edit": "Toṅge",
+ "wikibase-add": "Joṛao"
+}
diff --git a/extensions/Wikibase/repo/includes/Api/SetReference.php
b/extensions/Wikibase/repo/includes/Api/SetReference.php
index 0d45751..f3239ef 100644
--- a/extensions/Wikibase/repo/includes/Api/SetReference.php
+++ b/extensions/Wikibase/repo/includes/Api/SetReference.php
@@ -79,10 +79,7 @@
$this->statementChangeOpFactory =
$changeOpFactoryProvider->getStatementChangeOpFactory();
$this->errorReporter = $apiHelperFactory->getErrorReporter(
$this );
- $this->deserializerFactory = new DeserializerFactory(
- $wikibaseRepo->getDataValueDeserializer(),
- $wikibaseRepo->getEntityIdParser()
- );
+ $this->deserializerFactory =
$wikibaseRepo->getExternalFormatDeserializerFactory();
$this->modificationHelper = new StatementModificationHelper(
$wikibaseRepo->getSnakFactory(),
diff --git a/extensions/Wikibase/repo/includes/WikibaseRepo.php
b/extensions/Wikibase/repo/includes/WikibaseRepo.php
index 7906d69..5556c68 100644
--- a/extensions/Wikibase/repo/includes/WikibaseRepo.php
+++ b/extensions/Wikibase/repo/includes/WikibaseRepo.php
@@ -3,13 +3,10 @@
namespace Wikibase\Repo;
use DataTypes\DataTypeFactory;
-use DataValues\BooleanValue;
use DataValues\DataValueFactory;
use DataValues\Deserializers\DataValueDeserializer;
use DataValues\Geo\Values\GlobeCoordinateValue;
use DataValues\MonolingualTextValue;
-use DataValues\MultilingualTextValue;
-use DataValues\NumberValue;
use DataValues\QuantityValue;
use DataValues\Serializers\DataValueSerializer;
use DataValues\StringValue;
@@ -1374,7 +1371,7 @@
/**
* @return Deserializer
*/
- public function getDataValueDeserializer() {
+ private function getDataValueDeserializer() {
return new DataValueDeserializer( array(
'string' => StringValue::class,
'unknown' => UnknownValue::class,
@@ -1383,12 +1380,9 @@
'quantity' => QuantityValue::class,
'time' => TimeValue::class,
'wikibase-entityid' => function( $value ) {
- if ( isset( $value['id'] ) ) {
- $id =
$this->getEntityIdParser()->parse( $value['id'] );
- return new EntityIdValue( $id );
- } else {
- return EntityIdValue::newFromArray(
$value );
- }
+ return isset( $value['id'] )
+ ? new EntityIdValue(
$this->getEntityIdParser()->parse( $value['id'] ) )
+ : EntityIdValue::newFromArray( $value );
},
) );
}
diff --git
a/extensions/Wikibase/repo/tests/phpunit/includes/Api/SetReferenceTest.php
b/extensions/Wikibase/repo/tests/phpunit/includes/Api/SetReferenceTest.php
index e9ad0a2..6ccad3f 100644
--- a/extensions/Wikibase/repo/tests/phpunit/includes/Api/SetReferenceTest.php
+++ b/extensions/Wikibase/repo/tests/phpunit/includes/Api/SetReferenceTest.php
@@ -78,10 +78,7 @@
new DataValueSerializer(),
SerializerFactory::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH
);
- $this->deserializerFactory = new DeserializerFactory(
- $wikibaseRepo->getDataValueDeserializer(),
- $wikibaseRepo->getEntityIdParser()
- );
+ $this->deserializerFactory =
$wikibaseRepo->getExternalFormatDeserializerFactory();
}
/**
diff --git
a/extensions/Wikibase/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
b/extensions/Wikibase/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
index f129dc9..2edb462 100644
---
a/extensions/Wikibase/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
+++
b/extensions/Wikibase/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
@@ -57,10 +57,7 @@
$serializerOptions =
SerializerFactory::OPTION_SERIALIZE_MAIN_SNAKS_WITHOUT_HASH +
SerializerFactory::OPTION_SERIALIZE_REFERENCE_SNAKS_WITHOUT_HASH;
$this->serializerFactory = new SerializerFactory( new
DataValueSerializer(), $serializerOptions );
- $this->deserializerFactory = new DeserializerFactory(
- $wikibaseRepo->getDataValueDeserializer(),
- $wikibaseRepo->getEntityIdParser()
- );
+ $this->deserializerFactory =
$wikibaseRepo->getExternalFormatDeserializerFactory();
}
/**
diff --git
a/extensions/Wikibase/repo/tests/phpunit/includes/WikibaseRepoTest.php
b/extensions/Wikibase/repo/tests/phpunit/includes/WikibaseRepoTest.php
index 462f2ba..41b789f 100644
--- a/extensions/Wikibase/repo/tests/phpunit/includes/WikibaseRepoTest.php
+++ b/extensions/Wikibase/repo/tests/phpunit/includes/WikibaseRepoTest.php
@@ -3,7 +3,6 @@
namespace Wikibase\Tests\Repo;
use DataTypes\DataTypeFactory;
-use DataValues\BooleanValue;
use DataValues\DataValue;
use DataValues\DataValueFactory;
use DataValues\Geo\Values\GlobeCoordinateValue;
@@ -24,7 +23,6 @@
use Wikibase\DataModel\Entity\EntityIdParser;
use Wikibase\DataModel\Entity\EntityIdValue;
use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\DataModel\Entity\PropertyId;
use Wikibase\DataModel\Services\Lookup\EntityLookup;
use Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup;
use Wikibase\DataModel\Services\Lookup\TermLookup;
@@ -334,11 +332,6 @@
$this->assertInstanceOf( Serializer::class, $serializer );
}
- public function testGetDataValueDeserializer() {
- $service = $this->getWikibaseRepo()->getDataValueDeserializer();
- $this->assertInstanceOf( Deserializer::class, $service );
- }
-
public function testGetEntityChangeFactory() {
$factory = $this->getWikibaseRepo()->getEntityChangeFactory();
$this->assertInstanceOf( EntityChangeFactory::class, $factory );
@@ -489,80 +482,72 @@
$this->assertInstanceOf(
CachingCommonsMediaFileNameLookup::class, $lookup );
}
- public function providetDataValueDeserializer_valueTypes() {
- $latLong = new LatLongValue( 23.7, 42.1 );
-
- $time = new TimeValue(
- '+1980-10-07T17:33:22Z',
- 0,
- 0,
- 1,
- TimeValue::PRECISION_DAY,
- TimeValue::CALENDAR_GREGORIAN
- );
-
- $quantity = QuantityValue::newFromNumber( 2.3, 'm', 2.5, 2.1 );
-
- $itemId = new ItemId( 'Q13' );
-
+ public function dataValueProvider() {
return [
'string' => [ new StringValue( 'Test' ) ],
'unknown' => [ new UnknownValue( [ 'foo' => 'bar' ] ) ],
- 'globecoordinate' => [ new GlobeCoordinateValue(
$latLong, 2.3 ) ],
+ 'globecoordinate' => [ new GlobeCoordinateValue( new
LatLongValue( 2, 3 ), 1 ) ],
'monolingualtext' => [ new MonolingualTextValue( 'als',
'Test' ) ],
- 'quantity' => [ $quantity ],
- 'time' => [ $time ],
- 'wikibase-entityid old style' => [
- new EntityIdValue( $itemId ),
- [
- 'type' => 'wikibase-entityid',
- 'value' => [ 'entity-type' => 'item',
'numeric-id' => 13 ]
- ]
- ],
- 'wikibase-entityid' => [
- new EntityIdValue( $itemId ),
- [
- 'type' => 'wikibase-entityid',
- 'value' => [ 'id' => 'Q13', ]
- ]
- ],
+ 'quantity' => [ QuantityValue::newFromNumber( 2 ) ],
+ 'time' => [ new TimeValue(
+ '+1980-10-07T17:33:22Z',
+ 0,
+ 0,
+ 1,
+ TimeValue::PRECISION_DAY,
+ TimeValue::CALENDAR_GREGORIAN
+ ) ],
+ 'wikibase-entityid' => [ new EntityIdValue( new ItemId(
'Q13' ) ) ],
];
}
/**
- * @dataProvider providetDataValueDeserializer_valueTypes
- *
- * @param $data
- * @param DataValue $expected
+ * @dataProvider dataValueProvider
*/
- public function testGetDataValueDeserializer_valueTypes( DataValue
$expected, $data = null ) {
- if ( $data === null ) {
- // test round trip
- $data = $expected->toArray();
- }
+ public function testDataValueSerializationDeserializationRoundtrip(
DataValue $expected ) {
+ $service = $this->getWikibaseRepo()->getDataValueFactory();
+ $deserialized = $service->newFromArray( $expected->toArray() );
- $entityTypeDefs = [
- 'item' => array(
+ $this->assertEquals( $expected, $deserialized );
+ }
+
+ public function entityIdValueSerializationProvider() {
+ return [
+ 'legacy' => [ [
+ 'entity-type' => 'item',
+ 'numeric-id' => 13,
+ ] ],
+ 'intermediate' => [ [
+ 'entity-type' => 'item',
+ 'numeric-id' => 13,
+ 'id' => 'Q13',
+ ] ],
+ 'new' => [ [
+ 'id' => 'Q13',
+ ] ],
+ ];
+ }
+
+ /**
+ * @dataProvider entityIdValueSerializationProvider
+ */
+ public function testEntityIdValueDeserialization( array $serialization
) {
+ $entityTypeDefinitions = [
+ 'item' => [
'entity-id-pattern' => ItemId::PATTERN,
'entity-id-builder' => function( $serialization
) {
return new ItemId( $serialization );
},
- ),
- 'property' => array(
- 'entity-id-pattern' => PropertyId::PATTERN,
- 'entity-id-builder' => function( $serialization
) {
- return new PropertyId( $serialization );
- },
- )
+ ],
];
+ $service = $this->getWikibaseRepo( $entityTypeDefinitions
)->getDataValueFactory();
+ $deserialized = $service->newFromArray( [
+ 'type' => 'wikibase-entityid',
+ 'value' => $serialization,
+ ] );
- $service = $this->getWikibaseRepo( $entityTypeDefs
)->getDataValueDeserializer();
- $value = $service->deserialize( $data );
-
- $this->assertTrue(
- $expected->equals( $value ),
- $expected->getType() . "\n" . var_export( $data, true )
- );
+ $expected = new EntityIdValue( new ItemId( 'Q13' ) );
+ $this->assertEquals( $expected, $deserialized );
}
}
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 79f8666..74f3392 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -1345,12 +1345,12 @@
"source": {
"type": "git",
"url":
"https://github.com/wikimedia/mediawiki-extensions-Wikibase.git",
- "reference": "ec1396d91432627aedd33cef4cf020045df36322"
+ "reference": "ca948d8eb949433d105fbf51448b902c89cb652e"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/ec1396d91432627aedd33cef4cf020045df36322",
- "reference": "ec1396d91432627aedd33cef4cf020045df36322",
+ "url":
"https://api.github.com/repos/wikimedia/mediawiki-extensions-Wikibase/zipball/ca948d8eb949433d105fbf51448b902c89cb652e",
+ "reference": "ca948d8eb949433d105fbf51448b902c89cb652e",
"shasum": ""
},
"require": {
@@ -1383,7 +1383,7 @@
"jakub-onderka/php-parallel-lint": "0.9.2",
"mediawiki/mediawiki-codesniffer": "0.4.0|0.5.0"
},
- "time": "2016-06-18 20:51:04",
+ "time": "2016-06-20 20:24:18",
"type": "mediawiki-extension",
"installation-source": "dist",
"autoload": {
@@ -1692,17 +1692,17 @@
},
{
"name": "propertysuggester/property-suggester",
- "version": "3.0.1",
- "version_normalized": "3.0.1.0",
+ "version": "3.0.2",
+ "version_normalized": "3.0.2.0",
"source": {
"type": "git",
"url": "https://github.com/Wikidata-lib/PropertySuggester.git",
- "reference": "c267839dbf9e1369053999ebee996bff7c87f3ee"
+ "reference": "fdb33b593b96a890145c6ae008333768fb4f0d3c"
},
"dist": {
"type": "zip",
- "url":
"https://api.github.com/repos/Wikidata-lib/PropertySuggester/zipball/c267839dbf9e1369053999ebee996bff7c87f3ee",
- "reference": "c267839dbf9e1369053999ebee996bff7c87f3ee",
+ "url":
"https://api.github.com/repos/Wikidata-lib/PropertySuggester/zipball/fdb33b593b96a890145c6ae008333768fb4f0d3c",
+ "reference": "fdb33b593b96a890145c6ae008333768fb4f0d3c",
"shasum": ""
},
"require": {
@@ -1714,7 +1714,7 @@
"phpunit/phpunit": "3.7.*",
"satooshi/php-coveralls": "dev-master"
},
- "time": "2016-03-16 11:16:15",
+ "time": "2016-06-20 17:44:28",
"type": "mediawiki-extension",
"installation-source": "dist",
"autoload": {
--
To view, visit https://gerrit.wikimedia.org/r/295329
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I34484f67c8e344d75347a0a92c486092f4e6b955
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikidata
Gerrit-Branch: master
Gerrit-Owner: WikidataBuilder <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits