Wikipedia:Lua/Modul/WikidataScheme/en
Wikipedia:Lua Modul WikidataScheme en
| Vorlagenprogrammierung | Diskussionen | Lua | Unterseiten | |||
| Modul | Deutsch | English
|
Modul: | Dokumentation | ||
WikidataScheme – support creation of new Wikidata data objects (items, „Q“) and completion of existing entries.
For certain objects in the (real) world some input which is always or quite often needed shall be presented for easy access. That covers properties, some typical items for this context and qualifiers. Those things should remind to provide all minimal information and are to be displayed in a comprehensible manner.
- Presentation is not bound to any human language in particular. The specification is heading for global usage and shall exploit multilingual labels and descriptions already available at Wikidata, completed by extendible multilingual text elements.
- The recommended structure of the new data object should be available to gadgets which can exploit the pointers to create an individual form for this object type. That form can be filled first until all constraints are met, then published at once. Currently by universal method a lot of particular fields are to be generated first, then items get selected from a global variety and finally published one by one.
- A global community may agree on some mandatory properties and typical items to be offered for certain thematic objects in this field. That suggestion is published independent of human language.
See the scenario for a general survey.
Functions for templates
- form
- Generate HTML code with a description of entities to provide (in user language)
- Mandatory parameter:
1– JSON data with specification, or name of a Lua page asmw.loadData
- Returns: HTML code
- format
- Export a spezification as well formatted JSON
- Mandatory parameter:
1– JSON data with specification, or name of a Lua page asmw.loadData
- Returns: JSON code
- JSON
- Export a spezification as well formatted JSON, symbolic names resolved
- Mandatory parameter:
1– JSON data with specification, or name of a Lua page asmw.loadData
- Returns: JSON code
- failsafe
- Version ID (local):
2019-12-16 - Optional parameter:
1– Minimum version orwikidataor~
{{#invoke:WikidataScheme|failsafe}}yields2019-12-16- With a parameter as ISO date it is compared whether the current module satisfies this version or later.
{{#invoke:WikidataScheme|failsafe|2001-01-01}}returns: »2019-12-16«{{#invoke:WikidataScheme|failsafe|2099-01-01}}returns: »« – (empty), if minimal version condition not matched- If keyword is
wikidata, result is version ID registered on Wikidata (2019-12-16) or local if not found there. - If keyword is
~, result is empty if local and Wikidata version are the same: ().
- Returns:
- Empty, if minimal version condition not matched, or
~and local version is synchronized. - Version ID if no parameter, or if
wikidata, or local if not found there, or not synchronized.
- Empty, if minimal version condition not matched, or
Examples (test page)
See the scenario which illustrates results on input values.
- JSON example
- Use case (GlobalSharing)
Functions for Lua modules (API)
All functions described above can be used by other modules:
local lucky, WikidataScheme = pcall( require, "Module:WikidataScheme" )
if type( WikidataScheme ) == "table" then
WikidataScheme = WikidataScheme.WikidataScheme()
else
-- In the event of errors, WikidataScheme is an error message.
return "<span class=\"error\">" .. WikidataScheme .. "</span>"
end
Subsequently there are available:
- WikidataScheme.fetch( about )
- Analyse a specification
- about
- Specification; either:
- string, with JSON code
- string, with name of a
mw.loadDatapage - table
- Specification; either:
- about
- returns: Either string, with error message, or table, with validated specification
- WikidataScheme.flat( about, adjust, frame )
- Generate and format JSON code
- about
- Specification; either:
- string, with JSON code
- string, with name of a
mw.loadDatapage - table
- Specification; either:
- adjust
- optional boolean
true– symbolic entity names will be resolvedfalse(default) – symbolic entity names will be kept
- frame
- optional
frameobject, if available
- about
- returns: A string, with error message, or JSON code
- WikidataScheme.form( about, frame )
- Create HTML table
- about
- Specification; either:
- string, with JSON code
- string, with name of a
mw.loadDatapage - table
- Specification; either:
- frame
- optional
frameobject, if available
- about
- returns: HTML code as string
- WikidataScheme.failsafe( atleast )
- Versioning interface
- atleast
optional
nil or minimum version orwikidataor~for synchronisation
- atleast
- returns: Version ID as string or
false
Usage
- Global coordination on creation and completion of Wikidata items.
- Pages offering WikidataScheme tables or JSON code.
- Gadget exploiting JSON of WikidataScheme
- GlobalSharing (auxilary functions)
Dependencies
- Multilingual (recommended for full language support; otherwise it will work with limited functionality)
- WikidataScheme (recommended for full non-latin scripting support, but will help itself)
Installation on other WMF projects
Languages
- commons:Data:I18n/Module:WikidataScheme.tab
- More text fragments in best matching language will be retrieved from Wikidata or system messages.
Installation
Follow the steps:
- Copy main module
Module:WikidataSchemeinto your project.- If possible keep the name
WikidataScheme. - If another name is required due to conflict or naming convention or non-latin script then choose a different one.
- If possible keep the name
- Register this module at d:Q71584769.
- Consider availablity of dependencies to support languages best.
- Ready.
- Consider translation of this doc page.
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.