Content deleted Content added
Not warranted IMO |
→Complex date dependencies: -deleted |
||
(13 intermediate revisions by 7 users not shown) | |||
Line 1:
{{Module rating |protected}}
{{#ifeq:{{SUBPAGENAME}}|sandbox||{{High-use
{{ombox|text=For a more user-friendly wrapper of this module see {{t|wdib}}.}}
This module is intended to be used inside {{t|infobox}} (letters Wikidata'''IB''' stand for ''Info Box'', hence the name) or other templates and designed specifically to
One of the two sandboxes should be used for testing anything other than trivial amendments.
Line 39:
# <code>getAwardCat</code> if the item has values of P166 (award received), then it examines each of those awards for P2517 (category for recipients of this award) and it returns the corresponding category, with the item's P734 (family name) as sort key, or no sort key if there is no family name
# <code>getIntersectCat</code> for each value of the prop1 it fetches the value's main category and then each value of prop2, then it returns all of the categories representing the intersection of those properties
# <code>getSumOfParts</code> scans the property 'has part' (P527) for values matching a list
# <code>getCoords</code>
#
The obsolete call getSourcedValue has now been removed as it is redundant to getValue which can do the same job using the {{para|onlysourced|true}} parameter (which is set by default).
===Utilities functions===
# <code>getLink</code> if there is a sitelink to an article on the local Wiki, it returns a link to the article with the Wikidata label as the displayed text. If there is no sitelink, it returns the label as plain text. If there is no label in the local language, it returns the entity-ID
Line 51 ⟶ 50:
# <code>getAllLabels</code> fetches the set of labels and formats it for display as wikitext
# <code>labelorid</code> returns the label with all wikitext removed, or the entity-ID if no label
# <code>getDescription</code> returns the article description for the Wikidata entity if the local parameter is "Wikidata"
# <code>getAllDescriptions</code> fetches the set of descriptions and formats it for display as wikitext
# <code>getAliases</code> returns the aliases for the entity in the current or given language
Line 66 ⟶ 65:
# <code>followQid</code> given a list of properties, looks for each property in turn and returns the entity-ID of the first value that matches (optionally, returns all entity-IDs that match)
# <code>getGlobe</code> returns the entity-ID of the globe used in P625 (coordinate ___location), or nil if there isn't one
# <code>getCommonsLink</code> returns one of the following in order of preference: the Commons sitelink of the linked Wikidata item; the Commons sitelink of the topic's main category of the linked Wikidata item
# <code>siteID</code> returns the root of the globalSiteID, e.g. "en" for "enwiki", "enwikisource", "en-gb", etc.
# <code>projID</code> same as siteID
Line 87 ⟶ 86:
<nowiki>{{#invoke:WikidataIB |getValueByLang |<PropertyID> |lang=<language code to match> |name=<fieldname> |suppressfields=<list of fields which will never display> |fetchwikidata=<list of fields to fetch values from Wikidata> |onlysourced=<yes/no>}}</nowiki>
== Function getValue ==
Line 151 ⟶ 149:
| onlysourced
| osd
| A boolean which will filter out Wikidata values that are unsourced or only sourced to Wikipedia. [[Wikipedia:Wikidata/2018_Infobox_RfC#Discussion|This 2018 RFC]] requires that Wikidata values displayed in article infoboxes must be sourced. Values <code>no</code>, <code>false</code> and <code>0</code> are all false; anything else is true.
| true
|-
Line 316 ⟶ 314:
| parameterset
| ps
| Convenience parameter to allow commonly used sets of parameters to be specified with a single parameter: ps=1 gets a simple linked value wherever possible; ps=2 represents a plain text value. See [[#Parameter sets|Parameter sets]].
|
|-
Line 464 ⟶ 462:
==== Example of getValueByQual ====
In {{Q|Q10990}} there is a property {{Q|P443}} that has multiple values, each of which has a qualifier {{Q|P407}}. We can return the property value whose qualifier has the value {{Q|
* <code><nowiki>{{#invoke:WikidataIB |getValueByQual |qid=Q10990 |P443 |qualID=P407 |qvalue=
=== Function getValueByLang ===
Line 767 ⟶ 765:
=== Linked items ===
If the target Wiki has a convention that certain items are not normally linked (see [[:en:Wikipedia:Manual of Style/Linking #What generally should not be linked]] for an example), then a sub-module [[Module:WikidataIB/nolinks]] can be created to list items that should not be linked, using the English Wikipedia sub-module as an exemplar.
=== Italic titles ===
If the target Wiki has a convention that certain works should be italicised or quoted (see [[:en:Wikipedia:Manual of Style/Text formatting #Names and titles]] for an example), then a sub-module [[Module:WikidataIB/titleformats]] can be created to list items that should be italicised or quoted, using the English Wikipedia sub-module as an exemplar.
=== Complex date ===
Line 777 ⟶ 775:
==== Complex date dependencies ====
[[Module:Complex_date]] relies on the following modules:
* [[Module:ISOdate]]
** [[Module:DateI18n]] (no dependencies)
* [[Module:i18n/complex date]]
** [[Module:Ordinal]] (lazy loading)
Line 787 ⟶ 783:
*** [[Module:Formatnum]] (no dependencies)
** [[Module:Roman]] (lazy loading with no dependencies)
Unless otherwise noted, the authoritative version of each module can be found on [https://commons.wikimedia.org/ Commons] although the versions on English Wikipedia are usually kept in sync.
|