Module:Property documentation/sandbox
Documentation for this module may be created at Module:Property documentation/sandbox/doc
Code
local p = require 'Module:Property navbox'
local entity
local frame = p.getFrame()
local addcat = p.addCategory
local fb = p.fb
local highlightDollarInFormatter = p.highlightDollarInFormatter
local translate = p.translate
local d = require 'Module:Wikidata/sandbox'
local datatypemod = require 'Module:Datatype'
local linguistic = require 'Module:Linguistic'
local function showFieldAsEntity(field)
return function(data)
return d.showentity(data[field], p.getLang())
end
end
local function set(array)
local zset = {}
for _, l in ipairs(array) do zset[l] = true end
return zset
end
-- list from https://www.wikidata.org/wiki/Wikidata:Database_reports/List_of_properties/Top100
local freqproperties = set {
"P31", "P248", "P813", "P577", "P1476", "P1433", "P1545", "P2093", "P304", "P478", "P433", "P698", "P356",
"P854", "P143", "P17", "P131", "P2860", "P625", "P921", "P407", "P932", "P5875", "P21", "P50", "P106" }
local prop31279 = set { "P31", "P279" }
-- https://gerrit.wikimedia.org/g/operations/mediawiki-config/+/69607ea194f6ea5406cd144dc99c1c8436e45ec6/wmf-config/InitialiseSettings.php#20671 (large page)
local searchPropertiesExclude = set { "P304", "P433", "P478", "P558", "P3903", "P3921", "P4316", "P1433", "P2860" }
p.rows = {
--[[
label = name of the message for the header in Module:i18n/property documentation,
value = value of the line (by default, it gets the value of the parameter with the name of the label),
query = property to be retrieved from item, or complex query from item,
required = boolean,
missingcat = categorization in case some template data are missing,
duplicatecat = categorization in case some template data duplicate property statement data,
conversioncat = categorization in case some template data need to be moved to property statement data,
converttoprop = property to be used as replacement for template parameter value (defaults to param 'query' if it's a string),
maintenancecat = categorization in case some other issue gets detected
]]--
{
label = 'description',
},
{
label = 'subject item',
value = showFieldAsEntity('subject item'),
query = 'P1629',
missingcat = 'Property documentation missing a subject item',
duplicatecat = 'Property with duplicated subject item',
conversioncat = 'Property with subject item to move to statement',
},
{
label = 'associated item',
query = function(data)
return d.formatStatements{
conjtype = 'comma',
displayformat = 'wikidatastyle',
entity = entity,
lang = p.getLang(),
property = {'P2378', -- "issued by"
'P1875', -- "represented by"
'P137' , -- "operator"
'P126' , -- "maintained by"
'P127' , -- "owned by"
'P749' }, -- "parent organization"
rank = 'valid',
}
end,
maintenancecat = function(data)
if data['associated item'] then
return "Property documentation using 'associated item'"
end
return nil
end,
},
{
label = 'has quality',
query = 'P1552',
},
{
label = 'datatype',
query = function() return datatypemod.display(entity.datatype, p.getLang()) end,
},
{
label = 'corresponding template',
query = 'P2667',
},
{
label = 'infobox parameter',
maintenancecat = function(data)
if data['infobox parameter'] then
return "Property documentation using 'infobox parameter'"
end
return nil
end,
},
{
label = 'domain',
query = function()
return d.showQualifier{
conjtype = 'or', -- fixme: doesn't work
displayformat = 'wikidatastyle',
entity = entity,
lang = p.getLang(),
property = 'P2302',
qualifier = 'P2308',
targetvalue = 'Q21503250',
}
end
},
{
label = 'allowed values',
query = function()
if (
entity.datatype == 'commonsMedia' or
entity.datatype == 'external-id' or
entity.datatype == 'geo-shape' or
entity.datatype == 'monolingualtext' or
entity.datatype == 'string' or
entity.datatype == 'tabular-data' or
entity.datatype == 'url'
) then
--todo: local pattern = 'https://regex101.com/?regex=$1'
return d.formatStatements{
conjtype = '<br />',
entity = entity,
lang = p.getLang(),
property = 'P1793', -- format as a regular expression
showqualifiers = {'P2916','P17'} -- syntax clarif, country
} or d.showQualifier{
entity = entity,
lang = p.getLang(),
property = 'P2302',
qualifier = 'P1793',
targetvalue = 'Q21502404',
}
elseif entity.datatype == 'quantity' then
return d.showQualifier{
conjtype = ' ≤ 𝓧 ≤ ',
displayFormat = 'wikidatastyle',
entity = entity,
lang = p.getLang(),
property = 'P2302',
qualifiers = {'P2313','P2312'}, -- minimum value, maximum value
targetvalue = 'Q21510860',
} -- todo: also display allowed units (Q21514353) constraint
elseif entity.datatype == 'time' then
return d.showQualifier{
conjtype = ' ≤ 𝓧 ≤ ',
displayFormat = 'wikidatastyle',
entity = entity,
lang = p.getLang(),
property = 'P2302',
qualifiers = {'P2310','P2311'}, -- minimum date, maximum date
targetvalue = 'Q21510860',
}
elseif entity.datatype == 'wikibase-item' then
return d.showQualifier{
conjtype = 'or', -- fixme: doesn't work
displayformat = 'wikidatastyle',
entity = entity,
lang = p.getLang(),
property = 'P2302',
qualifier = 'P2305',
targetvalue = 'Q21510859',
}
end
return nil
end,
duplicatecat = function()
if entity.datatype == 'external-id' then
return 'Property (external-id) with duplicated allowed values'
else
return 'Property with duplicated allowed values'
end
end,
conversioncat = function()
if entity.datatype == 'external-id' then
return 'Property (external-id) with allowed values to move to statement'
elseif (entity.datatype == 'string' or entity.datatype == 'url' or
entity.datatype == 'monolingualtext' or entity.datatype == 'commonsMedia') then
-- Everything else that uses regex P1793
return 'Property (string) with allowed values to move to statement'
else
return 'Property with allowed values to move to statement'
end
end,
converttoprop = function()
if entity.datatype == 'external-id' then
return 'P1793' -- format as a regular expression
else
return nil
end
end,
},
{
label = 'allowed units',
query = function()
if entity.datatype ~= 'quantity' then
return nil
end
local s = ''
local lang = p.getLang()
local units = d.showQualifier{
conjtype = 'or', -- fixme: doesn't work
displayformat = 'wikidatastyle',
entity = entity,
lang = p.getLang(),
property = 'P2302',
qualifier = 'P2305',
targetvalue = 'Q21514353',
}
local unittypes = d.formatStatements{
entity = entity,
lang = lang,
property = 'P2876',
}
if unittypes then
s = s .. translate('instances of') .. unittypes
if units then
s = s .. '<br />'
end
end
if units then
s = s .. units
end
if s == '' then
return nil
else
return s
end
end,
--converttoprop = {'P2237','P2876'}, -- units or types of units
},
{
label = 'usage notes',
query = function()
for _, language in ipairs(fb.fblist(p.getLang(), true)) do
local value = d.formatStatements{
conjtype = '<br />',
entity = entity,
isinlanguage = language,
property = 'P2559', -- Wikidata usage instructions
rank = 'best',
}
if value then
return value
end
end
return d.formatStatements{
conjtype = '<br />',
entity = entity,
rank = 'best',
property = 'P2559',
}
end,
converttoprop = 'P2559', -- Wikidata usage instructions
},
{
label = 'preferred rank',
value = showFieldAsEntity('preferred rank'),
maintenancecat = function(data)
if data['preferred rank'] then
return "Property documentation using 'preferred rank'"
end
return nil
end,
},
{
-- fixme: skip P1855 with novalue and use only data in template
label = 'example',
query = function()
local pattern, urlpattern
if entity.datatype == 'commonsMedia' then -- they all have the same one
urlpattern = 'https://commons.wikimedia.org/wiki/File:$1'
elseif entity.datatype == 'tabular-data' or entity.datatype == 'geo-shape' then
urlpattern = 'https://commons.wikimedia.org/wiki/$1' -- unlike for files, the prefix is part of the value
elseif entity.datatype == 'string' or entity.datatype == 'external-id' then -- check first whether we need it
urlpattern = d.formatStatements{ entity = entity, property = 'P1630', rank = 'best', numval = 1, displayformat = 'raw' }
end
if urlpattern then
local rdf = d.formatStatements{ entity = entity, property = 'P1921', rank = 'best', numval = 1, displayformat = 'raw' }
if rdf then
pattern = mw.ustring.format('[%s $1] ([%s %s])', urlpattern, rdf, translate('rdf'))
urlpattern = nil
end
end
local delimiter = ' ' .. mw.getLanguage(p.getLang()):getArrow('forwards') .. ' '
if entity.id == 'P7383' then
pattern = '<div style="display: inline;"> <hiero> $1 </hiero> </div>'
urlpattern = nil
end
local stdsamples = d.formatStatements{
conjtype = '<br />',
delimiter = delimiter,
displayformat = 'wikidatastyle',
entity = entity,
lang = p.getLang(),
pattern = pattern,
property = {'P1855','P2271','P5192','P5193','P5977'},
showqualifiers = {entity.id},
urlpattern = urlpattern,
}
if entity.id == 'P7383' then
return frame:preprocess(stdsamples)
else
return stdsamples
end
end,
converttoprop = {'P1855','P2271','P5192','P5193','P5977'}, -- property example
required = false,
missingcat = 'Property documentation missing an example',
duplicatecat = 'Property with duplicated example',
conversioncat = 'Property with example to move to statement',
},
{
-- fixme: some value types may not work. Ok: string, quantity, item
label = 'Commons example',
query = function()
local delimiter = '|' .. mw.getLanguage(p.getLang()):getArrow('forwards') .. ' '
local csamples = d.formatStatements{
conjtype = '\n',
delimiter = delimiter,
displayformat = 'wikidatastyle',
entity = entity,
lang = p.getLang(),
property = 'P6685',
showqualifiers = {entity.id},
}
if csamples then
return frame:preprocess('<gallery mode="packed" heights="150px" style="text-align:left">\n' .. csamples .. '\n</gallery>')
else
return nil
end
end,
converttoprop = {'P6685'}, -- property example
required = false,
},
{
label = 'filter',
value = function(data)
local arg = data.filter
if arg then
local num = tonumber(arg)
if num and num < 150 then
local formatNum = require('Module:Formatnum')
return mw.ustring.format('[[Special:AbuseFilter/%d|%s]]', num,
mw.ustring.format(translate('abuse filter'), formatNum.formatNum(num, p.getLang())))
else
return arg
end
end
return nil
end,
maintenancecat = function(data)
if data.filter then
if string.len(data.filter) <= 30 then
return "Property documentation using 'filter'"
else
return "Property documentation using long 'filter'"
end
end
return nil
end,
},
{
label = 'source',
query = function()
local claims = d.getClaims{
entity = entity,
property = 'P1896', -- source website
rank = 'valid',
}
if not claims then
return nil
end
for i, statement in ipairs(claims) do
local showntext = d.getFormattedQualifiers(statement,
{'P1476'}, -- title
{ lang = p.getLang() })
claims[i] = d.formatStatement(statement, {
displayformat = 'weblink',
lang = p.getLang(),
showntext = showntext,
showqualifiers = {'P2315'} -- comment
})
end
return linguistic.conj(claims, p.getLang(), '<br />')
end,
converttoprop = 'P1896', -- source website
duplicatecat = 'Property with duplicated source',
conversioncat = 'Property with source to move to statement',
},
{
label = 'external links',
value = function(data)
if (entity.datatype == 'url' or entity.datatype == 'external-id') and data['external links'] then
return frame:expandTemplate{ title = 'External links', args = { data['external links'], data['external links 2'], data['external links 3'], data['external links 4'], data['external links 5'], data['external links 6'], data['external links 7'], data['external links 8'], data['external links 9'], data['external links 10'] } }
end
return nil
end
},
{
label = 'formatter URL',
value = function(data)
local val = data['formatter URL']
if val then
local append = ''
if not mw.ustring.match(val, '^https?://') then
append = append .. translate('wrong format')
end
if not mw.ustring.find(val, '$1', 7, true) then
if append ~= '' then
append = append .. ', '
end
append = append .. mw.ustring.format(translate('missing stuff'), '$1')
end
if append ~= '' then
append = ' – <span style="color: red;">' .. append .. '</span>'
addcat('Invalid formatter URL')
end
return highlightDollarInFormatter(val) .. append
end
end,
query = function()
if entity.datatype == 'commonsMedia' then
return highlightDollarInFormatter('https://commons.wikimedia.org/wiki/File:$1')
end
if entity.datatype == 'tabular-data' or entity.datatype == 'geo-shape' then
return highlightDollarInFormatter('https://commons.wikimedia.org/wiki/$1')
end
local claims = d.getClaims{
entity = entity,
property = 'P1630',
rank = 'valid',
sorttype = function(first, second)
return first.rank == 'preferred' and second.rank ~= 'preferred'
end
}
if not claims then
return nil
end
for i, statement in ipairs(claims) do
claims[i] = d.formatStatement(statement, { displayformat = 'raw' }) -- no escaping
claims[i] = highlightDollarInFormatter(claims[i])
local comment = d.getFormattedQualifiers(statement, {'P2916'}, { lang = p.getLang() }) -- syntax clarif
local regex = d.getFormattedQualifiers(statement, {'P1793'}, {})
if comment or regex then
if regex then
local colon = frame:expandTemplate{ title = 'colon', args = { lang = p.getLang() } }
regex = '[[Q185612|' .. translate('regex') .. ']]' .. colon .. '<code>' .. regex .. '</code>'
end
if comment and regex then
claims[i] = claims[i] .. linguistic.inparentheses(comment .. translate('semicolon') .. regex, p.getLang())
else
claims[i] = claims[i] .. linguistic.inparentheses(comment or regex, p.getLang())
end
end
end
return linguistic.conj(claims, p.getLang(), '<br />')
end,
converttoprop = 'P1630', -- formatter URL
duplicatecat = 'Property with duplicated formatter URL',
conversioncat = 'Property with formatter URL to move to statement',
},
{
label = 'embed URL',
value = function(data)
local val = data['embed URL']
if val then
local append = ''
if not mw.ustring.match(val, '^https?://') then
append = append .. translate('wrong format')
end
if not mw.ustring.find(val, '$1', 7, true) then
if append ~= '' then
append = append .. ', '
end
append = append .. mw.ustring.format(translate('missing stuff'), '$1')
end
if append ~= '' then
append = ' – <span style="color: red;">' .. append .. '</span>'
addcat('Invalid formatter URL')
end
return highlightDollarInFormatter(val) .. append
end
end,
query = function()
local lang = p.getLang()
if entity.datatype == 'commonsMedia' then
return highlightDollarInFormatter('https://commons.wikimedia.org/wiki/File:$1')
end
local claims = d.getClaims{
entity = entity,
property = 'P2720',
rank = 'valid',
sorttype = function(first, second)
return first.rank == 'preferred' and second.rank ~= 'preferred'
end
}
if not claims then
return nil
end
for i, statement in ipairs(claims) do
claims[i] = d.formatStatement(statement, { displayformat = 'raw' }) -- no escaping
claims[i] = highlightDollarInFormatter(claims[i])
local comment = d.getFormattedQualifiers(statement, {'P2916'}, { lang = lang })
local regex = d.getFormattedQualifiers(statement, {'P1793'}, {})
if comment or regex then
if regex then
regex = '[[Q185612|' .. translate('regex') .. ']]' .. linguistic.colon(lang) .. '<code>' .. regex .. '</code>'
end
if comment and regex then
claims[i] = claims[i] .. linguistic.inparentheses(comment .. translate('semicolon') .. regex, lang)
else
claims[i] = claims[i] .. linguistic.inparentheses(comment or regex, lang)
end
end
end
return linguistic.conj(claims, lang, '<br />')
end,
converttoprop = 'P2720', -- embed URL
duplicatecat = 'Property with duplicated formatter URL',
conversioncat = 'Property with formatter URL to move to statement',
},
{
label = 'URN',
query = function()
local lang = p.getLang()
local claims = d.getClaims{
entity = entity,
property = 'P7470',
rank = 'valid',
sorttype = function(first, second)
return first.rank == 'preferred' and second.rank ~= 'preferred'
end
}
if not claims then
return nil
end
for i, statement in ipairs(claims) do
claims[i] = d.formatStatement(statement, { displayformat = 'raw' }) -- no escaping
claims[i] = highlightDollarInFormatter(claims[i])
local comment = d.getFormattedQualifiers(statement, {'P2916'}, { lang = lang })
if comment then
claims[i] = claims[i] .. linguistic.inparentheses(comment, lang)
end
end
return linguistic.conj(claims, lang, '<br />') .. " — [https://query.wikidata.org/embed.html#SELECT%20%3FUniform_Resource_Name_URN%20%3Fitem%20%3FitemLabel%20%3Fvalue%0A%7B%0A%20%20%20%20%7B%20BIND%28%20wdt%3A" .. entity.id .. "%20as%20%3Fwdt%29%20%3Fp%20wikibase%3AdirectClaim%20%3Fwdt%3B%20p%3AP7470%20%3Fst.%20%3Fst%20ps%3AP7470%20%3Ff.%20OPTIONAL%20%7B%3Fst%20pq%3AP1793%20%3Fr%7D%20BIND%28CONCAT%28%22%5E%22%2CCOALESCE%28%3Fr%2C%22%28%5E.%2a%29%22%29%2C%22%24%22%29%20as%20%3Fre%29%20%7D%0A%20%20%20%20%3Fitem%20%3Fwdt%20%3Fvalue.%20FILTER%28REGEX%28str%28%3Fvalue%29%2C%3Fre%29%29%20BIND%28URI%28REPLACE%28str%28%3Fvalue%29%2C%3Fre%2C%3Ff%29%29%20as%20%3FUniform_Resource_Name_URN%29%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7Bbd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22%7D%0A%7D%0ALIMIT%20100 " .. translate('list of URNs') .. "]"
end,
},
{
label = 'robot and gadget jobs',
value = function(data)
local val = data['robot and gadget jobs']
local json = mw.title.new('User:DeltaBot/fixClaims/jobs'):getContent()
local allJobs = mw.text.jsonDecode(json)
local jobs = {}
for _, job in ipairs(allJobs) do
if job.p == entity.id then
table.insert(jobs, job)
end
end
if #jobs > 0 then
local rows = {}
table.insert(rows, mw.ustring.format(translate('DeltaBot'), 'User:DeltaBot/fixClaims/jobs'))
for _, job in ipairs(jobs) do
local jobDesc
if job.action == 'addClaim' then
jobDesc = mw.ustring.format(translate('DeltaBot-' .. job.action), job.pNew, job.valNew or 'none')
elseif job.action == 'changeProperty' then
jobDesc = mw.ustring.format(translate('DeltaBot-' .. job.action), job.pOld or entity.id, job.pNew)
elseif job.action == 'changeQualifierProperty' then
jobDesc = mw.ustring.format(translate('DeltaBot-' .. job.action), job.pOld, job.pNew)
elseif job.action == 'format' then
jobDesc = translate('DeltaBot-' .. job.action .. '-' .. job.subaction)
elseif job.action == 'inverse' then
jobDesc = mw.ustring.format(translate('DeltaBot-' .. job.action), job.pNewT)
elseif job.action == 'moveQualifierToStatement' then
jobDesc = mw.ustring.format(translate('DeltaBot-' .. job.action), job.pQualifier, job.pNew)
elseif job.action == 'moveStatementToQualifier' then
jobDesc = mw.ustring.format(translate('DeltaBot-' .. job.action), job.pNew)
else
jobDesc = translate('DeltaBot-' .. job.action)
end
table.insert(rows,
mw.ustring.format('* [https://query.wikidata.org/#%s %s]',
mw.uri.encode(job.query, 'PATH'), jobDesc))
if job.action == 'changeValue' then
for old, new in pairs(job.map) do
table.insert(rows, mw.ustring.format('** %s → %s',
d.showentity('Q' .. old, p.getLang()), d.showentity('Q' .. new, p.getLang())))
end
end
end
if val then
table.insert(rows, val)
end
return table.concat(rows, '\n')
end
return val
end,
maintenancecat = function(data)
if data['robot and gadget jobs'] then
if string.len(data['robot and gadget jobs']) <= 30 then
return "Property documentation using 'robot and gadget jobs'"
else
return "Property documentation using long 'robot and gadget jobs'"
end
end
return nil
end,
},
{
label = 'track same cat',
value = showFieldAsEntity('track same cat'),
query = 'P3734', -- category for value same as Wikidata
},
{
label = 'track diff cat',
value = showFieldAsEntity('track diff cat'),
query = 'P3709', -- category for value different from Wikidata
},
{
label = 'track usage cat',
value = showFieldAsEntity('track usage cat'),
query = 'P2875', -- property usage tracking category
},
{
label = 'track local no-WD yes',
value = showFieldAsEntity('track local no-WD yes'),
},
{
label = 'track local yes-WD no',
value = showFieldAsEntity('track local yes-WD no'),
query = 'P3713', -- category for value not in Wikidata
},
{
label = 'track local no-WD no',
value = showFieldAsEntity('track local no-WD no'),
},
{
label = 'track avail both cat',
value = showFieldAsEntity('track avail both cat'),
},
{
label = 'related2country',
query = function(data)
local lang = p.getLang()
local function displayformat(snak, params)
local id = d.getRawvalue(snak)
local label = d._getLabel(id, 'en')
local formatted = d.showentity(id, lang)
local flag, category, seeothers
local image = d.formatStatements{
entity = id,
numval = 1,
pattern = '[[File:$1|border|25px|link=' .. id .. ']]',
property = 'P41',
rank = 'best',
}
if image then
flag = image .. ' '
else
flag = ''
end
if label then
local cat_title = label .. '-related properties'
local otherpropertynum = mw.site.stats.pagesInCategory(cat_title, 'pages') - 1
if otherpropertynum > 0 then
local msg = mw.message.newRawMessage(translate('see others'))
:numParams(otherpropertynum)
:plain()
seeothers = linguistic.inparentheses(
mw.ustring.format('[[:Category:%s|%s]]', cat_title, frame:preprocess(msg)), lang)
else
seeothers = ''
end
category = '[[Category:' .. cat_title .. ']]'
else
category = ''
seeothers = ''
end
return flag .. formatted .. seeothers .. category
end
local country = d.formatStatements{
entity = entity,
property = 'P17',
lang = lang,
displayformat = displayformat,
conjtype = '<br />'
}
if country then
local jurisdiction = d.formatStatements{ entity = entity, property = 'P1001', lang = lang, displayformat = 'wikidatastyle', conjtype = 'comma' }
if jurisdiction then
country = country .. linguistic.inparentheses(jurisdiction, lang)
end
end
return country
end,
converttoprop = {'P17','P1001'}, -- country, jurisdiction
},
{
label = 'seealso',
query = 'P1659',
},
{
label = 'lists',
value = function(data)
-- Use template field, if set
local append = data.lists or ''
local lang = p.getLang()
-- Get P2354 "has list" property, if any
local val = d.formatStatements{ entity = entity, lang = lang, displayformat = 'wikidatastyle', conjtype = '<br />', property = 'P2354' }
if val then
append = append .. '\n*' .. val
end
if entity.claims and entity.claims.P31 then
for _, statement in ipairs(entity.claims.P31) do
if d.getmainid(statement) == 'Q70564278' then
-- https://commons.wikimedia.org/wiki/Commons_talk:Structured_data#Search_for_depicts_qualifier
linkText = translate("search Commons for files with depicts-statement and this property as qualifier")
linkURL = 'c:Special:Search/haswbstatement:P180 +"' .. d._getLabel(entity.id, 'en') .. ':"'
append = append .. '\n* [[' .. linkURL .. '|' .. linkText .. ']]'
break
end
end
end
if entity.claims and entity.claims.P6685 then
linkText = translate("search Commons for files with property")
linkURL = "https://commons.wikimedia.org/w/index.php?ns6=1&search=haswbstatement%3A" .. entity.id
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
end
if not forQualifierUse then
if not freqproperties[entity.id] then
linkText = translate("items with the most statements of this property")
linkURL = "https://query.wikidata.org/#%23%20items%20with%20most%20values%20of%20the%20property%20" .. entity.id .. "%0A%23%20added%20by%20User%3AInfovarius%2C%202019-07-15%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fcnt%0A%7B%0A%20%20%7B%0A%20%20%20%20%20%20%20SELECT%20%3Fitem%20%28COUNT%28%3Fvalue%29%20AS%20%3Fcnt%29%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20GROUP%20BY%20%3Fitem%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fcnt%29%0ALIMIT%20100"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("count of items by number of statements (chart)")
linkURL = "https://query.wikidata.org/#%23defaultView%3AAreaChart%0ASELECT%20%3Fst%20%3Fct%20%7B%0A%20%20%7B%0A%20%20%20BIND%20%280%20AS%20%3Fct%29%0A%20%20%20BIND%20%280%20AS%20%3Fst%29%0A%20%20%7D%0A%20%20UNION%20%7B%0A%20%20%20%20SELECT%20%3Fst%20%28COUNT%28%2a%29%20as%20%3Fct%29%20%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Astatements%20%3Fst%0A%20%20%20%20%7D%0A%20%20%20%20GROUP%20BY%20%3Fst%0A%20%20%20%20ORDER%20BY%20%3Fst%0A%20%20%7D%0A%7D"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("items with the most statements")
linkURL = "https://query.wikidata.org/#%23%20items%20with%20property%20" .. entity.id .. "%20and%20most%20statements%0A%23%20added%20by%20User%3AJura1%2C%202017-07-30%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3Fst%0A%7B%0A%20%20%7B%0A%20%20%20%20%20%20%20SELECT%20%2a%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Astatements%20%3Fst%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20ORDER%20BY%20DESC%28%3Fst%29%20%0A%20%20%20%20%20%20%20LIMIT%20100%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fst%29%20%3Fitem"
append = append .. '\n** [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("items with the fewest statements")
linkURL = "https://query.wikidata.org/#%23%20items%20with%20property%20" .. entity.id .. "%20and%20the%20lowest%20number%20of%20statements%0A%23%20added%20by%20User%3AJura1%2C%202017-07-31%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3FvalueLabel%20%3Fst%0A%7B%0A%20%20%7B%0A%20%20%20%20%20%20%20SELECT%20%2a%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Astatements%20%3Fst%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20ORDER%20BY%20ASC%28%3Fst%29%20%3Fitem%20%0A%20%20%20%20%20%20%20LIMIT%20100%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20ASC%28%3Fst%29%20%3Fitem"
append = append .. '\n** [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("count of items by number of sitelinks (chart)")
linkURL = "https://query.wikidata.org/#%23defaultView%3AAreaChart%0ASELECT%20%3Fst%20%28COUNT%28%2a%29%20as%20%3Fct%29%20%0A%7B%0A%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Asitelinks%20%3Fst%0A%7D%0AGROUP%20BY%20%3Fst%0AORDER%20BY%20%3Fst"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("items with the most sitelinks")
linkURL = "https://query.wikidata.org/#%23%20items%20with%20property%20" .. entity.id .. "%20and%20most%20sitelinks%0A%23%20added%20by%20User%3AJura1%2C%202017-07-30%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3Fsl%0A%7B%0A%20%20%7B%0A%20%20%20%20%20%20%20SELECT%20%2a%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Asitelinks%20%3Fsl%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20ORDER%20BY%20DESC%28%3Fsl%29%20%0A%20%20%20%20%20%20%20LIMIT%20100%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fsl%29%20%3Fitem"
append = append .. '\n** [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("items with the most sitelinks, but no link to one Wikipedia (sample: Welsh Wikipedia, cywiki)")
linkURL = "https://query.wikidata.org/#%23%20items%20without%20property%20" .. entity.id .. "%2C%20but%20no%20sitelink%20to%20cywiki%0A%23%20added%20by%20Jura1%2C%202017-11-27%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3Fsl%0A%7B%0A%20%20%7B%0A%20%20%20%20%20%20%20SELECT%20%2a%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Asitelinks%20%3Fsl%0A%20%20%20%20%20%20%20%20%20%20FILTER%20NOT%20EXISTS%20%7B%20%5B%5D%20schema%3Aabout%20%3Fitem%20%3B%20schema%3AisPartOf%20%3Chttps%3A%2F%2Fcy.wikipedia.org%2F%3E%20%7D%20%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20ORDER%20BY%20DESC%28%3Fsl%29%20%3Fitem%0A%20%20%20%20%20%20%20LIMIT%201000%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fsl%29%20%3Fitem"
append = append .. '\n** [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("items with the most identifier properties")
linkURL = "https://query.wikidata.org/#%23%20items%20with%20property%20" .. entity.id .. "%20and%20most%20identifiers%0A%23%20added%20by%20User%3AJura1%2C%202017-07-30%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3Fids%0A%7B%0A%20%20%7B%0A%20%20%20%20%20%20%20SELECT%20%2a%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Aidentifiers%20%3Fids%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20ORDER%20BY%20DESC%28%3Fids%29%20%0A%20%20%20%20%20%20%20LIMIT%20100%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fids%29%20%3Fitem"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
end
if entity.datatype == 'external-id' then
linkText = translate("items with no other external identifier")
linkURL = "https://query.wikidata.org/#%23%20items%20with%20property%20" .. entity.id .. "%20and%20no%20other%20identifiers%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3Fst%0A%7B%0A%20%20%7B%0A%20%20%20%20%20%20%20SELECT%20%2a%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Aidentifiers%201%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20LIMIT%201000%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fst%29%20%3Fitem"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
end
linkText = translate("items with no other statements")
linkURL = "https://query.wikidata.org/#%23%20items%20with%20property%20" .. entity.id .. "%20and%20no%20other%20statements%0A%23%20added%20by%20User%3AJura1%2C%202017-07-30%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3Fst%0A%7B%0A%20%20%7B%0A%20%20%20%20%20%20%20SELECT%20%2a%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20%3B%20wikibase%3Astatements%201%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20LIMIT%201000%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fst%29%20%3Fitem"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("most recently created items")
linkURL = "https://query.wikidata.org/#SELECT%20%20%20%2a%0AWHERE%0A%7B%0A%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%5B%5D%20.%0A%7D%0AORDER%20BY%20DESC%28xsd%3Ainteger%28SUBSTR%28STR%28%3Fitem%29%2C33%29%29%29%0ALIMIT%2010"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
end
local linkText = translate("items with novalue claims")
local linkURL = "https://query.wikidata.org/#%23Items%20with%20statements%20where%20property%20" .. entity.id .. "%20uses%20the%20novalue%20special%20value%0A%23by%20Jura1%2C%202015-02-27%0ASELECT%20%09%0A%09%3Fitem%20%3FitemLabel%20%0A%09%28GROUP_CONCAT%28%3FinstanceLabel%3B%20separator%3D%22%2C%20%22%29%20as%20%3FinstanceLabels%29%0AWHERE%20%09%0A{%0A%09%3Fitem%20p%3A" .. entity.id .. "%2Fa%20wdno%3A" .. entity.id .. "%0A%09OPTIONAL%20{%3Fitem%20wdt%3AP31%20%3Finstance}%0A%09SERVICE%20wikibase%3Alabel%20{%20%09bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%2Cru%2Cja%2Czh%22%20.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%3Fitem%20rdfs%3Alabel%20%3FitemLabel%20.%20%3Finstance%20rdfs%3Alabel%20%3FinstanceLabel%20}%0A}%0AGROUP%20BY%20%3Fitem%20%3FitemLabel%0ALIMIT%20100"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("items with somevalue claims")
linkURL = "https://query.wikidata.org/#%23Items%20with%20statements%20where%20property%20" .. entity.id .. "%20uses%20the%20somevalue%2Fanyvalue%20special%20value%0ASELECT%20%09%0A%09%3Fitem%20%3FitemLabel%20%0A%09%28GROUP_CONCAT%28%3FinstanceLabel%3B%20separator%3D%22%2C%20%22%29%20as%20%3FinstanceLabels%29%0AWHERE%20%09%0A{%0A%20%20%09%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20.%20%0A%20%20%09FILTER%20%28isBlank%28%3Fvalue%29%29%20%20%20%20%20%20%20%20%20%20%20%0A%09OPTIONAL%20{%3Fitem%20wdt%3AP31%20%3Finstance}%0A%09SERVICE%20wikibase%3Alabel%20{%20%09bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%2Cru%2Cja%2Czh%22%20.%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%09%09%3Fitem%20rdfs%3Alabel%20%3FitemLabel%20.%20%3Finstance%20rdfs%3Alabel%20%3FinstanceLabel%20}%0A}%0AGROUP%20BY%20%3Fitem%20%3FitemLabel%0ALIMIT%20100"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("usage history") -- Use embed
linkURL = "https://query.wikidata.org/embed.html#%23%20Chart%20of%20" .. entity.id .. "%20usage%0A%23%20Note%3A%20this%20chart%20is%20based%20on%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FTemplate%3AProperty_uses%0A%23%20which%20is%20updated%20once%20a%20day%20by%20PLbot%0A%0A%23defaultView%3ALineChart%0ASELECT%20%3Fday%20%3Fcount%20WITH%20%7B%20SELECT%20%28%22.%2B%5C%5C%7C" .. string.sub(entity.id, 2) .. "%3D%28%5C%5Cd%2B%29.%2B%22%20as%20%3Fr%29%20%28%22%7C" .. string.sub(entity.id, 2) .. "%3D%22%20as%20%3Fp%29%0A%20%20%28IF%28CONTAINS%28%3Fr1%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr1%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc1%29%20%28xsd%3AdateTime%28%3Ft1%29%20AS%20%3Fd1%29%0A%20%20%28IF%28CONTAINS%28%3Fr2%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr2%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc2%29%20%28xsd%3AdateTime%28%3Ft2%29%20AS%20%3Fd2%29%0A%20%20%28IF%28CONTAINS%28%3Fr3%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr3%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc3%29%20%28xsd%3AdateTime%28%3Ft3%29%20AS%20%3Fd3%29%0A%20%20%28IF%28CONTAINS%28%3Fr4%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr4%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc4%29%20%28xsd%3AdateTime%28%3Ft4%29%20AS%20%3Fd4%29%0A%20%20%28IF%28CONTAINS%28%3Fr5%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr5%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc5%29%20%28xsd%3AdateTime%28%3Ft5%29%20AS%20%3Fd5%29%0A%20%20%28IF%28CONTAINS%28%3Fr6%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr6%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc6%29%20%28xsd%3AdateTime%28%3Ft6%29%20AS%20%3Fd6%29%0A%20%20%28IF%28CONTAINS%28%3Fr7%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr7%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc7%29%20%28xsd%3AdateTime%28%3Ft7%29%20AS%20%3Fd7%29%0A%20%20%28IF%28CONTAINS%28%3Fr8%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr8%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc8%29%20%28xsd%3AdateTime%28%3Ft8%29%20AS%20%3Fd8%29%0A%20%20%28IF%28CONTAINS%28%3Fr9%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr9%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc9%29%20%28xsd%3AdateTime%28%3Ft9%29%20AS%20%3Fd9%29%0A%20%20%28IF%28CONTAINS%28%3Fr10%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr10%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc10%29%20%28xsd%3AdateTime%28%3Ft10%29%20AS%20%3Fd10%29%0A%20%20%28IF%28CONTAINS%28%3Fr11%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr11%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc11%29%20%28xsd%3AdateTime%28%3Ft11%29%20AS%20%3Fd11%29%0A%20%20%28IF%28CONTAINS%28%3Fr12%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr12%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc12%29%20%28xsd%3AdateTime%28%3Ft12%29%20AS%20%3Fd12%29%0A%20%20%28IF%28CONTAINS%28%3Fr13%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr13%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc13%29%20%28xsd%3AdateTime%28%3Ft13%29%20AS%20%3Fd13%29%0A%20%20%28IF%28CONTAINS%28%3Fr14%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr14%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc14%29%20%28xsd%3AdateTime%28%3Ft14%29%20AS%20%3Fd14%29%0A%20%20%28IF%28CONTAINS%28%3Fr15%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr15%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc15%29%20%28xsd%3AdateTime%28%3Ft15%29%20AS%20%3Fd15%29%0A%20%20%28IF%28CONTAINS%28%3Fr16%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr16%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc16%29%20%28xsd%3AdateTime%28%3Ft16%29%20AS%20%3Fd16%29%0A%20%20%28IF%28CONTAINS%28%3Fr17%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr17%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc17%29%20%28xsd%3AdateTime%28%3Ft17%29%20AS%20%3Fd17%29%0A%20%20%28IF%28CONTAINS%28%3Fr18%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr18%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc18%29%20%28xsd%3AdateTime%28%3Ft18%29%20AS%20%3Fd18%29%0A%20%20%28IF%28CONTAINS%28%3Fr19%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr19%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc19%29%20%28xsd%3AdateTime%28%3Ft19%29%20AS%20%3Fd19%29%0A%20%20%28IF%28CONTAINS%28%3Fr20%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr20%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc20%29%20%28xsd%3AdateTime%28%3Ft20%29%20AS%20%3Fd20%29%0A%20%20%28IF%28CONTAINS%28%3Fr21%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr21%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc21%29%20%28xsd%3AdateTime%28%3Ft21%29%20AS%20%3Fd21%29%0A%20%20%28IF%28CONTAINS%28%3Fr22%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr22%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc22%29%20%28xsd%3AdateTime%28%3Ft22%29%20AS%20%3Fd22%29%0A%20%20%28IF%28CONTAINS%28%3Fr23%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr23%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc23%29%20%28xsd%3AdateTime%28%3Ft23%29%20AS%20%3Fd23%29%0A%20%20%28IF%28CONTAINS%28%3Fr24%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr24%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc24%29%20%28xsd%3AdateTime%28%3Ft24%29%20AS%20%3Fd24%29%0A%20%20%28IF%28CONTAINS%28%3Fr25%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr25%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc25%29%20%28xsd%3AdateTime%28%3Ft25%29%20AS%20%3Fd25%29%0A%20%20%28IF%28CONTAINS%28%3Fr26%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr26%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc26%29%20%28xsd%3AdateTime%28%3Ft26%29%20AS%20%3Fd26%29%0A%20%20%28IF%28CONTAINS%28%3Fr27%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr27%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc27%29%20%28xsd%3AdateTime%28%3Ft27%29%20AS%20%3Fd27%29%0A%20%20%28IF%28CONTAINS%28%3Fr28%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr28%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc28%29%20%28xsd%3AdateTime%28%3Ft28%29%20AS%20%3Fd28%29%0A%20%20%28IF%28CONTAINS%28%3Fr29%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr29%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc29%29%20%28xsd%3AdateTime%28%3Ft29%29%20AS%20%3Fd29%29%0A%20%20%28IF%28CONTAINS%28%3Fr30%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr30%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc30%29%20%28xsd%3AdateTime%28%3Ft30%29%20AS%20%3Fd30%29%0A%20%20%28IF%28CONTAINS%28%3Fr31%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr31%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc31%29%20%28xsd%3AdateTime%28%3Ft31%29%20AS%20%3Fd31%29%0A%20%20%28IF%28CONTAINS%28%3Fr32%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr32%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc32%29%20%28xsd%3AdateTime%28%3Ft32%29%20AS%20%3Fd32%29%0A%20%20%28IF%28CONTAINS%28%3Fr33%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr33%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc33%29%20%28xsd%3AdateTime%28%3Ft33%29%20AS%20%3Fd33%29%0A%20%20%28IF%28CONTAINS%28%3Fr34%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr34%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc34%29%20%28xsd%3AdateTime%28%3Ft34%29%20AS%20%3Fd34%29%0A%20%20%28IF%28CONTAINS%28%3Fr35%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr35%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc35%29%20%28xsd%3AdateTime%28%3Ft35%29%20AS%20%3Fd35%29%0A%20%20%28IF%28CONTAINS%28%3Fr36%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr36%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc36%29%20%28xsd%3AdateTime%28%3Ft36%29%20AS%20%3Fd36%29%0A%20%20%28IF%28CONTAINS%28%3Fr37%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr37%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc37%29%20%28xsd%3AdateTime%28%3Ft37%29%20AS%20%3Fd37%29%0A%20%20%28IF%28CONTAINS%28%3Fr38%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr38%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc38%29%20%28xsd%3AdateTime%28%3Ft38%29%20AS%20%3Fd38%29%0A%20%20%28IF%28CONTAINS%28%3Fr39%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr39%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc39%29%20%28xsd%3AdateTime%28%3Ft39%29%20AS%20%3Fd39%29%0A%20%20%28IF%28CONTAINS%28%3Fr40%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr40%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc40%29%20%28xsd%3AdateTime%28%3Ft40%29%20AS%20%3Fd40%29%0A%20%20%28IF%28CONTAINS%28%3Fr41%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr41%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc41%29%20%28xsd%3AdateTime%28%3Ft41%29%20AS%20%3Fd41%29%0A%20%20%28IF%28CONTAINS%28%3Fr42%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr42%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc42%29%20%28xsd%3AdateTime%28%3Ft42%29%20AS%20%3Fd42%29%0A%20%20%28IF%28CONTAINS%28%3Fr43%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr43%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc43%29%20%28xsd%3AdateTime%28%3Ft43%29%20AS%20%3Fd43%29%0A%20%20%28IF%28CONTAINS%28%3Fr44%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr44%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc44%29%20%28xsd%3AdateTime%28%3Ft44%29%20AS%20%3Fd44%29%0A%20%20%28IF%28CONTAINS%28%3Fr45%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr45%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc45%29%20%28xsd%3AdateTime%28%3Ft45%29%20AS%20%3Fd45%29%0A%20%20%28IF%28CONTAINS%28%3Fr46%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr46%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc46%29%20%28xsd%3AdateTime%28%3Ft46%29%20AS%20%3Fd46%29%0A%20%20%28IF%28CONTAINS%28%3Fr47%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr47%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc47%29%20%28xsd%3AdateTime%28%3Ft47%29%20AS%20%3Fd47%29%0A%20%20%28IF%28CONTAINS%28%3Fr48%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr48%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc48%29%20%28xsd%3AdateTime%28%3Ft48%29%20AS%20%3Fd48%29%0A%20%20%28IF%28CONTAINS%28%3Fr49%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr49%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc49%29%20%28xsd%3AdateTime%28%3Ft49%29%20AS%20%3Fd49%29%0A%20%20%28IF%28CONTAINS%28%3Fr50%2C%20%3Fp%29%2C%20xsd%3Ainteger%28REPLACE%28%3Fr50%2C%20%3Fr%2C%20%22%241%22%29%29%2C%20-1%29%20AS%20%3Fc50%29%20%28xsd%3AdateTime%28%3Ft50%29%20AS%20%3Fd50%29%0A%20%20%7B%20SERVICE%20wikibase%3Amwapi%20%7B%0A%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Aapi%20%22Generator%22%20%3B%20wikibase%3Aendpoint%20%22www.wikidata.org%22%20%3B%20mwapi%3Agenerator%20%22allpages%22%20%3B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mwapi%3Agapfrom%20%22Property_uses%22%20%3B%20mwapi%3Agapto%20%22Property_uses%22%20%3B%20mwapi%3Agapnamespace%20%2210%22%20%3B%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mwapi%3Aprop%20%22revisions%22%20%3B%20mwapi%3Arvprop%20%22content%7Ctimestamp%22%20%3B%20mwapi%3Arvlimit%20%2250%22%20%3B%20mwapi%3Arvuser%20%22PLbot%22%20.%0A%20%20%20%20%20%20%3Ft1%20wikibase%3AapiOutput%20%22revisions%2Frev%5B1%5D%2F%40timestamp%22%20.%20%3Fr1%20wikibase%3AapiOutput%20%22revisions%2Frev%5B1%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft2%20wikibase%3AapiOutput%20%22revisions%2Frev%5B2%5D%2F%40timestamp%22%20.%20%3Fr2%20wikibase%3AapiOutput%20%22revisions%2Frev%5B2%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft3%20wikibase%3AapiOutput%20%22revisions%2Frev%5B3%5D%2F%40timestamp%22%20.%20%3Fr3%20wikibase%3AapiOutput%20%22revisions%2Frev%5B3%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft4%20wikibase%3AapiOutput%20%22revisions%2Frev%5B4%5D%2F%40timestamp%22%20.%20%3Fr4%20wikibase%3AapiOutput%20%22revisions%2Frev%5B4%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft5%20wikibase%3AapiOutput%20%22revisions%2Frev%5B5%5D%2F%40timestamp%22%20.%20%3Fr5%20wikibase%3AapiOutput%20%22revisions%2Frev%5B5%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft6%20wikibase%3AapiOutput%20%22revisions%2Frev%5B6%5D%2F%40timestamp%22%20.%20%3Fr6%20wikibase%3AapiOutput%20%22revisions%2Frev%5B6%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft7%20wikibase%3AapiOutput%20%22revisions%2Frev%5B7%5D%2F%40timestamp%22%20.%20%3Fr7%20wikibase%3AapiOutput%20%22revisions%2Frev%5B7%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft8%20wikibase%3AapiOutput%20%22revisions%2Frev%5B8%5D%2F%40timestamp%22%20.%20%3Fr8%20wikibase%3AapiOutput%20%22revisions%2Frev%5B8%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft9%20wikibase%3AapiOutput%20%22revisions%2Frev%5B9%5D%2F%40timestamp%22%20.%20%3Fr9%20wikibase%3AapiOutput%20%22revisions%2Frev%5B9%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft10%20wikibase%3AapiOutput%20%22revisions%2Frev%5B10%5D%2F%40timestamp%22%20.%20%3Fr10%20wikibase%3AapiOutput%20%22revisions%2Frev%5B10%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft11%20wikibase%3AapiOutput%20%22revisions%2Frev%5B11%5D%2F%40timestamp%22%20.%20%3Fr11%20wikibase%3AapiOutput%20%22revisions%2Frev%5B11%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft12%20wikibase%3AapiOutput%20%22revisions%2Frev%5B12%5D%2F%40timestamp%22%20.%20%3Fr12%20wikibase%3AapiOutput%20%22revisions%2Frev%5B12%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft13%20wikibase%3AapiOutput%20%22revisions%2Frev%5B13%5D%2F%40timestamp%22%20.%20%3Fr13%20wikibase%3AapiOutput%20%22revisions%2Frev%5B13%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft14%20wikibase%3AapiOutput%20%22revisions%2Frev%5B14%5D%2F%40timestamp%22%20.%20%3Fr14%20wikibase%3AapiOutput%20%22revisions%2Frev%5B14%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft15%20wikibase%3AapiOutput%20%22revisions%2Frev%5B15%5D%2F%40timestamp%22%20.%20%3Fr15%20wikibase%3AapiOutput%20%22revisions%2Frev%5B15%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft16%20wikibase%3AapiOutput%20%22revisions%2Frev%5B16%5D%2F%40timestamp%22%20.%20%3Fr16%20wikibase%3AapiOutput%20%22revisions%2Frev%5B16%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft17%20wikibase%3AapiOutput%20%22revisions%2Frev%5B17%5D%2F%40timestamp%22%20.%20%3Fr17%20wikibase%3AapiOutput%20%22revisions%2Frev%5B17%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft18%20wikibase%3AapiOutput%20%22revisions%2Frev%5B18%5D%2F%40timestamp%22%20.%20%3Fr18%20wikibase%3AapiOutput%20%22revisions%2Frev%5B18%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft19%20wikibase%3AapiOutput%20%22revisions%2Frev%5B19%5D%2F%40timestamp%22%20.%20%3Fr19%20wikibase%3AapiOutput%20%22revisions%2Frev%5B19%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft20%20wikibase%3AapiOutput%20%22revisions%2Frev%5B20%5D%2F%40timestamp%22%20.%20%3Fr20%20wikibase%3AapiOutput%20%22revisions%2Frev%5B20%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft21%20wikibase%3AapiOutput%20%22revisions%2Frev%5B21%5D%2F%40timestamp%22%20.%20%3Fr21%20wikibase%3AapiOutput%20%22revisions%2Frev%5B21%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft22%20wikibase%3AapiOutput%20%22revisions%2Frev%5B22%5D%2F%40timestamp%22%20.%20%3Fr22%20wikibase%3AapiOutput%20%22revisions%2Frev%5B22%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft23%20wikibase%3AapiOutput%20%22revisions%2Frev%5B23%5D%2F%40timestamp%22%20.%20%3Fr23%20wikibase%3AapiOutput%20%22revisions%2Frev%5B23%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft24%20wikibase%3AapiOutput%20%22revisions%2Frev%5B24%5D%2F%40timestamp%22%20.%20%3Fr24%20wikibase%3AapiOutput%20%22revisions%2Frev%5B24%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft25%20wikibase%3AapiOutput%20%22revisions%2Frev%5B25%5D%2F%40timestamp%22%20.%20%3Fr25%20wikibase%3AapiOutput%20%22revisions%2Frev%5B25%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft26%20wikibase%3AapiOutput%20%22revisions%2Frev%5B26%5D%2F%40timestamp%22%20.%20%3Fr26%20wikibase%3AapiOutput%20%22revisions%2Frev%5B26%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft27%20wikibase%3AapiOutput%20%22revisions%2Frev%5B27%5D%2F%40timestamp%22%20.%20%3Fr27%20wikibase%3AapiOutput%20%22revisions%2Frev%5B27%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft28%20wikibase%3AapiOutput%20%22revisions%2Frev%5B28%5D%2F%40timestamp%22%20.%20%3Fr28%20wikibase%3AapiOutput%20%22revisions%2Frev%5B28%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft29%20wikibase%3AapiOutput%20%22revisions%2Frev%5B29%5D%2F%40timestamp%22%20.%20%3Fr29%20wikibase%3AapiOutput%20%22revisions%2Frev%5B29%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft30%20wikibase%3AapiOutput%20%22revisions%2Frev%5B30%5D%2F%40timestamp%22%20.%20%3Fr30%20wikibase%3AapiOutput%20%22revisions%2Frev%5B30%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft31%20wikibase%3AapiOutput%20%22revisions%2Frev%5B31%5D%2F%40timestamp%22%20.%20%3Fr31%20wikibase%3AapiOutput%20%22revisions%2Frev%5B31%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft32%20wikibase%3AapiOutput%20%22revisions%2Frev%5B32%5D%2F%40timestamp%22%20.%20%3Fr32%20wikibase%3AapiOutput%20%22revisions%2Frev%5B32%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft33%20wikibase%3AapiOutput%20%22revisions%2Frev%5B33%5D%2F%40timestamp%22%20.%20%3Fr33%20wikibase%3AapiOutput%20%22revisions%2Frev%5B33%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft34%20wikibase%3AapiOutput%20%22revisions%2Frev%5B34%5D%2F%40timestamp%22%20.%20%3Fr34%20wikibase%3AapiOutput%20%22revisions%2Frev%5B34%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft35%20wikibase%3AapiOutput%20%22revisions%2Frev%5B35%5D%2F%40timestamp%22%20.%20%3Fr35%20wikibase%3AapiOutput%20%22revisions%2Frev%5B35%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft36%20wikibase%3AapiOutput%20%22revisions%2Frev%5B36%5D%2F%40timestamp%22%20.%20%3Fr36%20wikibase%3AapiOutput%20%22revisions%2Frev%5B36%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft37%20wikibase%3AapiOutput%20%22revisions%2Frev%5B37%5D%2F%40timestamp%22%20.%20%3Fr37%20wikibase%3AapiOutput%20%22revisions%2Frev%5B37%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft38%20wikibase%3AapiOutput%20%22revisions%2Frev%5B38%5D%2F%40timestamp%22%20.%20%3Fr38%20wikibase%3AapiOutput%20%22revisions%2Frev%5B38%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft39%20wikibase%3AapiOutput%20%22revisions%2Frev%5B39%5D%2F%40timestamp%22%20.%20%3Fr39%20wikibase%3AapiOutput%20%22revisions%2Frev%5B39%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft40%20wikibase%3AapiOutput%20%22revisions%2Frev%5B40%5D%2F%40timestamp%22%20.%20%3Fr40%20wikibase%3AapiOutput%20%22revisions%2Frev%5B40%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft41%20wikibase%3AapiOutput%20%22revisions%2Frev%5B41%5D%2F%40timestamp%22%20.%20%3Fr41%20wikibase%3AapiOutput%20%22revisions%2Frev%5B41%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft42%20wikibase%3AapiOutput%20%22revisions%2Frev%5B42%5D%2F%40timestamp%22%20.%20%3Fr42%20wikibase%3AapiOutput%20%22revisions%2Frev%5B42%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft43%20wikibase%3AapiOutput%20%22revisions%2Frev%5B43%5D%2F%40timestamp%22%20.%20%3Fr43%20wikibase%3AapiOutput%20%22revisions%2Frev%5B43%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft44%20wikibase%3AapiOutput%20%22revisions%2Frev%5B44%5D%2F%40timestamp%22%20.%20%3Fr44%20wikibase%3AapiOutput%20%22revisions%2Frev%5B44%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft45%20wikibase%3AapiOutput%20%22revisions%2Frev%5B45%5D%2F%40timestamp%22%20.%20%3Fr45%20wikibase%3AapiOutput%20%22revisions%2Frev%5B45%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft46%20wikibase%3AapiOutput%20%22revisions%2Frev%5B46%5D%2F%40timestamp%22%20.%20%3Fr46%20wikibase%3AapiOutput%20%22revisions%2Frev%5B46%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft47%20wikibase%3AapiOutput%20%22revisions%2Frev%5B47%5D%2F%40timestamp%22%20.%20%3Fr47%20wikibase%3AapiOutput%20%22revisions%2Frev%5B47%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft48%20wikibase%3AapiOutput%20%22revisions%2Frev%5B48%5D%2F%40timestamp%22%20.%20%3Fr48%20wikibase%3AapiOutput%20%22revisions%2Frev%5B48%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft49%20wikibase%3AapiOutput%20%22revisions%2Frev%5B49%5D%2F%40timestamp%22%20.%20%3Fr49%20wikibase%3AapiOutput%20%22revisions%2Frev%5B49%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%20%20%3Ft50%20wikibase%3AapiOutput%20%22revisions%2Frev%5B50%5D%2F%40timestamp%22%20.%20%3Fr50%20wikibase%3AapiOutput%20%22revisions%2Frev%5B50%5D%2Ftext%28%29%22%20.%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%20as%20%25revs%20%7B%0A%20%20%7BBIND%28%3Fc1%20AS%20%3Fcount%29%20BIND%28%3Fd1%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc2%20AS%20%3Fcount%29%20BIND%28%3Fd2%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc3%20AS%20%3Fcount%29%20BIND%28%3Fd3%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc4%20AS%20%3Fcount%29%20BIND%28%3Fd4%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc5%20AS%20%3Fcount%29%20BIND%28%3Fd5%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc6%20AS%20%3Fcount%29%20BIND%28%3Fd6%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc7%20AS%20%3Fcount%29%20BIND%28%3Fd7%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc8%20AS%20%3Fcount%29%20BIND%28%3Fd8%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc9%20AS%20%3Fcount%29%20BIND%28%3Fd9%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc10%20AS%20%3Fcount%29%20BIND%28%3Fd10%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc11%20AS%20%3Fcount%29%20BIND%28%3Fd11%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc12%20AS%20%3Fcount%29%20BIND%28%3Fd12%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc13%20AS%20%3Fcount%29%20BIND%28%3Fd13%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc14%20AS%20%3Fcount%29%20BIND%28%3Fd14%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc15%20AS%20%3Fcount%29%20BIND%28%3Fd15%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc16%20AS%20%3Fcount%29%20BIND%28%3Fd16%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc17%20AS%20%3Fcount%29%20BIND%28%3Fd17%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc18%20AS%20%3Fcount%29%20BIND%28%3Fd18%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc19%20AS%20%3Fcount%29%20BIND%28%3Fd19%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc20%20AS%20%3Fcount%29%20BIND%28%3Fd20%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc21%20AS%20%3Fcount%29%20BIND%28%3Fd21%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc22%20AS%20%3Fcount%29%20BIND%28%3Fd22%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc23%20AS%20%3Fcount%29%20BIND%28%3Fd23%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc24%20AS%20%3Fcount%29%20BIND%28%3Fd24%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc25%20AS%20%3Fcount%29%20BIND%28%3Fd25%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc26%20AS%20%3Fcount%29%20BIND%28%3Fd26%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc27%20AS%20%3Fcount%29%20BIND%28%3Fd27%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc28%20AS%20%3Fcount%29%20BIND%28%3Fd28%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc29%20AS%20%3Fcount%29%20BIND%28%3Fd29%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc30%20AS%20%3Fcount%29%20BIND%28%3Fd30%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc31%20AS%20%3Fcount%29%20BIND%28%3Fd31%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc32%20AS%20%3Fcount%29%20BIND%28%3Fd32%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc33%20AS%20%3Fcount%29%20BIND%28%3Fd33%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc34%20AS%20%3Fcount%29%20BIND%28%3Fd34%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc35%20AS%20%3Fcount%29%20BIND%28%3Fd35%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc36%20AS%20%3Fcount%29%20BIND%28%3Fd36%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc37%20AS%20%3Fcount%29%20BIND%28%3Fd37%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc38%20AS%20%3Fcount%29%20BIND%28%3Fd38%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc39%20AS%20%3Fcount%29%20BIND%28%3Fd39%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc40%20AS%20%3Fcount%29%20BIND%28%3Fd40%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc41%20AS%20%3Fcount%29%20BIND%28%3Fd41%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc42%20AS%20%3Fcount%29%20BIND%28%3Fd42%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc43%20AS%20%3Fcount%29%20BIND%28%3Fd43%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc44%20AS%20%3Fcount%29%20BIND%28%3Fd44%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc45%20AS%20%3Fcount%29%20BIND%28%3Fd45%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc46%20AS%20%3Fcount%29%20BIND%28%3Fd46%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc47%20AS%20%3Fcount%29%20BIND%28%3Fd47%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc48%20AS%20%3Fcount%29%20BIND%28%3Fd48%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc49%20AS%20%3Fcount%29%20BIND%28%3Fd49%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%20UNION%0A%20%20%7BBIND%28%3Fc50%20AS%20%3Fcount%29%20BIND%28%3Fd50%20AS%20%3Fday%29%20INCLUDE%20%25revs%7D%0A%20%20FILTER%28%3Fcount%20%21%3D%20-1%29%0A%7D"
-- append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
local usagecount = tonumber( frame:expandTemplate{ title = 'Property uses', args = { string.sub(entity.id, 2) } } ) or 0
if (usagecount < 400000) and (usagecount > 100) then
linkText = translate("chart by item creation date")
linkURL = "https://query.wikidata.org/embed.html#%23defaultView%3AAreaChart%0ASELECT%20%3Fdate%20%3Fcumulativecount%20%0A%7B%0A%20%20%20%20hint%3AQuery%20hint%3Aoptimizer%20%22None%22.%0A%20%20%20%20%7B%20%20%20SELECT%20%3Fmilestonep%20%28COUNT%28%3Fitem%29%20as%20%3Fcumulativecount%29%0A%20%20%20%20%20%20%20%20WHERE%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%3Fitem%20wdt%3A" .. entity.id .. "%20%5B%5D%0A%20%20%20%20%20%20%20%20%20%20BIND%28%20xsd%3Ainteger%28%20substr%28str%28%3Fitem%29%2C%2033%29%29%20as%20%3Fqid%29%0A%20%20%20%20%20%20%20%20%20%20wd%3AQ38074555%20p%3AP1114%20%3Fmilestonep%20.%0A%20%20%20%20%20%20%20%20%20%20%3Fmilestonep%20ps%3AP1114%20%3Fmilestone%20.%0A%20%20%20%20%20%20%20%20%20%20FILTER%28%20%3Fmilestone%20%3E%20%3Fqid%20%29%20%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20GROUP%20BY%20%3Fmilestonep%0A%20%20%20%20%7D%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%3Fmilestonep%20pq%3AP585%20%3Fdate%0A%7D"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
end
if entity.datatype == 'time' then
linkText = translate("future dates")
linkURL = "https://query.wikidata.org/#SELECT%20%3Fsubject%20%3FsubjectLabel%20%3Finstance%20%3FinstanceLabel%20%28year%28%3Fdate%29%20as%20%3Fyear%29%20%3Fdate%20%20WHERE%20{%20%0A%20%20%20%3Fsubject%20p%3A" .. entity.id .. "%2Fpsv%3A" .. entity.id .. "%20%3Fdate_node%20.%0A%20%20%20%3Fdate_node%20wikibase%3AtimeValue%20%3Fdate%20.%0A%20%20%20FILTER%20%28%28%3Fdate%29%20%3E%3D%20%28now%28%29%29%29%20.%20%20%0A%20%20%20%3Fsubject%20wdt%3AP31%20%3Finstance%20.%0A%20%20SERVICE%20wikibase%3Alabel%20{%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20.%0A%20%20}%0A}%0AORDER%20BY%20DESC%28%3Fdate%29%20%20%20%20%20%0ALIMIT%20100"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("dates in Gregorian calendar before 1582")
linkURL = "https://query.wikidata.org/#%23Dates%20before%201582%20in%20Gregorian%20calendar%20%28date%20precision%20%3E%209%29%0A%23added%202016-02-26%2C%20based%20on%20a%20query%20by%20Mbch331%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fdate%20%0A{%0A%09{%09SELECT%20%3Fitem%20%3Fdate%20%0A%09%09{%0A%09%09%09%3Fitem%20p%3A" .. entity.id .. "%2Fpsv%3A" .. entity.id .. "%20%3Fdatevalue%20.%0A%20%20%20%20%09%09%3Fdatevalue%20wikibase%3AtimeValue%20%3Fdate%20.%20%20%20%20%20%20%20%20%20%20%20%0A%09%09%09FILTER%28%3Fdate%20%3C%20%22%2B1582-10-15T00%3A00%3A00Z%22^^xsd%3AdateTime%29%0A%09%09%09%3Fdatevalue%20wikibase%3AtimePrecision%20%3Fdateprecision%20.%20%0A%09%09%09FILTER%28%3Fdateprecision%20%3E%209%29%0A%09%09%09%3Fdatevalue%20wikibase%3AtimeCalendarModel%20wd%3AQ1985727%20.%0A%09%09}%0A%20%20%20%20%20%20%20%20LIMIT%205000%0A%20%20%20%20}%0A%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20}%0A}"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("dates before year 1")
linkURL = "https://query.wikidata.org/#%23Dates%20before%20year%201%20with%20precision%20%3E8%3A%20year%2C%20month%2C%20day%0A%23added%202016-08-07%2C%20Jura1%0ASELECT%20%3Fitem%20%3FitemLabel%20%28%3Fdate%20as%20%3FGregorianDate%29%20%28CONCAT%28str%281%2BYEAR%28%3Fdate%29%2a-1%29%2C%20%22%20BC%22%29%20as%20%3FyearBC%29%20%3Fdateprec%20%3FdateprecisionLabel%20%3FinputcalendarmodelLabel%0A%7B%0A%09%7B%09SELECT%20%3Fitem%20%3Fdate%20%28xsd%3Adecimal%28%3Fprecision%29%20as%20%3Fdateprec%29%20%3Finputcalendarmodel%0A%09%09%7B%0A%09%09%09%3Fitem%20p%3A" .. entity.id .. "%20%3Fd%20.%20%0A%20%20%20%20%20%20%20%20%20%20%09%3Fd%20psv%3A" .. entity.id .. "%20%3Fdatevalue%20.%0A%20%20%20%20%09%09%3Fdatevalue%20wikibase%3AtimeValue%20%3Fdate%20.%20%20%20%20%20%20%20%20%20%20%20%09FILTER%28%3Fdate%20%3C%20%22%2B1-00-00T00%3A00%3A00Z%22%5E%5Exsd%3AdateTime%29%0A%09%09%09%3Fdatevalue%20wikibase%3AtimePrecision%20%3Fprecision%20.%20%09%09FILTER%28%3Fprecision%20%3E%208%29%0A%09%09%09%3Fd%20wikibase%3Arank%20%3Frank%20.%09%09%09%09%09%09%09FILTER%28%3Frank%20%21%3D%20wikibase%3ADeprecatedRank%29%0A%09%09%09%3Fdatevalue%20wikibase%3AtimeCalendarModel%20%3Finputcalendarmodel%20.%0A%09%09%7D%0A%20%20%20%20%20%20%20%20LIMIT%205000%0A%20%20%20%20%7D%0A%20%20%09%3Fdateprecision%20wdt%3AP2803%20%3Fdateprec%0A%09SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%2Cla%22%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fdate%29"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. '] ([[Help:Dates#Years BC]])'
end
if entity.datatype == 'quantity' then
linkText = translate("Items with highest numeric value")
linkURL = "https://query.wikidata.org/#SELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%0A%7B%0A%09%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20.%0A%09SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20%20%7D%20%20%20%20%0A%7D%0AORDER%20BY%20DESC%28%3Fvalue%29%0ALIMIT%2050"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
linkText = translate("Items with lowest numeric value")
linkURL = "https://query.wikidata.org/#SELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%0A%7B%0A%09%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue%20.%0A%09SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20%20%7D%20%20%20%20%0A%7D%0AORDER%20BY%20ASC%28%3Fvalue%29%0ALIMIT%2050"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
-- todo : queries with units/normalized unit value
end
linkURL = d.formatStatements{
conjtype = '<br />',
entity = entity,
property = 'P2264',
pattern = '[https://tools.wmflabs.org/mix-n-match/#/catalog/$1 ' .. translate('mixnmatch') .. ']'
.. linguistic.inparentheses("[[User:Magnus Manske/Mix'n'match report/$1|" .. translate('mixnmatch-report') .. ']]', p.getLang()),
}
if linkURL then
append = append .. '\n* ' .. linkURL
end
local quantity = entity.datatype == 'quantity'
append = append
.. frame:preprocess('{{#ifexist:Wikidata:Database_reports/Recent_deaths/missing/{{PAGENAME}}|* [[Wikidata:Database_reports/Recent_deaths/missing/{{PAGENAME}}|Database reports/Recent deaths/missing/{{PAGENAME}}]]}}')
.. (quantity and frame:preprocess('{{#ifexist:User:Laboramus/Units/{{PAGENAME}}|* [[User:Laboramus/Units/{{PAGENAME}}]]' .. linguistic.inparentheses(translate('units used'), lang) .. '}}') or '')
.. frame:preprocess('{{#ifexist:Wikidata:Database_reports/Complex_constraint_violations/{{PAGENAME}}|* [[Wikidata:Database_reports/Complex_constraint_violations/{{PAGENAME}}|' .. translate('database-reports-complex-constraint-violations') .. '/{{PAGENAME}}]]}}')
.. frame:preprocess('{{#ifexist:Wikidata:Database_reports/Humans_with_missing_claims/{{PAGENAME}}|* [[Wikidata:Database reports/Humans with missing claims/{{PAGENAME}}|Database reports/Humans with missing claims/{{PAGENAME}}]]}}')
.. frame:preprocess('{{#ifexist:Wikidata:Database_reports/Constraint_violations/{{PAGENAME}}|* [[Wikidata:Database_reports/Constraint_violations/{{PAGENAME}}|' .. translate('database-reports-constraint-violations') .. '/{{PAGENAME}}]]}}')
if not forQualifierUse then
local linkText = translate("random list")
local linkURL = "https://query.wikidata.org/embed.html#SELECT%20%3Fitem%20%3FitemLabel%20%3FitemDescription%20%3Fvalue%20%3Fst%20%3Fids%20%3Fsl%0AWHERE%0A%7B%0A%20%20SERVICE%20bd%3Asample%20%7B%20%3Fitem%20wdt%3A" .. entity.id .. "%20%3Fvalue.%20bd%3AserviceParam%20bd%3Asample.limit%2042%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fitem%20wikibase%3Astatements%20%3Fst%20%3B%20wikibase%3Aidentifiers%20%3Fids%20%3B%20wikibase%3Asitelinks%20%3Fsl%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D"
append = append .. '\n* [' .. linkURL .. ' ' .. linkText .. ']'
end
return append
end,
maintenancecat = function(data)
if data.lists then
return "Property documentation using 'lists'"
end
return nil
end,
},
{
label = 'living people protection class',
query = 'P8274',
},
{
label = 'proposal discussion',
value = function(data)
local arg = data['proposed by'] or data.subpage
if arg then
if string.lower(arg) == 'none' then
return translate('no discussion')
end
local link = 'Property proposal/'
if tonumber(arg) then
link = link .. 'Archive/' .. arg .. '#' .. entity.id
else
link = link .. arg
end
if not mw.title.new(link, 'Wikidata') then
return arg
end
return '[[Wikidata:' .. link .. '|' .. link .. ']]'
else
discussion_link = d.formatStatements{
entity = entity,
property = 'P3254',
numval = 1,
pattern = '$1',
}
if not discussion_link then
return translate('no discussion')
else
discussion_page = discussion_link:gsub('https://www.wikidata.org/wiki/','')
if discussion_page == discussion_link then
-- This should really not happen
return '<span class="plainlinks">[' .. discussion_link .. ' ' .. translate('proposal discussion') .. ']</span>'
else
discussion_page = mw.uri.decode(discussion_page)
return '[[' .. discussion_page .. '|' .. translate('proposal discussion') .. ']]'
end
end
end
return arg
end,
maintenancecat = function(data)
if data['proposed by'] and data.subpage then
return 'Property documentation with unclear link to its proposal discussion'
end
local arg = data['proposed by'] or data.subpage
if arg then
if string.lower(arg) == 'none' then
return 'Property originally created without a formal discussion'
end
local link
if tonumber(arg) then
link = 'Property proposal/Archive/' .. arg
else
link = 'Property proposal/' .. arg
end
local title = mw.title.new(link, 'Wikidata')
if not title or not title.exists then
return 'Property documentation with malformed link to its proposal discussion'
end
end
return nil
end,
required = true,
missingcat = 'Property documentation missing a link to its proposal discussion',
},
{
label = 'current uses',
value = function()
local total = tonumber( frame:expandTemplate{ title = 'Property uses', args = { string.sub(entity.id, 2) } } )
local distinctuses = tonumber( frame:expandTemplate{ title = 'Statcount', args = { string.sub(entity.id, 1) .. "distinct" } } )
if total and total > 0 then
addcat(string.format('Properties used on %d+ items', 10 ^ math.floor(math.log10(total))))
local formatNum = require('Module:Formatnum')
local usage_table = mw.html.create( 'table' )
:attr('class', 'wikitable')
:css('font-size', 'smaller')
:css('text-align', 'right')
:done();
local row = usage_table:tag('tr')
:tag('td')
:css('text-align', 'left')
:wikitext("'''Total'''")
:done()
:tag('td')
:wikitext(formatNum.formatNum(total, p.getLang()))
:done()
:tag('td')
:wikitext('') -- empty
:done()
if distinctuses and distinctuses > 0 then
addcat('Properties with distinct value counts')
row:tag('td')
:wikitext("'''<span title='distinct values of property'>distinct values'''</span>")
:done()
row:tag('td')
:wikitext("<span title='items with property / distinct values of property'>'''ratio'''</span>")
:done()
end
local main_value = tonumber( frame:expandTemplate{ title = 'Number of main statements by property', args = { string.sub(entity.id, 2) } } )
local qual_value = tonumber( frame:expandTemplate{ title = 'Number of qualifiers by property', args = { string.sub(entity.id, 2) } } )
local ref_value = tonumber( frame:expandTemplate{ title = 'Number of references by property', args = { string.sub(entity.id, 2) } } )
local makePercentage = function (number, total)
local ratio = number / total
if ratio < .001 then
return '<' .. formatNum.formatNum('0.1', p.getLang())
else
return formatNum.formatNum(string.format('%.1f', 100*ratio), p.getLang())
end
end
if main_value and main_value > 0 then
local row = usage_table:tag('tr')
:tag('td')
:css('text-align', 'left')
:wikitext(translate('main-statement'))
:done()
local sourceIds = tonumber(d.formatStatements{
entity = entity,
numval = 1,
property = 'P4876',
rank = 'best',
})
if sourceIds and sourceIds > 0 then
local percentage = string.format('%.0f', 100*main_value/sourceIds)
row:tag('td')
:wikitext(mw.ustring.format(translate('identifier coverage statistics'),
formatNum.formatNum(main_value, p.getLang()),
formatNum.formatNum(sourceIds, p.getLang()),
formatNum.formatNum(percentage, p.getLang())))
:done()
else
row:tag('td')
:wikitext(formatNum.formatNum(main_value, p.getLang()))
:done()
end
row:tag('td')
:wikitext(mw.ustring.format(translate('percentage-of-uses'), makePercentage(main_value, total)))
:done()
if distinctuses and distinctuses > 0 then
row:tag('td')
:wikitext(formatNum.formatNum(distinctuses, p.getLang()))
:done()
row:tag('td')
:wikitext( "<span title='one value is used on ~" .. string.format('%.1f', main_value/distinctuses) .. " items'>" .. string.format('%.1f', main_value/distinctuses) .. "</span>" )
:done()
end
end
if qual_value and qual_value > 0 then
usage_table:tag('tr')
:tag('td')
:css('text-align', 'left')
:wikitext(translate('qualifier'))
:done()
:tag('td')
:wikitext(formatNum.formatNum(qual_value, p.getLang()))
:done()
:tag('td')
:wikitext(mw.ustring.format(translate('percentage-of-uses'), makePercentage(qual_value, total)))
:done()
end
if ref_value and ref_value > 0 then
usage_table:tag('tr')
:tag('td')
:css('text-align', 'left')
:wikitext(translate('reference'))
:done()
:tag('td')
:wikitext(formatNum.formatNum(ref_value, p.getLang()))
:done()
:tag('td')
:wikitext(mw.ustring.format(translate('percentage-of-uses'), makePercentage(ref_value, total)))
:done()
end
return tostring(usage_table)
end
addcat('Unused properties')
return nil
end,
},
{
label = 'search for values',
value = function()
local value
if (
-- https://gerrit.wikimedia.org/r/plugins/gitiles/operations/mediawiki-config/+/master/wmf-config/SearchSettingsForWikibase.php#65
entity.datatype == 'string' or
entity.datatype == 'external-id' or
entity.datatype == 'url' or
entity.datatype == 'wikibase-item' or
entity.datatype == 'wikibase-property' or
entity.datatype == 'wikibase-lexeme' or
entity.datatype == 'wikibase-form' or
entity.datatype == 'wikibase-sense'
) and not searchPropertiesExclude[entity.id] then
-- todo: nearcoord for globe-coordinate
-- todo: quantity (https://www.mediawiki.org/wiki/Help:Extension:WikibaseCirrusSearch#wbstatementquantity)
local sample = d.showQualifier{
displayformat = 'raw',
entity = entity,
numval = 1,
property = {'P1855','P2271','P5192','P5193','P5977'},
rank = 'best',
qualifier = entity.id,
}
local data = {
'type=fulltext',
'break=no',
'inline=true',
'width=80',
}
local search_term
if sample and sample ~= '' then
table.insert( data, 'searchbuttonlabel=' .. mw.ustring.format( translate( 'search for' ), sample ) )
search_term = entity.id .. '=' .. sample
else
search_term = entity.id
end
if entity.datatype == 'string' and sample then
table.insert( data, 'default=haswbstatement:"' .. search_term .. '"' )
else
table.insert( data, 'default=haswbstatement:' .. search_term )
end
value = frame:extensionTag( 'inputbox', table.concat( data, '\n' ), { align = 'left' } )
end
return value
end,
},
}
function p.getI18n()
return mw.loadData('Module:i18n/property documentation')
end
function p.init(args)
local id = args.id or frame:preprocess('{{BASEPAGENAME}}')
if args.lang then
p.setLang(args.lang)
end
entity = d.getEntityFromId(id)
if not entity then
return error('Entity not found')
end
addcat('All Properties')
addcat('Properties with ' .. entity.datatype .. '-datatype')
end
function p.links(args)
local forQualifierUse = false
-- todo: use property constraints
if entity.claims and entity.claims.P31 then
for _, statement in ipairs(entity.claims.P31) do
if d.getmainid(statement) == 'Q15720608' then
forQualifierUse = true
break
end
end
end
local id = entity.id
local lang = p.getLang()
local queries = {}
local linkText, linkURL
if not forQualifierUse then
linkText = translate("basic item query")
linkURL = "https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20p%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%23Sample%20query%20to%20start%20a%20list%20of%20values%20for%20property%20" .. id .. "%0A%23Remove%20some%20of%20the%20%22%23%22%20below%20to%20see%20if%20it%20helps%20you%0A%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3FvalueLabel%20%0A%23sample%20variables%20defined%20below%20%28but%20commented%20out%29%0A%3Fdob%20%3Fdod%20%3Fcountry%0AWHERE%0A{%0A%09%3Fitem%20wdt%3A" .. id .. "%20%3Fvalue%20.%0A%23%09%3Fitem%20wdt%3AP569%20%3Fdob%20.%20%0A%23%09OPTIONAL%20{%3Fitem%20wdt%3AP570%20%3Fdod%20}%20.%20%0A%23%09%3Fitem%20wdt%3AP17%20%3Fcountry%20.%20%0A%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20%20}%20%20%20%20%0A}%0ALIMIT%2010"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
linkText = translate("current uses")
linkURL = "https://query.wikidata.org/#SELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue" ..
( entity.datatype == "wikibase-item" and "%20%3FvalueLabel" or "" ) .. -- Only include "?valueLabel" if property has datatype wikibase-item
"%0A{%0A%09%3Fitem%20wdt%3A" .. id .. "%20%3Fvalue%20.%0A%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20%20}%20%20%20%20%0A}%0ALIMIT%201000"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
if entity.datatype == 'time' then
linkText = translate("with precision and calendarmodel")
linkURL = "https://query.wikidata.org/#SELECT%20%3Fitem%20%3FitemLabel%20%3Fvalue%20%3Fprecision%20%3FtpLabel%20%3Fmodel%20%3FmodelLabel%0A%7B%0A%20%20%20%20%7B%20%20SELECT%20%2a%0A%20%20%20%20%20%20%20WHERE%0A%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%3Fitem%20p%3A" .. id .. "%2Fpsv%3A" .. id .. "%20%5B%20wikibase%3AtimeValue%20%3Fvalue%20%3B%20wikibase%3AtimePrecision%20%3Fprecision%20%3B%20wikibase%3AtimeCalendarModel%20%3Fmodel%20%5D%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20LIMIT%20200%0A%20%20%20%20%7D%0A%20%20%20%20%0A%20%20%20%20%23%20for%20labels%0A%20%20%20%20%3Ftp%20wdt%3AP2803%20%3Fpr%20.%20FILTER%28%20str%28%3Fpr%29%20%3D%20str%28%3Fprecision%29%20%29%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
if not prop31279[id] then
linkText = translate("counts by class")
linkURL = "https://query.wikidata.org/#%23top%2050%20for%20P31%20and%20P279%20of%20items%20using%20" .. id .. "%0ASELECT%20%3Fclass%20%3FclassLabel%20%3Fcount%20%3Fuse_as_Label%0A{%09{%09SELECT%20%3Fclass%20%28COUNT%28*%29%20AS%20%3Fcount%29%20%28wd%3AP31%20as%20%3Fuse_as_%29%0A%09%09{%09%3Fa%09wdt%3A" .. id .. "%09%3Fp%09%3B%20wdt%3AP31%09%3Fclass}%0A%20%20%20%20%20%20%20%20GROUP%20BY%20%3Fclass%20ORDER%20BY%20DESC%28%3Fcount%29%20LIMIT%2050%0A%20%20%09}%0A%20%20%09UNION%0A%09{%09SELECT%20%3Fclass%20%28COUNT%28*%29%20AS%20%3Fcount%29%20%28wd%3AP279%20as%20%3Fuse_as_%29%0A%09%09{%09%3Fa%09wdt%3A" .. id .. "%09%3Fp%09%3B%20wdt%3AP279%09%3Fclass}%0A%20%20%20%20%20%20%20%20GROUP%20BY%20%3Fclass%20ORDER%20BY%20DESC%28%3Fcount%29%20LIMIT%2050%0A%20%20%09}%0A%20%20%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20}%0A}%0AORDER%20BY%20DESC%28%3Fcount%29%20%3Fclass"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
if entity.datatype == 'wikibase-item' then
linkText = translate("value list")
linkURL = "https://query.wikidata.org/#%23Values%20used%20by%20property%20" .. id .. "%0ASELECT%20%3Fvalue%20%3FvalueLabel%20%3Fct%20%3Fsampleitem%20%3FsampleitemLabel%0AWHERE%0A%7B%0A%20%20%7B%0A%20%20%20%20SELECT%20%3Fvalue%20%28count%28%2a%29%20as%20%3Fct%29%20%28SAMPLE%28%3Fitem%29%20as%20%3Fsampleitem%29%0A%20%20%20%20WHERE%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%3Fitem%20wdt%3A" .. id .. "%20%3Fvalue%0A%20%20%20%20%7D%0A%20%20%20%20GROUP%20BY%20%3Fvalue%0A%20%20%20%20ORDER%20BY%20DESC%28%3Fct%29%0A%20%20%20%20LIMIT%201000%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fct%29%20ASC%28%3Fvalue%29"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
if entity.datatype == 'time' then
linkText = translate("by century")
-- unresolved: FLOOR((0-1)/100)+1 = 0
-- new problem: 20. century => 2000-00-00 => 19th century
linkURL = "https://query.wikidata.org/#%23Number%20of%20dates%20per%20century%0ASELECT%20%3Fcentury%20%28COUNT%28%3Fitem%29%20as%20%3Fcount%29%0AWHERE%20%0A%7B%09%0A%20%20%3Fitem%20wdt%3A" .. id .. "%20%3Fdate%20.%0A%20%20BIND%28FLOOR%28%28YEAR%28%3Fdate%29-1%29%2F100%29%2B1%20as%20%3Fcentury%29%0A%7D%20%0AGROUP%20BY%20%3Fcentury%0AORDER%20BY%20DESC%28%3Fcentury%29"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
-- access date (scope issue)
if id ~= 'P813' then
linkText = translate("date precisions")
linkURL = "https://query.wikidata.org/#%23by%20Jura1%2C%202016-05-04%0ASELECT%20%3Fcount%20%3Fdatetime_precision_label%20%3Fdatetime_precision%20%0A{%0A%09{%0A%09%09SELECT%20%3Fdatetime_precision%20%28count%28DISTINCT%28%3Fnode%29%29%20as%20%3Fcount%29%0A%09%09{%09%0A%20%20%09%09%09%3Fnode%20psv%3A" .. id .. "%2Fwikibase%3AtimePrecision%20%3Fdatetime_precision%0A%09%09}%20%0A%09%09GROUP%20BY%20%3Fdatetime_precision%0A%09}%0A%09%3Fitem%20wdt%3AP2803%20%3Fvalue%0A%09FILTER%20%28%3Fdatetime_precision%20%3D%20%3Fvalue%29%0A%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20.%20%3Fitem%20rdfs%3Alabel%20%3Fdatetime_precision_label%20%20}%20%20%20%20%0A}%0AORDER%20BY%20DESC%28%3Fcount%29%0ALIMIT%2010"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
linkText = translate("calendars")
linkURL = "https://query.wikidata.org/#SELECT%20%3Fcalendar%20%28count%28*%29%20as%20%3Fcount%29%0AWHERE%20{%09%0A%20%20%3Fdateproperty%20psv%3A" .. id .. "%2Fwikibase%3AtimeCalendarModel%20%3Fcalendar.%0A}%20%0AGROUP%20BY%20%3Fcalendar%0AORDER%20BY%20DESC%28%3Fcount%29"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
if entity.datatype == 'external-id' or entity.datatype == 'string' or entity.datatype == 'monolingualtext' then
linkText = translate("string lengths")
linkURL = "https://query.wikidata.org/#%23String%20lenghts%20by%20frequency%20with%20sample%20value%0A%23by%20Jura1%2C%202016-01-24%2C%202017-07-28%0A%0ASELECT%20%3Fstringlength%20%28COUNT%28DISTINCT%28%3Fstringvalue%29%29%20AS%20%3Fcount%29%20%28SAMPLE%28%3Fstringvalue%29%20as%20%3Fsamplestringvalue%29%20%20%28SAMPLE%28%3Fitem%29%20as%20%3Fsampleitem%29%0A%28URI%28CONCAT%28%22https%3A%2F%2Fquery.wikidata.org%2F%23SELECT%2520%253Fitem%2520%253FitemLabel%2520%253FitemDescription%2520%253Fstringvalue%2520%253Fstringlength%250A%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22WHERE%2520%250A%257B%250A%2509%253Fitem%2520wdt%253A%22%2C%22" .. id .. "%22%2C%22%2520%253Fstringvalue%2520.%250A%2520%2520%2520%2520BIND%2528strlen%2528%253Fstringvalue%2529%2520as%2520%253F%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22stringlength%2529%250A%2520%2520%2520%2520FILTER%2528%253Fstringlength%2520%253D%2520%22%2Cstr%28%3Fstringlength%29%2C%22%2529%250A%2520%2520%2520%2520SERVICE%2520wikibase%253Alabel%2520%257B%2520bd%253A%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22serviceParam%2520wikibase%253Alanguage%2520%2522%255BAUTO_LANGUAGE%255D%252Cen%2522.%2520%257D%250A%257D%250ALIMIT%2520100%250A%22%29%29%20as%20%3Flist%29%0AWHERE%0A%7B%0A%09%3Fitem%20wdt%3A" .. id .. "%20%3Fstringvalue%20.%0A%20%20%20%20BIND%28strlen%28%3Fstringvalue%29%20as%20%3Fstringlength%29%0A%7D%0AGROUP%20BY%20%3Fstringlength%0AORDER%20BY%20DESC%28%3Fcount%29%0ALIMIT%2010"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
if entity.datatype == 'monolingualtext' then
linkText = translate("languages of strings")
linkURL = "https://query.wikidata.org/#%23by%20Jura1%2C%202016-01-24%0A%0ASELECT%20%3Flang%20%28COUNT%28DISTINCT%28%3Fmonolingualstring%29%29%20as%20%3Fcount%29%20%20%0AWHERE%20%0A{%20%0A%20%20%3Fitem%20wdt%3A" .. id .. "%20%3Fmonolingualstring%20.%20%0A%20%20BIND%28lang%28%3Fmonolingualstring%29%20as%20%3Flang%29%20%0A}%20%0AGROUP%20BY%20%3Flang%0AORDER%20BY%20DESC%28%3Fcount%29%0ALIMIT%2050"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
if entity.datatype == 'quantity' then
linkText = translate("units")
linkURL = "https://query.wikidata.org/#%23Units%20used%20by%20property%20" .. id .. "%0A%23by%20Jura1%2C%202016-01-24%2C%20rev.%202017-07-30%0A%0ASELECT%20DISTINCT%20%3Funit%20%3FunitLabel%20%3Fcount%20%3Fhas_SI_conversion%20%3Fhas_some_conversion%0AWHERE%0A%7B%0A%09%7B%0A%20%20%09%09SELECT%20%3Funit%20%28count%28DISTINCT%28%3Fitem%29%29%20as%20%3Fcount%29%0A%09%09WHERE%20%0A%09%09%7B%09%0A%20%20%09%09%20%20%20%20%3Fitem%20psv%3A" .. id .. "%2Fwikibase%3AquantityUnit%20%3Funit%0A%09%09%7D%20%0A%09%09GROUP%20BY%20%3Funit%0A%09%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3Funit%20wdt%3AP2370%20%5B%5D%20.%20BIND%28%22y%22%20as%20%3Fhas_SI_conversion%29%20%7D%0A%20%20%20%20OPTIONAL%20%7B%20%3Funit%20wdt%3AP2442%20%5B%5D%20.%20BIND%28%22y%22%20as%20%3Fhas_some_conversion%29%20%7D%0A%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D%0AORDER%20BY%20DESC%28%3Fcount%29%20%3Funit%0ALIMIT%2010"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
linkText = translate("scale of values")
linkURL = "https://query.wikidata.org/#%23by%20Jura1%2C%202015-01-25%0A%23scales%3A%20%3C1%3D%3C1%2C%201%3D1-9%2C%202%3D10-99%2C%203%3D100-999%2C%20etc.%0A%0ASELECT%20%3Fscale%20%28COUNT%28%3Fquantityvalue%29%20AS%20%3Fcount%29%0A{%0A%09%3Fitem%20wdt%3A" .. id .. "%20%3Fquantityvalue%20.%0A%20%20%20%20BIND%28strlen%28STR%28ROUND%28%3Fquantityvalue%29%29%29%20as%20%3Flength%29%0A%20%20%20%20BIND%28IF%28%3Fquantityvalue%3C1%2C%22%3C1%22%2C%3Flength%29%20%09as%20%3Fscale%29%0A}%0AGROUP%20BY%20%3Fscale%0AORDER%20BY%20%3Fscale%0ALIMIT%20100"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
if entity.datatype == 'url' then
linkText = translate("protocol")
linkURL = "https://query.wikidata.org/#SELECT%20%3Fprotocol%20%28COUNT%28%3Fitem%29%20as%20%3Fcount%29%20%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fcountdistinct%29%0AWHERE%0A{%0A%09%3Fitem%20wdt%3A" .. id .. "%20%3Fvalue%20.%0A%20%20%09BIND%28strbefore%28%20str%28%3Fvalue%29%2C%20%22%3A%22%29%20as%20%3Fprotocol%29%0A}%0AGROUP%20BY%20%3Fprotocol%0AORDER%20BY%20DESC%28%3Fcount%29%0ALIMIT%2010"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
if entity.datatype == 'commonsMedia' then
linkText = translate("file extensions")
linkURL = "https://query.wikidata.org/#%23by%20Jura1%2C%202016-01-24%0A%0ASELECT%20%3Fextension%20%28COUNT%28DISTINCT%28%3Ffilename%29%29%20AS%20%3Fcount%29%20WHERE%20%0A{%0A%09%3Fitem%20wdt%3A" .. id .. "%20%3Ffilename%20.%0A%20%20%20%20BIND%28fn%3Alower-case%28REPLACE%28str%28%3Ffilename%29%2C%20%27%28.%2B%3F%29.%28\\u005B^.\\u005D*%24%29%27%2C%20%22%242%22%29%29%20AS%20%3Fextension%29%0A}%0AGROUP%20BY%20%3Fextension%0AORDER%20BY%20DESC%28%3Fcount%29%0ALIMIT%2010"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
linkText = translate("qualifiers")
linkURL = "https://query.wikidata.org/#SELECT%20%3Fqual%20%3FqualLabel%20%3Fcount%20WHERE%20%7B%0A%20%20%7B%0A%20%20%20%20SELECT%20%3Fqual%20(COUNT(DISTINCT%20%3Fitem)%20AS%20%3Fcount)%20WHERE%20%7B%0A%20%20%20%20%20%20%20%20%20hint%3AQuery%20hint%3Aoptimizer%20%22None%22%20.%0A%20%20%20%20%20%20%20%20%20%3Fitem%20p%3A" .. id .. "%20%3Fstatement%20.%0A%20%20%20%20%20%20%20%20%20%3Fstatement%20%3Fpq_qual%20%3Fpq_obj%20.%0A%20%20%20%20%20%20%20%20%20%3Fqual%20wikibase%3Aqualifier%20%3Fpq_qual%20.%0A%20%20%20%20%7D%20%20GROUP%20BY%20%3Fqual%0A%20%20%7D%20.%0A%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fqual%20rdfs%3Alabel%20%3FqualLabel%20filter%20(lang(%3FqualLabel)%20%3D%20%22" .. lang .. "%22)%20.%0A%20%20%7D%0A%7D%0AORDER%20BY%20DESC(%3Fcount)%20ASC(%3FqualLabel)"
-- avoid query timeout
if not freqproperties[id] then
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
else
--- for qualifiers
linkText = translate("basic item query")
linkURL = "https://query.wikidata.org/#PREFIX%20wd%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20wikibase%3A%20%3Chttp%3A%2F%2Fwikiba.se%2Fontology%23%3E%0APREFIX%20p%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2F%3E%0APREFIX%20ps%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20pq%3A%20%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fqualifier%2F%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%23Sample%20query%20to%20start%20a%20list%20of%20statements%20using%20the%20qualifer%20" .. id .. "%0A%0ASELECT%20%3Fitem%20%3FitemLabel%20%3Fproperty%20%3FpropertyLabel%20%3Fvalue%20%3FvalueLabel%20%3Fqualifier" .. id .. "value%0AWHERE%0A{%0A%20%20%20%20%3Fprop%20pq%3A" .. id .. "%20%3Fqualifier" .. id .. "value%20.%0A%20%20%09hint%3AQuery%20hint%3Aoptimizer%20%22None%22%20.%09%0A%09%3Fitem%20%3Fp%20%3Fprop%20.%20%0A%09%3Fproperty%20wikibase%3Aclaim%20%3Fp%20.%20%20%0A%20%20%09%3Fproperty%20wikibase%3AstatementProperty%20%3Fps%20.%0A%20%20%20%20%3Fprop%20%3Fps%20%3Fvalue%20.%20%20%20%20%20%20%0A%0A%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22" .. lang .. "%2Cen%22%20%20}%20%20%20%20%0A}%0ALIMIT%2020"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
linkText = translate("properties using this qualifier")
linkURL = "https://query.wikidata.org/#%23Number%20of%20items%2Fstatements%20using%20qualifer%20" .. id .. "%20for%20each%20property%0A%23added%202016-02-24%20by%20Jura1%20%0A%0ASELECT%20%3Fproperty%20%3FpropertyLabel%20%3Fitems%20%3Fstatements%0AWHERE%0A{%0A%09{%0A%09%09SELECT%20%3Fproperty%20%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fitems%29%20%28COUNT%28%3Fvalue%29%20as%20%3Fstatements%29%0A%09%09WHERE%0A%09%09{%0A%20%20%20%20%09%09%3Fprop%20pq%3A" .. id .. "%20%3Fqualifier" .. id .. "value%20.%0A%20%20%09%09%09hint%3AQuery%20hint%3Aoptimizer%20%22None%22%20.%09%0A%09%09%09%3Fitem%20%3Fp%20%3Fprop%20.%20%0A%09%09%09%3Fproperty%20wikibase%3Aclaim%20%3Fp%20.%20%20%0A%20%20%09%09%09%3Fproperty%20wikibase%3AstatementProperty%20%3Fps%20.%0A%20%20%20%20%09%09%3Fprop%20%3Fps%20%3Fvalue%20.%20%20%20%20%20%20%0A%09%09}%0A%09%09GROUP%20BY%20%3Fproperty%20%0A%09%09ORDER%20BY%20DESC%28%3Fitems%29%20DESC%28%3Fstatements%29%0A%09%09LIMIT%2025%0A%09}%0A%09SERVICE%20wikibase%3Alabel%20{%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%2Cen%22%20%20}%20%20%20%20%0A}%0AORDER%20BY%20DESC%28%3Fitems%29%20DESC%28%3Fstatements%29%0A%0A%0A"
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
end
linkText = translate("counts")
if freqproperties[id] then
linkURL = "https://query.wikidata.org/#%23Uses%20of%20" .. id .. "%3A%09as%20property%20%28any%20rank%2Fbest%20rank%29.%20For%20performance%20reasons%2C%20detailed%20counts%20by%20rank%20are%20not%20included.%0A%23%09%09%09%09as%20qualifier%0A%23%09%09%09%09in%20references%0A%23by%20Jura1%2C%20rev%202016-03-03%0ASELECT%09%3Fuse%20%3Frank%20%3Fitems_with_property%09%3Fuses_of_property%0AWHERE{%09{%09%09SELECT%20%09%28wikibase%3AstatementProperty%20as%20%3Fuse%29%09%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fitems_with_property%29%09%28COUNT%28%3Fvalue%29%20as%20%3Fuses_of_property%29%0A%09%09%09%09WHERE%09{%3Fitem%20p%3A" .. id .. "%20%3Fvalue}}%0AUNION%09{%09%09SELECT%20%09%28wikibase%3AstatementProperty%20as%20%3Fuse%29%09%28wikibase%3ABestRank%20as%20%3Frank%29%09%28COUNT%28DISTINCT%28%3Fitem%29%29%09as%20%3Fitems_with_property%29%09%28COUNT%28%3Fbestvalue%29%20as%20%3Fuses_of_property%29%0A%20%20%20%20%20%09%09%09WHERE%20%09{%3Fitem%20wdt%3A" .. id .. "%20%3Fbestvalue%20}%20}%0AUNION%09{%09%09SELECT%20%09%28wikibase%3Areference%20as%20%3Fuse%29%09%09%09%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fitems_with_property%29%09%28COUNT%28%3Fvalue%29%20as%20%3Fuses_of_property%29%0A%20%20%20%20%20%09%09%09WHERE%20%09{%3Fitem%20pr%3A" .. id .. "%20%3Fvalue%20}}%0AUNION%09{%09%09SELECT%20%09%28wikibase%3Aqualifier%20as%20%3Fuse%29%09%09%09%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fitems_with_property%29%09%28COUNT%28%3Fvalue%29%20as%20%3Fuses_of_property%29%0A%20%20%20%20%20%09%09%09WHERE%20%09{%3Fitem%20pq%3A" .. id .. "%20%3Fvalue%20}}%0A}%0AORDER%20BY%20DESC%28%3Fuse%29%20DESC%28%3Fitems_with_property%29%20%3Frank%0A%0A%23PLEASE%20NOTE%3A%20Deleted%20items%20appear%20in%20counts%20for%20some%20ranks%2C%20but%20not%20in%20others."
else
linkURL = "https://query.wikidata.org/#%23Uses%20of%20" .. id .. "%3A%09as%20property%20%28any%20rank%2Fbest%20rank%2Fnormal%20rank%2Fpreferred%20rank%2Fdeprecated%20rank%29%0A%23%09%09%09%09as%20qualifier%0A%23%09%09%09%09in%20references%0A%23by%20Jura1%2C%20rev%202016-03-03%0ASELECT%09%3Fuse%20%3Frank%20%3Fitems_with_property%09%3Fuses_of_property%0AWHERE{%09{%09%09SELECT%20%09%28wikibase%3AstatementProperty%20as%20%3Fuse%29%09%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fitems_with_property%29%09%28COUNT%28%3Fvalue%29%20as%20%3Fuses_of_property%29%0A%09%09%09%09WHERE%09{%3Fitem%20p%3A" .. id .. "%20%3Fvalue}}%0AUNION%09{%09%09SELECT%20%09%28wikibase%3AstatementProperty%20as%20%3Fuse%29%09%28wikibase%3ABestRank%20as%20%3Frank%29%09%28COUNT%28DISTINCT%28%3Fitem%29%29%09as%20%3Fitems_with_property%29%09%28COUNT%28%3Fbestvalue%29%20as%20%3Fuses_of_property%29%0A%20%20%20%20%20%09%09%09WHERE%20%09{%3Fitem%20wdt%3A" .. id .. "%20%3Fbestvalue%20}%20}%0AUNION%20%09{%09%09SELECT%20%20%28wikibase%3AstatementProperty%20as%20%3Fuse%29%09%3Frank%09%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fitems_with_property%29%09%28COUNT%28%28%3Fstatement%29%29%20as%20%3Fuses_of_property%29%20%0A%09%09%09%09WHERE%09{%3Fitem%20p%3A" .. id .. "%20%3Fstatement%20.%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3Fstatement%20wikibase%3Arank%20%3Frank%20}%0A%09%09%09%09%09%09GROUP%20BY%20%3Frank%20}%0AUNION%09{%09%09SELECT%20%09%28wikibase%3Areference%20as%20%3Fuse%29%09%09%09%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fitems_with_property%29%09%28COUNT%28%3Fvalue%29%20as%20%3Fuses_of_property%29%0A%20%20%20%20%20%09%09%09WHERE%20%09{%3Fitem%20pr%3A" .. id .. "%20%3Fvalue%20}}%0AUNION%09{%09%09SELECT%20%09%28wikibase%3Aqualifier%20as%20%3Fuse%29%09%09%09%28COUNT%28DISTINCT%28%3Fitem%29%29%20as%20%3Fitems_with_property%29%09%28COUNT%28%3Fvalue%29%20as%20%3Fuses_of_property%29%0A%20%20%20%20%20%09%09%09WHERE%20%09{%3Fitem%20pq%3A" .. id .. "%20%3Fvalue%20}}%0A}%0AORDER%20BY%20DESC%28%3Fuse%29%20DESC%28%3Fitems_with_property%29%20%3Frank%0A%0A%23PLEASE%20NOTE%3A%20Deleted%20items%20appear%20in%20counts%20for%20some%20ranks%2C%20but%20not%20in%20others."
end
table.insert(queries, '[' .. linkURL .. ' ' .. linkText .. ']')
return queries
end
function p.before(args)
local deprecated_params = {"status", "datatype", "topic", "subpage", "proposed by"}
local used_deprecated_params = {}
for i, v in ipairs(deprecated_params) do
if args[v] ~= nil then
table.insert(used_deprecated_params,v)
end
end
if #used_deprecated_params > 0 then
local result = '<span style="font-size: 200%; color: red;">Please remove the following deprecated parameters: '
result = table.concat(used_deprecated_params, ', ') .. '.</span>'
return result
end
return ''
end
function p.header(args)
-- Top-left: Label <br/> Description
local label = d._getLabel(entity, p.getLang()) or ''
local description = d._getDescription(entity, p.getLang()) or ''
return '<b>' .. label .. '</b><br />' .. description
end
function p.makeRow(rowparams, data)
-- get value from template
local templateval
local templatequery = rowparams.value
if templatequery and type(templatequery) == 'function' then
templateval = templatequery(data)
else
templateval = data[rowparams.label] -- by default parameter name = label name
end
-- get value from item properties
local itemval, itemquery
local lang = p.getLang()
if entity then
itemquery = rowparams.query
if type(itemquery) == 'string' then
itemval = d.formatStatements{ entity = entity, property = itemquery, lang = lang, displayformat = 'wikidatastyle', conjtype = 'comma' }
elseif type(itemquery) == 'function' then
itemval = itemquery()
end
end
local val = templateval or itemval
if templateval then
if itemval then
-- Warn that info in the template parameter duplicates info from some property statement
val = '<div>' .. translate('local data') .. '\n' .. templateval
.. '</div>\n<div>' .. translate('property data') .. '<br />' .. itemval
.. '</div>\n<b>' .. translate('notice') .. '</b>'
local dupcat = 'Property with duplicated information'
if rowparams.duplicatecat then
if type(rowparams.duplicatecat) == 'function' then
dupcat = rowparams.duplicatecat()
else
dupcat = rowparams.duplicatecat
end
end
addcat(dupcat)
elseif itemquery then
-- Warn that template parameter needs to be ported to some statement of the property
-- Look for a property to use as a destination for the info currently held by the template parameter
local toprop
if rowparams.converttoprop then
if type(rowparams.converttoprop) == 'function' then
toprop = rowparams.converttoprop(data)
else
toprop = rowparams.converttoprop
end
end
if not toprop and type(itemquery) == 'string' then
toprop = itemquery
end
if toprop then
local topropstr
if type(toprop) == 'table' then
local toproptable = {}
for i, j in ipairs(toprop) do
toproptable[i] = d.showentity(j, lang)
end
topropstr = linguistic.conj(toproptable, lang, 'or')
else
topropstr = d.showentity(toprop, lang)
end
val = val .. '\n' .. mw.ustring.format(translate('to move with prop'), topropstr)
else
val = val .. '\n' .. translate('to move')
end
local convcat = 'Property documentation with data to be moved to statements'
if rowparams.conversioncat then
if type(rowparams.conversioncat) == 'function' then
convcat = rowparams.conversioncat()
else
convcat = rowparams.conversioncat
end
end
addcat(convcat)
end
end
if not val or val == '-' then
if not rowparams.required then
return nil
end
val = '<span style="color: red;">' .. translate('missing') .. '</span>' -- maintenance for missing parameters
addcat(rowparams.missingcat or 'Property documentation with missing information')
end
if rowparams.maintenancecat then
addcat(rowparams.maintenancecat(data))
end
if string.find(val, '^[*#:;]') then
val = '\n' .. val
end
return val
end
return p