Модуль:Wikidata/Places: відмінності між версіями
[неперевірена версія] | [неперевірена версія] |
Вилучено вміст Додано вміст
Rausch (обговорення | внесок) Немає опису редагування |
Rausch (обговорення | внесок) Немає опису редагування |
||
Рядок 140:
results = getParentsInBoundariesSnakImpl( context, entityId, boundaries, {'P17'} ) -- country
end
for r, result in pairs( results ) do
if result.snaktype ~= 'value' then
return nil;
end
local resultId = result.datavalue.value.id;
if resultId == entityId then
return nil;
end
end
return results;
end
local function getParentsInBoundariesSnak2( context, entityId, boundaries )
if not entityId then error('entityId must be specified'); end
if type(entityId) ~= 'string' then error('entityId must be string'); end
if not boundaries then error('boundaries must be specified'); end
if type(boundaries) ~= 'table' then error('boundaries must be table'); end
local results = getParentsInBoundariesSnakImpl( context, entityId, boundaries, {'P17'} ) -- country
for r, result in pairs( results ) do
Рядок 450 ⟶ 470:
while parentId ~= nil do
-- get parent
local newParentSnaks =
if not newParentSnaks or #newParentSnaks == 0 then
parentId = nil;
|