https://de.wikipedia.org/w/index.php?action=history&feed=atom&title=Wikipedia%3ALua%2FModul%2FWikidataScheme%2FSpecificationWikipedia:Lua/Modul/WikidataScheme/Specification - Versionsgeschichte2025-07-03T11:33:00ZVersionsgeschichte dieser Seite in WikipediaMediaWiki 1.45.0-wmf.8https://de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/WikidataScheme/Specification&diff=194846049&oldid=prevPerfektesChaos: m2019-12-12T13:25:34Z<p>m</p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="de">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Nächstältere Version</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Version vom 12. Dezember 2019, 15:25 Uhr</td>
</tr><tr>
<td colspan="2" class="diff-lineno">Zeile 86:</td>
<td colspan="2" class="diff-lineno">Zeile 86:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*; qualifiers</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*; qualifiers</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*: Permitted within <code>claims.values</code> only.</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*: Permitted within <code>claims.values</code> only.</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>*: Sequence table, of [[#Qualifier|Qualifier]]</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>*: Sequence table, of [[#Qualifier|Qualifier]]<ins style="font-weight: bold; text-decoration: none;"> each.</ins></div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*; [[#example|example]]</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*; [[#example|example]]</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*; [[#terminate|terminate]]</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*; [[#terminate|terminate]]</div></td>
</tr>
<tr>
<td colspan="2" class="diff-lineno">Zeile 93:</td>
<td colspan="2" class="diff-lineno">Zeile 93:</td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This is rather similar to <code>claims</code>.</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>This is rather similar to <code>claims</code>.</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* One single qualifier.</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>* One single qualifier.</div></td>
</tr>
<tr>
<td class="diff-marker" data-marker="−"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>* <del style="font-weight: bold; text-decoration: none;">Sequence</del> table, with each element as mapping table of the following (mostly optional) components:</div></td>
<td class="diff-marker" data-marker="+"></td>
<td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>* <ins style="font-weight: bold; text-decoration: none;">Element of a sequence</ins> table, with each element as mapping table of the following (mostly optional) components:</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*; [[#subject|subject]]</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*; [[#subject|subject]]</div></td>
</tr>
<tr>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*: Mandatory.</div></td>
<td class="diff-marker"></td>
<td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>*: Mandatory.</div></td>
</tr>
</table>PerfektesChaoshttps://de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/WikidataScheme/Specification&diff=194832625&oldid=prevPerfektesChaos: +2019-12-11T21:35:22Z<p>+</p>
<a href="//de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/WikidataScheme/Specification&diff=194832625&oldid=194817998">Änderungen zeigen</a>PerfektesChaoshttps://de.wikipedia.org/w/index.php?title=Wikipedia:Lua/Modul/WikidataScheme/Specification&diff=194817998&oldid=prevPerfektesChaos: Setup2019-12-11T12:00:25Z<p>Setup</p>
<p><b>Neue Seite</b></p><div>{{LuaModuleDoc}}<br />
This page describes the data structure used for a '''WikidataScheme specification'''.<br />
* The structure applies to both [[JavaScript Object Notation|JSON]] and [[Lua]] table.<br />
A [[#root|root]] element is to be provided.<br />
<br />
== Building blocks ==<br />
<br />
=== EntityName ===<br />
This can be either:<br />
* A [[Wikidata]] entity ID, beginning with P, Q, L and followed by digits: <code>[[d:Q1|Q1]]</code><code></code><br />
* A symbolic name.<br />
** This is required to be resolved by [[#NameResolver|NameResolver]].<br />
<br />
=== NameResolver ===<br />
This is a mapping table <code>resolve</code> in [[#root|root]] element which assigns:<br />
* symbolic name<br />
* mapping table as follows:<br />
** assign a ''number'' to (at least) one of the components <code>P</code>, <code>Q</code>, <code>L</code>.<br />
** Basically more than one component may be present, but the first one found in that order will be used.<br />
The motivation to use a symbolic name is:<br />
* The thematic description becomes more intuitive; described by self explaining words only.<br />
* An entity used in several places may change pointer at once.<br />
* The assignment may differ in development. Just apply another resolving map. Actually there are three different Wikibase installations available:<br />
*# Productive Wikidata https://www.wikidata.org/<br />
*# WMF test Wikidata<br />
*# BETA Wikidata (wmflabs)<br />
Naturally, all expected symbolic names are to be resolved, otherwise an error is shown in displayed table.<br />
<br />
The [[../#JSON|JSON]] function may be used to resolve all symbolic names and generates pretty formatted JSON with entity IDs only.<br />
<br />
=== TextVariant ===<br />
This can be either:<br />
* A ''string'', with [[Wikidata]] entity ID only, beginning with P, Q, L and followed by digits (label will be used)<br />
* A ''string'', with constant text otherwise<br />
* A mapping ''table'', which assigns an [[ISO 639]] / BCP47 key to a text ''string''.<br />
** There should be always present at least: <syntaxhighlight lang="json" style="white-space:nowrap" inline>{ "en": "Fallback text" }</syntaxhighlight><br />
** In addition to language codes, the following two components are processed:<br />
***; class<br />
***: Sequence table (array) or ''string'' with class names for this text element<br />
***; style<br />
***: Mapping table or ''string'' with [[Cascading Style Sheets|CSS]] for this text element<br />
The resulting strings may contain basic markup:<br />
* For italic and bold, <code><nowiki>''</nowiki></code> and <code><nowiki>'''</nowiki></code> wikisyntax<br />
* Internal links, with <code style="white-space:nowrap"><nowiki>[[double bracket]]</nowiki></code> syntax, beginning with global project prefix.<br />
* External links, with <code style="white-space:nowrap"><nowiki>[single bracket]</nowiki></code> syntax, beginning with protocol ''http https ftp''.<br />
* Whitelisted HTML elements, like ''span div bdi bdo code pre ul ol li dl dt dd em strong b i table caption tr th td''.<br />
<br />
=== Entry ===<br />
This is used for both <code>claims</code> and <code>qualifiers</code>.<br />
* Both are a sequence table, with each element as mapping table of the following components:<br />
*; subject<br />
*: Property name, P-number or symbolic name resolved by [[#NameResolver|NameResolver]] as P-number.<br />
*; intro<br />
*: General description, introduction<br />
*: [[#TextVariant|TextVariant]]<br />
*; state<br />
*: One of: <code>"required"</code>, <code>"suggested"</code>, <code>"deprecated"</code>, otherwise <code>"optional"</code><br />
*; values<br />
*: Sequence table (array) of mapping tables. Each with the following components:<br />
*:; q<br />
*:: The one and only permitted value as item<br />
*:: [[#EntityName|EntityName]] as Q-number.<br />
*:: Must not be used together with <code>qlist</code>.<br />
*:; qlist<br />
*:: Sequence table (array) of items.<br />
*::* [[#EntityName|EntityName]] as Q-number.<br />
*::* Last element may be <code>true</code> which indicates that other items than explicitly mentioned are permitted as well.<br />
*:: Must not be used together with <code>q</code>.<br />
*; qualifiers<br />
*: Permitted within <code>claims</code> only.<br />
*: [[#Entry|Entry]]<br />
*; example<br />
*: Example value, text<br />
*: [[#TextVariant|TextVariant]]<br />
*; terminate<br />
*: Final remarks<br />
*: [[#TextVariant|TextVariant]]<br />
*; class<br />
*: Sequence table (array) or ''string'' with class names for entire unit<br />
*; style<br />
*: Mapping table or ''string'' with [[Cascading Style Sheets|CSS]] for entire unit<br />
<br />
== {{Anker|root}} Root Element ==<br />
Using all definitions of [[#Parts|parts ]], the specification is defined as follows:<br />
* Mapping table created from the following components:<br />
*; caption<br />
*: Table or gadget title<br />
*: [[#TextVariant|TextVariant]]<br />
*; onLabel<br />
*: Naming convention and expectations on label text<br />
*: [[#TextVariant|TextVariant]]<br />
*; onDesc<br />
*: Formatting and expectations on description text<br />
*: [[#TextVariant|TextVariant]]<br />
*; onAlias<br />
*: Formatting and expectations on aliases texts<br />
*: [[#TextVariant|TextVariant]]<br />
*; claims<br />
*: Statements (actually mandatory)<br />
*; footer<br />
*: Terminating hints, remarks, legend<br />
*: [[#TextVariant|TextVariant]]<br />
*; id<br />
*: ''string'', selector for entire table<br />
*; class<br />
*: Sequence table (array) or ''string'' with class names for entire table<br />
*; style<br />
*: Mapping table or ''string'' with [[Cascading Style Sheets|CSS]] for entire table<br />
*; options<br />
*: Mapping table, override local /config<br />
*; resolve<br />
*: Mandatory if symbolic names occurring.<br />
*: [[#NameResolver|NameResolver]]<br />
* While all components are optional a specification without <code>claims</code> is pointless.<br />
* More components are permitted but not evaluated.<br />
<br />
== JSON and Lua ==<br />
* A ''mapping table'' in Lua is an ''object'' <code style="white-space:nowrap">{ }</code> in JSON.<br />
* A ''sequence table'' in Lua is an ''Array'' <code style="white-space:nowrap">[ ]</code> in JSON.<br />
* Both textual JSON and Lua tables may be provided.<br />
* Lua specifications may be generated by general module call, or by providing a generating <code style="white-space:nowrap">mw.loadData()</code> page name.<br />
* A number of specifications may be created programmatically, e.g. fundamentals of a human being, then forking into opera singer, rock & pop musisicians, composer, painter, writer,&nbsp;…<br />
<br />
== Example ==<br />
{{#rel2abs:../../GlobalSharing/Wikidata}}</div>PerfektesChaos