Modul:Wikidata utilities: Unterschied zwischen den Versionen
K
etwas umgestellt
(rückgängig; mw.wikibase.getReferencedEntityId ist unbrauchbar) |
K (etwas umgestellt) |
||
Zeile 288: | Zeile 288: | ||
local aType, i, id, j | local aType, i, id, j | ||
for i = 1, #p31, 1 do -- check p31 ids first | for i = 1, #p31, 1 do -- check p31 ids first, maybe step 2 is not nessary | ||
aType = list[ p31[ i ].id ] | aType = list[ p31[ i ].id ] | ||
if aType then | if aType then | ||
Zeile 294: | Zeile 294: | ||
end | end | ||
end | end | ||
for i = 1, #p31, 1 do -- analyse P279 | |||
for i = 1, #p31, 1 do -- step 2: analyse P279 chains of first ids | |||
id = p31[ i ].id -- start id | |||
j = 0 | j = 0 | ||
repeat | repeat | ||
id, catArray = fw.getId( | id, catArray = fw.getId( id, 'P279', catArray ) -- only first id | ||
if id ~= '' then | if id ~= '' then | ||
aType = list[ id ] | aType = list[ id ] | ||
Zeile 307: | Zeile 309: | ||
until j >= limit or id == '' | until j >= limit or id == '' | ||
end | end | ||
return 'error', catArray | return 'error', catArray | ||
end | end |