Module:WikidataIB/doc: Difference between revisions

Content deleted Content added
remove High-use template from sandbox display
 
(8 intermediate revisions by 3 users not shown)
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,. If the matched values have a qualifier 'quantity' (P1114), those quantities are summed and returned (but zero returns nil)
# <code>getCoords</code> - gets coordinates and passes them through {{t|Coord}}
# <code>getPreferredValue</code> - {{color|red|'''Deprecated'''}} but retained for backward compatibility. Use the <code>|getValue|rank=best</code> parameters instead.
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===
Line 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 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 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 315 ⟶ 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 463 ⟶ 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|Q797913955}}
* <code><nowiki>{{#invoke:WikidataIB |getValueByQual |qid=Q10990 |P443 |qualID=P407 |qvalue=Q7979Q13955 |fwd=ALL |osd=no |noicon=true}}</nowiki></code> → {{#invoke:WikidataIB/sandbox |getValueByQual |qid=Q10990 |P443 |qualID=P407 |qvalue=Q7979Q13955 |fwd=ALL |osd=no |noicon=true}}
 
=== Function getValueByLang ===
Line 776 ⟶ 775:
==== Complex date dependencies ====
[[Module:Complex_date]] relies on the following modules:
* [[Module:Calendar]] (lazy loading with no dependencies)
* [[Module:ISOdate]]
** [[Module:DateI18n]] (no dependencies)
*** [[Module:No globals]] (from en.wikipedia)
* [[Module:i18n/complex date]]
** [[Module:Ordinal]] (lazy loading)
Line 786 ⟶ 783:
*** [[Module:Formatnum]] (no dependencies)
** [[Module:Roman]] (lazy loading with no dependencies)
** [[Module:Linguistic]] (lazy loading with no dependencies)
*** [[Module:No globals]] (from en.wikipedia)
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.