<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ar">
	<id>https://3rabica.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3AWikidata2%2Ffunctions</id>
	<title>وحدة:Wikidata2/functions - تاريخ المراجعة</title>
	<link rel="self" type="application/atom+xml" href="https://3rabica.org/index.php?action=history&amp;feed=atom&amp;title=%D9%88%D8%AD%D8%AF%D8%A9%3AWikidata2%2Ffunctions"/>
	<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Wikidata2/functions&amp;action=history"/>
	<updated>2026-06-05T04:42:40Z</updated>
	<subtitle>تاريخ التعديل لهذه الصفحة في الويكي</subtitle>
	<generator>MediaWiki 1.43.7</generator>
	<entry>
		<id>https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Wikidata2/functions&amp;diff=2535&amp;oldid=prev</id>
		<title>عبد العزيز في 00:35، 1 أبريل 2023</title>
		<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Wikidata2/functions&amp;diff=2535&amp;oldid=prev"/>
		<updated>2023-04-01T00:35:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ar&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;→ نسخة أقدم&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;نسخة 04:35، 1 أبريل 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;ar&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(لا فرق)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key arabica_wiki:diff:1.41:old-2401:rev-2535 --&gt;
&lt;/table&gt;</summary>
		<author><name>عبد العزيز</name></author>
	</entry>
	<entry>
		<id>https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Wikidata2/functions&amp;diff=2401&amp;oldid=prev</id>
		<title>عبد العزيز في 00:35، 1 أبريل 2023</title>
		<link rel="alternate" type="text/html" href="https://3rabica.org/index.php?title=%D9%88%D8%AD%D8%AF%D8%A9:Wikidata2/functions&amp;diff=2401&amp;oldid=prev"/>
		<updated>2023-04-01T00:35:12Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;صفحة جديدة&lt;/b&gt;&lt;/p&gt;&lt;div&gt;--[[&lt;br /&gt;
&lt;br /&gt;
Link of copy of main module used (Module:Wikidata2/functions):&lt;br /&gt;
https://ar.wikipedia.org/w/index.php?title=وحدة:Wikidata2/ملعب&amp;amp;oldid=58189763&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local help_functions = {}&lt;br /&gt;
local ModuleTime = require &amp;quot;Module:wikidata2/time&amp;quot;&lt;br /&gt;
help_functions.Frame_args = {} &lt;br /&gt;
help_functions.i18n = {&lt;br /&gt;
	[&amp;quot;errors&amp;quot;] = {&lt;br /&gt;
		[&amp;quot;property-param-not-provided&amp;quot;] = &amp;quot;وسيط property غير متوفر.&amp;quot;,&lt;br /&gt;
		[&amp;quot;entity-not-found&amp;quot;] = &amp;quot;الكيان غير موجود.&amp;quot;,&lt;br /&gt;
		[&amp;quot;unknown-claim-type&amp;quot;] = &amp;quot;نوع claim غير معروف.&amp;quot;,&lt;br /&gt;
		[&amp;quot;unknown-snak-type&amp;quot;] = &amp;quot;نوع snak غير معروف.&amp;quot;,&lt;br /&gt;
		[&amp;quot;unknown-datatype&amp;quot;] = &amp;quot;نوع data غير معروف.&amp;quot;,&lt;br /&gt;
		[&amp;quot;unknown-entity-type&amp;quot;] = &amp;quot;نوع entity غير معروف.&amp;quot;,&lt;br /&gt;
		[&amp;quot;unknown-value-module&amp;quot;] = &amp;quot;يجب عليك تعيين كل من  value-module و value-function.&amp;quot;,&lt;br /&gt;
		[&amp;quot;unknown-claim-module&amp;quot;] = &amp;quot;يجب عليك تعيين كل من claim-module و claim-function.&amp;quot;,&lt;br /&gt;
		[&amp;quot;unknown-property-module&amp;quot;] = &amp;quot;يجب عليك تعيين كل من property-module و property-function.&amp;quot;,&lt;br /&gt;
		[&amp;quot;property-module-not-found&amp;quot;] = &amp;quot;الوحدة المستخدمة في وسيط property-module غير موجودة.&amp;quot;,&lt;br /&gt;
		[&amp;quot;property-function-not-found&amp;quot;] = &amp;quot;الوظيفة المستخدمة في وسيط property-function غير موجودة.&amp;quot;,&lt;br /&gt;
		[&amp;quot;value-module-not-found&amp;quot;] = &amp;quot;الوحدة المستخدمة في وسيط value-module غير موجودة.&amp;quot;,&lt;br /&gt;
		[&amp;quot;value-function-not-found&amp;quot;] = &amp;quot;الوظيفة المستخدمة في وسيط value-function غير موجودة.&amp;quot;,&lt;br /&gt;
		[&amp;quot;claim-module-not-found&amp;quot;] = &amp;quot;الوحدة المستخدمة في وسيط claim-module غير موجودة.&amp;quot;,&lt;br /&gt;
		[&amp;quot;claim-function-not-found&amp;quot;] = &amp;quot;الوظيفة المستخدمة في وسيط claim-function غير موجودة.&amp;quot;&lt;br /&gt;
	},&lt;br /&gt;
	[&amp;quot;noarabiclabel&amp;quot;] = &amp;quot;تصنيف:صفحات_ويكي_بيانات_بحاجة_لتسمية_عربية&amp;quot;,&lt;br /&gt;
	[&amp;quot;warnDump&amp;quot;] = &amp;quot;[[Category:Called function &amp;#039;Dump&amp;#039; from module Wikidata]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;somevalue&amp;quot;] = &amp;quot;&amp;quot;,	--&amp;#039;&amp;#039;غير محدد&amp;#039;&amp;#039;&lt;br /&gt;
	[&amp;quot;novalue&amp;quot;] = &amp;quot;&amp;quot;, 	--قيمة مجهولة&lt;br /&gt;
	[&amp;quot;cateref&amp;quot;] = &amp;quot;[[&amp;quot; .. &amp;quot;تصنيف:صفحات بها مراجع ويكي بيانات&amp;quot; .. &amp;quot;]]&amp;quot;,&lt;br /&gt;
	[&amp;quot;to translate&amp;quot;] = &amp;quot;صفحات تستعمل معطيات من ويكي بيانات بحاجة لترجمة&amp;quot;,&lt;br /&gt;
	[&amp;quot;trackingcat&amp;quot;] = &amp;quot;صفحات تستخدم خاصية $1&amp;quot;,&lt;br /&gt;
	[&amp;quot;see-wikidata-value&amp;quot;] = &amp;quot;الاطلاع ومراجعة البيانات على ويكي داتا&amp;quot;,&lt;br /&gt;
	[&amp;quot;see-wikidata&amp;quot;] = &amp;quot;راجع العنصر من ويكي بيانات المقابل&amp;quot;,&lt;br /&gt;
	[&amp;quot;see-another-project&amp;quot;] = &amp;quot;مقالة على $1&amp;quot;,&lt;br /&gt;
	[&amp;quot;see-another-language&amp;quot;] = &amp;quot;مقالة على أرابيكا $1&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
help_functions.sortingproperties = {&amp;quot;P585&amp;quot;, &amp;quot;P571&amp;quot;, &amp;quot;P580&amp;quot;, &amp;quot;P569&amp;quot;, &amp;quot;P582&amp;quot;, &amp;quot;P570&amp;quot;}&lt;br /&gt;
help_functions.sorting_methods = {&lt;br /&gt;
	[&amp;quot;chronological&amp;quot;] = &amp;quot;chronological&amp;quot;,&lt;br /&gt;
	[&amp;quot;تصاعدي&amp;quot;] = &amp;quot;chronological&amp;quot;,&lt;br /&gt;
	[&amp;quot;asc&amp;quot;] = &amp;quot;chronological&amp;quot;,&lt;br /&gt;
	[&amp;quot;inverted&amp;quot;] = &amp;quot;inverted&amp;quot;,&lt;br /&gt;
	[&amp;quot;تنازلي&amp;quot;] = &amp;quot;inverted&amp;quot;,&lt;br /&gt;
	[&amp;quot;desc&amp;quot;] = &amp;quot;inverted&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
help_functions.skiip = {&lt;br /&gt;
	[&amp;quot;P106&amp;quot;] = {&lt;br /&gt;
		&amp;quot;Q42857&amp;quot;, -- prophet&lt;br /&gt;
		&amp;quot;Q14886050&amp;quot;, -- terrorist&lt;br /&gt;
		&amp;quot;Q2159907&amp;quot; -- criminal&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
local function isvalid(x)&lt;br /&gt;
	if x and x ~= &amp;quot;&amp;quot; then return x end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.formatFromPattern(str, options)&lt;br /&gt;
	-- [[	function to replace $1 with string	]]&lt;br /&gt;
	local str = string.gsub(str, &amp;quot;%%&amp;quot;, &amp;quot;%%%%&amp;quot;)&lt;br /&gt;
	if options.pattern and options.pattern ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		str = mw.ustring.gsub(options.pattern, &amp;quot;$1&amp;quot;, str) --الحصول على اول نتيجة للدالة&lt;br /&gt;
	end&lt;br /&gt;
	return str&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.formatError(key)&lt;br /&gt;
	return help_functions.i18n.errors[key]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.count_Site_Links(id)&lt;br /&gt;
	numb = 0&lt;br /&gt;
	Table = {}&lt;br /&gt;
	local entity = mw.wikibase.getEntityObject(id)&lt;br /&gt;
	if entity and entity.sitelinks then&lt;br /&gt;
		for i, v in pairs(entity.sitelinks) do&lt;br /&gt;
			Table[v.site] = v.title&lt;br /&gt;
			numb = numb + 1&lt;br /&gt;
		end&lt;br /&gt;
	--return Frame:extensionTag(&amp;quot;source&amp;quot;, mw.dumpObject( Table ),{ lang= &amp;#039;lua&amp;#039;})&lt;br /&gt;
	end&lt;br /&gt;
	return numb&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.make_format_num(String)&lt;br /&gt;
	local line = String&lt;br /&gt;
	line = mw.getCurrentFrame():preprocess(&amp;quot;{{ {{{|safesubst:}}}formatnum: &amp;quot; .. String .. &amp;quot; }}&amp;quot;)&lt;br /&gt;
	line = mw.ustring.gsub(line, &amp;quot;٫&amp;quot;, &amp;quot;.&amp;quot;)&lt;br /&gt;
	line = mw.ustring.gsub(line, &amp;quot;٬&amp;quot;, &amp;quot;,&amp;quot;)&lt;br /&gt;
	return line&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.formatcharacters(label, options)&lt;br /&gt;
	local formatcharacters = options.formatcharacters&lt;br /&gt;
	--if options.FormatfirstCharacter and options.num == 1 then&lt;br /&gt;
	--formatcharacters = options.FormatfirstCharacter&lt;br /&gt;
	--end&lt;br /&gt;
	if not label then return label end&lt;br /&gt;
	local String2 = mw.ustring.gsub(label, &amp;quot;–&amp;quot;, &amp;quot;-&amp;quot;)&lt;br /&gt;
	local march_y = mw.ustring.match(String2, &amp;quot;%d%d%d%d%-%d%d%d%d&amp;quot;, 1) or &lt;br /&gt;
		mw.ustring.match(String2, &amp;quot;%d%d%-%d%d%d%d&amp;quot;, 1) or &lt;br /&gt;
		mw.ustring.match(String2, &amp;quot;%d%d%d%d&amp;quot;, 1) or &lt;br /&gt;
		mw.ustring.match(String2, &amp;quot;%d%d%d%d%-%d%d&amp;quot;, 1) or&lt;br /&gt;
		mw.ustring.match(String2, &amp;quot;%d%d%d%d&amp;quot;, 1)&lt;br /&gt;
		&lt;br /&gt;
	if options.illwd2y and options.illwd2y ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		ca = march_y or label&lt;br /&gt;
		return ca&lt;br /&gt;
	end&lt;br /&gt;
	if options.illwd2noy and options.illwd2noy ~= &amp;quot;&amp;quot; and march_y then&lt;br /&gt;
		label = mw.ustring.gsub(label, march_y, &amp;quot;&amp;quot;)&lt;br /&gt;
		return label&lt;br /&gt;
	end&lt;br /&gt;
	if not formatcharacters or formatcharacters == &amp;quot;&amp;quot; then&lt;br /&gt;
		return label&lt;br /&gt;
	end&lt;br /&gt;
	function preproces(Type, label)&lt;br /&gt;
		return mw.getCurrentFrame():preprocess(&amp;quot;{{ {{{|safesubst:}}}&amp;quot; .. Type .. &amp;quot;:&amp;quot; .. label .. &amp;quot; }}&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	if formatcharacters == &amp;quot;lcfirst&amp;quot; then&lt;br /&gt;
		return preproces(&amp;quot;lcfirst&amp;quot;, label)&lt;br /&gt;
	elseif formatcharacters == &amp;quot;ucfirst&amp;quot; then&lt;br /&gt;
		return mw.language.getContentLanguage():ucfirst(label)&lt;br /&gt;
	elseif formatcharacters == &amp;quot;lc&amp;quot; then&lt;br /&gt;
		return preproces(&amp;quot;lc&amp;quot;, label)&lt;br /&gt;
	elseif formatcharacters == &amp;quot;uc&amp;quot; then&lt;br /&gt;
		return preproces(&amp;quot;uc&amp;quot;, label)&lt;br /&gt;
	elseif formatcharacters == &amp;quot;formatnum&amp;quot; then&lt;br /&gt;
		return help_functions.make_format_num(label)&lt;br /&gt;
	end&lt;br /&gt;
	return label&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.getqualifierbysortingproperty(claim, sortingproperty)&lt;br /&gt;
	for k, v in pairs(sortingproperty) do&lt;br /&gt;
		if claim.qualifiers and claim.qualifiers[v] and claim.qualifiers[v][1].snaktype == &amp;quot;value&amp;quot; then&lt;br /&gt;
			vali = claim.qualifiers[v][1].datavalue.value.time or claim.qualifiers[v][1].datavalue.value.amount&lt;br /&gt;
			if vali:sub(1, 1) == &amp;quot;+&amp;quot; then&lt;br /&gt;
				vali = vali:sub(2)&lt;br /&gt;
			end&lt;br /&gt;
			--mw.log(vali)&lt;br /&gt;
			return vali&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.get_entityId(options)&lt;br /&gt;
	local id = options.entityId or options.entityid or options.id or options.qid&lt;br /&gt;
	if isvalid(id) == nil then&lt;br /&gt;
		if isvalid(options.page) then&lt;br /&gt;
			id = mw.wikibase.getEntityIdForTitle( options.page )&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	--mw.log(&amp;quot;id :&amp;quot; .. id)&lt;br /&gt;
	return id or &amp;quot;&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.descriptionIn(langcode, id) -- returns item description for a given language&lt;br /&gt;
	local lan = langcode&lt;br /&gt;
	if not lan or lan == &amp;quot;&amp;quot; then&lt;br /&gt;
		lan = &amp;quot;ar&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if lan == &amp;quot;ar&amp;quot; then&lt;br /&gt;
		local description, lange = mw.wikibase.getDescriptionWithLang(id)&lt;br /&gt;
		if lange == lan then&lt;br /&gt;
			return description&lt;br /&gt;
		else&lt;br /&gt;
			return nil&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		local entity = help_functions.getEntityFromId(id)&lt;br /&gt;
		if entity and entity.descriptions then&lt;br /&gt;
			local description = entity.descriptions[lan]&lt;br /&gt;
			if description and description.value then&lt;br /&gt;
				if description[&amp;quot;language&amp;quot;] == lan then&lt;br /&gt;
					return description.value&lt;br /&gt;
				else&lt;br /&gt;
					return nil&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.labelIn(langcode, id) -- returns item label for a given language&lt;br /&gt;
	local lang = langcode&lt;br /&gt;
	if not langcode or langcode == &amp;quot;&amp;quot; then&lt;br /&gt;
		lang = &amp;quot;ar&amp;quot;&lt;br /&gt;
	end&lt;br /&gt;
	if type(id) ~= &amp;quot;string&amp;quot; then&lt;br /&gt;
		id = tostring(id)&lt;br /&gt;
	end&lt;br /&gt;
	local label = mw.wikibase.getLabelByLang(id, lang) or nil&lt;br /&gt;
	return label&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.get_snak_id(snak)&lt;br /&gt;
	if&lt;br /&gt;
		snak and snak.type and snak.type == &amp;quot;statement&amp;quot; and snak.mainsnak and snak.mainsnak.snaktype and&lt;br /&gt;
			snak.mainsnak.snaktype == &amp;quot;value&amp;quot; and&lt;br /&gt;
			snak.mainsnak.datavalue and&lt;br /&gt;
			snak.mainsnak.datavalue.type and&lt;br /&gt;
			snak.mainsnak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot; and&lt;br /&gt;
			snak.mainsnak.datavalue.value and&lt;br /&gt;
			snak.mainsnak.datavalue.value.id&lt;br /&gt;
	 then&lt;br /&gt;
		--ID = &amp;#039;Q&amp;#039; .. snak.datavalue.value[&amp;#039;numeric-id&amp;#039;]&lt;br /&gt;
		ID = snak.mainsnak.datavalue.value.id&lt;br /&gt;
		return ID&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.comparedates(a, b) -- returns true if a is earlier than B or if a has a date but not b&lt;br /&gt;
	local a = tonumber(a) or a&lt;br /&gt;
	local b = tonumber(b) or b&lt;br /&gt;
	if a and b then&lt;br /&gt;
		return a &amp;gt; b&lt;br /&gt;
	elseif a then&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.getEntityIdFromValue(value)&lt;br /&gt;
	if value then&lt;br /&gt;
		if value[&amp;quot;entity-type&amp;quot;] == &amp;quot;item&amp;quot; then&lt;br /&gt;
			return &amp;quot;Q&amp;quot; .. value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
		elseif value[&amp;quot;entity-type&amp;quot;] == &amp;quot;property&amp;quot; then&lt;br /&gt;
			return &amp;quot;P&amp;quot; .. value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return help_functions.formatError(&amp;quot;unknown-entity-type&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.getEntityFromId(id)&lt;br /&gt;
	if id and id ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		--	if not(mw.wikibase.isValidEntityId(id)) or not(mw.wikibase.entityExists(id)) then&lt;br /&gt;
		--	return false&lt;br /&gt;
		--end&lt;br /&gt;
		return mw.wikibase.getEntityObject(id)&lt;br /&gt;
	else&lt;br /&gt;
		return mw.wikibase.getEntityObject()&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.claimindex(claims, options)&lt;br /&gt;
	local claims2 = {}&lt;br /&gt;
	for j, index in pairs(mw.text.split(options.claimindex, &amp;quot;,&amp;quot;)) do&lt;br /&gt;
		if tonumber(index) and #claims &amp;gt;= tonumber(index) then&lt;br /&gt;
			table.insert(claims2, claims[tonumber(index)])&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return claims2&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.avoidvalue(claims, options)&lt;br /&gt;
	-- options.avoidvalue&lt;br /&gt;
	-- to avoid values&lt;br /&gt;
	local claims4 = {}&lt;br /&gt;
	local vaild&lt;br /&gt;
	local toavoid&lt;br /&gt;
	if (type(options.avoidvalue) == &amp;quot;string&amp;quot;) then&lt;br /&gt;
		toavoid = mw.text.split(options.avoidvalue, &amp;quot;,&amp;quot;)&lt;br /&gt;
	elseif (type(options.avoidvalue) == &amp;quot;table&amp;quot;) then&lt;br /&gt;
		toavoid = options.avoidvalue&lt;br /&gt;
	else&lt;br /&gt;
		return claims&lt;br /&gt;
	end&lt;br /&gt;
	for i, j in pairs(claims) do&lt;br /&gt;
		ID = help_functions.get_snak_id(j)&lt;br /&gt;
		vaild = true&lt;br /&gt;
		if ID then&lt;br /&gt;
			for k, t in pairs(toavoid) do&lt;br /&gt;
				--mw.log(&amp;quot;t: &amp;quot; .. t)&lt;br /&gt;
				if ID == t then&lt;br /&gt;
					vaild = false&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if vaild then&lt;br /&gt;
				table.insert(claims4, j)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return claims4&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.prefervalue(claims, options)&lt;br /&gt;
	local claims4 = {}&lt;br /&gt;
	local prefervalues&lt;br /&gt;
	if (type(options.prefervalue) == &amp;quot;string&amp;quot;) then&lt;br /&gt;
		prefervalues = mw.text.split(options.prefervalue, &amp;quot;,&amp;quot;)&lt;br /&gt;
	elseif (type(options.prefervalue) == &amp;quot;table&amp;quot;) then&lt;br /&gt;
		prefervalues = options.prefervalue&lt;br /&gt;
	else&lt;br /&gt;
		return claims&lt;br /&gt;
	end&lt;br /&gt;
	for i, j in pairs(claims) do&lt;br /&gt;
		ID = help_functions.get_snak_id(j)&lt;br /&gt;
		vaild = false&lt;br /&gt;
		if ID then&lt;br /&gt;
			for k, t in pairs(prefervalues) do&lt;br /&gt;
				if ID == t then&lt;br /&gt;
					table.insert(claims4, j)&lt;br /&gt;
					break&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return claims4&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.avoidqualifier(claims, options)&lt;br /&gt;
	-- options.avoidqualifier&lt;br /&gt;
	-- options.avoidqualifiervalue&lt;br /&gt;
	if not options.avoidqualifier or options.avoidqualifier == &amp;quot;&amp;quot; then&lt;br /&gt;
		return claims&lt;br /&gt;
	end&lt;br /&gt;
	local av = options.avoidqualifier:upper()&lt;br /&gt;
	local claims2 = {}&lt;br /&gt;
	for i, statement in pairs(claims) do&lt;br /&gt;
		if not statement.qualifiers or not statement.qualifiers[options.avoidqualifier:upper()] then&lt;br /&gt;
			table.insert(claims2, statement)&lt;br /&gt;
		elseif statement.qualifiers and statement.qualifiers[av] then&lt;br /&gt;
			if options.avoidqualifiervalue and options.avoidqualifiervalue ~= &amp;quot;&amp;quot; then&lt;br /&gt;
				list = {}&lt;br /&gt;
				if (type(options.avoidqualifiervalue) == &amp;quot;string&amp;quot;) then&lt;br /&gt;
					list = mw.text.split(options.avoidqualifiervalue, &amp;quot;,&amp;quot;)&lt;br /&gt;
				elseif (type(options.avoidqualifiervalue) == &amp;quot;table&amp;quot;) then&lt;br /&gt;
					list = options.avoidqualifiervalue&lt;br /&gt;
				end&lt;br /&gt;
				local active = true&lt;br /&gt;
				for k, t in pairs(list) do&lt;br /&gt;
					for ii, quall in pairs(statement.qualifiers[av]) do&lt;br /&gt;
						if&lt;br /&gt;
							quall.snaktype == &amp;quot;value&amp;quot; and quall.datavalue and quall.datavalue.value and&lt;br /&gt;
								quall.datavalue.value[&amp;quot;id&amp;quot;]&lt;br /&gt;
						 then&lt;br /&gt;
							if quall.datavalue.value[&amp;quot;id&amp;quot;] == t then&lt;br /&gt;
								active = false&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				if active then&lt;br /&gt;
					table.insert(claims2, statement)&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return claims2&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.preferqualifier(claims, options)&lt;br /&gt;
	-- options.preferqualifier&lt;br /&gt;
	-- options.preferqualifiervalue&lt;br /&gt;
	mw.log(&amp;quot;preferqualifier: &amp;quot; .. options.preferqualifier)&lt;br /&gt;
	local preferqualifiers = options.preferqualifier:upper()&lt;br /&gt;
&lt;br /&gt;
	local claims2 = {}&lt;br /&gt;
	for i, statement in pairs(claims) do --&lt;br /&gt;
		if statement.qualifiers and statement.qualifiers[preferqualifiers] then&lt;br /&gt;
			if options.preferqualifiervalue and options.preferqualifiervalue ~= &amp;quot;&amp;quot; then&lt;br /&gt;
				for k, t in pairs(mw.text.split(options.preferqualifiervalue, &amp;quot;,&amp;quot;)) do&lt;br /&gt;
					for ii, quall in pairs(statement.qualifiers[preferqualifiers]) do&lt;br /&gt;
						--mw.log( &amp;quot;value &amp;quot; .. value )&lt;br /&gt;
						snaktype = quall.snaktype&lt;br /&gt;
						if snaktype == &amp;quot;value&amp;quot; then&lt;br /&gt;
							ty = quall.datavalue.value[&amp;quot;id&amp;quot;]&lt;br /&gt;
							if ty and ty == t then&lt;br /&gt;
								table.insert(claims2, statement)&lt;br /&gt;
								break&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				table.insert(claims2, statement)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return claims2&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.sortbyqualifier(claims, sorting_properties, options)&lt;br /&gt;
	local sortbytime = help_functions.sorting_methods[options.sortbytime] or options.sortbytime&lt;br /&gt;
	table.sort(&lt;br /&gt;
		claims,&lt;br /&gt;
		function(a, b)&lt;br /&gt;
			local timeA = help_functions.getqualifierbysortingproperty(a, sorting_properties)&lt;br /&gt;
			local timeB = help_functions.getqualifierbysortingproperty(b, sorting_properties)&lt;br /&gt;
			if sortbytime == &amp;quot;inverted&amp;quot; then&lt;br /&gt;
				return help_functions.comparedates(timeB, timeA)&lt;br /&gt;
			else&lt;br /&gt;
				return help_functions.comparedates(timeA, timeB)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	)&lt;br /&gt;
	return claims&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.sortbyqualifiernumber(claims, options, sorting_properties)&lt;br /&gt;
	if not sorting_properties then&lt;br /&gt;
		if (type(options.sortingproperty) == &amp;quot;table&amp;quot;) then&lt;br /&gt;
			sorting_properties = options.sortingproperty&lt;br /&gt;
		elseif (type(options.sortingproperty) == &amp;quot;string&amp;quot;) and options.sortingproperty ~= &amp;quot;&amp;quot; then&lt;br /&gt;
			sorting_properties = mw.text.split(options.sortingproperty, &amp;quot;,&amp;quot;)&lt;br /&gt;
		else&lt;br /&gt;
			sorting_properties = help_functions.sortingproperties&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local sortbynumber = help_functions.sorting_methods[options.sortbynumber] or options.sortbynumber&lt;br /&gt;
	table.sort(&lt;br /&gt;
		claims,&lt;br /&gt;
		function(a, b)&lt;br /&gt;
			local timeA = help_functions.getqualifierbysortingproperty(a, sorting_properties)&lt;br /&gt;
			local timeB = help_functions.getqualifierbysortingproperty(b, sorting_properties)&lt;br /&gt;
			if sortbynumber == &amp;quot;inverted&amp;quot; then&lt;br /&gt;
				return help_functions.comparedates(timeB, timeA)&lt;br /&gt;
			else&lt;br /&gt;
				return help_functions.comparedates(timeA, timeB)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	)&lt;br /&gt;
	return claims&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.sortbyarb(claims, sorting_properties, options)&lt;br /&gt;
	local sortingmethod = options.sortbyarbitrary or options.sortingmethod&lt;br /&gt;
	sortingmethod = help_functions.sorting_methods[sortingmethod] or sortingmethod&lt;br /&gt;
	--mw.log(&amp;quot;sortbyarb: &amp;quot; .. sortingmethod)&lt;br /&gt;
&lt;br /&gt;
	table.sort(&lt;br /&gt;
		claims,&lt;br /&gt;
		function(a, b)&lt;br /&gt;
			local timeA = getDateArb(a, sorting_properties)&lt;br /&gt;
			local timeB = getDateArb(b, sorting_properties)&lt;br /&gt;
			if sortingmethod == &amp;quot;inverted&amp;quot; then&lt;br /&gt;
				return help_functions.comparedates(timeB, timeA)&lt;br /&gt;
			else&lt;br /&gt;
				return help_functions.comparedates(timeA, timeB)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	)&lt;br /&gt;
	return claims&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.claims_limit(claims, limit)&lt;br /&gt;
	local newclaims = {}&lt;br /&gt;
	local ic = 0&lt;br /&gt;
	if #claims &amp;gt; limit then -- limit is not 0&lt;br /&gt;
		for i = 1, #claims do&lt;br /&gt;
			if i &amp;lt;= limit then&lt;br /&gt;
				newclaims[ic] = claims[i]&lt;br /&gt;
				ic = ic + 1&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return newclaims&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.claims_offset(claims, offset)&lt;br /&gt;
	local offsetclaims = {}&lt;br /&gt;
	local ic = 1&lt;br /&gt;
	if #claims &amp;gt; offset then -- offset is not 0&lt;br /&gt;
		for i = 1, #claims do&lt;br /&gt;
			if i &amp;gt; offset then&lt;br /&gt;
				offsetclaims[#offsetclaims + 1] = claims[i]&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return offsetclaims&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.filter_claims(claims, options)&lt;br /&gt;
	local claims = claims&lt;br /&gt;
	--===========&lt;br /&gt;
	local offset = options.offset&lt;br /&gt;
	if offset and offset ~= &amp;quot;&amp;quot; and type(offset) ~= &amp;quot;number&amp;quot; then&lt;br /&gt;
		offset = tonumber(offset)&lt;br /&gt;
		claims = help_functions.claims_offset(claims, offset)&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	local limit = options.limit&lt;br /&gt;
	if limit and limit ~= &amp;quot;&amp;quot; and type(limit) ~= &amp;quot;number&amp;quot; then&lt;br /&gt;
		limit = tonumber(limit)&lt;br /&gt;
		claims = help_functions.claims_limit(claims, limit)&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	if options.avoidqualifier and options.avoidqualifier ~= &amp;quot;&amp;quot; then -- to avoid value with a given qualifier&lt;br /&gt;
		claims = help_functions.avoidqualifier(claims, options)&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	if options.preferqualifier and options.preferqualifier ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		claims = help_functions.preferqualifier(claims, options)&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	-- options.avoidvalue&lt;br /&gt;
	if options.avoidvalue and options.avoidvalue ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		claims = help_functions.avoidvalue(claims, options)&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	-- options.prefervalue&lt;br /&gt;
	if options.prefervalue and options.prefervalue ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		claims = help_functions.prefervalue(claims, options)&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	if not options.langpref or options.langpref == &amp;quot;&amp;quot; then&lt;br /&gt;
		local claims7 = {}&lt;br /&gt;
		for i, statement in pairs(claims) do&lt;br /&gt;
			if statement.qualifiers and statement.qualifiers.P407 then&lt;br /&gt;
				for k, v in pairs(statement.qualifiers.P407) do&lt;br /&gt;
					if v.snaktype == &amp;quot;value&amp;quot; and v.datavalue.value[&amp;quot;numeric-id&amp;quot;] == 13955 then -- Q13955 = &amp;#039;العربية&amp;#039;&lt;br /&gt;
						table.insert(claims7, statement)&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			elseif statement.qualifiers and statement.qualifiers.P282 then&lt;br /&gt;
				for k, v in pairs(statement.qualifiers.P282) do&lt;br /&gt;
					if v.snaktype == &amp;quot;value&amp;quot; and v.datavalue.value[&amp;quot;numeric-id&amp;quot;] == 8196 then -- Q8196 = &amp;#039;أبجدية عربية&amp;#039;&lt;br /&gt;
						table.insert(claims7, statement)&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if #claims7 &amp;gt; 0 then&lt;br /&gt;
			claims = claims7&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	local sortingmethod = options.sortbyarbitrary or options.sortingmethod&lt;br /&gt;
	local sorting_properties = {}&lt;br /&gt;
&lt;br /&gt;
	if (type(options.sortingproperty) == &amp;quot;table&amp;quot;) then&lt;br /&gt;
		sorting_properties = options.sortingproperty&lt;br /&gt;
	elseif (type(options.sortingproperty) == &amp;quot;string&amp;quot;) and options.sortingproperty ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		sorting_properties = mw.text.split(options.sortingproperty, &amp;quot;,&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if isvalid(options.sortbytime) then&lt;br /&gt;
		if #sorting_properties == 0 then&lt;br /&gt;
			sorting_properties = help_functions.sortingproperties&lt;br /&gt;
		end&lt;br /&gt;
		claims = help_functions.sortbyqualifier(claims, sorting_properties, options)&lt;br /&gt;
&lt;br /&gt;
	elseif isvalid(options.sortbynumber) then&lt;br /&gt;
		claims = help_functions.sortbyqualifiernumber(claims, options, sorting_properties)&lt;br /&gt;
&lt;br /&gt;
	elseif isvalid(sortingmethod) then&lt;br /&gt;
		claims = help_functions.sortbyarb(claims, sorting_properties, options)&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	local firstvalue = options.enbarten or options.firstvalue&lt;br /&gt;
	if firstvalue and firstvalue ~= &amp;quot;&amp;quot; and #claims &amp;gt; 1 then&lt;br /&gt;
		if firstvalue == &amp;quot;2&amp;quot; then&lt;br /&gt;
			claims = {claims[2]}&lt;br /&gt;
		elseif firstvalue == &amp;quot;3&amp;quot; and #claims &amp;gt; 2 then&lt;br /&gt;
			claims = {claims[3]}&lt;br /&gt;
		elseif firstvalue == &amp;quot;4&amp;quot; and #claims &amp;gt; 3 then&lt;br /&gt;
			claims = {claims[4]}&lt;br /&gt;
		elseif firstvalue == &amp;quot;5&amp;quot; and #claims &amp;gt; 4 then&lt;br /&gt;
			claims = {claims[5]}&lt;br /&gt;
		elseif firstvalue == &amp;quot;6&amp;quot; and #claims &amp;gt; 5 then&lt;br /&gt;
			claims = {claims[6]}&lt;br /&gt;
		elseif firstvalue == &amp;quot;7&amp;quot; and #claims &amp;gt; 6 then&lt;br /&gt;
			claims = {claims[7]}&lt;br /&gt;
		elseif firstvalue == &amp;quot;8&amp;quot; and #claims &amp;gt; 7 then&lt;br /&gt;
			claims = {claims[8]}&lt;br /&gt;
		elseif firstvalue == &amp;quot;9&amp;quot; and #claims &amp;gt; 8 then&lt;br /&gt;
			claims = {claims[9]}&lt;br /&gt;
		else&lt;br /&gt;
			claims = {claims[1]}&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	local numval = options.numval&lt;br /&gt;
	if numval and type(numval) ~= &amp;quot;number&amp;quot; then&lt;br /&gt;
		numval = tonumber(numval)&lt;br /&gt;
	end&lt;br /&gt;
	if numval and type(numval) == &amp;quot;number&amp;quot; and #claims &amp;gt; 1 and #claims &amp;gt; numval then&lt;br /&gt;
		local claimsnumval = {}&lt;br /&gt;
		local ic = 1&lt;br /&gt;
		while (numval &amp;gt;= ic) and (#claims &amp;gt;= ic) do&lt;br /&gt;
			table.insert(claimsnumval, claims[ic])&lt;br /&gt;
			ic = ic + 1&lt;br /&gt;
		end&lt;br /&gt;
		claims = claimsnumval&lt;br /&gt;
	end&lt;br /&gt;
	--===========&lt;br /&gt;
	return claims&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.formattabulardata(datavalue, datatype, options)&lt;br /&gt;
	--[[ tabular-data]]&lt;br /&gt;
	data = &amp;quot;[[commons:&amp;quot; .. datavalue.value .. &amp;quot;|&amp;quot; .. datavalue.value .. &amp;quot;]]&amp;quot;&lt;br /&gt;
	return {value = data}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.formatgeoshape(datavalue, datatype, options)&lt;br /&gt;
	--[[ geo-shape ]]&lt;br /&gt;
	shape = &amp;quot;[[commons:&amp;quot; .. datavalue.value .. &amp;quot;|&amp;quot; .. datavalue.value .. &amp;quot;]]&amp;quot;&lt;br /&gt;
	return {value = shape}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.formatmath(datavalue, datatype, options)&lt;br /&gt;
	--[[ datatype math ]]&lt;br /&gt;
	--return	{value = mw.text.tag(&amp;#039;math&amp;#039;, {}, &amp;#039;&amp;#039;.. datavalue.value..&amp;#039;&amp;#039;) } -- that doesn&amp;#039;t work well&lt;br /&gt;
	return {value = mw.getCurrentFrame():callParserFunction(&amp;quot;#tag:math&amp;quot;, &amp;quot;&amp;quot; .. datavalue.value .. &amp;quot;&amp;quot;)}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.formatstring(datavalue, datatype, options)&lt;br /&gt;
	--[[ datatype	string	-  external-id ]]&lt;br /&gt;
	local par = options.pattern&lt;br /&gt;
	if options.stringpattern and options.stringpattern ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		--mw.log(options.stringpattern)&lt;br /&gt;
		tid = mw.ustring.gsub(options.stringpattern, &amp;quot;$1&amp;quot;, datavalue.value)&lt;br /&gt;
	elseif par and par ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		if par == &amp;quot;autourl&amp;quot; or par == &amp;quot;autourl2&amp;quot; or par == &amp;quot;autourl3&amp;quot; or par == &amp;quot;autourl4&amp;quot; then&lt;br /&gt;
			tid = help_functions.formatcharacters(datavalue.value, options)&lt;br /&gt;
		else&lt;br /&gt;
			tid = help_functions.formatFromPattern(help_functions.formatcharacters(datavalue.value, options), options)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		tid = help_functions.formatcharacters(datavalue.value, options)&lt;br /&gt;
	end&lt;br /&gt;
	return {value = tid}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.formattime(datavalue, datatype, options)&lt;br /&gt;
	--[[  datatype	 time  ]]&lt;br /&gt;
	local timen = datavalue.value&lt;br /&gt;
	local modifytime = (options.modifytime or &amp;quot;&amp;quot;)&lt;br /&gt;
	local tid = ModuleTime.getdate(timen, options)&lt;br /&gt;
	-- local tid =	mw.getCurrentFrame():preprocess(mall)&lt;br /&gt;
	if options.modifytime and options.modifytime ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		if options.modifytime == &amp;quot;q&amp;quot; then&lt;br /&gt;
			local mall = datavalue.value.time&lt;br /&gt;
			tid = mw.getCurrentFrame():preprocess(mall)&lt;br /&gt;
		elseif options.modifytime == &amp;quot;precision&amp;quot; then&lt;br /&gt;
			local mall = datavalue.value.precision&lt;br /&gt;
			tid = mw.getCurrentFrame():preprocess(mall)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return {value = tid}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.get_site_link(id, wikisite)&lt;br /&gt;
	local site = wikisite or &amp;quot;arwiki&amp;quot;&lt;br /&gt;
	--local link = mw.wikibase.getSitelink( id , site ) or &amp;quot;&amp;quot;&lt;br /&gt;
	--return link&lt;br /&gt;
&lt;br /&gt;
	local entity = mw.wikibase.getEntityObject(id)&lt;br /&gt;
	if&lt;br /&gt;
		entity and entity.sitelinks and entity.sitelinks[&amp;quot;&amp;quot; .. site .. &amp;quot;&amp;quot;] and entity.sitelinks[&amp;quot;&amp;quot; .. site .. &amp;quot;&amp;quot;].site and&lt;br /&gt;
			entity.sitelinks[&amp;quot;&amp;quot; .. site .. &amp;quot;&amp;quot;].title&lt;br /&gt;
	 then&lt;br /&gt;
		if entity.sitelinks[&amp;quot;&amp;quot; .. site .. &amp;quot;&amp;quot;].site == site then&lt;br /&gt;
			return entity.sitelinks[&amp;quot;&amp;quot; .. site .. &amp;quot;&amp;quot;].title&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;quot;&amp;quot;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.getId(snak)&lt;br /&gt;
	if (snak.snaktype == &amp;quot;value&amp;quot;) then&lt;br /&gt;
		if snak.datavalue.type == &amp;quot;wikibase-entityid&amp;quot; then&lt;br /&gt;
			return &amp;quot;Q&amp;quot; .. snak.datavalue.value[&amp;quot;numeric-id&amp;quot;]&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.addLinkBack(str, id, property)&lt;br /&gt;
	if not id then&lt;br /&gt;
		id = help_functions.getEntity()&lt;br /&gt;
	end&lt;br /&gt;
	if not id then&lt;br /&gt;
		return str&lt;br /&gt;
	end&lt;br /&gt;
	if type(property) == &amp;quot;table&amp;quot; then&lt;br /&gt;
		property = property[1]&lt;br /&gt;
	end&lt;br /&gt;
	if type(id) == &amp;quot;table&amp;quot; then&lt;br /&gt;
		id = id.id&lt;br /&gt;
	end&lt;br /&gt;
	local class = &amp;quot;&amp;quot;&lt;br /&gt;
	if property then&lt;br /&gt;
		class = &amp;quot;wd_&amp;quot; .. string.lower(property)&lt;br /&gt;
	end&lt;br /&gt;
	local icon = &amp;quot;[[File:Blue pencil.svg|%s|10px|baseline|class=noviewer|link=%s]]&amp;quot;&lt;br /&gt;
	local title = help_functions.i18n[&amp;quot;see-wikidata-value&amp;quot;]&lt;br /&gt;
	local url = mw.uri.fullUrl(&amp;quot;d:&amp;quot; .. id, &amp;quot;uselang=ar&amp;quot;)&lt;br /&gt;
	url.fragment = property&lt;br /&gt;
	url = tostring(url)&lt;br /&gt;
	local v =&lt;br /&gt;
		mw.html.create(&amp;quot;span&amp;quot;):addClass(class):wikitext(str):tag(&amp;quot;span&amp;quot;):addClass(&amp;quot;noprint wikidata-linkback&amp;quot;):css(&lt;br /&gt;
		&amp;quot;padding-left&amp;quot;,&lt;br /&gt;
		&amp;quot;0.5em&amp;quot;&lt;br /&gt;
	):wikitext(icon:format(title, url)):allDone()&lt;br /&gt;
	return tostring(v)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.Subclass(options)&lt;br /&gt;
	if options then help_functions.Frame_args = options end&lt;br /&gt;
	local parent = options.parent or &amp;quot;&amp;quot;&lt;br /&gt;
	local id = isvalid(options.id) or isvalid(options.qid) or &amp;quot;&amp;quot;&lt;br /&gt;
	local Entity = help_functions.getEntityFromId(id)&lt;br /&gt;
	if Entity then&lt;br /&gt;
		id = Entity.id&lt;br /&gt;
	end&lt;br /&gt;
	local property = isvalid(options.property) or isvalid(options.pid) or &amp;quot;P31&amp;quot;&lt;br /&gt;
	if parent == &amp;quot;&amp;quot; or id == &amp;quot;&amp;quot; or property == &amp;quot;&amp;quot; then&lt;br /&gt;
		return false&lt;br /&gt;
	end&lt;br /&gt;
	local tab = mw.text.split(options.parent, &amp;quot;,&amp;quot;)&lt;br /&gt;
	local result = mw.wikibase.getReferencedEntityId(id, property, tab) -- { &amp;#039;Q5&amp;#039;, &amp;#039;Q2095&amp;#039; } )&lt;br /&gt;
	if not result and property == &amp;quot;P31&amp;quot; then&lt;br /&gt;
		result = mw.wikibase.getReferencedEntityId(id, &amp;quot;P279&amp;quot;, tab)&lt;br /&gt;
	end&lt;br /&gt;
	if result then&lt;br /&gt;
		return true&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.ViewSomething(frame) -- from en:Module:Wikidata&lt;br /&gt;
	if frame.args then help_functions.Frame_args = frame.args end&lt;br /&gt;
&lt;br /&gt;
	local f = (frame.args[1] or frame.args.id) and frame or frame:getParent()&lt;br /&gt;
	if f.args.id and f.args.id ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		aa = f.args.id&lt;br /&gt;
	end&lt;br /&gt;
	local data = mw.wikibase.getEntityObject(aa)&lt;br /&gt;
	if not data then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&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;
		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;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.Dump(frame)&lt;br /&gt;
	if frame.args then Frame_args = frame.args end&lt;br /&gt;
&lt;br /&gt;
	local f = (frame.args[1] or frame.args.id) and frame or frame:getParent()&lt;br /&gt;
	if f.args.id and f.args.id ~= &amp;quot;&amp;quot; then&lt;br /&gt;
		aa = f.args.id&lt;br /&gt;
	end&lt;br /&gt;
	local data = mw.wikibase.getEntityObject(aa)&lt;br /&gt;
	if not data then&lt;br /&gt;
		return help_functions.i18n.warnDump&lt;br /&gt;
	end&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;
			return frame:extensionTag(&amp;quot;source&amp;quot;, mw.dumpObject(data), {lang = &amp;quot;lua&amp;quot;}) .. help_functions.i18n.warnDump&lt;br /&gt;
		end&lt;br /&gt;
		data = data[index] or data[tonumber(index)]&lt;br /&gt;
		if not data then&lt;br /&gt;
			return help_functions.i18n.warnDump&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function help_functions.property_module_function(options, claims)&lt;br /&gt;
	if not options[&amp;quot;property-module&amp;quot;] or not options[&amp;quot;property-function&amp;quot;] then&lt;br /&gt;
		return help_functions.formatError(&amp;quot;unknown-property-module&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	local formatter = require(&amp;quot;Module:&amp;quot; .. options[&amp;quot;property-module&amp;quot;])&lt;br /&gt;
	if not formatter then&lt;br /&gt;
		return help_functions.formatError(&amp;quot;property-module-not-found&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
	local fun = formatter[options[&amp;quot;property-function&amp;quot;]]&lt;br /&gt;
	if not fun then&lt;br /&gt;
		return help_functions.formatError(&amp;quot;property-function-not-found&amp;quot;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	mw.log(&amp;quot;work with property-module: &amp;quot; .. options[&amp;quot;property-module&amp;quot;] .. &amp;quot;|&amp;quot; .. options[&amp;quot;property-function&amp;quot;])&lt;br /&gt;
	&lt;br /&gt;
	return fun(claims, options)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return help_functions&lt;/div&gt;</summary>
		<author><name>عبد العزيز</name></author>
	</entry>
</feed>