Module:Sandbox/Smsingh34/Wikidata

-- smsingh Task 9, Using Wikidata in Wikipedia local p = {} p.wikidata = function(frame) entityid = frame.args.entityid request = frame.args.request if request == 'given name' then property = 'P735' elseif request == 'family name' then property = 'P734' elseif request == 'place of birth' then property = 'P19' elseif request == 'occupation' then property = 'P106' elseif request == 'spouse' then property = 'P26' end statementstbl = mw.wikibase.getBestStatements(entityid, property) if not (statementstbl[1] == nil) then --datatoprint = mw.wikibase.getSitelink(statementstbl[1].mainsnak.datavalue.value.id) datatoprint = mw.wikibase.getSitelink(statementstbl[1].mainsnak.datavalue.value.id) else return end return datatoprint end return p