Home
Random
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/Underlying lk/Wikidatacoordtest
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
--http://www.wikidata.org/w/api.php?action=wbgetentities&ids=Q1590213&format=jsonfm -- Module:Wikibase local p = {} -- Return the item ID of the item linked to the current page. function p.id(frame) if not mw.wikibase then return "wikibase module not found" end entity = mw.wikibase.getEntity() if entity == nil then return "(no item connected)" end return entity.claims['P281'][0].mainsnak.datavalue.value end function p.tablew(frame) t2 = mw.wikibase.getEntity().claims claimsList = {} local num = frame.args[1] local num = tonumber(num) for k, v in pairs(t2) do if k == "p281" then k = v[0].mainsnak.datavalue.value end table.insert(claimsList, k) end return claimsList[num] end function p.tableview(frame) --{{#invoke:Sandbox/Underlying lk/Wikidatacoordtest|tableview|P281|1162282}} -- returns the value of the property P281 having 1162282 as qualifier t2 = mw.wikibase.getEntity().claims[frame.args[1]] claimsList = {} for k,v in pairs(t2) do if v.qualifiers then --this instance of P281 --has a qualifier qualifiersTable = v.qualifiers for key, qualifier in pairs(qualifiersTable) do if qualifier[0].datavalue.value["numeric-id"] then code = qualifier[0].datavalue.value["numeric-id"] if code == tonumber(frame.args[2]) then code = v.mainsnak.datavalue.value table.insert(claimsList, code) end end end end end return claimsList[1] end function p.tabee(frame) t2 = mw.wikibase.getEntity().claims['p281'] claimsList = {} local num = frame.args[1] local num = tonumber(num) for k,v in pairs(t2) do k = v.mainsnak.datavalue.value k = v.references[0].snaks["P248"][0].datavalue.value['numeric-id'] table.insert(claimsList, k) end return claimsList[num] end return p
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Sandbox/Underlying lk/Wikidatacoordtest/doc
(
edit
)