Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Sandbox/RexxS/Iscountry
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!
local p = {} --[[ https://w.wiki/aXJ SELECT ?item ?itemLabel WHERE { ?item wdt:P279 wd:Q6256. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } --]] local types_of_country = { "Q6256", -- country "Q112099", -- island nation "Q123480", -- landlocked country "Q132453", -- developed country "Q160381", -- Western world "Q177323", -- developing country "Q188800", -- personal union "Q331644", -- Khanate "Q831048", -- Nassau-Hadamar "Q899706", -- Peru–Bolivian Confederation "Q1093720", -- real union "Q1151616", -- stateless nation "Q1323642", -- transcontinental country "Q1501897", -- Generality Lands "Q1538989", -- megadiverse country "Q1541668", -- County of Diez "Q1641089", -- Multinational state "Q2281140", -- safe country of origin "Q2639564", -- low-wage country "Q3024240", -- historical country "Q3373662", -- French-speaking Country "Q3500085", -- periphery countries "Q3624078", -- sovereign state "Q5170193", -- core countries "Q5367717", -- shinkoku "Q6726158", -- Independent country "Q7449317", -- semi-periphery countries "Q11396118", -- divided country "Q11495981", -- victorious country "Q25449457", -- continental country "Q28864179", -- proposed country "Q51576574", -- Mediterranean country "Q66724388", -- autonomous country within the Kingdom of Denmark "Q66903706", -- banana producing countries } local isCountry = {} for i, v in ipairs(types_of_country) do isCountry[v] = true end ------------------------------------------------------------------------------- -- _iscountry takes Q-id and returns true if it's a country. ------------------------------------------------------------------------------- -- Dependencies: ------------------------------------------------------------------------------- p._iscountry = function(qid) local inst = mw.wikibase.getBestStatements(qid, "P31") if #inst > 0 then for i, v in ipairs(inst) do local instid = v.mainsnak.datavalue and v.mainsnak.datavalue.value.id if isCountry[instid] then return true end end end return false end p.iscountry = function(frame) local args = frame.args if not args.qid then args = frame:getParent().args end return p._iscountry(args.qid) or "" -- return empty string not "false" to invoke 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)
Stockhub entities used in this page
Q12130
: Statement: P31, Label: en-gb, Miscellaneous (e.g. aliases, entity existence)
Q142
: Statement: P31, Label: en-gb, Miscellaneous (e.g. aliases, entity existence)
Templates used on this page:
Template:Para
(
edit
)
Template:Q
(
edit
)
Template:Tl
(
edit
)
Module:Sandbox/RexxS/Iscountry
(
edit
)
Module:Sandbox/RexxS/Iscountry/doc
(
edit
)
Module:Wd
(
edit
)
Module:Wd/i18n
(
edit
)