Template:SPARQL2: Difference between revisions

From Almeda
imported Template:SARQL2
Tag: 2017 source edit
 
copied from source code
Tag: 2017 source edit
 
Line 1: Line 1:
<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.11/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.11/ http://www.mediawiki.org/xml/export-0.11.xsd" version="0.11" xml:lang="en">
{{SPARQL2/doc}}
  <siteinfo>
<onlyinclude>{{Clear}}{{#ifeq:{{{nohints|}}}|{{{nohints}}}| <!--hidden hints--> | {{TranslateThis<!--
    <sitename>Wikidata</sitename>
       -->|ar=يستخدم الاستعلام التالي هذه:<!--
    <dbname>wikidatawiki</dbname>
       -->|be-tarask=Дадзены запыт выкарыстоўвае:<!--
    <base>https://www.wikidata.org/wiki/Wikidata:Main_Page</base>
       -->|cs=Následující dotaz používá:<!--
    <generator>MediaWiki 1.47.0-wmf.17</generator>
       -->|de=Die Suchanfrage verwendet:<!--  
    <case>first-letter</case>
       -->|en=The following query uses these:<!--
    <namespaces>
       -->|en-gb=The following query uses these:<!--
      <namespace key="-2" case="first-letter">Media</namespace>
       -->|el=Το ακόλουθο ερώτημα χρησιμοποιεί αυτά:<!--
      <namespace key="-1" case="first-letter">Special</namespace>
       -->|es=La siguiente consulta utiliza lo siguiente:<!--
      <namespace key="0" case="first-letter" />
       -->|fi=Seuraava kysely käyttää näitä:<!--
      <namespace key="1" case="first-letter">Talk</namespace>
       -->|fr=La requête suivante utilise ces :<!--
      <namespace key="2" case="first-letter">User</namespace>
       -->|hu=Ez a lekérdezés a következőket használja:<!--  
      <namespace key="3" case="first-letter">User talk</namespace>
       -->|id=Kueri di bawah akan menggunakan entitas berikut:<!--  
      <namespace key="4" case="first-letter">Wikidata</namespace>
       -->|it=La seguente query utilizza questi:<!--  
      <namespace key="5" case="first-letter">Wikidata talk</namespace>
       -->|ja=以下のクエリではこれらを使用します:<!--
      <namespace key="6" case="first-letter">File</namespace>
       -->|nl=Deze query gebruikt:<!--
      <namespace key="7" case="first-letter">File talk</namespace>
       -->|pl=To zapytanie używa:<!--
      <namespace key="8" case="first-letter">MediaWiki</namespace>
       -->|pt=A consulta seguinte utiliza estes:<!--
      <namespace key="9" case="first-letter">MediaWiki talk</namespace>
       -->|pt-br=A consulta seguinte utiliza estes:<!--
      <namespace key="10" case="first-letter">Template</namespace>
       -->|ru=Этот запрос использует:<!--
      <namespace key="11" case="first-letter">Template talk</namespace>
       -->|sv=Följande fråga använder dessa:<!--
      <namespace key="12" case="first-letter">Help</namespace>
       -->|tr=Aşağıdaki sorgu bunları kullanıyor:<!--
      <namespace key="13" case="first-letter">Help talk</namespace>
       -->|uk=Цей запит використовує:<!--
      <namespace key="14" case="first-letter">Category</namespace>
-->}}<!--
      <namespace key="15" case="first-letter">Category talk</namespace>
