QuickStatements 3.0/Documentation/User guide

QuickStatements (QS) is a tool that is used to batch edit Wikidata items. The tool aims to solve the problem of manually editing wikidata items by allowing edits to be done in batches. It does this using a simple set of text commands. It simplifies and semi-automates the process of wikidata editing. The tool can add and remove statements, labels, descriptions and aliases; as well as add statements with optional qualifiers and sources.
QuickStatements 3.0 is the latest version of the QuickStatements tool, developed by Wikimedia Brasil. Originally created by Magnus Manske, the tool has evolved through various versions, including Quickstatements 1 and 2. Quickstatements 3.0 introduces new features and extends the tool's capabilities. These enhancements include generating reports of successful command batches, forcing the creation of duplicate statements, increasing the execution speed of commands targeting the same entity, removing sources and qualifiers, and setting and editing the preferential ranks of statements, among others.
Overview
[edit]Here is a basic overview of how to use QuickStatements 3.0 and some of its features.
- Go to the QuickStatements 3.0 website.
- Make sure you are logged into OAuth and your name is visible in the upper-right corner. If not, then log in.
- You must be an autoconfirmed user in order to create and run batches in QuickStatements 3.0
- Click "New batch".
- Click the drop-down menu to select "V1" or "CSV" command syntax.
- You have the option to block the Batch if a command fails
- In Quickstatements 3.0, if there are multiple consecutive commands aimed at the same item, they are grouped together and executed in a single API call; thus, a single edit. Users have the option to disable this feature when executing commands by toggling on the "Do not combine commands" option.
- Cut and paste your commands. The syntax is described in the next sections.
- Click "Create" to preview the commands. Inspect them and click "Save and run batch" to execute.
- As your commands are being processed, double-check the results, and click "Stop execution" if you detect a problem.
- Toggle between "SHOWING ALL" and "SHOWING ONLY ERRORS" to inspect the results.
- The user interface will tell you when all commands have been processed.
- After successfully executing batch commands, you can download a csv report of all the batch commands.
Syntaxes
[edit]There are two different syntaxes that can be used to prepare the commands to be executed by Quickstatements: the V1 and the CSV (or V2) file syntax. You can choose whichever you prefer to prepare your commands.
The v1 syntax is built around specific keywords and each line roughly represents a statement. It is more user-friendly and easier to write on your own.
The csv syntax is designed to be build using a spreadsheet, in which each row represents an entity. The columns can represent statements to be added or modified in the entity.
V1 syntax
[edit]This section describes syntax used since V1 version of the tool, sometimes referred to as V1 commands.
- Statements can be specified by typing into directly into the tools text area. Different parts of the statement are separated by a
TABor|(pipe) characters. - You can also use a spreadsheet software like LibreOffice Calc or Microsoft Excel to achieve this.
- Enter your data into the cells, with each column representing one part of the statement. When your data is organized, copy and paste the cells into the tool's text area, the spreadsheet software will automatically insert TABs between the columns.
- You can also use a text editor like Notepad++, it allow replacement of any symbol by the
TABcharacter (\t). - Each command for different statements are placed on a new line or separated by
||characters. - You can use new lines or
||and tabs or|interchangeably.
Statements
[edit]Each statement must be structured with three components: an entity, a property, and a value.
If the statement does not exist, it will create it. If it exists already, it will not create a duplicate. If you need that, check the corresponding section for the new + syntax.
Entity: This is the subject of the statement and can be an item or a property. For example, the entity of a statement could be an item: "Earth" (Q2). Represented in the form Qxx for items and Pxx for properties.
Property: This describes a characteristic or attribute of the entity. For instance, if the entity of a statement is an item: "Earth", the properties might include its human population, highest point, shape, etc. Represented in the form Pxx.
Values:
Value provides the specific detail related to the property. it can be another entity, a string, a time, a location, or a quantity, depending on the property type. Special values like somevalue or novalue can also be used for unknown or no values. For the example above the property "highest point" will have the value "Mount Everest".
Entity
[edit]The statement value can be another entity.
Q42 | P19 | Q350
Meaning: add to Douglas Adams (Q42) a statement for the property place of birth (P19) with value Cambridge (Q350).
String
[edit]Strings should be enclosed in double quotes. Many statements use string values, including URLs, Media (such as images and videos, which must be uploaded to Wikimedia Commons), page names (e.g., Commons category (P373)), and external-ID properties (e.g., VIAF cluster ID (P214)).
Q14579 | P856 | "https://kernel.org/"
Q14579 | P1581 | "https://planet.kernel.org/"
Q14579 | P348 | "6.13.7"
Q14579 | P154 | "Tux.svg"
Q14579 | P18 | "Linux 5.13.5 boot message screenshot.png"
Meaning: add to Linux kernel (Q14579) the following statements:
- property official website (P856) with value "https://kernel.org/"
- property official blog URL (P1581) with value "https://planet.kernel.org/"
- property software version identifier (P348) with value "6.13.7"
- property logo image (P154) with value "Tux.svg"
- property image (P18) with value "Linux 5.13.5 boot message screenshot.png".
Time
[edit]Time values must follow the format: 1967-01-17T00:00:00Z/11, where /11 specifies the precision of the date. You can put an optional plus "+" at the start.
The precision levels are: 0: Billion years, 1: Hundred million years, 2: Ten million years, 3: Million years, 4: Hundred thousand years, 5: Ten thousand years, 6: Millennium, 7: Century, 8: Decade, 9: Year (default), 10: Month, 11: Day.
Use "+" (plus) or empty for CE dates and "-" (minus) for BCE dates. Use at least 4 digits. Set an additional "/J" if you want to set the date in Julian Calendar.
Q52 | P571 | 2001-01-15T00:00:00Z/11
Q868 | P569 | -0384-00-00T00:00:00Z/9
Meaning: add to Wikipedia (Q52) a statement for the property inception (P571) with value 15 January 2001 with date precision, as defined in /11; and add to Aristotle (Q868) a statement for the property date of birth (P569) with value 384 BCE with year precision, as defined in /9.
Monolingual text
[edit]To add monolingual text, prefix the text in double quotes with the language code followed by a colon. For example, en:"Some text".
Q935 | P1559 | en:"Isaac Newton"
Meaning: add to Isaac Newton (Q935) a statement for the property name in native language (P1559) with value "Isaac Newton", an english language string.
Coordinates
[edit]Location coordinates must be in the form of @LAT/LON, where LAT and LON are decimal numbers representing latitude and longitude, respectively.
Q173559 | P625 | @-33.903469/18.411102
Meaning: add to Cape Town Stadium (Q173559) a statement for the property coordinate location (P625) with value as the point with latitude -33.903469 and longitude 18.411102.
Quantity
[edit]Quantity is used to add numerical values to wikidata items. The syntax for Quantity must be in the format Amount~ToleranceUnit or Amount[Lower,Upper]Unit. Tolerance, Lower/Upper bounds and the unit are optional.
- Amount: The main quantity value.
- Tolerance (optional): represents that the quantity can be plus or minus this value. To define it, add a tilda
~after the amount and the tolerance's value. Cannot be used together with bounds. - Lower/upper bounds (optional): The lower and upper bounds of the quantity. Both values must either be present or absent together. When present, they must be enclosed in square brackets and separated by a ",". Cannot be used together with tolerance.
- Unit (optional):
Ufollowed by entity id of the unit. Common units are metre (Q11573) (U11573) and centimetre (Q174728) (U174728).
Don't leave any spaces in the quantity definition.
Amount, tolerance, lower and upper bounds must use . (dot) as decimal separator, must not use any thousands separator and may be prefixed by "+" (plus) or "-" (minus).
Simple quantity
[edit]Q3450504 | P1098 | 1
Meaning: add to Resígaro (Q3450504) a statement for the property number of speakers, writers, or signers (P1098) with value 1.
Quantity with units
[edit]Q739484 | P2044 | 2994U11573
Meaning: add to Pico da Neblina (Q739484) a statement for the property elevation above sea level (P2044) with value 2994 using metre (Q11573) as the unit.
Quantity with tolerance
[edit]Q97 | P2046 | 106460000[106450000,106470000]U712226
Q97 | P2046 | 106460000~10000U712226
Meaning: add to Atlantic Ocean (Q97) a statement for the property area (P2046) with value 106 460 000, plus or minus 10 thousand, with unit square kilometre (Q712226). The first command uses lower/upper bounds and the second command uses tolerance. They are equivalent.
Somevalue and novalue
[edit]It is also possible to use somevalue or novalue as a statement's value. Some value is used when there is a value for that property but is unknown, and no value is used when it is known that there is no value for that property (which is different from not having the statement). Check the Wikidata's documentation for more details.
Q331226 | P156 | novalue
Q35811 | P569 | somevalue
Meaning: to Of the Rings of Power and the Third Age (Q331226), add a statement for the property followed by (P156) with novalue, meaning that it is not followed by any work, since it is the last of its series. To Zoroaster (Q35811), add a statement for the property date of birth (P569) with somevalue, meaning that it has a value (that person was born) but it is unknown.
Label, description, alias and sitelink
[edit]Each command must consist of an item, what should be set (Labels, Descriptions, Aliases, or Sitelinks) and a string in double quotes.
To set a label in a specific language to an item, use "Lxx" instead of a property, with "xx" as the language code.
Q1001 | Len | "Mahatma Gandhi"
Meaning: add English label "Mahatma Gandhi" to item Mahatma Gandhi (Q1001)
To set a description in a specific language to an item, use "Dxx" instead of a property, with "xx" as the language code.
Q1001 | Den | "Indian independence activist (1869–1948)"
Q1001 | Dfr | "leader politique et religieux indien (1869–1948)"
Meaning: add English and French description to Mahatma Gandhi (Q1001).
To add an alias in a specific language to an item, use "Axx" instead of a property, with "xx" as the language code. You can specify multiple aliases to be added at the same time, separated in multiple columns.
Aliases are the only ones which can be added multiple times, because an entity can have multiple aliases for the same language. On the other hand, entities can have only one label and one description for each language.
Q1001 | Aeo | "Mahatmo Gandho"
Q1001 | Aen | "Gandhi" | "Mohandas K Gandhi" | "M. K. Gandhi"
Meaning: add Esperanto alias "Mahatmo Gandho" to item Mahatma Gandhi (Q1001) and multiple English aliases to said item.
To set the sitelink of a specific page to an item, use "Sxxx" instead of a property, with "xxx" as the site. Ensure that the site code corresponds to the correct Wikimedia project (e.g., enwiki for English Wikipedia) and that the sitelink title matches the exact page title on that site.
Q1001 | Sptwiki | "Mahatma Gandhi"
Meaning: add sitelink to the Portuguese Wikipedia page titled "Mahatma Gandhi" to Mahatma Gandhi (Q1001).
Qualifiers
[edit]Each statement triplet can be followed by an unlimited number of qualifier pairs of property and value. Therefore, multiple P cells are not multiple statements: the first one defines the statement's property, and the subsequent ones define the qualifier properties.
Q40269 | P1082 | 1360590 | P585 | +2000-08-01T00:00:00Z/11 | P459 | Q39825
Meaning: add to Porto Alegre (Q40269) a statement for the property population (P1082) with value 1360590. For this statement, add a qualifier with property point in time (P585) with value August 1st of 2000 (date precision) and another qualifier with property determination method or standard (P459) with value census (Q39825).
References
[edit]Each statement can be followed by an unlimited number of source pairs to add references. A source pair consists of a reference property and its value. The source property uses the form Sxx instead of Pxx.
You can mix qualifiers and references in the same command.
For editing on Wikidata, use the Help:Sources page for useful documentation and guidelines.
Q12418 | P276 | Q10292830 | S854 | "http://cartelfr.louvre.fr/cartelfr/visite?srv=car_not_frame&idNotice=14153" | S813 | +2017-09-23T00:00:00Z/11
Meaning: add to Mona Lisa (Q12418) a statement for the property location (P276) with value Salle des États, Louvre (Q10292830). For this statement, add just one reference block, consisting of two reference parts: property reference URL (P854) with value "http://cartelfr.louvre.fr/cartelfr/visite?srv=car_not_frame&idNotice=14153" and property retrieved (P813) with value September 23d of 2017.
By default, all reference parts will go into the same reference (a block of property/value pairs). If you want to create more than one reference in a single command row, simply prefix the first source property of the new group with an exclamation mark: !Sxx. Note: in the first reference block, the exclamation mark is optional and will not influence the outcome.
Q143 | P220 | "epo" | S248 | Q14790 | S813 | +2014-10-31T00:00:00Z/11 | !S248 | Q75488338 | S854 | "https://op.europa.eu/web/eu-vocabularies/at-dataset/-/resource/dataset/language" | S1065 | "https://web.archive.org/web/20200107134814/https://op.europa.eu/en/web/eu-vocabularies/at-dataset/-/resource/dataset/language" | S2960 | +2020-01-07T00:00:00Z/11
Meaning: add to Esperanto (Q143) a statement for the property ISO 639-3 code (P220) with value "epo". For this statement, add two reference blocks.
- The first block consists of two reference parts
- property stated in (P248) with value Ethnologue (Q14790);
- and property retrieved (P813) with date October 31st of 2014.
- The second block consists of four reference parts. Notice the exclamation mark in
!S248.- property stated in (P248) with value Language (Q75488338);
- property reference URL (P854) with value "https://op.europa.eu/web/eu-vocabularies/at-dataset/-/resource/dataset/language"
- property archive URL (P1065) with value "https://web.archive.org/web/20200107134814/https://op.europa.eu/en/web/eu-vocabularies/at-dataset/-/resource/dataset/language";
- and property archive date (P2960) with date January 7th of 2020.
Ranks (new)
[edit]In QuickStatements 3.0, you can set and edit statements rankings. The possible keywords for ranking are:
R+orRpreferredfor preferred ranking.R0orRnormalfor normal ranking. If no ranks are specified when creating a statement, this is the default.R-orRdeprecatedfor deprecated ranking.
If editing on Wikidata, take a look in the help pages for ranking and specially for deprecation.
Q2513 | P856 | "http://hubblesite.org/" | R+
Q2513 | P856 | "http://spacetelescope.org/" | R0
Q2513 | P10565 | "68143" | R- | P2241 | Q21441764
Meaning: in Hubble Space Telescope (Q2513), for the property official website (P856), set the rank of the statement with value "http://hubblesite.org/" as preferred, and the rank of the statement with value "http://spacetelescope.org/" as normal. Also, set the rank of the statement for the property Encyclopedia of China (Third Edition) old ID (2021) (P10565) with value "68143" as deprecated, as well as adding a qualifier with property reason for deprecated rank (P2241) and value withdrawn identifier value (Q21441764).
Force create statements (new)
[edit]By default, a new statement will not be created if one with the specified value already exists. In order to force its creation, prefix the statement with a + (plus symbol).
This can be useful for statements that are modeled with start time (P580) and end time (P582) as qualifiers, to create two disjoint intervals for a specific value.
+Q6454 | P6 | Q3160150 | P580 | +1959-03-15T00:00:00Z/11 | P582 | +1969-03-15T00:00:00Z/11
Meaning: create a statement in Calais (Q6454) for the property head of government (P6) with value Jacques Vendroux (Q3160150) even though a statement with that value already exists. In the created statement, add two qualifiers, property start time (P580) with date March 15th 1959 and property end time (P582) with date March 15th 1969.
Create items
[edit]Ensure that you do not create duplicate items! |
To create a new item, insert a line with only the word CREATE. To add statements to this new item, use LAST instead of a QID. This will add the statement to the previously created item.
CREATE
LAST | Len | "New item label"
LAST | Den | "A new Wikidata item"
LAST | P18 | "MyNewItem.jpg"
Meaning: create an item, label the item as "New item label", add an English description and add a statement for the property image (P18) with value "MyNewItem.jpg".
Properties may be created in the same way with CREATE_PROPERTY followed by the entity type, one of: commonsMedia, globe-coordinate, wikibase-item, wikibase-property, string, monolingualtext, external-id, quantity, time, url, math, geo-shape, musical-notation, tabular-data, wikibase-lexeme, wikibase-form, wikibase-sense.
This is mostly of use on third-party Wikibase instances, as property creation is restricted on Wikidata.
Merge items
[edit]You can merge two items. The newer item will be merged and (if successful) redirected into the older item.
MERGE | Q1 | Q2
Item merging is not yet supported in QuickStatements3.0, use the QuickStatements version 2 to merge items.
Edit summaries
[edit]You can add a comment to any command, which will be included in the edit summary. Simply add the /* ... */ syntax at the end of the command. Optionally, you can insert a | or TAB before the comment. Any spaces around the comment will be removed before processing.
Q8023 | P18 | "Nelson Mandela 1994.jpg" | /* Add image to Nelson Mandela */
Q8023 | P103 | Q13218 /* Add native language to Nelson Mandela */
Meaning: add to Nelson Mandela (Q8023) a statement for the property image (P18) with value "Nelson Mandela 1994.jpg", a file hosted no Wikimedia Commons, and for the property native language (P103) add a statement with value Xhosa (Q13218). Both summaries will be joined into one edit.
When commands target the same entity and are combined into a single edit, the edit summaries are joined.
Remove statements
[edit]By value
[edit]To remove specific statements, prefix the command line with a - (minus). This will remove the entire statement, therefore removing all qualifiers and references.
-Q5682 | P18 | "Cervantes Jáuregui.jpg"
Meaning: from Miguel de Cervantes (Q5682), remove the statement for the property image (P18) with value "Cervantes Jáuregui.jpg".
Note about removing statements with time values:
Dates with precision ≤ 9, which don't have a date (only year, decade, and so forth) may use either 00-00 (month and day 0) or 01-01 (January 1st) as their month-date value, so it may be necessary to attempt to remove both:
-Qid | Pid | +1990-01-01T00:00:00Z/9
-Qid | Pid | +1990-00-00T00:00:00Z/9
By ID
[edit]You may remove statements with a specific statement ID by putting it after a -STATEMENT syntax, like the following:
-STATEMENT | Q1$00000000-0000-0000-0000-000000000000
The statement ID can be received by:
- The source code of any entity page, where the ID may be found in the
<div>elements with "wikibase-statementview" class - Wikibase REST API
- name of statement node in RDF which may be queried by query service (you need to replace the - after entity ID with $)
Remove label, description, alias and sitelink
[edit]To remove a label, description, or sitelink, set the value to an empty string while keeping the rest of the command unchanged. Alias are removed by prefixing the commands with a "-" and their value should be specified.
Q1001 | Len | ""
Q1001 | Dfr | ""
Q1001 | Sptwiki | ""
-Q1001 | Aeo | "Mahatmo Gandho"
-Q1001 | Aen | "Gandhi" | "Mohandas K Gandhi" | "M. K. Gandhi"
Meaning: from Mahatma Gandhi (Q1001), remove the English label, the French description, the Portuguese Wikipedia article link, the Esperanto alias "Mahatmo Gandho" and multiple English aliases.
Remove qualifier and reference (new)
[edit]To remove a specific qualifier or reference part from a statement use the REMOVE_QUAL or the REMOVE_REF syntax. This is illustrated below.
The first three elements after the command specify from which statements the qualifiers or reference parts should be removed. The command will remove the first qualifier or reference part from statements that match the specification.
REMOVE_QUAL | Q14560 | P225 | "Cactaceae" | P405 | Q223963
Meaning: in Cactaceae (Q14560), in the statement for the property taxon name (P225) and value "Cactaceae", remove the qualifier of property taxon author (P405) and value Antoine Laurent de Jussieu (Q223963).
The REMOVE_REF command only removes 1 reference part, and not the whole block. To remove the whole block matching that part, use REMOVE_REF_BLOCK.
REMOVE_REF | Q5598 | P27 | Q170072 | S143 | Q328
Meaning: in Rembrandt (Q5598), in the statement for the property country of citizenship (P27) and value Dutch Republic (Q170072), remove the reference part with property imported from Wikimedia project (P143) and value English Wikipedia (Q328).
Switch statement (new)
[edit]Value
[edit]To switch a value in a statement for another while keeping qualifiers and references, use the SWITCH_VALUE syntax.
The first three elements after the command specify the statement's property and the current value. The next element specifies the new value for the statement.
SWITCH_VALUE | Q1774 | P2046 | 2461U712226 | 950.2U232291Meaning: in Zanzibar Islands (Q1774), in the statement for the property area (P2046) and value 2461 with unit square kilometre (Q712226), keep qualifiers and references and switch the value to 950.2 with unit square mile (Q232291).
Property
[edit]To switch a property id in a statement for another while keeping value, qualifiers and references, use the SWITCH_PROPERTY syntax.
The first three elements after the command specify the statement's current property and value. The next element specifies the new property id for the statement. Note that both properties should have the same data type.
SWITCH_PROPERTY | Q40269 | P18 | "Aerial view of the point of Porto Alegre extending into Guaíba Lake.jpg" | P8592Meaning: in Porto Alegre (Q40269), in the statement for the property image (P18) and value "Aerial view of the point of Porto Alegre extending into Guaíba Lake.jpg", keep value, qualifiers and references and switch the property of this statement to aerial view (P8592).
Both
[edit]It is also possible to perform both switches in the same command, with the SWITCH_PROPERTY_AND_VALUE syntax.
The first three elements after the command specify the statement's property and the current value. The next element specifies the new property id for the statement and the last element specifies the new value for the statement.
SWITCH_PROPERTY_AND_VALUE | Qid | Pid | value | new Pid | new valueCSV syntax
[edit]The CSV syntax can be prepared using a spreadsheet.
Each row represents an entity and possibly multiple commands to be created.
This file will outline the commands to be executed as columns and their rows will contain the values. The first line serves as a header row, explaining how to interpret the data in each column.
For instance, a column labeled P31 might have the value Q5, which would create a statement with property P31 and value Q5 for the entity of that row.
Format
[edit]- qid: always the first column of commands. The values in the column should contain the id of the item or entity to edit. If the cell is left empty, a new item will be created. It represents the entity of the row.
The other columns may specify the following commands:
- Len: an uppercase "L" followed by a language code sets the label in that language.
- Dfr: an uppercase "D" followed by a language code sets the description in that language.
- Ade: an uppercase "A" followed by a language code adds an alias in that language.
- Senwiki: an uppercase "S" followed by a site ID adds a sitelink to that site.
- P1234: a property ID (uppercase) begins a new statement. The value in the column specifies the main value of the statement.
- qal1234: this is used to add a qualifier to the current statement. It starts with a lowercase "qal" followed by a property number (excluding "P"). The value in the column specifies the qualifier's value. Ensure there is a "P" column before a "qal" column to specify which statement the qualifier is added to.
- S1234: this indicates the beginning of a new source for the current statement. It starts with an uppercase "S" followed by a property number (excluding "P"). The column value specifies the source's value. Make sure there is a "P" column before an "S" column to show which statement the source is linked to.
- s1234: this is used to add an additional property-value pair to the current reference block. It starts with a lowercase "s" followed by a property number (excluding "P"). The column value specifies the source's value. There must be an "S" column before an "s" column to indicate which reference block the property-value pair is added to.
- #: the number sign "#" is used to set the edit summary (comment) for the preceding command.
Statements
[edit]Each statement is defined by a property column. The cell's value for that property indicates the statement's value.
If the statement does not exist, it will create it. If it exists already, it will not create a duplicate.
The values in the statement cell follow the same rules as the v1 syntax, with the exception of strings. Check its documentation in the next section.
Example:
qid,P19,P31
Q42,Q350,Q5
Q8023,Q1020378,Q5
Meaning: add two statements to Douglas Adams (Q42): one for the property place of birth (P19) with value Cambridge (Q350), and one for the property instance of (P31) with value human (Q5); add two statements to Nelson Mandela (Q8023): onw for the property place of birth (P19) with value Mvezo (Q1020378) and one for the property instance of (P31) with value human (Q5).
String
[edit]String values need to be put in double quotates, e.g. "London". For historical reasons, triple double quotes are also allowed, e.g. """London""".
However if the string value contains double quotes ("), replace all double quotes with two double quotes (""), then as with any string value, wrap it in double quotes. So, if you want to input String "with" quotes, you should enter "String ""with"" quotes" in the csv.
Strings are also used for Wikimedia Commons media and URLs.
qid,P348
Q14579,"6.13.7"
Q83,"1.43.0"
Meaning: add to Linux kernel (Q14579) a statement for the property software version identifier (P348) with value "6.13.7" and to MediaWiki (Q83) with value "1.43.0".
Other types
[edit]The values in the statement cell follow the same rules as the v1 syntax, so check the v1 documentation to understand how other types of values are formatted, or check the csv examples in a following section.
Create items
[edit]To create a new item, the first element of the row needs to be empty. Therefore, the line starts with a comma.
qid,Len,Den,P18
,New item label,A new Wikidata item,"MyNewItem.jpg"
Meaning: create an item, label the item as "New item label", add an English description and add a statement for the property image (P18) with value "MyNewItem.jpg".
Edit summaries
[edit]The summary for the preceding command is defined by the # (hashtag) column.
qid,P18,#
Q5682,"Cervantes Jáuregui.jpg",Add image to Miguel de Cervantes
Q8023,"Nelson Mandela 1994.jpg",Add image to Nelson Mandela
Meaning: add to Miguel de Cervantes (Q5682) a statement for the property image (P18) with value "Cervantes Jáuregui.jpg", and to to Nelson Mandela (Q8023) with value "Nelson Mandela 1994.jpg". Both have custom edit summaries.
Label, description, alias and sitelink
[edit]Labels, descriptions, aliases, and sitelinks do not need to be in double quotes unless they themselves contain commas (,) or double quotes ("). If they do, replace each double quote with two double quotes and then enclose the entire string in double quotes. So, if you want to input String "with" quotes, you should enter "String ""with"" quotes" in the csv. If you want to input String, with comma, you should enter "String, with comma".
qid,Len,Dfr,Aeo,Sptwiki
Q1001,Mahatma Gandhi,leader politique et religieux indien (1869–1948),Mahatmo Gandho,Mahatma Gandhi
Meaning: add to Mahatma Gandhi (Q1001) an English label with value "Mahatma Gandhi", a French description, an Esperanto alias, and a sitelink to the Portuguese Wikipedia.
Qualifiers
[edit]The qualifier column is formatted as qalXX with XX as the property ID.
qid,P1082,qal585,qal459
Q40269,1360590,+2000-08-01T00:00:00Z/11,Q39825
Meaning: add to Porto Alegre (Q40269) a statement for the property population (P1082) with value 1360590. For this statement, add a qualifier with property point in time (P585) with value August 1st of 2000 (date precision) and another qualifier with property determination method or standard (P459) with value census (Q39825).
References
[edit]The reference column is formatted as SXX with XX as the property ID. To add a reference part to the same reference block, use a lowercase s. To create a new block, add a capital S again.
qid,P276,S854,s813
Q12418,Q10292830,"http://cartelfr.louvre.fr/cartelfr/visite?srv=car_not_frame&idNotice=14153",+2017-09-23T00:00:00Z/11
Meaning: add to Mona Lisa (Q12418) a statement for the property location (P276) with value Salle des États, Louvre (Q10292830). For this statement, add just one reference block, consisting of two reference parts: property reference URL (P854) with value "http://cartelfr.louvre.fr/cartelfr/visite?srv=car_not_frame&idNotice=14153" and property retrieved (P813) with value September 23rd of 2017.
Remove
[edit]To remove statements, prefix the property column with a - (minus). To remove labels, descriptions, aliases or sitelinks, do the same thing: prefix the column with a -.
qid,-Len,-Dfr,-P18
Q1001,"","","Mahatma-Gandhi, studio, 1931.jpg"
Meaning: from Mahatma Gandhi (Q1001), remove the English label, the French description, and the statement for the property image (P18) with value "Mahatma-Gandhi, studio, 1931.jpg".
Examples
[edit]In the following gallery, there are multiple CSV syntax examples in video, running on test.wikidata.org.
- Example videos in test.wikidata.org.[a]
-
Time values
-
Monolingual text values
-
Multimedia files
-
URL values
-
Coordinate values
-
Quantity values
-
Labels
-
Descriptions
-
Aliases
-
Sitelinks
-
Complete example
Limitations
[edit]REST API dependant
[edit]QuickStatements 3.0 uses the Wikibase REST API to perform the edits. The REST API is in active development and does not, currently, allow us to:
- Edit lexemes
- Edit Structured Data on Commons
- Merge entities
Therefore, those functionalities are not available in QuickStatements 3.0. When the REST API implements those functionalities, QuickStatements 3.0 will be updated to allow them too.
New features
[edit]Compared to the QuickStatements 2.0, the 3.0 version presents new features and improvements. The most notable ones are:
- Users can now force the creation of statements, using the + syntax.
- Users can set and edit Preferential rank of statements, using the R syntax.
- Removal of Sources and Qualifiers from statements, using the REMOVE_QUAL and REMOVE_REF syntax.
- Users can generate a report of batches that are executed successfully. The report is downloaded in a csv file format.
- Multiple command statements targeting the same entity are combined and executed with one API call. This improves the speed of command execution and reduces the number of edits in the targeted Wikibase.
FAQ
[edit]- How do I experiment with QuickStatements?
- Use the Wikidata Sandbox.
- How do I report issues with the tool?
- Check with other users in the talk page Talk:QuickStatements 3.0. Confirmed bugs should be reported on the issues tab of the [>https://github.com/wikimediabrasil/quickstatements3/issues tool's GitHub page]
- Where do I suggest new features?
- Leave a message in the talk page or create an issue in the tool's GitHub page.
- What is the maximum number of commands I can enter at once?
- Not documented. It was already tested with over 140 thousand commands. But note that such large batch runs will take a long time to complete.
Best practices
[edit]- Avoid creating duplicate items.
Wikidata-specific
[edit]- Very large runs or potentially-controversial runs should go through the approval process described in Wikidata Bots page.
- All statements in Wikidata should have references as per the Help:Sources Wikidata page. That might be less important for identifiers.
- Users doing the edits are responsible for fixing or undoing their changes if issues are found. Each batch can be discussed or reverted with the Edit groups tool.
Send commands by URL
[edit]https://qs-dev.toolforge.org/batch/new?v1=your_commands_here
Notes
[edit]- ↑ a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac The videos perform operations on the test.wikidata.org wikibase instance. Therefore, the entity ids (QIDs and PIDs) are not the same as in Wikidata. They serve as demonstration video only and the displayed commands should not be copied into Wikidata.