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

Bearbeiten
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 as mw.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 as mw.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 as mw.loadData
Returns: JSON code
failsafe
Version ID (local): 2019-12-16
Optional parameter:
  • 1 – Minimum version or wikidata or ~
{{#invoke:WikidataScheme|failsafe}} yields 2019-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.

Examples (test page)

Bearbeiten

See the scenario which illustrates results on input values.

Functions for Lua modules (API)

Bearbeiten

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.loadData page
      • table
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.loadData page
      • table
  • adjust
    • optional boolean
    • true – symbolic entity names will be resolved
    • false (default) – symbolic entity names will be kept
  • frame
    • optional
    • frame object, if available
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.loadData page
      • table
  • frame
    • optional
    • frame object, if available
returns: HTML code as string
WikidataScheme.failsafe( atleast )
Versioning interface
  • atleast
    optional
    nil or minimum version or wikidata or ~ for synchronisation
returns: Version ID as string or false
  • 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

Bearbeiten
  • 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

Bearbeiten

Languages

Bearbeiten

Installation

Bearbeiten

Follow the steps:

  1. Copy main module Module:WikidataScheme into 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.
  2. Register this module at d:Q71584769.
  3. Consider availablity of dependencies to support languages best.
  4. Ready.
  5. Consider translation of this doc page.