Module:Wd/doc

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

Usage
The general structure of a call to this is as follows. Note that the basic structure consists of positional commands, flags and arguments, which all have a fixed position.



Use different commands to get different kinds of values from Wikidata. At least one command must be given and multiple commands can be combined into one call as shown above (in any order, more than two is also possible), but this only applies to commands from the claim class; calls containing a command from the general class cannot contain any other command. Each command can be followed by any number of command flags, which are optional and can be used to tweak the output generated by that command.

The commands and their flags may be followed by any number of configuration flags, which are also optional and affect the selection of data and the 's behaviour in general. The call is closed with the positional arguments, which may be required depending on the given command(s). Some named arguments (i.e. name-value pairs) also exist, as well as a set of named flags for advanced usage that can be used to change the way the fetched values are merged together into the output.

This was designed to provide the basic needs for fetching data from Wikidata, but a lot can be achieved through different combinations of calls. For convenience, such combinations could be wrapped into new templates that serve a specific need. See also the section on common use cases below for some examples of useful "building blocks". Likewise, the functionality of this can be extended by creating wrapper templates that use the   command provided by  (just like WikidataOI does).

Common use cases
Below follows a list of common use cases. In the future, shortcut commands may be implemented that are equivalent to these calls for convenience.

Commands
The commands (, , ...) 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 (see above for usage).

Combine multiple commands into one call to this, instead of making multiple calls to this with one command each, to be sure that all the returned pieces of information belong to each other (see also the examples below).

General class
The general class commands cannot be combined.

Flags
The following (optional) flags are available which can be used to alter this '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 (, , ...) apply to the command that precedes them directly.

Configuration flags
These flags are general configuration flags and can be given anywhere after the first command (but before the other arguments).

Arguments
The arguments determine the sources from which all the returned values are fetched.

Positional arguments
The following table shows the available positional arguments 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  and   have been given, then at least both the arguments   and   should be given as well.

More than one /  command can be given. The order in which these commands with their flags are given matches the order in which the respective  arguments are given.

Below follows a description of all positional arguments.

Named arguments
Below follows a description of all named arguments, which are name-value pairs (i.e. ). These are all optional and can be given anywhere.

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:

Advanced usage
The layout of the output from (a combination of) commands that have both a singular and a plural form (e.g. / ) can be customized by using a number of named flags, which are name-value pairs (i.e.  ), that can be given anywhere. The table below shows the available named flags.

To insert a space at the beginning or end of a, 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.