Modul:Wikidata utilities: Unterschied zwischen den Versionen

Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 288: Zeile 288:
end
end


function fw.typeSearch( p31, list, limit )
function fw.typeSearch( p31, list, limit, catArray )
-- p31: array of Wikidata values
-- p31: array of Wikidata values
-- list: array of q id - types relations
-- list: array of q id - types relations
-- limit: maximum levels to analyse
-- limit: maximum levels to analyse
if (not p31) or (#p31 == 0) then return 'error' end
if (not p31) or (#p31 == 0) then return 'error', catArray end
local aType, i, id, j
local aType, i, id, j


Zeile 300: Zeile 300:


if aType then
if aType then
return aType
return aType, catArray
else
else
j = 0
j = 0
repeat
repeat
id = fw.getId( id, 'P279' )
id, catArray = fw.getId( id, 'P279', catArray )
if id ~= '' then
if id ~= '' then
aType = list[id]
aType = list[id]
if aType then return aType end
if aType then return aType, catArray end
end
end
j = j + 1
j = j + 1
Zeile 313: Zeile 313:
end
end
end
end
return 'error'
return 'error', catArray
end
end