-->{{ItemOrNot|{{Capitalize|{{int items}}}}|{{#invoke:SPARQLMentions|getItems|{{{query}}} }} }}
      <namespace key="120" case="first-letter">Property</namespace>
<!--
      <namespace key="121" case="first-letter">Property talk</namespace>
-->{{ItemOrNot|{{int Properties}}|{{#invoke:SPARQLMentions|getProperties|{{{query}}} }} }}
      <namespace key="122" case="first-letter">Query</namespace>
<!--
      <namespace key="123" case="first-letter">Query talk</namespace>
-->{{ItemOrNot|{{Capitalize|{{int features}}}}|{{#invoke:SPARQLMentions|getFunctions|{{{query}}} }} }}
      <namespace key="146" case="first-letter">Lexeme</namespace>
<!--
      <namespace key="147" case="first-letter">Lexeme talk</namespace>
-->}}{{#tag:syntaxhighlight|{{SPARQLText|query={{{query}}}|extraprefix={{{extraprefix|}}} }}|highlight="{{{highlight|}}}"|start="{{{start|1}}}"|{{{line|line}}}=line|lang="sparql"|style="margin:.5em; max-width: -moz-max-content;
      <namespace key="640" case="first-letter">EntitySchema</namespace>
      <namespace key="641" case="first-letter">EntitySchema talk</namespace>
      <namespace key="710" case="first-letter">TimedText</namespace>
      <namespace key="711" case="first-letter">TimedText talk</namespace>
      <namespace key="828" case="first-letter">Module</namespace>
      <namespace key="829" case="first-letter">Module talk</namespace>
      <namespace key="1198" case="first-letter">Translations</namespace>
      <namespace key="1199" case="first-letter">Translations talk</namespace>
      <namespace key="1728" case="first-letter">Event</namespace>
      <namespace key="1729" case="first-letter">Event talk</namespace>
      <namespace key="2600" case="first-letter">Topic</namespace>
    </namespaces>
  </siteinfo>
  <page>
    <title>Template:SPARQL2</title>
    <ns>10</ns>
    <id>28161690</id>
    <revision>
      <id>2346047691</id>
      <parentid>2346040648</parentid>
      <timestamp>2025-05-08T12:02:25Z</timestamp>
      <contributor>
        <username>Madamebiblio</username>
        <id>2952832</id>
      </contributor>
      <minor/>
      <comment>Reverted edits by [[Special:Contributions/201.143.205.181|201.143.205.181]] ([[User talk:201.143.205.181|talk]]) to last revision by [[:User:Kokage si|Kokage si]]</comment>
      <origin>2294596805</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="7567" sha1="s4975lvx7s2i4pjji1govtxccu2rt3e" xml:space="preserve">{{SPARQL2/doc}}
&lt;onlyinclude&gt;{{Clear}}{{#ifeq:{{{nohints|}}}|{{{nohints}}}| &lt;!--hidden hints--&gt; | {{TranslateThis&lt;!--
       --&gt;|ar=يستخدم الاستعلام التالي هذه:&lt;!--
       --&gt;|be-tarask=Дадзены запыт выкарыстоўвае:&lt;!--
       --&gt;|cs=Následující dotaz používá:&lt;!--
       --&gt;|de=Die Suchanfrage verwendet:&lt;!--  
       --&gt;|en=The following query uses these:&lt;!--
       --&gt;|en-gb=The following query uses these:&lt;!--
       --&gt;|el=Το ακόλουθο ερώτημα χρησιμοποιεί αυτά:&lt;!--
       --&gt;|es=La siguiente consulta utiliza lo siguiente:&lt;!--
       --&gt;|fi=Seuraava kysely käyttää näitä:&lt;!--
       --&gt;|fr=La requête suivante utilise ces :&lt;!--
       --&gt;|hu=Ez a lekérdezés a következőket használja:&lt;!--  
       --&gt;|id=Kueri di bawah akan menggunakan entitas berikut:&lt;!--  
       --&gt;|it=La seguente query utilizza questi:&lt;!--  
       --&gt;|ja=以下のクエリではこれらを使用します:&lt;!--
       --&gt;|nl=Deze query gebruikt:&lt;!--
       --&gt;|pl=To zapytanie używa:&lt;!--
       --&gt;|pt=A consulta seguinte utiliza estes:&lt;!--
       --&gt;|pt-br=A consulta seguinte utiliza estes:&lt;!--
       --&gt;|ru=Этот запрос использует:&lt;!--
       --&gt;|sv=Följande fråga använder dessa:&lt;!--
       --&gt;|tr=Aşağıdaki sorgu bunları kullanıyor:&lt;!--
       --&gt;|uk=Цей запит використовує:&lt;!--
--&gt;}}&lt;!--
--&gt;{{ItemOrNot|{{Capitalize|{{int items}}}}|{{#invoke:SPARQLMentions|getItems|{{{query}}} }} }}
&lt;!--
--&gt;{{ItemOrNot|{{int Properties}}|{{#invoke:SPARQLMentions|getProperties|{{{query}}} }} }}
&lt;!--
--&gt;{{ItemOrNot|{{Capitalize|{{int features}}}}|{{#invoke:SPARQLMentions|getFunctions|{{{query}}} }} }}
&lt;!--
--&gt;}}{{#tag:syntaxhighlight|{{SPARQLText|query={{{query}}}|extraprefix={{{extraprefix|}}} }}|highlight="{{{highlight|}}}"|start="{{{start|1}}}"|{{{line|line}}}=line|lang="sparql"|style="margin:.5em; max-width: -moz-max-content;
min-width: 20em;"}}
min-width: 20em;"}}
&lt;!--
<!--
--&gt;&lt;div class="displayonly"&gt;[https://wdqs-frontend.almeda.engelska.uu.se/#{{urlencode: {{SPARQLText|query={{{query}}}|extraprefix={{{extraprefix|}}} }} | PATH }} {{#if: {{#invoke:SPARQLMentions|getTitle|{{{query}}}}}|{{#invoke:SPARQLMentions|getTitle|{{{query}}}}}|{{int try it}}}}]&lt;/div&gt;{{Clear}}&lt;/onlyinclude&gt;&lt;noinclude&gt;
--><div class="displayonly">[//query.wikidata.org/#{{urlencode: {{SPARQLText|query={{{query}}}|extraprefix={{{extraprefix|}}} }} | PATH }} {{#if: {{#invoke:SPARQLMentions|getTitle|{{{query}}}}}|{{#invoke:SPARQLMentions|getTitle|{{{query}}}}}|{{int try it}}}}]</div>{{Clear}}</onlyinclude><noinclude>
&lt;templatedata&gt;
<templatedata>
{
{
"params": {
"params": {
Line 168: Line 106:
"uk": "Додаткові префікси (необов'язкові)"
"uk": "Додаткові префікси (необов'язкові)"
},
},
"example": "PREFIX wikibase: &lt;http://wikiba.se/ontology#&gt;",
"example": "PREFIX wikibase: <http://wikiba.se/ontology#>",
"type": "string"
"type": "string"
}
}
Line 193: Line 131:
"format": "block"
"format": "block"
}
}
&lt;/templatedata&gt;
</templatedata>
&lt;/noinclude&gt;</text>
</noinclude>
      <sha1>s4975lvx7s2i4pjji1govtxccu2rt3e</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Template</title>
    <ns>10</ns>
    <id>12414</id>
    <redirect title="Template:Tl" />
    <revision>
      <id>431881</id>
      <parentid>312894</parentid>
      <timestamp>2012-11-13T02:07:50Z</timestamp>
      <contributor>
        <username>~riley</username>
        <id>2219</id>
      </contributor>
      <comment>http://en.wikipedia.org/w/index.php?title=Template:Template&amp;action=edit</comment>
      <origin>431881</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="25" sha1="cdpzj9yp99pn5v093b404f4sc7cybv1" xml:space="preserve">#REDIRECT [[Template:Tl]]</text>
      <sha1>cdpzj9yp99pn5v093b404f4sc7cybv1</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Tl</title>
    <ns>10</ns>
    <id>3170</id>
    <revision>
      <id>2508986920</id>
      <parentid>1946850712</parentid>
      <timestamp>2026-06-22T01:25:21Z</timestamp>
      <contributor>
        <username>RogueScholar</username>
        <id>3003918</id>
      </contributor>
      <minor/>
      <comment>Format template code for readability and convert numeric HTML entities to named equivalents to accomplish the same</comment>
      <origin>2508986920</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="1299" sha1="dqel96mgakegupz568kpnt91rdib9m4" xml:space="preserve">&lt;includeonly&gt;&lt;code&gt;&amp;lbrace;&amp;lbrace;{{#if:{{{subst|}}}|subst:}}&lt;!-- Begin evaluation of first parameter.
--&gt;{{#ifeq:{{padleft:|1|{{{1}}}}}|:|&amp;colon;[[{{FULLPAGENAME:{{{1}}}}}]]|&lt;!-- If already prefixed by colon, show the link as such, too.
  --&gt;{{#switch:{{NAMESPACE:{{{1}}}}}&lt;!-- Target's namespace determines the link format. --&gt;
      | {{ns:0}} | {{ns:10}} = [[{{ns:10}}:{{PAGENAME:{{{1}}}}}|{{PAGENAME:{{{1}}}}}]]&lt;!-- Main: (absent) or Template: namespaces --&gt;
      | {{ns:6}} | {{ns:14}} = [[:{{{1}}}]]&lt;!-- File and Category namespaces receive hidden colon prefix. --&gt;
                  | #default  = [[{{{1}}}]]&lt;!-- All others are linked verbatim.
--&gt;}}&lt;!-- End of switch function. --&gt;}}&lt;!-- End of first parameter evaluation.
--&gt;{{#ifeq: {{{2}}}| {{{2|x}}}|&amp;verbar;{{{2}}}}}&lt;!--
--&gt;{{#ifeq: {{{3}}}| {{{3|x}}}|&amp;verbar;{{{3}}}}}&lt;!--
--&gt;{{#ifeq: {{{4}}}| {{{4|x}}}|&amp;verbar;{{{4}}}}}&lt;!--
--&gt;{{#ifeq: {{{5}}}| {{{5|x}}}|&amp;verbar;{{{5}}}}}&lt;!--
--&gt;{{#ifeq: {{{6}}}| {{{6|x}}}|&amp;verbar;{{{6}}}}}&lt;!--
--&gt;{{#ifeq: {{{7}}}| {{{7|x}}}|&amp;verbar;{{{7}}}}}&lt;!--
--&gt;{{#ifeq: {{{8}}}| {{{8|x}}}|&amp;verbar;{{{8}}}}}&lt;!--
--&gt;{{#ifeq: {{{9}}}| {{{9|x}}}|&amp;verbar;{{{9}}}}}&lt;!--
--&gt;{{#ifeq:{{{10}}}|{{{10|x}}}|&amp;verbar;{{{10}}}}}&amp;rbrace;&amp;rbrace;&lt;/code&gt;&lt;/includeonly&gt;&lt;noinclude&gt;
{{Documentation}}&lt;/noinclude&gt;</text>
      <sha1>dqel96mgakegupz568kpnt91rdib9m4</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Capitalize</title>
    <ns>10</ns>
    <id>24835143</id>
    <revision>
      <id>2283223741</id>
      <parentid>2282968755</parentid>
      <timestamp>2024-12-03T22:55:49Z</timestamp>
      <contributor>
        <username>Tacsipacsi</username>
        <id>33956</id>
      </contributor>
      <comment>Undid revision [[Special:Diff/2282968755|2282968755]] by [[Special:Contributions/2806:2F0:A080:F124:78E9:9300:6983:EA83|2806:2F0:A080:F124:78E9:9300:6983:EA83]] ([[User talk:2806:2F0:A080:F124:78E9:9300:6983:EA83|talk]]): ???</comment>
      <origin>2283223741</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="100" sha1="08bgnnmlolmwjwag381zkq615fl2s0a" xml:space="preserve">&lt;includeonly&gt;{{#invoke:Capitalize|capitalize|{{{1}}}}}&lt;/includeonly&gt;&lt;noinclude&gt;
{{doc}}
&lt;/noinclude&gt;</text>
      <sha1>08bgnnmlolmwjwag381zkq615fl2s0a</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Int items</title>
    <ns>10</ns>
    <id>28641837</id>
    <revision>
      <id>2438810545</id>
      <parentid>2208740771</parentid>
      <timestamp>2025-12-06T14:15:50Z</timestamp>
      <contributor>
        <username>YeBoy371</username>
        <id>2200680</id>
      </contributor>
      <origin>2438810545</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="475" sha1="knyh87z85w0os01yxpmvrzvlnwf07fb" xml:space="preserve">&lt;noinclude&gt;{{doc}}&lt;/noinclude&gt;{{
TranslateThis
|cy=pethe
|be-tarask=элемэнты
|ar=عناصر
|cs=položky
|en=items
|en-gb=items
|de=Datenobjekte
|el=αντικείμενα
|fi=kohteet
|fr=éléments
|he=פריטים
|hu=elemek
|id=butir
|it=elementi
|ja=項目
|ko=항목
|nb=elementer
|nl=elementen
|nn=element
|pl=elementy
|pt=itens
|pt-br=itens
|ru=элементы
|sr=ставке
|sv=objekt
|tr=ögeler
|uk=елементи
|vec=ełementi
|zh=项目
|...=...
}}</text>
      <sha1>knyh87z85w0os01yxpmvrzvlnwf07fb</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Capitalize</title>
    <ns>828</ns>
    <id>25940912</id>
    <revision>
      <id>333880118</id>
      <parentid>327538585</parentid>
      <timestamp>2016-05-08T21:08:10Z</timestamp>
      <contributor>
        <username>TomT0m</username>
        <id>7333</id>
      </contributor>
      <comment>cap after the tags</comment>
      <origin>333880118</origin>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="518" sha1="oi3oo9q42s5okxrm5hbfy01zk32pehp" xml:space="preserve">
local p = {}
 
function p.cap(str)
lang = mw.getContentLanguage()
if lang:ucfirst(str) ~= str then
return lang:ucfirst(str)
else
local substr = mw.ustring.sub
b, e = mw.ustring.find(str, "&gt;%s*%a")
while e ~= nil do
if mw.ustring.find("&gt;", substr(str, b,e)) == nil then
return substr(str, 1, e-1) .. lang:ucfirst(substr(str,e,e)) ..substr(str, e+1)
end
b, e = mw.ustring.find(str, "&gt;%s*%a", e)
end
return str
end
end
 
function p.capitalize(frame) return p.cap(frame.args[1]) end
 
return p</text>
      <sha1>oi3oo9q42s5okxrm5hbfy01zk32pehp</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Clear</title>
    <ns>10</ns>
    <id>12131100</id>
    <revision>
      <id>665474881</id>
      <parentid>91992232</parentid>
      <timestamp>2018-04-14T18:59:12Z</timestamp>
      <contributor>
        <username>Dataeast0000001</username>
        <id>2952466</id>
      </contributor>
      <comment>move onlyinclude to noinclude</comment>
      <origin>665474881</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="79" sha1="5aa2j06l3n3husy1g6jggf6oznzocau" xml:space="preserve">&lt;div style="clear:{{{1|both}}};"&gt;&lt;/div&gt;&lt;noinclude&gt;{{documentation}}&lt;/noinclude&gt;</text>
      <sha1>5aa2j06l3n3husy1g6jggf6oznzocau</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Fallback</title>
    <ns>828</ns>
    <id>19181086</id>
    <revision>
      <id>714642825</id>
      <parentid>714642495</parentid>
      <timestamp>2018-07-23T16:35:03Z</timestamp>
      <contributor>
        <username>Matěj Suchánek</username>
        <id>53613</id>
      </contributor>
      <minor/>
      <comment>fix</comment>
      <origin>714642825</origin>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="5559" sha1="6vr2in87podxnsj3x2jttt1r1qisf9q" xml:space="preserve">local p = {}
 
function p.fblist(lang, langonly) -- list the full fallback chain from a language to en
local fbtable = mw.language.getFallbacksFor(lang)
table.insert(fbtable, 1, lang)
if not langonly then
table.insert(fbtable, 'message')
table.insert(fbtable, 'item')
table.insert(fbtable, 'default')
end
return fbtable
end
 
function p._langSwitch(args, lang) -- args: table of translations
-- Return error if there is not default and no English version
-- otherwise returns the message in the most appropriate, plus the lang code as a second value
if not args.en and not args.default and not args.message and not args.item and args.nocat ~= '1' then
return error("langSwitch error: no default")
end
-- get language (either stated one or user's default language)
if not lang then
return '&lt;strong class="error"&gt;LangSwitch Error: no lang&lt;/strong&gt;' -- must become proper error
end
-- get the list of acceptable language (lang + those in lang's fallback chain) and check their content
for i, j in ipairs(p.fblist(lang)) do
if args[j] then
if args[j] == '~' then return nil, j end
if j == 'item' then
local label, lang = mw.wikibase.getLabelWithLang(args[j])
if label then return label, lang
else return args[j], 'en' end
end
if j == 'message' then return tostring(mw.message.new(args[j]):inLanguage(lang)) end -- if this is an interface message
if args[j] ~= '' then return args[j], j end
end
end
return nil
end
 
function p.langSwitch(frame) -- version to be used from wikitext
local args = frame.args
-- if no expected args provided than check parent template/module args
if not args.en and not args.default and not args.nocat then
args = frame:getParent().args
end
local lang
if args.lang and args.lang ~= '' then
lang = args.lang
args.lang = nil
else -- get user's chosen language
lang = frame:preprocess( "{{int:lang}}" )
end
local str, language = p._langSwitch(args, lang)
return str -- get the first value of the langSwitch, (the text) not the second (the language)
end
 
function p.fallbackpage(base, lang, formatting)
local languages = p.fblist(lang)
for i, lng in ipairs(languages) do
if mw.title.new(base .. '/' .. lng).exists then
if formatting == 'table' then
return {base .. '/' .. lng, lng} -- returns name of the page + name of the language
else
return base .. '/' .. lng -- returns only the page
end
end
end
return base
end
 
function p.autotranslate(frame) -- logic for [[template:Autotranslate]]
local args = frame.args
if not args.lang or args.lang == '' then
args.lang = frame:preprocess( "{{int:lang}}" )          -- get user's chosen language
end
 
-- find base page
local base = args.base
if not base or base == '' then
return '&lt;strong class="error"&gt;Base page not provided for autotranslate&lt;/strong&gt;'
end
if string.sub(base, 2, 9) ~= 'emplate:' then
base = 'Template:' .. base  -- base provided without 'Template:' part
end
 
-- find base template language subpage
local page = p.fallbackpage(base, args.lang) --
if (not page and base ~= args.base) then
-- try the original args.base string. This case is only needed if base is not in template namespace
page = p.fallbackpage(args.base, args.lang)
end
if not page then
return string.format('&lt;strong class="error"&gt;no fallback page found for autotranslate (base=[[%s]], lang=%s)&lt;/strong&gt;', args.base, args.lang)
end
 
-- repack args in a standard table
local newargs = {}
for field, value in pairs(args) do
if field ~= 'base' then
newargs[field] = value
end
end
 
-- Transclude {{page |....}} with template arguments the same as the ones passed to {{autotranslate}} template.
return frame:expandTemplate{ title = page, args = newargs }
end
 
function p.translate(page, key, lang) --translate data stored in a module
if type(page) == 'string' then -- if the requested translation table is not yet loaded
page = require('Module:' .. page)
end
 
local val
if page[key] then
val = page[key]
elseif page.keys and page.keys[key] then-- key 'keys" is an index of all keys, including redirects, see [[Module:i18n/datatype]]
val = page.keys[key]
end
if not val then
return '&lt;' .. key .. '&gt;'
end
return p._langSwitch(val, lang)
end
 
function p.translatelua(frame)
local lang = frame.args.lang
local page = require('Module:' .. mw.text.trim(frame.args[1])) -- page should only contain a simple of translations
if not lang or mw.text.trim(lang) == '' then
lang = frame:preprocess( "{{int:lang}}" )
end
if frame.args[2] then
page = page[mw.text.trim(frame.args[2])]
end
return p._langSwitch(page, lang)
end
 
function p.runTests()
local toFallbackTest = require('Module:Fallback/tests/fallbacks')
local result = true
 
mw.log('Testing fallback chains')
for i, t in ipairs(toFallbackTest) do
local fbtbl = table.concat(p.fblist(t.initial), ', ')
local expected = table.concat(t.expected, ', ')
local ret = (fbtbl == expected)
mw.log(i, ret and 'passed' or 'FAILED', t.initial, (not ret) and ('FAILED\nis &gt;&gt;' .. fbtbl .. '&lt;&lt;\nbut should be &gt;&gt;' .. expected .. '&lt;&lt;\n') or '')
result = result and ret
end
return result
end
 
function p.showTemplateArguments(frame)
-- list all input arguments of the template that calls "{{#invoke:Fallback|showTemplateArguments}}"
local str = ''
for name, value in pairs( frame:getParent().args ) do
if str == '' then
str = string.format('%s=%s', name, value)          -- argument #1
else
str = string.format('%s, %s=%s', str, name, value) -- the rest
end
end
return str
end
 
return p</text>
      <sha1>6vr2in87podxnsj3x2jttt1r1qisf9q</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Ll</title>
    <ns>10</ns>
    <id>3264473</id>
    <revision>
      <id>618665821</id>
      <parentid>443393354</parentid>
      <timestamp>2018-01-11T02:59:59Z</timestamp>
      <contributor>
        <username>Jarekt</username>
        <id>1274</id>
      </contributor>
      <comment>Fulfilling [[Template:Edit request|edit request]] by [[User:Kaganer]]. Thanks for helping!</comment>
      <origin>618665821</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="178" sha1="h8s4unutwk14jcbyfcq88r5yvqbu5x5" xml:space="preserve">[[Special:MyLanguage/{{{1}}}{{#if:{{{3|{{{anchor|}}}}}}|&amp;#35;{{{3|{{{anchor}}}}}}}}|{{{2&lt;includeonly&gt;|{{PDT|{{{1}}}}}&lt;/includeonly&gt;}}}]]&lt;noinclude&gt;
{{documentation}}
&lt;/noinclude&gt;</text>
      <sha1>h8s4unutwk14jcbyfcq88r5yvqbu5x5</sha1>
    </revision>
  </page>
  <page>
    <title>Template:TranslateThis</title>
    <ns>10</ns>
    <id>16552759</id>
    <revision>
      <id>483148362</id>
      <parentid>483129342</parentid>
      <timestamp>2017-05-08T01:54:31Z</timestamp>
      <contributor>
        <username>MKar</username>
        <id>6110</id>
      </contributor>
      <minor/>
      <comment>Undid revision 483129342 by [[Special:Contributions/70.71.90.6|70.71.90.6]] ([[User talk:70.71.90.6|talk]])</comment>
      <origin>483148362</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="97" sha1="rm4lztokzfib496c8sbt9q36vx6n9tz" xml:space="preserve">&lt;includeonly&gt;{{#invoke:TranslateThis|main}}&lt;/includeonly&gt;&lt;noinclude&gt;{{documentation}}&lt;/noinclude&gt;</text>
      <sha1>rm4lztokzfib496c8sbt9q36vx6n9tz</sha1>
    </revision>
  </page>
  <page>
    <title>Module:TranslateThis</title>
    <ns>828</ns>
    <id>16552706</id>
    <revision>
      <id>2144500220</id>
      <parentid>1980692436</parentid>
      <timestamp>2024-05-04T13:29:50Z</timestamp>
      <contributor>
        <username>Uzume</username>
        <id>11596</id>
      </contributor>
      <comment>switch frame:preprocess("{{int:lang}}") to callParserFunction("int", "lang")</comment>
      <origin>2144500220</origin>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="1738" sha1="j2it1vjxk477pw54t7yheap3g9xt452" xml:space="preserve">local fb = require('Module:Fallback')
local dir = require('Module:Dir')
 
return { main = function( frame )
local function shallowcopy(orig)
if type(orig) ~= 'table' then
return orig
end
local result = {}
for key, value in pairs(orig) do
result[key] = value
end
return result
end
local args = shallowcopy(frame:getParent().args)
local lang = args.lang or frame:callParserFunction("int", "lang") -- I don't know of any other way to get the user's language...
args.lang = nil
local anchor = args.anchor
args.anchor = nil
if (anchor and args[anchor]) then
anchor = args[anchor]
end
anchor = anchor and frame:expandTemplate( { title = "Anchor", args = { anchor } } ) or ''
local result = args[ lang ]
if result and result ~= '' then
result = '&lt;span dir="' .. dir.select(lang, 'rtl', 'ltr') .. '" lang="' .. lang .. '"&gt;' .. result .. '&lt;/span&gt;'
else
local default = {}
for i, v in pairs( args ) do
if v ~= "" then
table.insert(default, '&lt;span dir="' .. dir.select(i, 'rtl', 'ltr') .. '" lang="' .. i .. '"&gt;' .. v .. '&lt;/span&gt; &lt;small&gt;(' .. i .. ')&lt;/small&gt;')
end
end
default = table.concat(default, ' / ')
args.default=default
local newlang
result, newlang = fb._langSwitch(args, lang)
if not newlang then
result = ''
elseif newlang~='default' then
result = '&lt;span dir="' .. dir.select(newlang, 'rtl', 'ltr') .. '" lang="' .. newlang .. '"&gt;' .. result .. '&lt;/span&gt; &lt;small&gt;(' .. newlang .. ')&lt;/small&gt;'
end
local langname = mw.language.fetchLanguageName( lang, lang )
if langname ~= "" and newlang then
result = result .. " – " .. frame:expandTemplate( { title = "Help translate", args = { langname, lang = lang } } )
end
end
return anchor .. result
end}</text>
      <sha1>j2it1vjxk477pw54t7yheap3g9xt452</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Dir</title>
    <ns>828</ns>
    <id>95388294</id>
    <revision>
      <id>1935187194</id>
      <parentid>1935159027</parentid>
      <timestamp>2023-07-15T22:41:28Z</timestamp>
      <contributor>
        <username>Tacsipacsi</username>
        <id>33956</id>
      </contributor>
      <comment>Undid revision 1935159027 by [[Special:Contributions/177.232.91.83|177.232.91.83]] ([[User talk:177.232.91.83|talk]]): test edit</comment>
      <origin>1935187194</origin>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="5612" sha1="n6dnippb8dl8nupbrxgqviac0hno50v" xml:space="preserve">-- This module implements [[Template:Dir]].
 
-- local rtlOverrides = mw.loadData('Module:Dir/RTL overrides') -- !!! mw.loadData() is currently broken, it does NOT load anything
local rtlOverrides = require('Module:Dir/RTL overrides')
local p = {}
 
local function trim(s)
    if s and s ~= '' then s = tostring(s):match('^%s*(.-)%s*$') end
    if s == '' then return nil end
    return s
end
 
function p.rtlLangs(isRTL)
    if isRTL == nil then isRTL = true end
    return rtlOverrides[isRTL] or {}
end
 
function p.isRTL(code)
    if type(code) ~= 'string' then return nil end
    local v = rtlOverrides[code] -- very fast and not limited in the number of supported languages
    if v ~= nil then return v end -- return it if mapped, otherwise use MediaWiki library:
    local success, ret = pcall(function ()
        return mw.language.new(code):isRTL() -- expensive and limited to 20 languages per MediaWiki instance
    end)
    return success and ret
end
 
function p.select(code, rtl, ltr)
    if p.isRTL(code) then
        return rtl
    else
        return ltr
    end
end
 
-- Used via a template {{Dir|language-code|wikitext if rtl|wikitext if ltr}}
-- which just calls {{#invoke:Dir|main}}, the 3 parameters are automatically trimmed:
-- Parameter 1 takes the default value from {{Int:Lang}} if it's empty or not specified.
-- Parameter 2 can be named rtl, may be explicitly empty, otherwise takes the default value 'rtl' only if it's not specified.
-- Parameter 3 can be named ltr, may be explicitly empty, otherwise takes the default value 'ltr' only if it's not specified.
function p.main(frame)
    local args = frame:getParent().args -- Parameters used to transclude Template:Dir
    local code = trim(args[1]) or frame:callParserFunction('Int', 'Lang')
    local rtl = trim(args.rtl or args[2] or 'rtl')
    local ltr = trim(args.ltr or args[3] or 'ltr')
    return p.select(code, rtl, ltr)
end
 
setmetatable(p, { quickTests = function ()
    local rtlLangs = p.rtlLangs(true)
    local ltrLangs = p.rtlLangs(false)
 
    -- Basic check of data format
    local function checkLangs(name, langs)
        for k, lang in pairs(langs) do
            assert(type(k) == 'number' and k == math.floor(k)
                and type(lang) == 'string' and #lang &gt;= 2 and #lang &lt;= 16
                and lang:find('^[a-z][%-0-9a-z]*[0-9a-z]$') == 1,
                ": Invalid sequence of language codes, " .. name .. "['" .. k .. "'] = '" .. lang .. "'")
        end
        return true
    end
    local ok, msg
    ok, msg = pcall(checkLangs, 'rtlLangs', rtlLangs)
    if not ok then return false, msg end
    ok, msg = pcall(checkLangs, 'ltrLangs', ltrLangs)
    if not ok then return false, msg end
 
    -- Build inverse maps of languages having each direction
    local isrtl, isltr = {}, {}
    for _, lang in ipairs(rtlLangs) do isrtl[lang] = true end
    for _, lang in ipairs(ltrLangs) do isltr[lang] = true end
    -- Check conflicts using the two inverse maps
    for _, lang in ipairs(rtlLangs) do
        if isltr[lang] then return false, ": Direction conflict for '" .. lang .. "'" end
    end
    for _, lang in ipairs(ltrLangs) do
        if isrtl[lang] then return false, ": Direction conflict for '" .. lang .. "'" end
    end
 
    -- Log missing languages (allows filling the tables above) according to MediaWiki internal data
    local knownLangs, isKnownLang = mw.language.fetchLanguageNames(), {}
    for lang, _ in pairs(knownLangs) do
        isKnownLang[lang] = true
        if rtlOverrides[lang] == nil then -- only if we still don't have data for this language
            -- Note: we cannot check more than 20 languages at once, then MediaWiki raises an error.
            -- So this test only runs on the Lua console, where you can update the tables at top.
            -- This also means we cannot compare what MediaWiki returns with the direction we map here for all languages.
            ok, value = pcall(function() return tostring(mw.language.new(lang):isRTL()) end)
            mw.log("Warning: missing direction for language '" .. lang .. "', MediaWiki returns '" .. value .. "'")
        end
    end
 
    -- utility: reverse order iterator on sequences
    local function revipairs(t)
        return function(t, i)
            i = i - 1
            local v = t[i]
            if v == nil then return nil end
            return i, v
        end, t, #t + 1
    end
    -- Sort and deduplicate language code values (by scanning backward) for data cleanup
    -- Also log languages having a direction mapping in this module but still not known by MediaWiki
    table.sort(rtlLangs)
    table.sort(ltrLangs)
    for i, lang in revipairs(rtlLangs) do
        if rtlLangs[i - 1] == rtlLangs[i] then table.remove(rtlLangs, i) end
        if isKnownLang[lang] == nil then
            mw.log("RTL language '" .. lang .. "' still not known by Mediawiki (could be a missing alias or variant)")
        end
    end
    for i, lang in revipairs(ltrLangs) do
        if ltrLangs[i - 1] == ltrLangs[i] then table.remove(ltrLangs, i) end
        if isKnownLang[lang] == nil then
            mw.log("LTR language '" .. lang .. "' still not known by Mediawiki (could be a missing alias or variant)")
        end
    end
 
    -- Final presentation of current lists, sorted and deduplicated
    mw.log("----")
    mw.log("local rtlLangs = { '" .. table.concat(rtlLangs, "', '") .. "' }")
    mw.log("local ltrLangs = { '" .. table.concat(ltrLangs, "', '") .. "' }")
    return true
end })
--[==[ Enter this to run tests in the Lua console:
=getmetatable(p).quickTests()
--]==]
 
return p</text>
      <sha1>n6dnippb8dl8nupbrxgqviac0hno50v</sha1>
    </revision>
  </page>
  <page>
    <title>Module:Dir/RTL overrides</title>
    <ns>828</ns>
    <id>95388411</id>
    <revision>
      <id>1223091335</id>
      <timestamp>2020-07-03T04:07:06Z</timestamp>
      <contributor>
        <username>Amitie 10g</username>
        <id>185006</id>
      </contributor>
      <comment>Created page with "local p = {}  --[==[ Basic input sequences: relative order or duplicates does not matter here (but the end of the self test displays them sorted and deduplicated), but codes m..."</comment>
      <origin>1223091335</origin>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="4566" sha1="cxld5o18iaxkhru8z4aje5lec04qed1" xml:space="preserve">local p = {}
 
--[==[
Basic input sequences: relative order or duplicates does not matter here (but the end of the self test displays them sorted and deduplicated),
but codes must be valid and belong to only one of the two sequences).
 
Any missing language code will be checked with mw.language.new(code):isRTL(), which is costly
in loaded resources (it can only check 20 languages at most including the content language)
So it is best to map all languages that are the most likely to be used.
--]==]
 
local rtlLangs = { 'aeb', 'aeb-arab', 'ar', 'arc', 'arq', 'ary', 'arz', 'azb', 'bcc', 'bgn', 'bqi', 'ckb', 'dv', 'fa', 'fa-af', 'glk', 'ha-arab', 'he', 'khw', 'kk-arab', 'kk-cn', 'ks-arab', 'ku-arab', 'lki', 'lrc', 'luz', 'mzn', 'nqo', 'ota', 'pnb', 'prd', 'ps', 'sd', 'sdh', 'skr', 'skr-arab', 'ug', 'ug-arab', 'ur', 'uz-arab', 'ydd', 'yi' }
 
local ltrLangs = { 'aa', 'ab', 'abs', 'ace', 'ady', 'ady-cyrl', 'aeb-latn', 'af', 'ak', 'aln', 'als', 'alt', 'am', 'ami', 'an', 'ang', 'anp', 'arn', 'as', 'ase', 'ast', 'atj', 'av', 'avk', 'awa', 'ay', 'az', 'ba', 'ban', 'bar', 'bat-smg', 'bbc', 'bbc-latn', 'bcl', 'be', 'be-tarask', 'be-x-old', 'bg', 'bh', 'bho', 'bi', 'bjn', 'bm', 'bn', 'bo', 'bpy', 'br', 'brh', 'bs', 'btm', 'bto', 'bu', 'bug', 'bxr', 'ca', 'cbk-zam', 'cdo', 'ce', 'ceb', 'ch', 'cho', 'chr', 'chy', 'co', 'cop', 'cps', 'cr', 'crh', 'crh-cyrl', 'crh-latn', 'cs', 'csb', 'cu', 'cv', 'cy', 'da', 'de', 'de-at', 'de-ch', 'de-formal', 'din', 'diq', 'dsb', 'dtp', 'dty', 'dz', 'ee', 'egl', 'el', 'eml', 'en', 'en-ca', 'en-gb', 'en-ie', 'en-us', 'eo', 'es', 'es-419', 'es-formal', 'et', 'eu', 'ext', 'ff', 'fi', 'fil', 'fit', 'fiu-vro', 'fj', 'fkv', 'fo', 'fr', 'frc', 'fro', 'frp', 'frr', 'fur', 'fy', 'ga', 'gag', 'gan', 'gan-hans', 'gan-hant', 'gcf', 'gcr', 'gd', 'gl', 'gn', 'gom', 'gom-deva', 'gom-latn', 'gor', 'got', 'grc', 'gsw', 'gu', 'gv', 'ha', 'hak', 'haw', 'hi', 'hif', 'hif-deva', 'hif-latn', 'hil', 'hmn', 'ho', 'hr', 'hrx', 'hsb', 'ht', 'hu', 'hu-formal', 'hy', 'hyw', 'hz', 'ia', 'id', 'ie', 'ig', 'ii', 'ik', 'ike-cans', 'ike-latn', 'ilo', 'inh', 'io', 'is', 'it', 'iu', 'ja', 'jam', 'jbo', 'jut', 'jv', 'ka', 'kaa', 'kab', 'kbd', 'kbd-cyrl', 'kbd-latn', 'kbp', 'kea', 'kg', 'ki', 'kiu', 'kj', 'kjp', 'kk', 'kk-cyrl', 'kk-kz', 'kk-latn', 'kk-tr', 'kl', 'km', 'kn', 'ko', 'ko-kp', 'ko-kr', 'koi', 'kr', 'krc', 'kri', 'krj', 'krl', 'ks', 'ks-deva', 'ksh', 'ku', 'ku-latn', 'kum', 'kv', 'kw', 'ky', 'la', 'lad', 'lb', 'lbe', 'lez', 'lfn', 'lg', 'li', 'lij', 'liv', 'lld', 'lmo', 'ln', 'lo', 'loz', 'lt', 'ltg', 'lus', 'lv', 'lzh', 'lzz', 'mai', 'map-bms', 'mdf', 'mg', 'mh', 'mhr', 'mi', 'min', 'mk', 'ml', 'mn', 'mni', 'mnw', 'mo', 'mr', 'mrj', 'ms', 'mt', 'mus', 'mwl', 'my', 'myv', 'na', 'nah', 'nan', 'nap', 'nb', 'nds', 'nds-nl', 'ne', 'new', 'ng', 'niu', 'nl', 'nl-informal', 'nn', 'no', 'nod', 'non', 'nov', 'nrf', 'nrf-fr', 'nrf-gg', 'nrf-je', 'nrm', 'nso', 'nv', 'ny', 'nys', 'oc', 'olo', 'om', 'or', 'os', 'pa', 'pag', 'pam', 'pap', 'pcd', 'pdc', 'pdt', 'pfl', 'pi', 'pih', 'pl', 'pms', 'pnt', 'prg', 'pt', 'pt-br', 'pt-cv', 'pt-pt', 'qu', 'quc', 'qug', 'rgn', 'rif', 'rm', 'rmf', 'rmy', 'rn', 'ro', 'roa-rup', 'roa-tara', 'ru', 'rue', 'rup', 'ruq', 'ruq-cyrl', 'ruq-latn', 'rw', 'rwr', 'sa', 'sah', 'sat', 'sc', 'scd', 'scn', 'sco', 'sdc', 'se', 'sei', 'ses', 'sg', 'sgs', 'sh', 'sh-cyrl', 'sh-latn', 'shi', 'shi-latn', 'shi-tfng', 'shn', 'shy-latn', 'si', 'simple', 'sjd', 'sje', 'sju', 'sk', 'sl', 'sli', 'sm', 'sma', 'smj', 'smn', 'sms', 'sn', 'so', 'sq', 'sr', 'sr-cyrl', 'sr-ec', 'sr-el', 'sr-latn', 'srn', 'srq', 'ss', 'st', 'stq', 'sty', 'su', 'sv', 'sw', 'szl', 'szy', 'ta', 'tay', 'tcy', 'te', 'tet', 'tg', 'tg-cyrl', 'tg-latn', 'th', 'ti', 'tk', 'tl', 'tly', 'tn', 'to', 'tokipona', 'tpi', 'tr', 'tru', 'trv', 'ts', 'tt', 'tt-cyrl', 'tt-latn', 'tum', 'tw', 'ty', 'tyv', 'tzl', 'tzm', 'udm', 'ug-latn', 'uk', 'uz', 'uz-cyrl', 'uz-latn', 've', 'vec', 'vep', 'vi', 'vls', 'vmf', 'vo', 'vot', 'vro', 'wa', 'war', 'wo', 'wuu', 'xal', 'xh', 'xmf', 'xsy', 'yo', 'yue', 'za', 'zea', 'zgh', 'zh', 'zh-classical', 'zh-cn', 'zh-hans', 'zh-hant', 'zh-hk', 'zh-min-nan', 'zh-mo', 'zh-my', 'zh-sg', 'zh-tw', 'zh-wuu', 'zh-yue', 'zu' }
 
-- Build the inverted map of languages to direction returned by this data module (fast, but collisions are not checked: run the test module)
for _, lang in ipairs(rtlLangs) do p[lang] = true  end
for _, lang in ipairs(ltrLangs) do p[lang] = false end
 
-- Also store the two lists (at boolean indice), used by the test module to check the inverted map
p[true] = rtlLangs
p[false] = ltrLangs
 
return p</text>
      <sha1>cxld5o18iaxkhru8z4aje5lec04qed1</sha1>
    </revision>
  </page>
  <page>
    <title>Template:SPARQLText</title>
    <ns>10</ns>
    <id>23033014</id>
    <revision>
      <id>1399250943</id>
      <parentid>1399250772</parentid>
      <timestamp>2021-04-10T14:44:00Z</timestamp>
      <contributor>
        <ip>87.126.92.234</ip>
      </contributor>
      <comment>Undid revision 1399250772 by [[Special:Contributions/87.126.92.234|87.126.92.234]] ([[User talk:87.126.92.234|talk]])</comment>
      <origin>1399250943</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="340" sha1="f35rnwtdn4sdogbp73jb3irfk0cvqp7" xml:space="preserve">{{#if:{{{p|}}}{{{v|}}}{{{q|}}}{{{extraprefix|}}}|
{{If||{{{p|}}}|
PREFIX p: &lt;http://www.wikidata.org/prop/&gt;|}}{{If||{{{q|}}}|
PREFIX q: &lt;http://www.wikidata.org/prop/qualifier/&gt;|}}{{If||{{{v|}}}|
PREFIX v: &lt;http://www.wikidata.org/prop/statement/&gt;|}}{{If||{{{extraprefix|}}}|
{{{extraprefix}}}|}}
}}{{{query}}}&lt;noinclude&gt;{{doc}}&lt;/noinclude&gt;</text>
      <sha1>f35rnwtdn4sdogbp73jb3irfk0cvqp7</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Int try it</title>
    <ns>10</ns>
    <id>109708780</id>
    <redirect title="Template:Int run it" />
    <revision>
      <id>1764769125</id>
      <timestamp>2022-11-04T21:44:15Z</timestamp>
      <contributor>
        <username>عُثمان</username>
        <id>5050751</id>
      </contributor>
      <comment>عُثمان moved page [[Template:Int try it]] to [[Template:Int run it]]: the recent change to run it seems fine, but I was confused about where to find the template since the name did not match  - move is inaccordance; redirects should resolve</comment>
      <origin>1764769125</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="33" sha1="jwzw36nb8jui2zuk88ncwnse88o65qy" xml:space="preserve">#REDIRECT [[Template:Int run it]]</text>
      <sha1>jwzw36nb8jui2zuk88ncwnse88o65qy</sha1>
    </revision>
  </page>
  <page>
    <title>Module:SPARQLMentions</title>
    <ns>828</ns>
    <id>28161729</id>
    <revision>
      <id>1453690994</id>
      <parentid>661638891</parentid>
      <timestamp>2021-07-04T13:54:47Z</timestamp>
      <contributor>
        <username>Azertus</username>
        <id>1229135</id>
      </contributor>
      <comment>add getTitle</comment>
      <origin>1453690994</origin>
      <model>Scribunto</model>
      <format>text/plain</format>
      <text bytes="2760" sha1="lahzcbsmcekjpuk5o23yy8vvav8qfnz" xml:space="preserve">local p = {}
 
-- Return the label of a given data item, formatted for linking
local function getLabel(frame, id, prefix)
if prefix == nil then prefix = '' end
if id == "defaultView:BubbleChart" then id = "Q24515280" end
if id == "defaultView:Graph" then id = "Q24515287" end
if id == "defaultView:Map" then id = "Q24515275" end
    if id == "defaultView:ImageGrid" then id = "Q24515278" end
if id == "wikibase:box"  then id = "Q26211169" end
if id == "wikibase:cornerWest" then id = "Q26211177" end
label = mw.wikibase.label( id )
if label == nil then
linktext = id
extra = ''
else
linktext = label .. " (" .. id .. ")"
extra = '&amp;nbsp;' .. frame:expandTemplate({ title="Reasonator", args= { [1] = id}}) 
.. '&amp;nbsp;' .. frame:expandTemplate({ title="SQID", args= { [1] = id}})
end
    link = mw.wikibase.getEntityUrl( id )
return '[' .. link .. ' ' .. linktext .. ']' .. extra;
end
 
 
local function map(func, array)
  local new_array = {}
  for i,v in ipairs(array) do
    new_array[i] = func(v)
  end
  return new_array
end
 
local function getAll(text, regexp, seen, items)
if items == nil then items = {} end
if seen == nil then seen = {} end
for item in string.gmatch(text, regexp) do
if seen[item] == nil then
seen[item] = 1
table.insert(items, item)
end
end
return items
end
 
 
-- Produce list of items mentioned in the query
function p.getItems(frame)
if not mw.wikibase then
return "no mw.wikibase"
end
 
items = getAll(frame.args[1], 'wd:(Q%d+)')
return table.concat(map(function(it) return getLabel(frame, it) end, items), ", ")
end
 
-- Produce list of properties mentioned in the query
function p.getProperties(frame)
if not mw.wikibase then
return "no mw.wikibase"
end
seen = {}
items = {}
prefixes = {'wdt', 'p', 'ps', 'pr', 'pq', 'psv', 'pv', 'prv', 'pqv', 'wdtn', 'psn', 'pqn', 'prn', 'wdno' }
for _, pr in ipairs(prefixes) do
items = getAll(frame.args[1], pr .. ':(P%d+)', seen, items)
end
return table.concat(map(function(it) return getLabel(frame, it, 'Property:') end, items), ", ")
end
 
function p.getFunctions(frame)
if not mw.wikibase then
return "no mw.wikibase"
end
seen = {}
items = {}
func = {'defaultView:BubbleChart', 'defaultView:Graph', 'defaultView:Map', 'defaultView:ImageGrid', 'wikibase:box', "wikibase:cornerWest" }
for _, pr in ipairs(func) do
items = getAll(frame.args[1], pr, seen, items)
end
return table.concat(map(function(it) return getLabel(frame, it) end, items), ", ")
end
 
function p.getTitle(frame)
if not mw.wikibase then
return "no mw.wikibase"
end
 
for line in string.gmatch(frame.args[1], "[^%c]+%c?") do
local title = string.match(line, '^#title:%s*([^%c]+)')
 
if not (title == nil) then
return title
end
end
end
 
return p</text>
      <sha1>lahzcbsmcekjpuk5o23yy8vvav8qfnz</sha1>
    </revision>
  </page>
  <page>
    <title>Template:SQID</title>
    <ns>10</ns>
    <id>26259378</id>
    <revision>
      <id>1233859301</id>
      <parentid>1227690908</parentid>
      <timestamp>2020-07-18T14:13:28Z</timestamp>
      <contributor>
        <username>MisterSynergy</username>
        <id>44949</id>
      </contributor>
      <comment>move URL to https://sqid.toolforge.org</comment>
      <origin>1233859301</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="993" sha1="j6wq5aq6l7wsi92xtysclan6m8dprov" xml:space="preserve">&lt;!--
--&gt;{{#if: {{{Q|}}}
| {{Q|1={{{Q|}}}}}&amp;#32;
}}&lt;!--
--&gt;{{#if: {{{P|}}}
| {{P|1={{{P|}}}}}&amp;#32;
}}&lt;!--
--&gt;{{#if: {{{2|}}}
| &lt;span class="plainlinks"&gt;[https://sqid.toolforge.org/#{{#if: {{{1|}}}{{{Q|}}}{{{P|}}}
  | /view?id={{#if: {{{1|}}}
    | {{{1|}}}
    | {{#if: {{{Q|}}}
      | Q{{#titleparts:{{{Q|}}}}}
      | P{{#titleparts:{{{P|}}}}}
      }}
    }}&amp;amp;lang={{Int:Lang}}
  | /?lang={{Int:Lang}}
  }} {{{2|}}}]&lt;/span&gt;&amp;nbsp;
}}&lt;!--
--&gt;[[File:SQID logo.svg|25px|{{TranslateThis
|ast=Ver con SQID
|bn=SQID দিয়ে দেখুন
|ca=Mostra amb SQID
|de=Mit SQID betrachten
|en=View with SQID
|es=Ver con SQID
|fr=Voir avec SQID
|it=Vedi con SQID
|mk=Погледајте со SQID
|pt=Visualizar com SQID
}}|link=https://sqid.toolforge.org/#/{{#if: {{{1|}}}{{{Q|}}}{{{P|}}}
| view?id={{#if: {{{1|}}}
  | {{{1|}}}
  | {{#if: {{{Q|}}}
    | Q{{{Q}}}
    | P{{{P}}}
    }}
  }}&amp;lang={{Int:Lang}}
| &lt;nowiki/&gt;?lang={{Int:Lang}}
}}]]&lt;!--
--&gt;&lt;noinclude&gt;{{Documentation}}&lt;/noinclude&gt;</text>
      <sha1>j6wq5aq6l7wsi92xtysclan6m8dprov</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Reasonator</title>
    <ns>10</ns>
    <id>17365939</id>
    <revision>
      <id>1556587517</id>
      <parentid>1507464031</parentid>
      <timestamp>2022-01-05T12:35:07Z</timestamp>
      <contributor>
        <username>Venca24</username>
        <id>103280</id>
      </contributor>
      <comment>+ cs, eo</comment>
      <origin>1556587517</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="882" sha1="ej9pd5v5fuipsemxo8gx8dbsqgg5vij" xml:space="preserve">{{#if: {{{2|}}}
| &lt;span class="plainlinks"&gt;[https://reasonator.toolforge.org/?q={{{1|}}}&amp;lang={{Int:Lang}} {{{2|}}}]&lt;/span&gt;
}}&amp;#x202F;[[File:Wikidata-Reasonator small logo.svg|12px|{{TranslateThis
|ast = Ver con Reasonator
|be-tarask = Праглядзець у Рэзанатары
|bn = Reasonator দিয়ে দেখুন
|ca = Mostra amb Reasonator
|cs = Zobrazit v Reasonatoru
|de = Im Reasonator betrachten
|en = View with Reasonator
|eo = Rigardi per Reasonator
|es = Ver con Reasonator
|fr = Voir avec Reasonator
|fi = Katso Reasonatorissa
|it = Vedi con Reasonator
|mk = Погледајте со Резонатор
|pt = Visualizar com Reasonator
|ru = Смотреть через Reasonator
|sv = Visa i Reasonator
|uk = Дивитись у Reasonator
}}|link=https://reasonator.toolforge.org/?q={{{1|}}}&amp;lang={{Int:Lang}}]]&lt;noinclude&gt;{{Documentation}}&lt;/noinclude&gt;</text>
      <sha1>ej9pd5v5fuipsemxo8gx8dbsqgg5vij</sha1>
    </revision>
  </page>
  <page>
    <title>Template:WikiProject</title>
    <ns>10</ns>
    <id>21790485</id>
    <revision>
      <id>2298079997</id>
      <parentid>2053606357</parentid>
      <timestamp>2025-01-14T09:49:46Z</timestamp>
      <contributor>
        <username>Mormegil</username>
        <id>28758</id>
      </contributor>
      <comment>+cs</comment>
      <origin>2298079997</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="2446" sha1="afrxihplnkiijrydcgi7kwzg00a84sv" xml:space="preserve">&lt;noinclude&gt;{{doc}}&lt;/noinclude&gt;&lt;!--
--&gt;{{#ifexist: Wikidata:WikiProject {{{1|}}}&lt;!--
    #then:
  --&gt;|{{#if:{{{2|}}}&lt;!--
        #then:
          --&gt;|{{Section link|{{WikiProject/pagename|{{{1|}}}|ns={{{ns|}}}}}|{{{2}}}}}&lt;!--
        #else:
          --&gt;|{{ll|{{WikiProject/pagename|{{{1|}}}|ns={{{ns|}}}}}|WikiProject {{{1|}}}}}&lt;!--
    --&gt;}}&lt;!--
    #else:
  --&gt;|{{error&lt;!--
      --&gt;|{{TranslateThis|ca=El Viquiprojecte {{{1 |}}} no existeix (encara?)
                          |cs=WikiProjekt ''{{{1|}}}'' (zatím?) neexistuje
                          |de=WikiProjekt {{{1|}}} existiert noch nicht?
                          |en=WikiProject {{{1|}}} do not exist (yet?)
                          |fr=Le WikiProjet {{{1|}}} n'existe pas (encore?)
                          |mk=Википроектот „{{{1|}}}“ (сè уште) не постои?
                          |pl=WikiProjekt {{{1|}}} (jeszcze?) nie istnieje
                          |sv=Wikiprojektet {{{1|}}} finns (ännu?) inte
                          |zh-hans={{{1|}}}专题不存在(没创建么?)
                          |zh-hant={{{1|}}}專題不存在(是否未建立?)
                          |xx=...&lt;!--
        --&gt;}}&lt;!--
    --&gt;}}&lt;!--
    --&gt; &lt;small&gt;{{TranslateThis
                    |ca=Seràs el seu creador? [[{{WikiProject/pagename|{{{1|}}}}}|clica aquí]].
                    |cs=Chtěli byste ho založit? [[{{WikiProject/pagename|{{{1|}}}}}|Klikněte sem]].
                    |de=Möchtest Du das WikiProjekt aufbauen? [[{{WikiProject/pagename|{{{1|}}}}}|Klicke hier]].
                    |en=Will you be its creator? [[{{WikiProject/pagename|{{{1|}}}}}|click here]].
                    |fr=allez-vous être son créateur ? [[{{WikiProject/pagename|{{{1|}}}}}|cliquez-ici]].
                    |mk=Дали сакате вие да бидете неговиот творец ? [[{{WikiProject/pagename|{{{1|}}}}}|стиснете тука]].
                    |pl=Czy chcesz go utworzyć? [[{{WikiProject/pagename|{{{1|}}}}}|kliknij tutaj]].
                    |sv=Vill du skapa det? [[{{WikiProject/pagename|{{{1|}}}}}|klicka här]].
                    |zh-hans=您是否希望成为创建者?[[{{WikiProject/pagename|{{{1|}}}}}|点此]]。
                    |zh-hant=您是否希望成為建立者?[[{{WikiProject/pagename|{{{1|}}}}}|按一下這裡]]。
              }}&lt;!--
    --&gt;&lt;/small&gt;&lt;!--
--&gt;}}</text>
      <sha1>afrxihplnkiijrydcgi7kwzg00a84sv</sha1>
    </revision>
  </page>
  <page>
    <title>Template:WikiProject/pagename</title>
    <ns>10</ns>
    <id>22491841</id>
    <revision>
      <id>1294585707</id>
      <parentid>238479307</parentid>
      <timestamp>2020-10-19T21:05:53Z</timestamp>
      <contributor>
        <username>Tacsipacsi</username>
        <id>33956</id>
      </contributor>
      <comment>substitute template that doesn’t do what its name suggests and what it does in other projects</comment>
      <origin>1294585707</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="60" sha1="8o2k69wu2sme8f490aakwi7ynj63jjv" xml:space="preserve">{{#if:{{{ns|}}}|Wikidata Talk|Wikidata}}:WikiProject {{{1}}}</text>
      <sha1>8o2k69wu2sme8f490aakwi7ynj63jjv</sha1>
    </revision>
  </page>
  <page>
    <title>Template:ItemOrNot</title>
    <ns>10</ns>
    <id>28161695</id>
    <revision>
      <id>361346548</id>
      <parentid>361300782</parentid>
      <timestamp>2016-08-02T21:22:10Z</timestamp>
      <contributor>
        <username>Smalyshev (WMF)</username>
        <id>1482806</id>
      </contributor>
      <origin>361346548</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="384" sha1="230nkvb4w9pmw09vu3optxajqkjdr42" xml:space="preserve">{{#if: {{{2|}}} | * {{{1}}}: {{{2|}}} | }}&lt;noinclude&gt;
&lt;templatedata&gt;
{
"params": {
"1": {
"label": "List item name",
"type": "string",
"required": true
},
"2": {
"description": "List item contents",
"type": "string"
}
},
"description": "Displays list item if second argument is not empty, otherwise nothing",
"format": "block"
}
&lt;/templatedata&gt;
&lt;/noinclude&gt;</text>
      <sha1>230nkvb4w9pmw09vu3optxajqkjdr42</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Int Properties</title>
    <ns>10</ns>
    <id>25945270</id>
    <revision>
      <id>360948553</id>
      <parentid>360948486</parentid>
      <timestamp>2016-07-31T15:39:37Z</timestamp>
      <contributor>
        <username>Airon90</username>
        <id>4782</id>
      </contributor>
      <origin>360948553</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="63" sha1="1f6bvc59pk8lngjngkff5ej07hrd17a" xml:space="preserve">&lt;noinclude&gt;{{doc}}&lt;/noinclude&gt;{{capitalize|{{int properties}}}}</text>
      <sha1>1f6bvc59pk8lngjngkff5ej07hrd17a</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Int properties</title>
    <ns>10</ns>
    <id>25941214</id>
    <revision>
      <id>2504115378</id>
      <parentid>2438818739</parentid>
      <timestamp>2026-06-10T11:28:12Z</timestamp>
      <contributor>
        <username>مواطن تونسي</username>
        <id>1537128</id>
      </contributor>
      <minor/>
      <comment>traduction ar</comment>
      <origin>2504115378</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="746" sha1="ao6colplfei84pspf07jmngpp7arssr" xml:space="preserve">&lt;noinclude&gt;{{doc}}&lt;/noinclude&gt;{{TranslateThis
|ar=خصائص
|be-tarask=уласьцівасьці
|bn=বৈশিষ্ট্যসমূহ
|ca=propietats
|cs=vlastnosti
|da=egenskaber
|de=Eigenschaften
|el=ιδιότητες
|en=properties
|en-gb=properties
|eo=ecoj
|es=propiedades
|fi=ominaisuudet
|fr=propriétés
|he=מאפיינים
|hu=tulajdonságok
|id=atribut-atribut
|it=proprietà
|ja=プロパティ
|ko=속성
|mk=својства
|nb=egenskaper
|nl=eigenschappen
|nn=eigenskapar
|pl=właściwości
|pt=propriedades
|pt-br=propriedades
|ru=свойства
|sq=tiparet
|sr=својства
|sv=egenskaper
|th=คุณลักษณะ
|tr=özellikler
|uk=властивості
|vec=propietà
|zh-hans=属性
|zh-hant=屬性
}}</text>
      <sha1>ao6colplfei84pspf07jmngpp7arssr</sha1>
    </revision>
  </page>
  <page>
    <title>Template:SPARQL2/doc</title>
    <ns>10</ns>
    <id>35750675</id>
    <revision>
      <id>1425856775</id>
      <parentid>1425856600</parentid>
      <timestamp>2021-05-21T17:39:04Z</timestamp>
      <contributor>
        <username>PAC2</username>
        <id>4892</id>
      </contributor>
      <comment>/* See also */ typo</comment>
      <origin>1425856775</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="533" sha1="p2irk8qhdq7sqdc2n9kyjs3lvi2j5kw" xml:space="preserve">&lt;nowiki&gt;{{SPARQL2|start=3|highlight=1|query=3}}&lt;/nowiki&gt;
 
{{SPARQL2
|highlight=1
|start=3
|query=3
}}
 
&lt;nowiki&gt;{{SPARQL2|highlight=2|query=1 2}}&lt;/nowiki&gt;
 
{{SPARQL2
|highlight=2
|query=
1
2
}}
 
&lt;nowiki&gt;{{SPARQL2|nohints=test|query=...}}&lt;/nowiki&gt;
 
{{SPARQL2
|nohints=test
|query=SELECT ?pop WHERE {
  wd:Q2807 wdt:P1082 ?pop
}
}}
 
&lt;nowiki&gt;{{SPARQL2|query=...}}&lt;/nowiki&gt;
 
{{SPARQL2
|query=SELECT ?pop WHERE {
  wd:Q2807 wdt:P1082 ?pop
}
}}
 
== See also ==
* {{Template|SPARQL}}
* {{WikiProject|Templates}}
[[Category:Query template]]</text>
      <sha1>p2irk8qhdq7sqdc2n9kyjs3lvi2j5kw</sha1>
    </revision>
  </page>
  <page>
    <title>Template:Int run it</title>
    <ns>10</ns>
    <id>25022557</id>
    <revision>
      <id>2438820809</id>
      <parentid>2033139854</parentid>
      <timestamp>2025-12-06T14:46:20Z</timestamp>
      <contributor>
        <username>YeBoy371</username>
        <id>2200680</id>
      </contributor>
      <origin>2438820809</origin>
      <model>wikitext</model>
      <format>text/x-wiki</format>
      <text bytes="1085" sha1="8ggotttekjqxrksv8jgpqj8yv3lzvla" xml:space="preserve">&lt;noinclude&gt;{{doc}}&lt;/noinclude&gt;{{TranslateThis
|ar=تجربة!
|ast=¡Pruébalo!
|be-tarask=Паспрабуйце!
|bn=এটি চেষ্টা করে দেখুন!
|bs=Isprobajte!
|ca=Prova-ho!
|cs=Zkuste to!
|cy=Ceisio!
|da=Prøv det!
|de=Versuche es!
|de-at|de-ch=Es kann versucht werden!
|de-formal=Versuchen Sie es!
|el=Δοκιμάστε το!
|en=Try it!
|en-gb=Try it!
|eo=Provu ĝin!
|es=¡Pruébalo!
|fi=Kokeile!
|fr=Essayez&amp;nbsp;!
|hu=Próbáld ki!
|hy=Փորձի՛ր
|id=Cobalah!
|it=Provalo!
|ja=試す!
|he=לנסות את זה!
|ko=실행하기!
|ku=Biceribîne!
|lv=Izmēģini!
|mk=Пробајте!
|ms=Jalankan!
|ms-arab=جالنکن!
|nl=Probeer!
|nb=Prøv selv!
|nn=Prøv sjølv
|pa=ਪ੍ਰਸ਼ਨ ਕਰੋ
|pnb=پرشن کرو
|pl=Wypróbuj!
|pt=Experimenta!
|pt-br=Experimente!
|ro=Încercați!
|ru=Выполнить запрос
|sq=Provoje
|sr=Испробајте!
|sv=Testa!
|th=ทดลองใช้
|tr=Deneyin!
|udm=Оскалтэ!
|uk=Виконати!
|zh=试一试!
|zh-hans=试一试!
|zh-hant=試一試!
|zh-tw=試試看!
}}</text>
      <sha1>8ggotttekjqxrksv8jgpqj8yv3lzvla</sha1>
    </revision>
  </page>
</mediawiki>

Latest revision as of 08:26, 1 September 2026

Template:SPARQL2/doc Template:Clear{{#ifeq:|{{{nohints}}}| | Template:TranslateThisTemplate:ItemOrNot Template:ItemOrNot Template:ItemOrNot

}}

[[:Template:SPARQLText]]

Template:Clear

<templatedata> { "params": { "query": { "required": true, "label": { "ar": "استعلام", "be-tarask": "запыт", "cs": "dotaz", "en": "query", "es": "consulta", "fr": "requête", "id": "kueri", "it": "query", "ja": "クエリ", "pl": "zapytanie", "pt": "consulta", "pt-br": "consulta", "sv": "fråga",

               "tr": "sorgu",

"uk": "запит" }, "description": { "ar": "استعلام سباركل", "be-tarask": "запыт SPARQL", "cs": "SPARQL dotaz", "en": "SPARQL query", "es": "consulta SPARQL", "fr": "la requête que le modèle doit traiter et afficher", "id": "kueri SPARQL", "it": "query SPARQL", "ja": "SPARQLクエリ", "pl": "query SPARQL", "pt": "consulta SPARQL", "pt-br": "consulta SPARQL", "sv": "SPARQL fråga", "tr": "SPARQL sorgusu", "uk": "запит SPARQL" }, "example": { "be-tarask": "SELECT * WHERE { ?x wdt:P31 wd:Q5 } LIMIT 1", "cs": "SELECT * WHERE { ?x wdt:P31 wd:Q5 } LIMIT 1", "en": "SELECT * WHERE { ?x wdt:P31 wd:Q5 } LIMIT 1", "es": "SELECT ?item WHERE { ?item wdt:P31 wd:Q5 } LIMIT 1", "fr": "select ?item where { ?item wdt:P31 wd:Q5 } LIMIT 1", "id": "SELECT * WHERE { ?a wdt:P31 wd:Q5 } LIMIT 1", "it": "select ?item where { ?item wdt:P31 wd:Q5 } LIMIT 1", "pt": "select ?item where { ?item wdt:P31 wd:Q5 } LIMIT 1", "pt-br": "select ?item where { ?item wdt:P31 wd:Q5 } LIMIT 1" }, "type": "string", "aliases": [ "sparql" ], "suggested": true }, "extraprefix": { "description": { "ar": "بادئات إضافية لإضافتها",

               "be-tarask": "дадатковыя прэфіксы (неабавязковыя)",

"cs": "Dodatečné prefixy (volitelné)", "en": "Extra prefixes to be added", "es": "Prefijos extra a añadir (opcional)", "fr": "les préfixes SPARQL non standards ou inconnus du service de requête éventuellement nécessaires (optionnel)", "id": "Prefiks SPARQL yang akan ditambahkan", "it": "Aggiungere i prefissi SPARQL non standard o sconosciuti eventualmente necessari (opzionale)", "ja": "追加する接頭辞(オプション)", "pl": "Dodatkowe prefiksy (opcjonalnie)", "pt": "Adicionar os prefixos SPARQL não padrões ou desconhecidos eventualmente necessários (opcional)", "pt-br": "Adicionar os prefixos SPARQL não padrões ou desconhecidos eventualmente necessários (opcional)", "uk": "Додаткові префікси (необов'язкові)" }, "example": "PREFIX wikibase: <http://wikiba.se/ontology#>", "type": "string" } }, "description": {

       "be-tarask": "Гэты шаблён выводзіць запыт SPARQL з падсьветкай сынтаксісу, выкарыстаных элемэнтаў і спасылак на WDQS дзеля запуску запыту. \nЗРАБІЦЬ: скарыстаныя меткі элемэнтаў не лякалізаваныя",

"cs": "Tato šablona zobrazuje SPARQL dotaz ze zvýrazněnou syntaxí, použité položky a odkaz na WDQS dotazovací službu pro vyzkoušení.", "en": "This template displays SPARQL query with syntax highlighting, used items and link to WDQS query site to run the query. \nTODO: used items labels are not localized", "es": "Esta plantilla muestra una consulta SPARQL con resaltado de sintaxis, los items utilizados y un enlace al WDQS para lanzar la consulta", "fr": "Ce modèle affiche une requête SPARQL et permet de la lancer au travers du service de requête Wikidata. Il affiche aussi quelques informations basiques sur les éléments et fonctionnalités utilisées par cette requête", "id": "Templat ini menampilkan kueri SPARQL dengan pembedaan warna pada sintaks beserta entitas Wikidata yang digunakan dan pranala kueri di WDQS.", "it": "Questo template mostra una query SPARQL evidenziandone la sintassi e gli elementi usati e fornisce un link alla query WDQS site che permette di lanciare la query", "ja": "このテンプレートは構文強調付きのSPARQLクエリ、使用した項目、クエリを実行するWDQSクエリサイトへのリンクを表示します。", "pl": "Szablon wyświetla zapytanie SPARQL z podświetlaniem składni, listą użytych elementów i linkiem do WDQS.", "pt": "Esta predefinição mostra uma consulta SPARQL na qual evidencia a sintaxe e os elementos usados e fornece um enlace ao site WDQS que permite executar a consulta", "pt-br": "Esta predefinição mostra uma consulta SPARQL na qual evidencia a sintaxe e os elementos usados e fornece um enlace ao site WDQS que permite executar a consulta", "sv": "Denna mall visar en SPARQL fråga med syntaxfärgning, använda objekt och länk till WDQS frågesajten för att köra frågan. \nTODO: använda objekts etiketter är inte lokaliserade", "uk": "Цей шаблон показує запит SPARQL з підсвічуванням елементів синтаксису, список використаних елементів і посилання на сайт WDQS-запиту." }, "paramOrder": [ "query", "extraprefix" ], "format": "block" } </templatedata>