Модул беседа:Wikidata

Съдържанието на страницата не се поддържа на други езици.
от Уикипедия, свободната енциклопедия

Пример: Гифу (град) и Шаблон:Селище инфо. Населението се взима с {{#invoke:Wikidata|claim|P1082|qualifier=P585}}, но модулът не взима под внимание, че в Уикиданни има две различни населения – едно с дата и едно без дата. Идеята би била шаблонът да взима най-актуалното население. Който чете тази беседа вероятно знае как най-бързо да го направи :-). --Лорд Бъмбъри (беседа) 19:03, 21 юли 2016 (UTC)[отговор]

Critical performance improvement[редактиране на кода]

There is the following inefficiency in Wikidata module:

		-- otherwise, iterate over all properties, fetch their labels and compare this to the given property name
		for k, v in pairs(entity.claims) do
			if mw.wikibase.label(k) == property then return v end
		end

This can also be expressed with:

		property = mw.wikibase.resolvePropertyId(property)
		if not property then return end

		return entity.claims[property]

The advantaged of the second version is that it doesn't need to iterate over all Statements (which is badly discouraged), thus the pages in question don't "use" all Statements. See also T178114. Please fix this problem. Thank you! Amir Sarabadani (WMDE) (беседа) 20:24, 8 март 2018 (UTC)[отговор]

Thank you. [1] --Спас Колев (беседа) 14:46, 12 март 2018 (UTC)[отговор]