Difference between revisions of "Module:Sandbox/RexxS/TA98"

From blackwiki
Jump to navigation Jump to search
blackwiki>RexxS
(see the props table)
blackwiki>RexxS
(see the props table)
Line 8: Line 8:
 
local out = {}
 
local out = {}
 
for k, v in pairs(props) do
 
for k, v in pairs(props) do
if k == 'value' then
+
-- if k == 'value' then
out[#out + 1] = "www.unifr.ch/ifaa/Public/EntryPage/TA98%20Tree/Entity%20TA98%20EN/" .. v .. "%20Entity%20TA98%20EN.htm " .. v .. "]"
+
out[#out + 1] = "k = " .. k .. " --- v = " .. v
end
+
-- end
 
end
 
end
 
ret = table.concat(out, "<br> ")
 
ret = table.concat(out, "<br> ")
Line 16: Line 16:
 
ret = "Invalid TA"
 
ret = "Invalid TA"
 
end
 
end
return table.concat(props, " --- ")
+
return ret
 
end
 
end
  
 
return p
 
return p

Revision as of 22:46, 21 September 2014

Usage

{{#invoke:Sandbox/RexxS|getTAValue}}

This is used to get the TA98 (Terminologia Anatomica first edition 1998) values (property P1323) - example: 'A01.1.00.005'

These are then linked to the corresponding urls - example: http://www.unifr.ch/ifaa/Public/EntryPage/TA98%20Tree/Entity%20TA98%20EN/01.1.00.005%20Entity%20TA98%20EN.htm

This is a test module, now incorporated into Module:Wikidata



local p = {}

-- This is used to get the TA98 (Terminologia Anatomica first edition 1998) values like 'A01.1.00.005' (property P1323)
-- which are then linked to http://www.unifr.ch/ifaa/Public/EntryPage/TA98%20Tree/Entity%20TA98%20EN/01.1.00.005%20Entity%20TA98%20EN.htm
p.getTAValue = function(frame)
	local ent = mw.wikibase.getEntityObject()
	local props = ent:formatPropertyValues('P1323')
	local out = {}
	for k, v in pairs(props) do
--		if k == 'value' then
			out[#out + 1] = "k = " .. k .. " --- v = " .. v
--		end
	end
	ret = table.concat(out, "<br> ")
	if #ret == 0 then
		ret = "Invalid TA"
	end
	return ret
end

return p