<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2Fgenewiki%2Fgeneboxdev</id>
	<title>Module:Sandbox/genewiki/geneboxdev - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ASandbox%2Fgenewiki%2Fgeneboxdev"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/genewiki/geneboxdev&amp;action=history"/>
	<updated>2026-04-21T22:00:13Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Sandbox/genewiki/geneboxdev&amp;diff=146506&amp;oldid=prev</id>
		<title>imported&gt;I9606: took Q out of pdb links</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/genewiki/geneboxdev&amp;diff=146506&amp;oldid=prev"/>
		<updated>2015-10-21T16:03:40Z</updated>

		<summary type="html">&lt;p&gt;took Q out of pdb links&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--This code is originally from https://en.wikipedia.org/wiki/Module:Sandbox/RexxS/AA and copied here (9/17/2015) for modifications and reusablity &lt;br /&gt;
-- Testing for arbitrary access&lt;br /&gt;
-- Intended to be:&lt;br /&gt;
-- Use : {{#invoke:Wikidata|getValueFromID|&amp;lt;ID&amp;gt;|&amp;lt;Property&amp;gt;|FETCH_WIKIDATA}}&lt;br /&gt;
-- E.g.: {{#invoke:Wikidata|getValueFromID|Q151973|P26|FETCH_WIKIDATA}} - to fetch value of &amp;#039;spouse&amp;#039; (P26) from &amp;#039;Richard Burton&amp;#039; (Q151973)&lt;br /&gt;
-- While in sandbox:&lt;br /&gt;
-- Use : {{#invoke:Sandbox/RexxS/AA|getValueFromID|&amp;lt;ID&amp;gt;|&amp;lt;Property&amp;gt;|FETCH_WIKIDATA}}&lt;br /&gt;
-- E.g.: {{#invoke:Sandbox/RexxS/AA|getValueFromID|Q151973|P26|FETCH_WIKIDATA}} - to fetch value of &amp;#039;spouse&amp;#039; (P26) from &amp;#039;Richard Burton&amp;#039; (Q151973)&lt;br /&gt;
-- Added Extra parameters for chosing rank (preferred, normal, truth, depreciated and random value (just first in list)&lt;br /&gt;
-- E.g.: {{#invoke:Sandbox/RexxS/AA|getValueFromID|Q151973|P26|FETCH_WIKIDATA|RANK_PREFERRED|RANDOM}}  &lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- This is used to get a value, or a comma separated list of them if multiple values exist &lt;br /&gt;
&lt;br /&gt;
p.getValueFromID = function(frame)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local input_rank = mw.text.trim(frame.args[4] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local random = mw.text.trim(frame.args[5] or &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	if input_parm == &amp;quot;FETCH_WIKIDATA&amp;quot; then&lt;br /&gt;
		local entity = mw.wikibase.getEntity(itemID)&lt;br /&gt;
		local claims = entity.claims[propertyID]&lt;br /&gt;
		if claims then&lt;br /&gt;
			&lt;br /&gt;
			-- if wiki-linked value output as link if possible&lt;br /&gt;
			if (claims[1] and claims[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and claims[1].mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot; ) then&lt;br /&gt;
				local out = {}&lt;br /&gt;
				for k, v in pairs(claims) do&lt;br /&gt;
					local sitelink = mw.wikibase.sitelink(&amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;])&lt;br /&gt;
					local label = mw.wikibase.label(&amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;])&lt;br /&gt;
					if label == nil then label = &amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;] end&lt;br /&gt;
							&lt;br /&gt;
					if sitelink then&lt;br /&gt;
						out[#out + 1] = &amp;quot;[[&amp;quot; .. sitelink .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
					else&lt;br /&gt;
						--out[#out + 1] = &amp;quot;[[:d:Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;] .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;lt;abbr title=&amp;#039;Article is not yet available in this wiki&amp;#039;&amp;gt;[*]&amp;lt;/abbr&amp;gt;&amp;quot;&lt;br /&gt;
						out[#out + 1] = &amp;quot;[[:d:Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;] .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				return table.concat(out, &amp;quot;, &amp;quot;)&lt;br /&gt;
			else&lt;br /&gt;
				local results&lt;br /&gt;
				if input_rank == &amp;quot;&amp;quot; then &lt;br /&gt;
					&lt;br /&gt;
					results = entity:formatPropertyValues(propertyID, mw.wikibase.entity.claimRanks).value&lt;br /&gt;
				else&lt;br /&gt;
					results = entity:formatPropertyValues(propertyID, mw.wikibase.entity.claimRanks.input_rank).value&lt;br /&gt;
				end&lt;br /&gt;
				if random == &amp;quot;&amp;quot; then&lt;br /&gt;
					return results&lt;br /&gt;
				else&lt;br /&gt;
					local results_split = mw.text.split(results, &amp;quot;,&amp;quot;)&lt;br /&gt;
					return results_split[1]&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return input_parm&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- A function to return the QID of a property value, rather than its text label&lt;br /&gt;
-- May be useful for constructing chains of calls to get properties of properties, etc.&lt;br /&gt;
-- It returns the QID of only the first property value if more than one&lt;br /&gt;
-- Use like this: {{#invoke:Sandbox/RexxS/AA|getQIDFromID|Q151973|P26|FETCH_WIKIDATA}}&lt;br /&gt;
-- That will fetch the QID of the first value for the spouse (P26) of Richard Burton (Q151973)&lt;br /&gt;
-- Returns an empty string if the value doesn&amp;#039;t exist or has no QID.&lt;br /&gt;
&lt;br /&gt;
p.getQIDFromID = function(frame)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	local entity = mw.wikibase.getEntity(itemID)&lt;br /&gt;
	local claims = entity.claims[propertyID]&lt;br /&gt;
	if claims then&lt;br /&gt;
		-- if wiki-linked value return the QID of the first value of the property&lt;br /&gt;
		if (claims[1] and claims[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and claims[1].mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot;) then&lt;br /&gt;
			return &amp;quot;Q&amp;quot; .. claims[1].mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.getRawValueFromID = function(frame)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if input_parm == &amp;quot;FETCH_WIKIDATA&amp;quot; then&lt;br /&gt;
		local entity = mw.wikibase.getEntity(itemID)&lt;br /&gt;
		local claims = entity.claims[propertyID]&lt;br /&gt;
		if claims then&lt;br /&gt;
			local result = entity:formatPropertyValues(propertyID, mw.wikibase.entity.claimRanks).value&lt;br /&gt;
		&lt;br /&gt;
			-- if number type: remove thousand separators&lt;br /&gt;
			if (claims[1] and claims[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and claims[1].mainsnak.datavalue.type == &amp;quot;quantity&amp;quot;) then&lt;br /&gt;
				result = mw.ustring.gsub(result, &amp;quot;(%d),(%d)&amp;quot;, &amp;quot;%1%2&amp;quot;)&lt;br /&gt;
			end&lt;br /&gt;
			return result&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return input_parm&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--This could be expanded into more levels taking a list in.  But the deeper one abstracts the more likely one level won&amp;#039;t return a value and error checking could be tedious.&lt;br /&gt;
--{{#invoke:Sandbox/RexxS/AA|getQIDFromID|Q151973|P26|P35|FETCH_WIKIDATA}}&lt;br /&gt;
p.getQIDFromID_two_levels = function(frame)&lt;br /&gt;
	local parent_itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;) ---first Qid&lt;br /&gt;
	local parent_propertyID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local child_propertyID = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[4] or &amp;quot;&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	local entity_parent = mw.wikibase.getEntity(parent_itemID)&lt;br /&gt;
	local claims_parent = entity_parent.claims[parent_propertyID]&lt;br /&gt;
	if claims_parent then&lt;br /&gt;
		-- if wiki-linked value return the QID of the first value of the property&lt;br /&gt;
		if (claims_parent[1] and claims_parent[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and claims_parent[1].mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot;) then&lt;br /&gt;
			local child_itemID = &amp;quot;Q&amp;quot; .. claims_parent[1].mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
			local entity_child = mw.wikibase.getEntity(child_itemID)&lt;br /&gt;
			local claims_child = entity_child.claims[child_propertyID]&lt;br /&gt;
			&lt;br /&gt;
			--wiki-linked value of the second QID&lt;br /&gt;
			if (claims_child[1] and claims_child[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and claims_child[1].mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot;) then&lt;br /&gt;
				return &amp;quot;Q&amp;quot;..claims_child[1].mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
				&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
			else &lt;br /&gt;
				return &amp;quot;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.getQualifierID = function(frame)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;) &lt;br /&gt;
	local qualifierID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[4] or &amp;quot;&amp;quot;) --if direct link from wikidata item&lt;br /&gt;
	&lt;br /&gt;
	if input_parm == &amp;quot;FETCH_WIKIDATA&amp;quot; then&lt;br /&gt;
		local entity = &amp;quot;&amp;quot;&lt;br /&gt;
		if itemID ~= &amp;quot;&amp;quot; then&lt;br /&gt;
			entity = mw.wikibase.getEntityObject(itemID)&lt;br /&gt;
		else&lt;br /&gt;
			entity = mw.wikibase.getEntityObject()&lt;br /&gt;
		end&lt;br /&gt;
		if entity.claims[propertyID] ~= nil then&lt;br /&gt;
			local out = {}&lt;br /&gt;
			for k, v in pairs(entity.claims[propertyID]) do&lt;br /&gt;
				for k2, v2 in pairs(v.qualifiers[qualifierID]) do&lt;br /&gt;
					if v2.snaktype == &amp;#039;value&amp;#039; then&lt;br /&gt;
							out[#out + 1] = &amp;quot;Q&amp;quot; .. v2.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			return table.concat(out, &amp;quot;, &amp;quot;)&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return input_parm&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
p.getAliasFromGenomeAssembly_hs = function(frame)&lt;br /&gt;
	-- will contain the numeric value for the requested coordinate&lt;br /&gt;
	local output = &amp;quot;&amp;quot;&lt;br /&gt;
	local sep = &amp;quot; &amp;quot;&lt;br /&gt;
	-- can only be P644 (genomic start) or P645 (genomic end) for this to work&lt;br /&gt;
	-- should probably try to catch that.  Might also increase legibility to use specific variable names when possible&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;) &lt;br /&gt;
	-- this can really only be P659 right now.  I&amp;#039;m not sure of the value of including it as a parameter as other values will likely break this function&lt;br /&gt;
	local qualifierID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- Why do we include this here?  What should happen if FETCH_WIKIDATA is not included? &lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- this can needs to be fed to the function either by a call to {{#invoke:Wikidata|pageId}} or by setting it directly (e.g. if the function was applied on a page other than the targeted gene)&lt;br /&gt;
	--alert if this id is not a valid thing in wikidata, a Lua error will occur that says&lt;br /&gt;
	--The ID entered is unknown to the system. Please use a valid entity ID.&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[4] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- will track the different builds pulled from the qualifiers&lt;br /&gt;
	local newest_build = &amp;quot;0&amp;quot;&lt;br /&gt;
	-- starts the process&lt;br /&gt;
	local entity = mw.wikibase.getEntityObject(itemID)&lt;br /&gt;
	local claims&lt;br /&gt;
	--gets a table of claims on the (genomic start or end) property Q19847637&lt;br /&gt;
	if entity and entity.claims then&lt;br /&gt;
		claims = entity.claims[propertyID]&lt;br /&gt;
	end&lt;br /&gt;
	--will return nothing if no claims are found&lt;br /&gt;
	if claims then&lt;br /&gt;
		--checking to be sure claims is populated, not sure it its needed&lt;br /&gt;
		if (claims[1] ) then&lt;br /&gt;
			--useful for debugging&lt;br /&gt;
			--local out = {}&lt;br /&gt;
			--pulls the genome location from the claim&lt;br /&gt;
			for k, v in pairs(claims) do&lt;br /&gt;
				local quals = v.qualifiers.P659 &lt;br /&gt;
				--if there are any&lt;br /&gt;
				if quals then&lt;br /&gt;
					for qk, qv in pairs(quals) do&lt;br /&gt;
						local qual_obj_id = &amp;quot;Q&amp;quot;..qv.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
						--get to the entity targeted by the qualifier property.  Genome builds are Items in wikidata&lt;br /&gt;
						local qual_obj = mw.wikibase.getEntityObject(qual_obj_id)&lt;br /&gt;
						local alias = &amp;quot;&amp;quot;&lt;br /&gt;
						--this uses the aliases to pull out version numbers&lt;br /&gt;
						--seems like there ought to be a better way to do this, but likely would need to change the data added by the bot&lt;br /&gt;
						if qual_obj[&amp;quot;aliases&amp;quot;] ~= nil then&lt;br /&gt;
							local test = qual_obj[&amp;quot;aliases&amp;quot;][&amp;quot;en&amp;quot;]&lt;br /&gt;
							for key, value in ipairs(test) do&lt;br /&gt;
								if string.match(value[&amp;#039;value&amp;#039;], &amp;#039;^hg&amp;#039;) then&lt;br /&gt;
									alias = value[&amp;#039;value&amp;#039;]&lt;br /&gt;
									local build_no = alias:gsub(&amp;quot;hg&amp;quot;,&amp;quot;&amp;quot;)&lt;br /&gt;
									--report only the most location associated with the most recent build&lt;br /&gt;
									--if there is more than one location per build, just give one back as that is not our problem right now.&lt;br /&gt;
									if build_no &amp;gt; newest_build then&lt;br /&gt;
										newest_build = build_no&lt;br /&gt;
									end&lt;br /&gt;
								end&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				--in case there are no qualifiers, but there is a location, might as well return it&lt;br /&gt;
				else output = location &lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
				return &amp;quot;hg&amp;quot;..newest_build&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
		--debug&lt;br /&gt;
		--&amp;quot;no claims for &amp;quot;..itemID..&amp;quot; prop &amp;quot;..propertyID&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--in future could just combine this with getChromosomeLoc once all in once code&lt;br /&gt;
p.getAliasFromGenomeAssembly_mm = function(frame)&lt;br /&gt;
	-- will contain the numeric value for the requested coordinate&lt;br /&gt;
	local output = &amp;quot;&amp;quot;&lt;br /&gt;
	local sep = &amp;quot; &amp;quot;&lt;br /&gt;
	-- can only be P644 (genomic start) or P645 (genomic end) for this to work&lt;br /&gt;
	-- should probably try to catch that.  Might also increase legibility to use specific variable names when possible&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;) &lt;br /&gt;
	-- this can really only be P659 right now.  I&amp;#039;m not sure of the value of including it as a parameter as other values will likely break this function&lt;br /&gt;
	local qualifierID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- Why do we include this here?  What should happen if FETCH_WIKIDATA is not included? &lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- this can needs to be fed to the function either by a call to {{#invoke:Wikidata|pageId}} or by setting it directly (e.g. if the function was applied on a page other than the targeted gene)&lt;br /&gt;
	--alert if this id is not a valid thing in wikidata, a Lua error will occur that says&lt;br /&gt;
	--The ID entered is unknown to the system. Please use a valid entity ID.&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[4] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- will track the different builds pulled from the qualifiers&lt;br /&gt;
	local newest_build = &amp;quot;0&amp;quot;&lt;br /&gt;
	-- starts the process&lt;br /&gt;
	local mouse_propertyID = &amp;quot;P684&amp;quot;&lt;br /&gt;
	--get the QID for the mouse gene&lt;br /&gt;
	local mouse_itemID &lt;br /&gt;
	--use itemID (QID) to get the mouse QID to return start or end location (propertyID)&lt;br /&gt;
	local entity_gene = mw.wikibase.getEntity(itemID)&lt;br /&gt;
	local claims_gene = entity_gene.claims[mouse_propertyID]&lt;br /&gt;
	if claims_gene then&lt;br /&gt;
		local claims_mouse&lt;br /&gt;
		if (claims_gene[1] and claims_gene[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and claims_gene[1].mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot;) then&lt;br /&gt;
			mouse_itemID = &amp;quot;Q&amp;quot; .. claims_gene[1].mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
			local entity_mouse = mw.wikibase.getEntity(mouse_itemID)&lt;br /&gt;
			claims_mouse = entity_mouse.claims[propertyID]&lt;br /&gt;
		end --will return nothing if no claims are found&lt;br /&gt;
		if claims_mouse then&lt;br /&gt;
			--checking to be sure claims is populated, not sure it its needed&lt;br /&gt;
			if (claims_mouse[1] ) then&lt;br /&gt;
			--useful for debugging&lt;br /&gt;
			--local out = {}&lt;br /&gt;
			--pulls the genome location from the claim&lt;br /&gt;
				for k, v in pairs(claims_mouse) do&lt;br /&gt;
					local quals = v.qualifiers.P659 &lt;br /&gt;
					--if there are any&lt;br /&gt;
					if quals then&lt;br /&gt;
						for qk, qv in pairs(quals) do&lt;br /&gt;
							local qual_obj_id = &amp;quot;Q&amp;quot;..qv.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
							--get to the entity targeted by the qualifier property.  Genome builds are Items in wikidata&lt;br /&gt;
							local qual_obj = mw.wikibase.getEntityObject(qual_obj_id)&lt;br /&gt;
							local alias = &amp;quot;&amp;quot;&lt;br /&gt;
							--this uses the aliases to pull out version numbers&lt;br /&gt;
							--seems like there ought to be a better way to do this, but likely would need to change the data added by the bot&lt;br /&gt;
							if qual_obj[&amp;quot;aliases&amp;quot;] ~= nil then&lt;br /&gt;
								local test = qual_obj[&amp;quot;aliases&amp;quot;][&amp;quot;en&amp;quot;]&lt;br /&gt;
								for key, value in ipairs(test) do&lt;br /&gt;
									if string.match(value[&amp;#039;value&amp;#039;], &amp;#039;^mm&amp;#039;) then&lt;br /&gt;
										alias = value[&amp;#039;value&amp;#039;]&lt;br /&gt;
										local build_no = alias:gsub(&amp;quot;mm&amp;quot;,&amp;quot;&amp;quot;)&lt;br /&gt;
										--report only the most location associated with the most recent build&lt;br /&gt;
										--if there is more than one location per build, just give one back as that is not our problem right now.&lt;br /&gt;
										if build_no &amp;gt; newest_build then&lt;br /&gt;
											newest_build = build_no&lt;br /&gt;
										end&lt;br /&gt;
									end&lt;br /&gt;
								end&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
					--in case there are no qualifiers, but there is a location, might as well return it&lt;br /&gt;
					else &lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
					return &amp;quot;mm&amp;quot;..newest_build&lt;br /&gt;
			else&lt;br /&gt;
				return &amp;quot;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
			--debug&lt;br /&gt;
			--&amp;quot;no claims for &amp;quot;..itemID..&amp;quot; prop &amp;quot;..propertyID&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---getChromosomeLoc &lt;br /&gt;
---input propertyID ie(Genomic start) P644&lt;br /&gt;
---      qualifierID (ie GenLoc Assembly) P659&lt;br /&gt;
---      input_parm (ie FETCH_WIKIDATA)  &lt;br /&gt;
---      {{#invoke:Sandbox/genewiki/geneboxdev|getChromosomeLoc|P644|P659|FETCH_WIKIDATA}}&lt;br /&gt;
---output preferred chromosome location start value in this case it would be 49893092&lt;br /&gt;
&lt;br /&gt;
--for debug window -- Q14865053&lt;br /&gt;
--frame = mw.getCurrentFrame()&lt;br /&gt;
--frame.args = {&amp;quot;P644&amp;quot;,&amp;quot;P659&amp;quot;,&amp;quot;FETCH_WIKIDATA&amp;quot;,&amp;quot;Q14865053&amp;quot;}&lt;br /&gt;
--print(p.getChromosomeLoc(frame))&lt;br /&gt;
&lt;br /&gt;
p.getChromosomeLoc = function(frame)&lt;br /&gt;
	-- will contain the numeric value for the requested coordinate&lt;br /&gt;
	local output = &amp;quot;&amp;quot;&lt;br /&gt;
	local sep = &amp;quot; &amp;quot;&lt;br /&gt;
	-- can only be P644 (genomic start) or P645 (genomic end) for this to work&lt;br /&gt;
	-- should probably try to catch that.  Might also increase legibility to use specific variable names when possible&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;) &lt;br /&gt;
	-- this can really only be P659 right now.  I&amp;#039;m not sure of the value of including it as a parameter as other values will likely break this function&lt;br /&gt;
	local qualifierID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- Why do we include this here?  What should happen if FETCH_WIKIDATA is not included? &lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- this can needs to be fed to the function either by a call to {{#invoke:Wikidata|pageId}} or by setting it directly (e.g. if the function was applied on a page other than the targeted gene)&lt;br /&gt;
	--alert if this id is not a valid thing in wikidata, a Lua error will occur that says&lt;br /&gt;
	--The ID entered is unknown to the system. Please use a valid entity ID.&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[4] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- will track the different builds pulled from the qualifiers&lt;br /&gt;
	local newest_build = &amp;quot;0&amp;quot;&lt;br /&gt;
	-- starts the process&lt;br /&gt;
	local entity = mw.wikibase.getEntityObject(itemID)&lt;br /&gt;
	local claims&lt;br /&gt;
	--gets a table of claims on the (genomic start or end) property Q19847637&lt;br /&gt;
	if entity and entity.claims then&lt;br /&gt;
		claims = entity.claims[propertyID]&lt;br /&gt;
	end&lt;br /&gt;
	--will return nothing if no claims are found&lt;br /&gt;
	if claims then&lt;br /&gt;
		--checking to be sure claims is populated, not sure it its needed&lt;br /&gt;
		if (claims[1] ) then&lt;br /&gt;
			--useful for debugging&lt;br /&gt;
			--local out = {}&lt;br /&gt;
			--pulls the genome location from the claim&lt;br /&gt;
			for k, v in pairs(claims) do&lt;br /&gt;
				local location = v.mainsnak.datavalue.value&lt;br /&gt;
				--debugging&lt;br /&gt;
				--out[#out + 1] = k..&amp;quot; location:&amp;quot; .. location.. &amp;quot; || &amp;quot; &lt;br /&gt;
				--gets the qualifiers linked to the current claim&lt;br /&gt;
				local quals = v.qualifiers.P659 &lt;br /&gt;
				--if there are any&lt;br /&gt;
				if quals then&lt;br /&gt;
					for qk, qv in pairs(quals) do&lt;br /&gt;
						local qual_obj_id = &amp;quot;Q&amp;quot;..qv.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
						--get to the entity targeted by the qualifier property.  Genome builds are Items in wikidata&lt;br /&gt;
						local qual_obj = mw.wikibase.getEntityObject(qual_obj_id)&lt;br /&gt;
						local alias = &amp;quot;&amp;quot;&lt;br /&gt;
						--this uses the aliases to pull out version numbers&lt;br /&gt;
						--seems like there ought to be a better way to do this, but likely would need to change the data added by the bot&lt;br /&gt;
						if qual_obj[&amp;quot;aliases&amp;quot;] ~= nil then&lt;br /&gt;
							local test = qual_obj[&amp;quot;aliases&amp;quot;][&amp;quot;en&amp;quot;]&lt;br /&gt;
							for key, value in ipairs(test) do&lt;br /&gt;
								if string.match(value[&amp;#039;value&amp;#039;], &amp;#039;^hg&amp;#039;) then&lt;br /&gt;
									alias = value[&amp;#039;value&amp;#039;]&lt;br /&gt;
									local build_no = alias:gsub(&amp;quot;hg&amp;quot;,&amp;quot;&amp;quot;)&lt;br /&gt;
									--report only the most location associated with the most recent build&lt;br /&gt;
									--if there is more than one location per build, just give one back as that is not our problem right now.&lt;br /&gt;
									if build_no &amp;gt; newest_build then&lt;br /&gt;
										output = location&lt;br /&gt;
										newest_build = build_no&lt;br /&gt;
									end&lt;br /&gt;
								end&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				--in case there are no qualifiers, but there is a location, might as well return it&lt;br /&gt;
				else output = location &lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
				return output&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;quot;&amp;quot;&lt;br /&gt;
		--debug&lt;br /&gt;
		--&amp;quot;no claims for &amp;quot;..itemID..&amp;quot; prop &amp;quot;..propertyID&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.getChromosomeLoc_mm = function(frame)&lt;br /&gt;
	-- will contain the numeric value for the requested coordinate&lt;br /&gt;
	local output = &amp;quot;&amp;quot;&lt;br /&gt;
	local sep = &amp;quot; &amp;quot;&lt;br /&gt;
	-- can only be P644 (genomic start) or P645 (genomic end) for this to work&lt;br /&gt;
	-- should probably try to catch that.  Might also increase legibility to use specific variable names when possible&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;) &lt;br /&gt;
	-- this can really only be P659 right now.  I&amp;#039;m not sure of the value of including it as a parameter as other values will likely break this function&lt;br /&gt;
	local qualifierID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- Why do we include this here?  What should happen if FETCH_WIKIDATA is not included? &lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- this can needs to be fed to the function either by a call to {{#invoke:Wikidata|pageId}} or by setting it directly (e.g. if the function was applied on a page other than the targeted gene)&lt;br /&gt;
	--alert if this id is not a valid thing in wikidata, a Lua error will occur that says&lt;br /&gt;
	--The ID entered is unknown to the system. Please use a valid entity ID.&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[4] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- will track the different builds pulled from the qualifiers&lt;br /&gt;
	local newest_build = &amp;quot;0&amp;quot;&lt;br /&gt;
	-- starts the process&lt;br /&gt;
	local mouse_propertyID = &amp;quot;P684&amp;quot;&lt;br /&gt;
	--get the QID for the mouse gene&lt;br /&gt;
	local mouse_itemID &lt;br /&gt;
	--use itemID (QID) to get the mouse QID to return start or end location (propertyID)&lt;br /&gt;
	local entity_gene = mw.wikibase.getEntity(itemID)&lt;br /&gt;
	local claims_gene = entity_gene.claims[mouse_propertyID]&lt;br /&gt;
	if claims_gene then&lt;br /&gt;
		local claims_mouse&lt;br /&gt;
		if (claims_gene[1] and claims_gene[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and claims_gene[1].mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot;) then&lt;br /&gt;
			mouse_itemID = &amp;quot;Q&amp;quot; .. claims_gene[1].mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
			local entity_mouse = mw.wikibase.getEntity(mouse_itemID)&lt;br /&gt;
			claims_mouse = entity_mouse.claims[propertyID]&lt;br /&gt;
		end --will return nothing if no claims are found&lt;br /&gt;
		if claims_mouse then&lt;br /&gt;
			--checking to be sure claims is populated, not sure it its needed&lt;br /&gt;
			if (claims_mouse[1] ) then&lt;br /&gt;
			--useful for debugging&lt;br /&gt;
			--local out = {}&lt;br /&gt;
			--pulls the genome location from the claim&lt;br /&gt;
				for k, v in pairs(claims_mouse) do&lt;br /&gt;
					local location = v.mainsnak.datavalue.value&lt;br /&gt;
					--debugging&lt;br /&gt;
					--out[#out + 1] = k..&amp;quot; location:&amp;quot; .. location.. &amp;quot; || &amp;quot; &lt;br /&gt;
					--gets the qualifiers linked to the current claim&lt;br /&gt;
					local quals = v.qualifiers.P659 &lt;br /&gt;
					--if there are any&lt;br /&gt;
					if quals then&lt;br /&gt;
						for qk, qv in pairs(quals) do&lt;br /&gt;
							local qual_obj_id = &amp;quot;Q&amp;quot;..qv.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
							--get to the entity targeted by the qualifier property.  Genome builds are Items in wikidata&lt;br /&gt;
							local qual_obj = mw.wikibase.getEntityObject(qual_obj_id)&lt;br /&gt;
							local alias = &amp;quot;&amp;quot;&lt;br /&gt;
							--this uses the aliases to pull out version numbers&lt;br /&gt;
							--seems like there ought to be a better way to do this, but likely would need to change the data added by the bot&lt;br /&gt;
							if qual_obj[&amp;quot;aliases&amp;quot;] ~= nil then&lt;br /&gt;
								local test = qual_obj[&amp;quot;aliases&amp;quot;][&amp;quot;en&amp;quot;]&lt;br /&gt;
								for key, value in ipairs(test) do&lt;br /&gt;
									if string.match(value[&amp;#039;value&amp;#039;], &amp;#039;^mm&amp;#039;) then&lt;br /&gt;
										alias = value[&amp;#039;value&amp;#039;]&lt;br /&gt;
										local build_no = alias:gsub(&amp;quot;mm&amp;quot;,&amp;quot;&amp;quot;)&lt;br /&gt;
										--report only the most location associated with the most recent build&lt;br /&gt;
										--if there is more than one location per build, just give one back as that is not our problem right now.&lt;br /&gt;
										if build_no &amp;gt; newest_build then&lt;br /&gt;
											output = location&lt;br /&gt;
											newest_build = build_no&lt;br /&gt;
										end&lt;br /&gt;
									end&lt;br /&gt;
								end&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
					--in case there are no qualifiers, but there is a location, might as well return it&lt;br /&gt;
					else output = location &lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
					return output&lt;br /&gt;
			else&lt;br /&gt;
				return &amp;quot;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
			--debug&lt;br /&gt;
			--&amp;quot;no claims for &amp;quot;..itemID..&amp;quot; prop &amp;quot;..propertyID&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--eg:{{#invoke:Sandbox/genewiki/geneboxdev|getChromosomeLoc|P644|FETCH_WIKIDATA}}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
--This function is used to generate a list of aliases&lt;br /&gt;
--To Do: exclude gene symbol that is already displayed&lt;br /&gt;
function p.get_aliases(frame)&lt;br /&gt;
	entity = mw.wikibase.getEntityObject(frame.args[&amp;#039;from&amp;#039;])&lt;br /&gt;
		&lt;br /&gt;
	a = &amp;#039;&amp;#039;&lt;br /&gt;
	if entity[&amp;#039;aliases&amp;#039;] ~= nil then&lt;br /&gt;
        test = entity[&amp;#039;aliases&amp;#039;][&amp;#039;en&amp;#039;]&lt;br /&gt;
		for key, value in ipairs(test) do&lt;br /&gt;
			a = a .. &amp;#039;, &amp;#039; ..  value[&amp;#039;value&amp;#039;]&lt;br /&gt;
		end&lt;br /&gt;
			&lt;br /&gt;
		return a&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.trimChromosome = function(frame)&lt;br /&gt;
	local string_to_trim = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local out = &amp;#039;&amp;#039;;&lt;br /&gt;
	if string.find(string_to_trim, &amp;#039;chromosome.&amp;#039;) then&lt;br /&gt;
		out = string_to_trim:gsub(&amp;quot;chromosome &amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	end &lt;br /&gt;
	if string.find(string_to_trim, &amp;#039;mouse.chromosome.&amp;#039;) then&lt;br /&gt;
		out = string_to_trim:gsub(&amp;quot;mouse chromosome &amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
	end &lt;br /&gt;
	return out&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--EG: {{#invoke:Sandbox/genewiki/geneboxdev|getGO|Q14864805|P680|P686|FETCH_WIKIDATA}}&lt;br /&gt;
p.getGO = function(frame)&lt;br /&gt;
	local itemID_parent = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local propertyID_parent = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;) -- ie molecular, cellular, function&lt;br /&gt;
	local propertyID_child  = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;) -- Gene Ontology ID&lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[4] or &amp;quot;&amp;quot;)&lt;br /&gt;
	&lt;br /&gt;
	if input_parm == &amp;quot;FETCH_WIKIDATA&amp;quot; then&lt;br /&gt;
		local entity = mw.wikibase.getEntity(itemID_parent)&lt;br /&gt;
		local claims = entity.claims[propertyID_parent]&lt;br /&gt;
		if claims then&lt;br /&gt;
			if (claims[1] and claims[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and claims[1].mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot;) then&lt;br /&gt;
				local out = {}&lt;br /&gt;
				for k, v in pairs(claims) do&lt;br /&gt;
					local itemID_child = &amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
					local entity = mw.wikibase.getEntityObject(itemID_child)&lt;br /&gt;
					local claims&lt;br /&gt;
					local result_GOID = &amp;#039;&amp;#039;&lt;br /&gt;
					if entity then claims = entity.claims[propertyID_child] end&lt;br /&gt;
					if claims then&lt;br /&gt;
						result_GOID = entity:formatPropertyValues(propertyID_child, mw.wikibase.entity.claimRanks).value&lt;br /&gt;
					else&lt;br /&gt;
						return &amp;quot;&amp;quot;&lt;br /&gt;
					end&lt;br /&gt;
					local sitelink = &amp;quot;http://amigo.geneontology.org/amigo/term/GO:&amp;quot;&lt;br /&gt;
					local label = mw.wikibase.label(&amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;])&lt;br /&gt;
					if label == nil then label = &amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;] end&lt;br /&gt;
							&lt;br /&gt;
					if sitelink then&lt;br /&gt;
						---out[#out + 1] = &amp;quot;*[&amp;quot; .. sitelink .. &amp;quot;|&amp;quot; .. label ..&amp;quot;]\n&amp;quot;&lt;br /&gt;
						out[#out + 1] = &amp;quot;*[&amp;quot; .. sitelink .. result_GOID .. &amp;quot; &amp;quot; .. label ..&amp;quot;]\n&amp;quot;&lt;br /&gt;
					else&lt;br /&gt;
						out[#out + 1] = &amp;quot;*[[:d:Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;] .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]\n&amp;quot;&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				return table.concat(out, &amp;quot;&amp;quot;)&lt;br /&gt;
			else&lt;br /&gt;
				return entity:formatPropertyValues(propertyID, mw.wikibase.entity.claimRanks).value&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return input_parm&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.getPDB = function(frame)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[3] or &amp;quot;&amp;quot;)&lt;br /&gt;
	if input_parm == &amp;quot;FETCH_WIKIDATA&amp;quot; then&lt;br /&gt;
		local entity = mw.wikibase.getEntity(itemID)&lt;br /&gt;
		local claims = entity.claims[propertyID]&lt;br /&gt;
		local sitelink = &amp;quot;http://www.rcsb.org/pdb/explore/explore.do?pdbId=&amp;quot;&lt;br /&gt;
		if claims then&lt;br /&gt;
			if (claims[1] and claims[1].mainsnak.snaktype == &amp;quot;value&amp;quot;) then&lt;br /&gt;
				local out = {}&lt;br /&gt;
				for k, v in pairs(claims) do&lt;br /&gt;
					--don&amp;#039;t think we want the Q here, right ?&lt;br /&gt;
					--local label = mw.wikibase.label(&amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value)&lt;br /&gt;
					--if label == nil then label = &amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value end&lt;br /&gt;
					local label = mw.wikibase.label(v.mainsnak.datavalue.value)&lt;br /&gt;
					if label == nil then label = v.mainsnak.datavalue.value end&lt;br /&gt;
					&lt;br /&gt;
					if sitelink then&lt;br /&gt;
						out[#out + 1] = &amp;quot;[&amp;quot; .. sitelink .. label .. &amp;quot; &amp;quot; ..label .. &amp;quot;]&amp;quot;&lt;br /&gt;
					else&lt;br /&gt;
						out[#out + 1] = &amp;quot;[[:d:Q&amp;quot; .. v.mainsnak.datavalue.value .. &amp;quot;|&amp;quot; .. label .. &amp;quot;]]&amp;quot;&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				return table.concat(out, &amp;quot;, &amp;quot;)&lt;br /&gt;
			else&lt;br /&gt;
				return entity:formatPropertyValues(propertyID, mw.wikibase.entity.claimRanks).value&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		return input_parm&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
function p.ViewSomething(frame)&lt;br /&gt;
	local itemID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local data = mw.wikibase.getEntityObject(itemID)&lt;br /&gt;
	if not data then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local f = frame.args[1] and frame or frame:getParent()&lt;br /&gt;
&lt;br /&gt;
	local i = 1&lt;br /&gt;
	while true do&lt;br /&gt;
		local index = f.args[i]&lt;br /&gt;
		if not index then&lt;br /&gt;
			if type(data) == &amp;quot;table&amp;quot; then&lt;br /&gt;
				return mw.text.jsonEncode(data, mw.text.JSON_PRESERVE_KEYS + mw.text.JSON_PRETTY)&lt;br /&gt;
			else&lt;br /&gt;
				return tostring(data)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		data = data[index] or data[tonumber(index)]&lt;br /&gt;
		if not data then&lt;br /&gt;
			return&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;I9606</name></author>
	</entry>
</feed>