QuickStatements is a tool, written by Magnus Manske, that can edit Wikidata items, based on a simple set of text commands. The tool can add and remove statements, labels, descriptions, and aliases; as well as, add statements with optional qualifiers and sources. The command sequence can be typed in the import window or created in a spreadsheet, text editor and pasted in. It can also be created by external code like Lua called from a template and passed as URL. Data edited in OpenRefine.org can also be exported to QuickStatements format.
- 1 Eszközök
- 2 Parancssorrend
- 3 A CSV-állományok felépítése
- 4 Running QuickStatements
- 5 Korlátozások
- 6 GYIK
- 7 Best practices
- 8 Lásd még
Egyszerű állítás hozzáadása
You can specify the statements to add by typing/pasting one row per statement into the tool's text area. Different parts of the statement are separated by a Excel or LibreOffice Calc; copying/pasting the cells should automatically insert s. Also text editors like Notepad++ allow replacement of any symbol by character.character, or in QuickStatements version 2 may also by "|". Each command is on a new line, or in QuickStatements version 2 may also be separated by "||". Hint: You can also use a spreadsheet software such as
Minden állításhoz kötelezően tartozik egy , egy és egy . Az a tulajdonságtól függően lehet egy másik , egy , , vagy .
Formatting of each part:
are always in the form Qxx. In Version 1 of the tool one could use an article name instead of the q-code, if one filled in a xxwiki value in the input box above the text area; the correct item number (if available) was retrieved automatically.
- Meaning: add to
- in the form Pxx.
- in the form Lxxx.
- in the form Lxxx-Fyy.
- in the form Lxxx-Syy.
- must be in "double quotes". Many statements take values in string format, including external identifiers (like VIAF ID (P214)), filenames (like image (P18)) or other page names (like Commons category (P373)).
(including URLs, and numerical values of text fields, for example external-ID property values)
- Meaning: add to
- Caution: Some characters in the string seem to confuse the tool. Those include: "_" (underscore), " (double quote), " " (spaces), "=", and possibly more. Adding URLs with those characters, like this one or this might fail. String and URLs with those characters might work when interacting with the tool through the interface but fail when interacting through URL.
prefix text in "double quotes" with the language and a colon, e.g. en:"Some text"
- Meaning: add to
- must be in format eg +1967-01-17T00:00:00Z/11, where /11 designates the precision. The precision is: 0 - billion years, 1 - hundred million years, ..., 6 - millennium, 7 - century, 8 - decade, 9 - year (default), 10 - month, 11 - day,
12 - hour, 13 - minute, 14 - second.
- Meaning: add to
- Use "-" for dates BC; and use at least 4 digits.
in the form of @LAT/LON, with LAT and LON as decimal numbers.
- Meaning: add location to San Dalmazio (Q3669835)
in the form of amount~toleranceUxx (amount[lower,upper]Uxx in Version 1), with amount, tolerance, lower and upper being a rational number and Uxx being the item number of a unit (Qxx).
- unit is optional.
- tolerance is optional.
- lower, upper are optional. lower and upper must be either both present or not present at all. When present, they should be enclosed in square brackets and separated by ,
- amount, lower and upper must use . as decimal separator, must not use any thousands separator and may be prefixed by + or -.
- Don't leave any space in the quantity.
- 10, 10U11573, -10[-12.5,-7.5], 0[-5,5]U11573 are all valid quantities (where U11573 indicates metre (Q11573))
- Quantities with tolerance may be entered as 1.2~0.3 (in Version 2 of the tool), which is the same as 1.2[0.9,1.5] (in Version 1) and means 1.2±0.3. Note that due to the way computers operate with floating-point numbers the input format of Version 2 may produce undesired results when working with decimal numbers.
- somevalue for unknown value Help
- novalue for no value Help
Állítások megadása minősítőkkel
Minden állítást korlátlan számú minősítő követhet ()
- Jelentése: az elem feltöltése a következő adatokkal:
Állítások megadása forrásokkal
Minden állítást korlátlan forrás követhet ().
- Jelentése: a következő forrásokkal:
- Már létező állítások nem adódnak hozzá még egyszer, azonban a forrásokra ez nem igaz
- Korábban minden forrástulajdonsághoz saját bejegyzés tartozott (nem rendeződtek csoportba), ezt a 2-es verzióban javították
Címkék, más nevek, leírások és interwikik hozzáadása
As with adding simple text statements, each command must consist of an, a , and a in double quotes.
- To add a label in a specific language to an item, use "Lxx" instead of the property, with "xx" as the language code.
- Meaning: add Polish label "Cyprian Kamil Norwid" to Cyprian Norwid (Q340122)
- To add an alias in a specific language to an item, use "Axx" instead of the property, with "xx" as the language code.
- Meaning: add English alias "Cyprjan Kamil Norwid" to Cyprian Norwid (Q340122)
- To add a description in a specific language to an item, use "Dxx" instead of the property, with "xx" as the language code.
- Meaning: add German description "polnischer Dichter" to Cyprian Norwid (Q340122)
- To add a sitelink to a specific page on a site to an item, use "Sxxx" instead of the property, with "xxx" as the site (e.g. enwiki, commonswiki).
|Kérjük, győződj meg róla, hogy nem hozol létre duplikált elemeket!|
You can create new items by inserting a line consisting only of the word "CREATE". To add statements to the newly created item, use the word "LAST" instead of the, and the statement will be added to the last created item.
An example for creating a new item, adding a sitelink, and setting a label:
- Meaning: create a new item with a link to French Wikipedia w:fr:Le croissant magnifique! and with French label "Le croissant magnifique!"
Elemek összevonásakor az első összevonódik (és átirányítódik) a másodikra.
|Csak a 2-es verzióban működik|
You can remove specific statements by prefixing a line with "-". (To remove labels or descriptions, set them to the empty string.)
- Example: -
- Meaning: remove from
|Only working in version 2|
Every command can have a comment at its end, which will be inserted into the edit summary for the command. Use the /* ... */ syntax. Before this a TAB may be inserted. Spaces around the comment will be removed from the command before processing. The tool splits adding of a claim and its reference in two edits. When using the "version 1 format" import it seems not to be possible to add a comment for the edit adding the reference. The comment is added to the edit adding the claim (if the claim does not exist yet and is added at all).
- Example: /* This is a comment. There are many others like it, but this one is mine. */
- Meaning: add to , with "This is a comment. There are many others like it, but this one is mine." in the edit summary.
A CSV-állományok felépítése
In version 2, one can also cut and paste a properly structured CSV file as an alternative to the syntax introduced in QuickStatements version 1. The CSV file will specify commands to execute. The first row is a header describing how the columns are interpreted.
The other columns may specify the following commands:
- A property ID (uppercase) begins a new statement. The column value specifies the main value of the statement, in QuickStatements version 1 syntax.
- A lowercase "qal" followed by a property number (without "P") adds a qualifier to the current statement. The column value specifies the value of the qualifier, in QuickStatements version 1 syntax. There must be some "P" column before a "qal" column to specify which statement the qualifier is added to.
- An uppercase "S" followed by a property number (without "P") begins a new source for the current statement. The column value specifies the value of the source, in QuickStatements version 1 syntax. There must be some "P" column before an "S" column to specify which statement the source is added to.
- A lowercase "s" followed by a property number (without "P") adds another property-value pair to the current source. The column value specifies the value of the source, in QuickStatements version 1 syntax. There must be some "S" column before an "s" column to specify which source the property-value pair is added to.
- An uppercase "L" followed by a language code sets the label in that language.
- An uppercase "D" followed by a language code sets the description in that language.
- An uppercase "A" followed by a language code adds an alias in that language.
- An uppercase "S" followed by a site ID adds a sitelink to that site.
- A number sign character sets the edit summary (comment) of the preceding command. The tool splits adding of a claim and its reference in two edits. A comment can be added to the edit summary of each of them. For the claim by putting a "#" column between the columns for the claim and its reference, for the reference by putting a "#" column behind its columns. For example:
qid,P21,#,S143,s813,# Q22124656,Q6581097,comment to claim adding edit,Q24731821,+2017-10-04T00:00:00Z/11,comment to reference adding edit
Statement column headers may also begin with - to remove the statement. (Note that this is only valid in the header for the whole column, not in individual values.) Removing other column types is not yet supported and will result in an error when the command is run; however, sitelinks and labels can be removed by setting them to the empty string (without - in the column header).
- For example
qid,Len,Den,Aen,P31,-P31,P21,P735,qal1545,S248,s214,S143,Senwiki Q42,Douglas Adams,author,Douglas Noël Adams,Q5,Q36180,Q6581097,Q463035,1,Q54919,113230702,Q328,Douglas Adams
To create a new item, the first element of the row needs to be empty, so the line starts with a
- For example
qid,Len,Den,P31 ,Regina Phalange,fictional character,Q5
The double quotes for string values seem to interfere with CSV syntax. Empirically four double quotes before and one after the string have been found to work.
- For example
qid,P473 Q304652,""""62" Q582223,""""34"
Using QuickStatements version 2
Here is how to use QuickStatements (version 2) in basic mode:
- Go to https://tools.wmflabs.org/quickstatements/
- Make sure you are logged in OAuth and your name is visible in the upper right corner. If not then log in.
- Click "New batch".
- Cut and paste your commands. See the syntax in the section above.
- When you are done, click "Import V1 commands" or "Import CSV commands".
- The tool will convert your commands into human-readable form. Inspect them and click "Run" to execute.
- As your statements are being processed, double-check the results, and press "Stop" if you detect a problem.
- The user interface will tell you when all statements have been processed.
Using QuickStatements version 1
- Go to https://tools.wmflabs.org/wikidata-todo/quick_statements.php
- Cut and paste your commands into the window
- Click "Do it!"
- The user interface will tell you when all statements have been processed.
Using QuickStatements version 2 in batch mode
When to use batch mode?
Batch mode (also known as running in the background) means your statements are executed from a Wikimedia server, rather than from your Web browser. This has several advantages:
- Even if you close your browser or if your computer crashes, the statements will be executed until the last one.
- You can launch several batches in parallel, without slowing down your computer.
- You get a unique URL for your batch, to which you can refer later. This page shows some statistics about your run.
- Anyone can stop your batch by going to this URL. For instance, if someone realizes that your batch is erroneous and you are sleeping, they can stop it immediately (by going to the individual batch page), rather than having to block you.
But there are also drawbacks:
- You can only see the total number of errors, not the statements that produced an error. Actually, you can not see any statement.
- It takes a few more clicks, so as a rule of thumb if you only have 10 or fewer statements, then better run them in normal mode.
- Checking the edits while waiting is not easy, as you don't get a list of the items that have been processed so far.
Prior to 18 október 2018, batch edits would also be made as User:QuickStatementsBot instead of as the user submitting the batch.
Before running a batch, it can be a good idea to run a few statements directly in non-batch mode to get a good view of what is being done.
Using batch mode
- Prepare your statement normally as described in Using QuickStatements version 2 section above
- Instead of pressing "Run", press "Run in background" button.
- "Your last batches" will show a list of the most recent batches run by you, with statistics.
The following statistics values are available:
- DONE: The number of statements that were successful run
- ERROR: The number of statements that failed
- INIT: The number of statements left to run?
- RUN: The number of statements being run right now?
Running QuickStatements through URL
An alternative way of communicating with QuickStatements is to use URL instead of cutting and pasting commands into import window. That approach worked for QuickStatements V1 and original V2, but no longer works in V2 rewrite. For example in original original V2, if we import https://tools.wmflabs.org/quickstatements/index_old.html/#v1=Q37887397%09P214%09%2296480189%22%09S143%09Q565 (image #2 below)(Statement is to add to with source ). Creating the URL through some other means can skip the initial step. Many templates on Commons, like c:template:Creator or c:template:Authority control use that technique to package information that can be imported to Wikidata into a clickable URL.statement using cut-and-past method (image #1 below), it will show the parsed statement and in URL field QS will show https: //tools.wmflabs.org/quickstatements/index_old.html/#v1= or
- URL cannot have any spaces. Replace TAB with "%09", double quote with "%22", space with "%20", and end-of-line with "%0A" and slash "/" with "%2F".
- Statements with URL inputs that have "_" or " " can be added through regular interface but not through URL. For example this URL was produced by the tool and it works; however if you click or cut-and-paste it you will end up on a page with slightly different URL, which does not work.
[[File:Commons to Wikidata QuickStatements.svg|20px|link=https://tools.wmflabs.org/quickstatements/index_old.html/#v1=Q37887397%09P214%09%2296480189%22%09S143%09Q565]]will encode the URL within a handy clickable icon: (click it but do not click "run"; pressing it will not work since that item already has that property).
- Pages with QuickStatements URLs may be located through Special:LinkSearch (see here) or through a database query calling externallinks table (see for example here).
A QuickStatements 2-es verziójával jelenleg nem lehet:
- elemeket összevonni (az 1-essel igen)
- rangsorokat hozzáadni
- naptártípust megadni
- földrajzi helyek pontosságát megadni
- Can QuickStatements add reference statements with more than one claim?
- Yes, current QuickStatements can add references that have for example both imported from Wikimedia project (P143) and retrieved (P813) (see here) or both stated in (P248) and page(s) (P304).
- How do I experiment with QuickStatements?
- Use Wikidata Sandbox (Q4115189).
- How do I report issues with the tool.
- Check with other users at the talk page or at Wikidata:Project chat. Confirmed bugs should be reported at tool's Bitbucket page.
- Where do I suggest new features?
- You can ask at tool's Bitbucket page or at User:Magnus Manske/quick statements2, but be aware that we keep Magnus busy!
- What is the maximum number of commands I can enter at once?
- Not documented. It was already tested with over 11,000 commands. But note that such large batch runs will take several hours to complete.
- QuickStatements allows edits ranging from single statement to multi-thousand-item batch runs. Very large runs or potentially-controversial runs should go through approval process described in Wikidata:Bots.
- Users should avoid creating duplicate items.
- All statements should have references as per Help:Sources. That might be less important for identifiers, like VIAF ID (P214) or RKDartists ID (P650), etc.
- Users doing the edits are responsible for fixing or undoing their changes if issues are found. See about statement removal.