functiongetProperty(propertyName)localentity=mw.wikibase.getEntityObject()ifnotentityornotentity.claimsthenreturnend--the entity doesn't exist or has no claimslocalproperty=entity.claims[propertyName]ifnotpropertythenreturnend--no such property for this itemproperty=property[1]localpropValue=property.mainsnakandproperty.mainsnak.datavalueifnotpropValuethenreturnend--property doesn't existifpropValue['type']=='wikibase-entityid'thenlocallinkTarget=mw.wikibase.sitelink("Q"..propValue.value['numeric-id'])locallinkTitle=mw.wikibase.label("Q"..propValue.value['numeric-id'])returnlinkTargetandlinkTitleandmw.ustring.format("[[%s|%s]]",linkTarget,linkTitle)orlinkTitleelseifpropValueandpropValue['type']=='string'thenreturnpropValue.valueendendfunctionproperty(frame)returngetProperty(string.upper(frame.args[1]))endfunctiongetLabel(propertyName)localentity=mw.wikibase.getEntityObject()ifnotentityornotentity.claimsthenreturnend--the entity doesn't exist or has no claimslocalproperty=entity.claims[propertyName]ifnotpropertythenreturnend--no such property for this itemproperty=property[1]localpropValue=property.mainsnak.datavalueifnotpropValuethenreturn''end--property doesn't existifpropValue['type']=='wikibase-entityid'thenreturnmw.wikibase.label("Q"..propValue.value['numeric-id'])elseifpropValue['type']=='string'thenreturnpropValue.valueendend-- Return the label for property, or the label of the linked entiy of that propertyfunctionlabel(frame)returngetLabel(string.upper(frame.args[1]))endfunctiongetImageLink(propName,width)localentity=mw.wikibase.getEntityObject()ifnotentityornotentity.claimsthenreturnend--the entity doesn't exist or has no claimslocalproperty=entity.claims[propNameor"P18"]ifpropertythenlocalwidth=widthor"220"returnmw.ustring.format('[[File:%s|%spx]]',property[1].mainsnak.datavalue.value,width)endend--use this function to get associated image to be used in the articlefunctionimageLink(frame)returngetImageLink(string.lower(frame.args[1]),frame.args.width)endreturn{imageLink=imageLink,Image=imageLink,File=imageLink,label=label,Label=label,property=property,Property=property,getProperty=getProperty,getImageLink=getImageLink,getLabel=getLabel}