Jump to content

Module:Is instance

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MSGJ (talk | contribs) at 16:36, 1 March 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {};
require('Module:No globals')

function p.main(frame)
	local args = frame.args
	local pargs = frame:getParent().args
	local qid = args.qid or pargs.qid
	local value = args.value or pargs.value
	local instances = wikibase.getBestStatements( qid, "P31" )
	local isInstance = false
	for i,statement in ipairs(instances) do
		if statement.mainsnak.datavalue.value == value then
			isInstance = true
		end
	end
	return isInstance
end

return p