Module talk:WikidataIB/sandbox/testing

Local parameter, fetchwikidata, suppressfields


† Note that when a blacklist is supplied, a field name is also needed, otherwise the call returns nothing.

Don't link common items


→

Quantity handling
,

Getting value and qualifiers

 * for
 * Qualifiers: and


 * for


 * for
 * Qualifiers: is handled to include "before "

Scaling quantities

 * for and

Ranks
Fetching the names of the from  (one value preferred):

Fetching the values of from  (no values preferred):

Using template – Fetching the names of the from  (one value preferred):

getQualifierValue

 * Date precision is month:
 * In : property equal to  has a  qualifier


 * Date precision is day:
 * In : property equal to  has a  qualifier


 * Multiple date values:
 * In : property equal to  has  qualifiers


 * Qualifier value is an article:
 * In : property equal to  has an  qualifier


 * Using a filter:
 * In : property equal to  has multiple  qualifiers. A filter can pick one of them.
 * Examples 2 and 3 filter on: (2) , and (3)   , returning the  where the filter matches.

getSumOfParts
For (which has 4 RBMK + 4 water-water energetic reactors): For (which has 1 PWR + 2 boiling water reactors): For (which has 8 CANDU reactors): For (which doesn't seem to have any reactors, according to Wikidata):
 * getSumOfParts scans the property 'has part' (P527) for values matching a list.
 * The list is passed in parameter vlist.
 * It consists of a string of Qids separated by spaces or any usual punctuation.
 * If the matched values have a qualifier 'quantity' (P1114), those quantities are summed.
 * The sum is returned as a number or nothing if it's zero.

getValueByLang
In, the value of the property which has the fixed qualifier "language of work or name" equal to a given language code (or default) is:

getAliases
Expensive call if using arbitrary access.

getAllAliases
Expensive call if using arbitrary access.

getAllLabels
Expensive call if using arbitrary access.

getAllDescriptions
Expensive call if using arbitrary access.

Link to redirect
Wikidata won't directly allow a sitelink to a redirect, so who has  of  won't link to Lichenologist, which is a redirect to Lichenology, because there's no enwiki sitelink in. So we have a parameter, yes or no, that switches in a test whether there is a redirect on the wiki with the same title as the label.

Format value
Some titles of works, journals, etc. should be "quoted" (for small works) or italicised (for large works). So we have a parameter y/n to allow that formatting when needed. For in :

location

 * debugging





But for the USA, we normally miss off the "US" part. So put it back and change Wikidata's "USA" to enwiki's "US" when skip is true.

For British locations, it would skip to which is the first instance of. Unfortunately is not an instance of a country, but an instance of a, according to Wikidata. So also test for Q3336843 when skip is true.

Some locations (like ) have multiple values for. So check for qualifier to pick the right one.

examine
Examining

→

→

→

→

→

Using wrapper template

→

Format Dates
Some test cases for the function formatDate. Call like