localp={}functioncc(arg,c)ifargandarg~=''thenreturnargelsereturncendendfunctionp.wikidatacheck(frame)localpframe=frame:getParent()localconfig=frame.args-- the arguments passed BY the template, in the wikitext of the template itselflocalargs=pframe.args-- the arguments passed TO the template, in the wikitext that transcludes the templatelocalproperty=config.propertylocalvalue=config.valuelocalcatbase=config.categorylocalnamespaces=config.namespaces----------localsame=cc(config.same,'كما في ويكي بيانات')localnotinwikidata=cc(config.notinwikidata,'ليست على ويكي بيانات')localdefrent=cc(config.defrent,'مختلفة عن ويكي بيانات')----------localok=false-- one-way flag to check if we're in a good namespacelocalns=mw.title.getCurrentTitle().namespace----------localcate_same="[[Category:"..catbase.." "..same.."]]"localcate_notinwikidata="[[Category:"..catbase.." "..notinwikidata.."]]"localcate_defrent="[[Category:"..catbase.." "..defrent.."]]"----------forvinmw.text.gsplit(namespaces,",",true)doiftonumber(v)==nsthenok=trueendend----------ifnotokorcatbase==""ornotvalueorvalue==""then-- not in one of the approved namespacesreturn""end----------localentity=mw.wikibase.getEntityObject()ifnotentitythen-- no Wikidata itemreturncate_notinwikidataend----------localclaims=entity.claimsor{}localhasProp=claims[property]ifnothasPropthen-- no claim of that propertyreturncate_notinwikidata-- bad. Bot needs to add the propertyend----------ifhasProp[1].mainsnak.snaktype=='value'thenlocalpropValue=hasProp[1].mainsnak.datavalue.value-- This should eventually iterate over all possible values?ifpropValue==valuethenreturncate_same-- yay!elsereturncate_defrent-- needs human review :(endend----------endreturnp