Template:Wd/doc

This is intended to fetch data from Wikidata with or without a link to the connected Wikipedia article.

The is under development and is not yet complete. Of the available datatypes, it currently supports strings, quantities, monolingual text, time and globe coordinates.

Functions
Returns the requested property or list of properties from the given item. Returns the requested qualifier or list of qualifiers from the given property of the given item. Returns the requested property and its requested qualifier or a list thereof from the given item, with the qualifier formatted between parentheses behind the property and with units of measurement if applicable. Returns the label of the given item or property. In case of an item that has no label, the title of the linked page will be returned instead if it exists. Returns the title of the page linked to the given item if it exists. Any label of the item will never be returned instead.

Flags
Creates a link to the Wikipedia article that is connected to the property or qualifier if it exists. Also links units of measurement that may be appended to values. If this parameter is omitted, then the plain property or qualifier value will be returned. Gets the short name (P1813) of any item returned if they have one attached. If that is not the case, then the default behaviour of returning the item label will occur. Returns only a single value instead of multiple (if multiple claims match). The returned value is the first match found from the best-ranked claims. Returns date values in month_day_year order instead of day_month_year order. (default)
 * (  when used)
 * One of:

Sets a rank constraint for the selected claims. The latter three can be followed by a  or a , e.g.  or  , where the first selects claims with a 'normal' rank or higher and the second selects claims with a 'preferred' rank or lower. To get claims of all ranks, use  or. Output is always sorted from highest rank to lowest (regardless of this flag being set).
 * One of:

Sets a time constraint for the selected claims. Uses the claims' qualifiers of start time (P580) and end time (P582) to determine if the claim is valid for the selected time period. Returns the raw value if applicable. If this flag is used with item or property datatypes, then this will return the Q-identifier or P-identifier. For quantity datatypes, this flag will strip off any units of measurement. If this flag is used with time datatypes, then the returned date will be in the format of  (e.g.  ). Dates in the Julian calendar stored with a precision of days through millenniums will have   attached to the output (e.g. , which may be split off using the   template function). If it is used with globe coordinate datatypes, then it replaces the various symbols with forward slashes in the returned value (e.g., which may be split into parts using the   template function).

property
A list of flags (see above). Q-identifier of the item to be accessed (e.g. Q55). If this parameter is omitted, then the item connected to the current page will be used. P-identifier or an available alias of the property to be accessed (e.g. P38).
 * (optional)
 * (optional,   when used)

qualifier
A list of flags (see above). Q-identifier of the item to be accessed (e.g. Q55). If this parameter is omitted, then the item connected to the current page will be used. P-identifier or an available alias of the property to be accessed (e.g. P38). Either the Q-identifier of the particular claim to be accessed (e.g. Q6655) or a literal value (i.e. string or quantity etc., no item label) equal to the claim to be accessed. Dates as literal values must be formatted  (e.g.  ) for dates with a precision of days,   (e.g.  ) for dates with a precision of months, and   (e.g.  ) for dates of lesser precision without any spaces or leading zeros. Dates BCE require a minus sign in front of the year (e.g. ). Dates stored in the Julian calendar must have   attached to the end (e.g.  ). Decades like the 2010s must be given as   (but the 2010s BCE as  ), centuries like the 20th century as   (but the 20th century BCE as  ), and millenniums like the 3rd millennium as   (but the 3rd millennium BCE as  ). Globe coordinates as literal values must be formatted with forward slashes (i.e. ) between the parts and no symbols (e.g.  ) without any spaces or leading zeros. The special type 'no value' can be given by entering the empty string (i.e. ) and the special type 'unknown value' can be given by entering a space (i.e.  ). If this parameter is omitted, then all claims (matching any other constraints) within the property will be accessed. P-identifier or an available alias of the qualifier to be accessed (e.g. P518).
 * (optional)
 * (optional,   when used)
 * (optional)

propertyWithQualifier
This function is equivalent to, except that the property is also returned with the qualifier between parentheses behind it.

label
A list of flags (see above). Q-identifier of the item (e.g. Q55) or P-identifier (or an available alias) of the property (e.g. P38) to be accessed. If this parameter is omitted, then the item connected to the current page will be used.
 * (optional)
 * (optional)

title
A list of flags (see above). Q-identifier of the item to be accessed (e.g. Q55). If this parameter is omitted, then the item connected to the current page will be used. {{#ifeq:{{NAMESPACENUMBER}}|828|
 * (optional)
 * (optional)

main
The name of one of the above functions. A list of flags and arguments applicable to the chosen function.
 * (optional)
 * }}

Named properties
Named properties are aliases for P-identifiers. The following named properties (which are case-sensitive) are currently available:

property

 * Q55, P395 : []


 * Q55, P1549 : []

If the is transcluded on the  page (which is linked to Q55), then the   can be omitted:


 * P1549 : []

property with rank

 * Q55, P38 : []


 * best rank (default)


 * other ranks



property with time constraint

 * Q55, P38 : []

property with short name

 * Q55, P38 : []

property with return of quantity

 * Q55, P2884 : []

property with return of globe coordinate

 * Q55, P625 : []

A named property (or alias) can be used instead of the P-identifier:


 * Q55, "coord" (→ P625, ): []

property with return of single value

 * Q55, P150 : []

qualifier

 * Q55, P1343 , Q302556 , P958 : []

If the is transcluded on the  page (which is linked to Q55), then the   can be omitted:


 * P1343, Q302556 , P958 : []

qualifier with rank

 * Q55, P38 , P518 : []


 * best rank (default)


 * other ranks



qualifier with time constraint

 * Q55, P38 , P518 : []

qualifier with claim ID

 * Q55, P38 , Q4917 , P518 : []

qualifier with literal value

 * Q55, P2884 , 230 volt, P2144 : []

qualifier with return of time

 * Q55, P463 , Q458 , P580 : []

qualifier with return of single value

 * Q55, P2855 , P518 : []

propertyWithQualifier

 * Q55, P2884 , P2144 : []


 * Q55, P38 , P518 : []

If the is transcluded on the  page (which is linked to Q55), then the   can be omitted:


 * P38, P518 : []

label






















If the is transcluded on the  page (which is linked to Q776), then the   can be omitted:



title


If the is transcluded on the  page (which is linked to Q776), then the   can be omitted: