Modulo:DTGenerico: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
New loop to identify root class
mNessun oggetto della modifica
(New loop to identify root class)
 
Riga 221: Riga 221:
InstanceQ = Item.claims[Property][1].mainsnak.datavalue.value.id
InstanceQ = Item.claims[Property][1].mainsnak.datavalue.value.id
--Initial setting
--Initial setting to calculate the root class of the item
RootInstanceQ = InstanceQ
RootInstanceQ = InstanceQ
--Loop only if the element is not a Class itself
--Loop only if the element is not a Class itself
Riga 239: Riga 239:
RootInstance = mw.wikibase.getLabelByLang(RootInstanceQ, 'it')
RootInstance = mw.wikibase.getLabelByLang(RootInstanceQ, 'it')
mw.smw.set("Istanza radice=" .. RootInstance)
mw.smw.set("Istanza radice=" .. RootInstance)
--[[
--If the item's root class is spaceship, then sets the name
RootInstanceArray = PropertiesOnTree("P14", 3, true, false, true)
if #RootInstanceArray > 1 then
--Second to last resul, because last one should always be a Class, the topmost Instance possible
RootInstance = RootInstanceArray[#RootInstanceArray - 1]
else
--Should be a Class, so instance of the current object IS the root instance
--RootInstance = RootInstanceArray[1]
RootInstance = mw.wikibase.getLabelByLang(InstanceQ, 'it')
end
mw.smw.set("Numero radice=" .. #RootInstanceArray)
mw.smw.set("Istanza radice=" .. RootInstance)
]]
if RootInstance == "Astronave" or RootInstance == "Spaceship" then
if RootInstance == "Astronave" or RootInstance == "Spaceship" then
--if InstanceQ == "Q876" or InstanceQ == "Q78" or InstanceQ == "Q890" then
--if InstanceQ == "Q876" or InstanceQ == "Q78" or InstanceQ == "Q890" then

Menu di navigazione