Template:PBD
This template is intended to fetch data from Porn Base Data with or without a link to the connected Porn Base Central article and with many other features.
Usage
{{pBD|command1|flag1a|flag1b|flag1c|command2|flag2a|flag2b|flag2c|flag0a|flag0b|flag0c|arg1|arg2|arg3}}
Commands
The commands (command1
, command2
, ...) determine what kind of values are returned. One call can only contain commands from a single class.
Claim class
The claim class commands can be combined, meaning that multiple commands of different types from this class can be given at one time.
Combine multiple commands into one call to this template, instead of making multiple calls to this template with one command each, to be sure that all the returned pieces of information belong to each other.
Type | Command | Returns | Basic usage | Description |
---|---|---|---|---|
I | property
|
first match[lower-alpha 1] | {{pBD|property|P1}}
|
Returns the requested property – or list of properties – from the current item-entity or from a given entity. |
properties
|
all matches | {{pBD|properties|P1}}
| ||
II | qualifier
|
first match[lower-alpha 1] | {{pBD|qualifier|P1|P2}}
|
Returns the requested qualifier – or list of qualifiers – from the given property of the current item-entity or of a given entity.
Unlike the other claim class commands, this command can be given multiple times to retrieve different qualifiers in one call. |
qualifiers
|
all matches | {{pBD|qualifiers|P1|P2}}
| ||
III | reference
|
first match[lower-alpha 1] | {{pBD|reference|P1}}
|
Returns a reference – or list of references – from the given property of the current item-entity or of a given entity.[lower-alpha 2] |
references
|
all matches | {{pBD|references|P1}}
| ||
|
General class
The general class commands cannot be combined.
Type | Command | Returns | Basic usage | Description |
---|---|---|---|---|
I | label
|
{{pBD|label}}
|
Returns the label of the current item-entity or of a given entity if present. | |
II | title
|
{{pBD|title}}
|
Returns the title of the page linked to the current item-entity or to a given item-entity if such page exists. | |
III | description
|
{{pBD|description}}
|
Returns the description of the current item-entity or of a given entity if present. | |
IV | alias
|
first match[lower-alpha 1] | {{pBD|alias}}
|
Returns an alias – or list of aliases – of the current item-entity or of a given entity if present. |
aliases
|
all matches | {{pBD|aliases}}
| ||
V | badge
|
first match[lower-alpha 1] | {{pBD|badge}}
|
Returns a badge – or list of badges – for the page linked to the current item-entity or to a given item-entity if such page exists. |
badges
|
all matches | {{pBD|badges}}
| ||
Flags
The following (optional) flags are available which can be used to alter this template's behaviour. They must be given after the (first) command and before the other arguments. For convenience, empty flags (i.e. ||
) are allowed and will simply be ignored.
Command flags
These flags (flag1*
, flag2*
, ...) apply to the command that precedes them directly.
Flag | Description |
---|---|
linked
|
Creates a link to the PBC 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. |
short
|
[EXPENSIVE] Returns the (P1813) of any entity returned if they have one attached. If that is not the case, then the default behaviour of returning the entity's label will occur.
|
raw
|
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, unless the If this flag is used with time datatypes, then the returned date will be in the format of If it is used with globe coordinate datatypes, then it replaces the various symbols with forward slashes in the returned value (e.g. |
multilanguage
|
Returns monolingual text values in any available language, not just the current wiki's language. |
unit
|
Returns only the unit of measurement for quantity datatypes. |
Configuration flags
These flags (flag0*
) are general configuration flags and can be given anywhere after the first command (but before the other arguments).
Flag | Command class | Description | |
---|---|---|---|
Combination of: | preferred
|
claim | Sets a rank constraint for the selected claim(s).
The first three set the ranks for which claim(s) will be selected. They can optionally be followed by a If the The default is Output is always sorted from highest rank to lowest (regardless of any of these flags being set). |
normal
| |||
deprecated
| |||
best
| |||
Combination of: | future
|
claim | Sets a time constraint for the selected claim(s). Uses the claims' qualifiers of start time (P34) and end time (P41) to determine if the claim is valid for the selected time period(s).
The default is |
current
| |||
former
| |||
mdy
|
claim | Returns date values in month-day-year order instead of day-month-year order. | |
single
|
claim | Returns only a single claim instead of multiple (if multiple claims match). Has no effect if the property /properties command is given, in which case this flag would be redundant.
| |
sourced
|
claim | Only returns claims that have at least one valid reference. | |
One of: | edit
|
claim, general | Adds a clickable icon after the output that may be used by readers to edit the returned claim on Wikidata.
If |
edit@end
|
Arguments
The arguments determine the sources from which all the returned values are fetched.
Positional arguments
The following table shows the available positional arguments (arg*
) in their fixed order. For each command, the applicable set of arguments is marked. If multiple commands are given, then the applicable set is the union of the individual sets. For instance, if the commands properties
and qualifiers
have been given, then at least both the arguments property_id
and qualifier_id
should be given as well.
More than one qualifier
/qualifiers
command can be given. The order in which these commands with their flags are given matches the order in which the respective qualifier_id
arguments are given.
(required) | (optional) | (optional) | (required) | (optional) | (required) | (required) | |||
{{pBD
|
commands
|
flags
|
entity_id
|
property_id
|
raw_value
|
qualifier_id
|
qualifier_id
|
}}
| |
---|---|---|---|---|---|---|---|---|---|
label , title ,description ,alias /aliases ,badge /badges
|
|||||||||
property /properties
|
|||||||||
reference /references
|
|||||||||
qualifier /qualifiers
|
|||||||||
qualifier /qualifiers (optional 2nd, 3rd, etc.)
| |||||||||
Below follows a description of all positional arguments.
Argument | Description |
---|---|
entity_id
(optional) |
[EXPENSIVE] Q-identifier of the item-entity to be accessed (e.g. Q205 ), or P-identifier (or an available alias) of the property-entity to be accessed preceded by the Property: prefix (e.g. Property:P38 ).
In case of the general class commands, the If this parameter is omitted, then the item-entity connected to the current page will be used (except when |
property_id
|
P-identifier (or an available alias) of the property within the entity to be accessed, without the Property: prefix (e.g. P35 ).
|
raw_value
(optional) |
Either the Q-identifier equal to the property value (e.g. Q29574 ) or a literal value (i.e. string or quantity etc., no entity label) equal to the raw property value of the particular claim to be accessed.
Dates as literal values must be formatted Globe coordinates as literal values must be formatted with forward slashes (i.e. The special type 'no value' can be given by entering the empty string (i.e. To get a literal vertical bar If this parameter is omitted, then all claims (matching any other constraints) within the property will be accessed. |
qualifier_id
|
P-identifier (or an available alias) of the qualifier within the entity to be accessed, without the Property: prefix (e.g. P34 ).
|
Named arguments
Below follows a description of all named arguments, which are name-value pairs (i.e. |name=value
). These are all optional and can be given anywhere inside the call.
Argument | Description |
---|---|
eid=
|
[EXPENSIVE] This argument offers the same functionality as the positional argument entity_id (e.g. |eid=Q205 ), with one difference: if the argument is given but its value is left empty (i.e. |eid= ), then no entity is accessed at all instead of the item-entity connected to the current page. This is useful in some cases where a variable entity-ID is expected, but where the item-entity connected to the current page should not be accessed as the default.
Also, the This argument only has effect if the positional argument |
<qualifier>=
|
The <qualifier> is a placeholder for a set of arguments that determine which claims should be accessed based on qualifier value, analogous to the pair of positional arguments property_id and raw_value that determine access based on property value.
As such, Example: Multiple arguments of this type can be given to match multiple qualifier values simultaneously for each claim. |
Property aliases
Property aliases are other names for P-identifiers that can be used instead. The following property aliases (which are case-sensitive) are currently available:
Alias | translates to |
P-identifier |
---|---|---|
coord | → | P48 |
author | → | P215 |
publisher | → | P218 |
importedFrom | → | P36 |
statedIn | → | P15 |
pages | → | P219 |
language | → | P44 |
publicationDate | → | P19 |
startTime | → | P34 |
endTime | → | P41 |
chapter | → | P221 |
retrieved | → | P17 |
referenceURL | → | P35 |
sectionVerseOrParagraph | → | P223 |
archiveURL | → | P208 |
title | → | P225 |
formatterURL | → | P167 |
quote | → | P226 |
shortName | → | P203 |
archiveDate | → | P227 |
inferredFrom | → | P71 |
typeOfReference | → | P228 |
column | → | P230 |
Advanced usage
The layout of the output from (a combination of) commands that have both a singular and a plural form (e.g. property
/properties
) can be customized by using a number of named flags, which are name-value pairs (i.e. |flag=value
), that can be given anywhere inside the call. The table below shows the available named flags.
To insert a space at the beginning or end of a value
, use an underscore _
. To get a literal underscore, escape it by placing a backslash \
directly in front of it (i.e. \_
); the same holds for a literal backslash (i.e. \\
). To get a literal vertical bar |
, use {{!}}
or |
.
Named flag | Default value | Default condition | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
format=
|
%p[%s][%r]
|
if the property /properties command was given and the qualifier /qualifiers command was not given
|
The format of a single claim. The available parameters are as follows.
Optional parameters can be given by encapsulating them between square brackets: To use two opening square brackets that directly follow each other (i.e. At least one parameter must be given that is not optional, while the To get a literal | ||||||||||||||||
%q[%s][%r]
|
if the property /properties command was not given and the qualifier /qualifiers command was given
| ||||||||||||||||||
%r
|
if only the reference /references command was given
| ||||||||||||||||||
%p[ <span style="font-size:85\%">(%q)</span>][%s][%r]
|
if the property /properties command was given and the qualifier /qualifiers command was given
| ||||||||||||||||||
%a[%s]
|
if the alias /aliases command was given
| ||||||||||||||||||
%b[%s]
|
if the badge /badges command was given
| ||||||||||||||||||
sep=
|
_
|
default | The fixed separator between each pair of claims. | ||||||||||||||||
|
if only the reference /references command was given without the raw flag
| ||||||||||||||||||
sep%s=
|
,
|
default | The movable separator between each pair of claims. This will be the value of the %s parameter applied to all claims except for the last in the list.
| ||||||||||||||||
;
|
if the property /properties command was not given and the qualifier /qualifiers command was given
| ||||||||||||||||||
sep%q1= , sep%q2= , sep%q3= , ...
|
,_
|
default | The separator between each pair of qualifiers of a single claim. These are the value separators for the %q1 , %q2 , %q3 , ... parameters.
If only one | ||||||||||||||||
sep%q=
|
,_
|
if exactly one qualifier /qualifiers command was given
|
The separator between each set of qualifiers of a single claim. This is the value separator for the %q parameter.
If only one | ||||||||||||||||
;_
|
if more than one qualifier /qualifiers command was given
| ||||||||||||||||||
sep%r=
|
|
default | The separator between each pair of references of a single claim. This is the value separator for the %r parameter.
| ||||||||||||||||
_
|
if the raw flag was given for the reference /references command
| ||||||||||||||||||
punc=
|
|
default | A punctuation mark placed at the end of the output. This will be placed on the %s parameter applied to the last claim in the list.
This allows any references to be placed after the punctuation mark when the output is used as part of a sentence. |
Examples
Parameters and output types | Example | Description |
---|---|---|
Q211 = "Russia", P111 = "licence plate code"
[string] |
{{pBD|property|Q211|P111}}
|
Gets a literal string value. |
P111 = "licence plate code"
[string] |
{{pBD|property|P111}}
|
If the template is transcluded on the page (which is linked to Q211), then the Q211 can be omitted.
|
Q211 = "Russia", P111 = "RUS"
[string] |
{{pBD|property|eid=Q211|P111}}
|
An entity-ID can also be given using the eid= argument.
|
Q211 = "Russia", P111 = "licence plate code"
[string] |
{{pBD|property|edit|Q211|P111}} |
Adds a clickable icon that may be used to edit the returned value on PBD. |
Q211 = "Russia", P111 = "licence plate code"
[string] |
{{pBD|property|edit@end|Q211|P111}} |
Places the edit icon at the end of the line. |
Q211 = "Russia", P59 = "population"
[quantity] |
{{pBD|property|normal+|Q211|P59}}
|
Gets a single property value from claims with a 'normal' rank or higher. |
Q211 = "Russia", P59 = "population"
[quantity] |
{{pBD|properties|normal+|Q211|P59}}
|
Gets multiple property values from claims with a 'normal' rank or higher. |
Q211 = "Russia", P59 = "population", P60 = "point in time"
[quantity], [time] |
{{pBD|properties|qualifier|normal+|Q211|P59|P60}}
|
Gets a single qualifier value for each claim, additional to the property value. |
Q211 = "Russia", P59 = "population", P60 = "point in time"
[quantity], [time], [reference] |
{{pBD|properties|qualifier|references|normal+|Q211|P59|P60}} |
Gets references for each claim. |
Q211 = "Russia", P59 = "population"
[quantity], [reference] |
A total of
|
Gets a property with its references. |
Q211 = "Russia", P59 = "population"
[quantity], [reference] |
Russia has a population of
|
Adds a punctuation mark at the end of the output, in front of the references. |
Q211 = "Russia", P59 = "population", P60 = "point in time"
[quantity], [time], [reference] |
<ul>
|
Returns the output in a custom format. |
Q211 = "Russia", P59 = "population", P60 = "point in time"
[time] |
{{pBD|qualifier|normal+|Q211|P59|P60}}
|
Gets a single qualifier per claim, by default for multiple matching claims. |
Q211 = "Russia", P59 = "population", P60 = "point in time"
[time] |
{{pBD|qualifier|normal+|single|Q211|P59|P60}}
|
To get a single qualifier for only a single claim, give the single flag too so that only a single claim will be accessed.
|
Q211 = "Russia", P59 = "population", P60 = "point in time"
[time] |
{{pBD|qualifier|Q211|P59|143056383|P60}}
|
Gets a qualifier from claims for which the (raw) property value matches a given literal value. |
Q211 = "Russia", P59 = "population", P60 = "point in time"
[time] |
{{pBD|qualifier|mdy|Q211|P59|143056383|P60}}
|
Gets dates in month-day-year order. |
Q211 = "Russia", P59 = "population", P60 = "point in time"
[time] |
{{pBD|qualifier|raw|Q211|P59|143056383|P60}}
|
Gets a raw date value. |
Q211 = "Russia", P59 = "population"
[reference] |
{{pBD|references|Q211|P59|143056383}}
|
Gets the references from a particular claim. |
Q211 = "Russia", P59 = "population"
[reference] |
{{pBD|references|raw|Q211|P59|143056383}} |
Gets references from a particular claim in their raw form. |
Q211 = "Russia", P233 = "Human Development Index"
[quantity], [reference] |
{{pBD|properties|references|normal+|Q211|P233}} |
Gets properties from each claim with any references they have. |
Q211 = "Russia", P233 = "Human Development Index"
[quantity], [reference] |
{{pBD|properties|references|normal+|sourced|Q211|P233}} |
Only gets properties from claims that have at least one reference. |
Q211 = "Russia", P234 = "VAT-rate", P200 = "applies to part"
[entity label] |
{{pBD|qualifier|Q211|P234|P200}}
|
Gets a single qualifier value (for each matching claim). |
Q211 = "Russia", P234 = "VAT-rate", P200 = "applies to part"
[entity label] |
{{pBD|qualifiers|Q211|P234|P200}}
|
Gets multiple qualifier values (for each matching claim). |
Q211 = "Russia", P234 = "VAT-rate", P200 = "applies to part"
[quantity], [entity label] |
{{pBD|properties|qualifiers|Q211|P234|P200}}
|
Gets multiple property values along with multiple qualifier values. |
Q211 = "Russia", P234 = "VAT-rate", P200 = "applies to part"
[quantity], [entity label] |
{{pBD|properties|qualifiers|Q211|P234|P200|sep=_+_|sep%s=|sep%q=_/_}}
|
Returns the output with custom separators. |
Q211 = "Russia", P236 = "capital", P34 = "start time", P41 = "end time"
[entity label], [time] |
{{pBD|properties|qualifier|qualifier|normal+|Q211|P236|P34|P41}}
|
Gets two different qualifier values for each claim. |
Q211 = "Russia", P236 = "capital", P34 = "start time", P41 = "end time"
[entity label], [time] |
{{pBD|properties|qualifier|qualifier|normal+|Q211|P236|P34|P41}}
|
Returns the output with a custom separator. |
Q211 = "Russia", P236 = "capital", P34 = "start time", P41 = "end time"
[entity label], [time] |
{{pBD|properties|qualifier|qualifier|normal+|Q211|P236|P34|P41}}
|
Returns the output in a custom format instead of with a custom separator. |
Q211 = "Russia", P236 = "capital", P34 = "start time", P41 = "end time"
[entity label], [time] |
{{pBD|properties|qualifier|qualifier|normal+|Q211|P236|P34|P41}}
|
To add text only when a certain value is not present, like adding the word since if there is no end time, wrap it in between two optional blocks containing HTML comment tags and the relevant parameter (this also prevents the text from being added to the page source). |
Q211 = "Russia", P236 = "capital", Q57 = "Saint Petersburg", P34 = "start time", P41 = "end time"
[entity label], [time] |
{{pBD|properties|qualifier|raw|qualifier|normal+|Q211|P236|Q57|P34|P41}}
|
Gets a property with qualifiers from claims for which the property matches a given Q-identifier, with one of the qualifier values in its raw form. |
Q211 = "Russia", P237 = "currency", P200 = "applies to part"
[entity label] |
{{pBD|properties|qualifiers|normal+|current|Q211|P237|P200}}
|
Gets claims that are currently valid. |
Q211 = "Russia", P237 = currency", P200 = "applies to part"
[entity label] |
{{pBD|properties|linked|qualifiers|normal+|current|Q211|P237|P200}}
|
Gets claims with linked property values. |
Q211 = "Russia", P237 = currency", P200 = "applies to part"
[entity label] |
{{pBD|properties|qualifiers|linked|normal+|current|Q211|P237|P200}}
|
Gets claims with linked qualifier values. |
Q211 = "Russia", P237 = currency", P200 = "applies to part"
[entity label] |
{{pBD|properties|linked|short|qualifiers|linked|normal+|current|Q211}}
|
Gets claims with linked property and qualifier values, with short property values wherever available. |
Q211 = "Russia", P237 = currency", Q236 = "Moscow", P200 = "applies to part"
[entity label] |
{{pBD|qualifiers|normal+|current|Q211|P237|Q236|P200}}
|
Gets qualifiers from claims for which the (raw) property value matches a given Q-identifier. |
Q211 = "Russia", P237 = currency", P200 = "applies to part", Q211 = "Russia"
[entity label] |
{{pBD|properties|normal+|current|Q211|P237|P200=Q211}}
|
Gets properties from claims for which a (raw) qualifier value matches a given Q-identifier. |
Q211 = "Russia", P237 = currency"
[entity label] |
{{pBD|properties|normal+|former|Q211|P237}}
|
Gets claims that were valid in the past. |
Q211 = "Russia", P237 = currency"
[entity label] |
{{pBD|properties|raw|normal+|former|Q211|P237}}
|
Gets raw property values. |
Q211 = "Russia", P237 = currency"
[entity label] |
{{pBD|properties|raw|linked|normal+|former|Q211|P237}}
|
Gets raw property values that are linked to PBD. |
Q211 = "Russia", P181 = "demonym"
[monolingual text] |
{{pBD|property|Q211|P181}}
|
Gets a monolingual text value in the current wiki's language. |
Q211 = "Russia", P181 = "demonym", P44 = "language of work or name", Q96 = "English"
[monolingual text] |
{{pBD|property|multilanguage|Q211|P181|P44=Q96}}
|
Gets a monolingual text value in any available language. |
Q211 = "Russia", P239 = "mains voltage"
[quantity] |
{{pBD|property|Q211|P239}}
|
Gets a quantity value with its associated unit of measurement. |
Q211 = "Russia", P239 = "mains voltage"
[quantity] |
{{pBD|property|linked|Q211|P239}}
|
Gets a quantity value with a linked unit of measurement. |
Q211 = "Russia", P239 = "mains voltage"
[quantity] |
{{pBD|property|raw|Q211|P239}}
|
Gets a raw quantity value. |
Q211 = "Russia", P239 = "mains voltage"
[quantity] |
{{pBD|property|unit|Q211|P239}}
|
Gets only the unit of measurement. |
Q211 = "Russia", P239 = "mains voltage"
[quantity] |
{{pBD|property|unit|raw|Q211|P239}}
|
Gets the raw unit of measurement. |
Q211 = "Russia", P48 = "coordinate location"
[globe coordinate] |
{{pBD|property|Q211|P48}}
|
Gets a globe coordinate value. |
Q211 = "Russia", P48 = "coordinate location"
[globe coordinate] |
{{pBD|property|linked|Q211|P48}}
|
Gets a linked globe coordinate value. |
Q211 = "Russia", P48 = "coordinate location"
[globe coordinate] |
{{pBD|property|raw|Q211|P48}}
|
Gets a raw globe coordinate value. |
Q211 = "Russia", P48 = "coordinate location"
[globe coordinate] |
{{pBD|property|Q211|coord}}
|
A property alias can be used instead of the P-identifier. |
Q236 = "Moscow"
[entity label] |
{{pBD|label|Q236}}
|
Gets an item's label. |
Q236 = "Moscow"
[entity label] |
{{pBD|label|short|linked|Q236}}
|
Gets an item's short and linked label. |
P237 = currency"
[entity label] |
{{pBD|label|P237}}
|
Gets a property's label. |
P237 = currency"
[entity label] |
{{pBD|label|linked|P237}}
|
Gets a property's label that is linked to PBD. |
Q242 = "Moscow Oblast"
[entity label] |
{{pBD|label|Q242}}
|
Gets an item's label. |
Q242 = "Moscow Oblast"
[entity label] |
{{pBD|label|linked|Q242}} |
Gets an item's linked label. |
[entity label] |
{{pBD|label}}
|
If the template is transcluded on the page (which is linked to Q242), then the Q242 can be omitted.
|
[entity label] |
{{pBD|label|raw}}
|
If just the label command with the raw flag is given, then the Q-identifier of the item connected to the current page is returned.
|
Q242 = "Moscow Oblast"
[page title] |
{{pBD|title|Q242}}
|
Gets the title of the page on the current wiki that is linked to the given item. |
Q242 = "Moscow Oblast"
[page title] |
{{pBD|title|linked|Q242}}
|
Gets the linked title of the page on the current wiki that is linked to the given item. |
[page title] |
{{pBD|title}}
|
If the template is transcluded on the page (which is linked to Q242), then the Q242 can be omitted.
|
Q211 = "Russia"
[entity description] |
{{pBD|description|Q211}}
|
Gets an item's description. |
[entity description] |
{{pBD|description}}
|
If the template is transcluded on the page (which is linked to Q211), then the Q211 can be omitted.
|
Q211 = "Russia"
[entity alias] |
{{pBD|alias|Q211}}
|
Gets one of an item's aliases. |
Q211 = "Russia"
[entity alias] |
{{pBD|aliases|Q211}}
|
Gets all of an item's aliases. |
Q211 = "Russia"
[entity alias] |
{{pBD|alias|linked|Q211}}
|
Gets a linked alias from an item. |
[entity alias] |
{{pBD|alias}}
|
If the template is transcluded on the page (which is linked to Q211), then the Q211 can be omitted.
|
Q2 = "Fabio Toba"
[page badge] |
{{pBD|badges|Q2}}
|
Gets the badges for the page on the current wiki that is linked to the given item. |
Q2 = "Fabio Toba"
[page badge] |
{{pBD|badges|raw|Q2}}
|
Gets the raw badges for the page on the current wiki that is linked to the given item. |
[page badge] |
{{pBD|badges}}
|
If the template is transcluded on the Fabio Toba page (which is linked to Q2), then the Q2 can be omitted.
|
Example references
See also
- {{Wikidata entity link}} or redirect {{Q}}), to add a Wikidata entity link to a PBC page
- {{Wikidata property link}} or redirect {{Property}}, to add a Wikidata property link to a PBC page
- {{Wikidata property}}, to add a Wikidata property {{side box}} to a PBC page or template documentation
- {{Uses Wikidata}}, to add a Wikidata property box to the documentation of a template or module
- {{Tracks Wikidata}}, to add a Wikidata property box to the documentation of a template, module, or category
- Module:PBD, the source module that is called by this template.
- {{Pageid to title}}, to get a page title using its local page id, rather than Wikidata