<?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%2FRexxs%2FPropIDs</id>
	<title>Module:Sandbox/Rexxs/PropIDs - 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%2FRexxs%2FPropIDs"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Rexxs/PropIDs&amp;action=history"/>
	<updated>2026-04-21T13:24:40Z</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/Rexxs/PropIDs&amp;diff=146117&amp;oldid=prev</id>
		<title>imported&gt;RexxS: no syntactic sugar if there&#039;s a &#039;-&#039; in the name</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Sandbox/Rexxs/PropIDs&amp;diff=146117&amp;oldid=prev"/>
		<updated>2016-09-29T17:18:01Z</updated>

		<summary type="html">&lt;p&gt;no syntactic sugar if there&amp;#039;s a &amp;#039;-&amp;#039; in the name&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This is used to get the QIDs of all of the values of a property, as a comma separated list if multiple values exist&lt;br /&gt;
-- Usage: {{#invoke:Sandbox/Rexxs/PropIDs |getPropertyIDs |&amp;lt;PropertyID&amp;gt; |FETCH_WIKIDATA}}&lt;br /&gt;
-- Usage: {{#invoke:Sandbox/Rexxs/PropIDs |getPropertyIDs |&amp;lt;PropertyID&amp;gt; |&amp;lt;InputParameter&amp;gt; |qid=&amp;lt;QID&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
p.getPropertyIDs = function(frame)&lt;br /&gt;
	local propertyID = mw.text.trim(frame.args[1] or &amp;quot;&amp;quot;)&lt;br /&gt;
	local input_parm = mw.text.trim(frame.args[2] or &amp;quot;&amp;quot;)&lt;br /&gt;
	-- can take a named parameter |qid which is the Wikidata ID for the article. This will not normally be used.&lt;br /&gt;
	local qid = frame.args.qid&lt;br /&gt;
	if qid and (#qid == 0) then qid = nil end&lt;br /&gt;
	if input_parm == &amp;quot;FETCH_WIKIDATA&amp;quot; then&lt;br /&gt;
		local entity = mw.wikibase.getEntityObject(qid)&lt;br /&gt;
		local propclaims&lt;br /&gt;
		if entity and entity.claims then&lt;br /&gt;
			propclaims = entity.claims[propertyID]&lt;br /&gt;
		end&lt;br /&gt;
		if propclaims then&lt;br /&gt;
			-- if wiki-linked value collect the QID in a table&lt;br /&gt;
			if (propclaims[1] and propclaims[1].mainsnak.snaktype == &amp;quot;value&amp;quot; and propclaims[1].mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot;) then&lt;br /&gt;
				local out = {}&lt;br /&gt;
				for k, v in pairs(propclaims) do&lt;br /&gt;
					out[#out + 1] = &amp;quot;Q&amp;quot; .. v.mainsnak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
				end&lt;br /&gt;
				return table.concat(out, &amp;quot;, &amp;quot;)&lt;br /&gt;
			else&lt;br /&gt;
				-- not a wikibase-entityid, so return empty&lt;br /&gt;
				return &amp;quot;&amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- no claim, so return empty&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;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;RexxS</name></author>
	</entry>
</feed>