GithubHelp home page GithubHelp logo

magnusmanske / quickstatements Goto Github PK

View Code? Open in Web Editor NEW
39.0 8.0 15.0 226 KB

The official repo for the QuickStatements PHP/HTML/JS interface

Home Page: https://quickstatements.toolforge.org/

License: GNU General Public License v3.0

PHP 44.25% Shell 0.12% HTML 37.09% JavaScript 18.54%
wikidata wikibase

quickstatements's Introduction

quickstatements's People

Contributors

addshore avatar daniel-mietchen avatar danmichaelo avatar davidfichtmueller avatar frog23 avatar harej avatar jmformenti avatar lucaswerkmeister avatar magnusmanske avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quickstatements's Issues

QuickStatememt fails to handle P6375 (street address)

It is not possible to add/change P6375 through quickstatement because it goes to error even with correct input statement.

Sample to test:
Q4115189|P6375|"Sunset Road"

My best guessing is that QS fails because Wikidata has a constrain to specificy the language code of the address for property P6375. To the best of my knowledge QS does not yet have a sintax to specifiy the language of a property value. Can someone implement it? A possible approach would be to specify the language code as a tail of the property code (e.g. P6375de for german)

possibly bug with `somevalue` when creating new items

Hi Magnus, in a custom Wikibase I was trying to create new items with a property value somevalue. It works when I do this in two separate steps like

qid,P1,Len
,Q1,"some label"

followed by

qid,P8
Qxxx,somevalue

But when I do:

qid,Len,P8
,"some label",somevalue

the statements error out with a message that somevalue is not known.

Does not work in Pale Moon

Hi I tried QS in palemoon on parabola linux and it did not work. On the same machine in Google Chrome it worked fine. Can anyone reproduce this?

QS issue with changed username

Hello,

I have QS activities that I would like to stop, but I'm having trouble with how QuickStatements recognizes my recently changed username. Because it's different from the username QS has for me, it's not letting me stop the runs.

Is it possible to stop all the runs for this account? https://quickstatements.toolforge.org/#/batches/Jacobmgreer

If I unauthorize QS and then log back in, will that recognize the new handle? (old handle: Jacobmgreer, new handle: Jakeob9000)

Thanks,
Jacob

Code vulnerable for SQL injections

Hi,

I see a lot of lines like this function:

	public function getBatch ( $id ) {
		$id *= 1 ;
		$ret = array('commands'=>array()) ;
		$db = $this->getDB() ;
		$sql = "SELECT * FROM command WHERE batch_id=$id" ;
		if(!$result = $db->query($sql)) return $this->setErrorMessage ( 'There was an error running the query [' . $db->error . ']'."\n$sql" ) ;
		while ( $o = $result->fetch_object() ) {
			$j = json_decode ( $o->json ) ;
			$j->_meta = $o ;
			unset ( $j->_meta->json ) ;
			$ret['commands'][$o->num] = $j ;
		}
		return $ret ;
	}

If one would simply set $id to 0;DROP TABLE COMMAND;, the command table will be gone. Easy as that.. Please, for the love of god; use SQL prepared statements. See: https://www.w3schools.com/php/php_mysql_prepared_statements.asp

Autoconfirm message is missing when creating batch by URL

Observed result:

When creating a batch by visiting a URL, autoconfirmed message isn't shown, but the query can't be run, the Run button is missing

Expected result:

The message

You can't create a new batch, because you are not autoconfirmed

is shown always when relevant

Reproduction steps:

  1. Log into quickstatements with a wikidata account that's missing autoconfirm, for example a fresh account with few edits
  2. Create a batch using external tool, e.g. Source MetaData
  3. Click on Open in QuickStatements button

Communication issues

Hi.
I wrote this today in the wikidata telegram channel at https://t.me/c/1224298920/45236 and as I don't like people talking behind my back, I post it here. (this was a reaction to another post)

`😅 ok, interesting.
I guess I will have to live with that as I have no way to change others thoughts. 😜
I have seen no one joining me until now that I know of so you might be right that I am wasting my time here.

People have al kinds of thoughts about each other, it's none of my business. What I do care about is my thoughts and finding a way forward in harmony with my needs.

Using Magnus Manskes tools is not in harmony with my needs (for connection, for feeling sure that he values feedback from me and others), so I avoid them (I could also fork the ones I would like to maintain but I found no candidates yet) and encourage others to do the same. Together we can build good tools in good connection with each other for the best of everyone and Wikidata.

Relying on tools from a person who does not seem to want to communicate with the community at all is a really bad idea IMO no matter the quality/niceness of the tool itself. When/If Magnus decides to clean up his mess of unanswered interactions (see #10 where he actually reacted 26 days ago, but generally he does not seem to be active in the issues section of his repos, on-wiki, or here which is a big problem if you are maintainer of something) in the repos of his tools I have no problem with starting to use his tools again.

If he askes someone for help taking over maintaining or communicating with the community that would probably work fine, but I would prefer a responsive maintainer like @smyst (wikibaseintegrator) or @Dvorak (daty).`

I encourage you to start engaging when people open issues or to delegate to someone else who can have your ear so we can avoid a situation where no one knows how to contact you, you don't answer on Twitter, nor on Wikidata nor anywhere else that I'm aware of. I personally opened an issue in the end of november that I have not got a single response to, see #9

Thanks in advance.

api.php doesn't work.

Hi:

I have a big (>300k) batch for SDC. I want to use QS api.php but it doesn't work to me. Not only for SDC but Wikidata too. Always get the same message:

{"status":"Problem generating OAuth signature; user '{}' needs to have submitted a batch namually at least once before","debug":{"format":"v1","temporary":false,"openpage":0},"site":"wikidata"}

I have lot of Wikidata editions (see my batches) and I my token configured.

I'm invoking the api as this:

curl https://quickstatements.toolforge.org/api.php \
	-d action=import \
	-d submit=1 \
	-d username=Olea \
	-d format=v1 \
	-d "batchname=test" \
	-d site=wikidata \
	--data-raw 'token=TOKENTOKENTOKEN.' \
	--data-urlencode [email protected]

I don't know if I'm missing something or there is a bug. I've been asking for other people using the api and got no answer. Is it deprecated maybe?

Thx.

CSV item creation is broken if statements are being added

When I try to import commands to create new items with the CSV syntax, and those items have a statement, such as
qid,Lko,Len,P1343
,"해요체","polite style",Q115683766
the following HTML appears in the API response immediately prior to the JSON output:
<br />
<b>Notice</b>: Undefined index: new_statement in <b>/data/project/quickstatements/public_html/quickstatements.php</b> on line <b>640</b><br />
Because of this extra output, the screen does not proceed to where I can start the resultant batch.
This error does not appear when trying to add statements in CSV syntax to existing items, and this error HTML appears in the API response each time a new statement is detected to be added--if there were two statement columns and two items being created in the above command sample, then the 'undefined index' error would appear four times.
My initial thought is that this has been broken since 8d516de but I am not entirely certain.

Website is down when attempting from 1 of my laptops

Steps to reproduce:

Your connection is not private
Attackers might be trying to steal your information from iw.toolforge.org (for example, passwords, messages, or credit cards). Learn more
NET::ERR_CERT_DATE_INVALID

Incognito doesn't work. There's no option to bypass this error message. All other versions ("V2 original" and "V1") have the same issue. The page had worked for me about 3 weeks ago.

EDIT: So I'm on my Macbook Air 2015, Version 10.11.6, and your website is not working. But on my newer Chromebook, running Chrome Version 93.0.4577.85, your website works!

I'm not sure if this is related, but this issue may coincide with me getting permissions rights via https://www.wikidata.org/wiki/Wikidata:Requests_for_permissions/Other_rights#Confirmed .

Not reuse statements when adding

When I try to create a new item in a local wikibase with one statement and two equal values, for instance:

CREATE
LAST	P137	Q63	P49	+1176-01-00T00:00:00Z/10	P787	"ad quem"	P50	+1873-03-09T00:00:00Z/11	P721	"<i>DHEE</i>"
LAST	P137	Q63	P49	+1874-04-14T00:00:00Z/11	P50	+1931-04-29T00:00:00Z/11	P721	"<i>DHEE</i>"

I get:
Captura de pantalla de 2022-09-25 06-32-25

But when I try to update an item with the same case, for instance:

Q103	P137	Q63	P49	+1176-01-00T00:00:00Z/10	P787	"ad quem"	P50	+1873-03-09T00:00:00Z/11	P721	"<i>DHEE</i>"
Q103	P137	Q63	P49	+1874-04-14T00:00:00Z/11	P50	+1931-04-29T00:00:00Z/11	P721	"<i>DHEE</i>"

I get:
Captura de pantalla de 2022-09-25 06-33-12

The statement only has one value with merged qualifiers.

Is it possible to configure quickstatements somehow to not reuse statements when adding?

limit the frequency of API requests

It looks like when used by admins, QuickStatements can send API requests too rapidly.
(Reported at https://www.wikidata.org/wiki/Wikidata:Administrators%27_noticeboard#batch_49266_by_User:Bovlb_ignores_maxlag) (permalink)

The solution might be using maxlag and pausing and retrying upon a failure. The suggested value is 5 seconds.

QuickStatements anti-abuse measure (rate limit?) - Cannot automatically assign ID

Hello, I have a batch for QuickStatement to create 90 new items for cultural monuments:

https://quickstatements.toolforge.org/#/batch/215767

Since 31st of October 2023 I get the error message:

Cannot automatically assign ID: Im Rahmen einer Anti-Missbrauchs-Maßnahme kann diese Aktion in einem kurzen Zeitabstand nur begrenzt oft ausgeführt werden. Diese Grenze hast du überschritten. Bitte versuche es in ein paar Minuten erneut.

which translates to

Cannot automatically assign ID: As part of an anti-abuse measure, this action can only be carried out a limited number of times within a short period of time. You have exceeded this limit. Please try again in a few minutes.

Even if I try to execute the batch several hours later (instead of a few minutes), the error message persists.

The error persists, independent if the statements are executed in foreground or as a background batch.

Thanks a lot!

Also see:
https://www.wikidata.org/wiki/Wikidata:Project_chat#QuickStatement_anti-abuse_measure_(rate_limit?)
https://www.wikidata.org/wiki/Help_talk:QuickStatements#QuickStatement_anti-abuse_measure_(rate_limit?)
https://www.wikidata.org/wiki/Help_talk:QuickStatements#Quickstatements_CSV_import_shows_too_many_errors

https://www.wikidata.org/w/index.php?title=Help_talk%3AQuickStatements&diff=2002178245&oldid=1985112525
https://www.wikidata.org/w/index.php?title=Wikidata%3AProject_chat&diff=2002178436&oldid=2001903648

Problem with units when using QuickStatements on a Wikibase

@magnusmanske, I have a custom Wikibase and the following QuickStatement:

      CREATE
      
      LAST	P1	Q2
      LAST	Den	"chemical compound"
      LAST	P7	"CCCCCOC1=C2C3=C(C(=O)CC3)C(=O)OC2=C4[C@@H]5C=CO[C@@H]5OC4=C1"	S14	Q5
      LAST	P3	"C₂₁H₂₀O₆"	S14	Q5
      LAST	P2	368.3807U3	S14	Q5
      LAST	Len	"foo"
      LAST	P9	"InChI=1S/C21H20O6/c1-2-3-4-8-24-14-10-15-18(12-7-9-25-21(12)26-15)19-17(14)11-5-6-13(22)16(11)20(23)27-19/h7,9-10,12,21H,2-6,8H2,1H3/t12-,21+/m0/s1"	S14	Q5
      LAST	P10	"VQBNVFKQPPPAER-LAJNKCICSA-N"

It works well, except for the line with 368.3807U3. When I include that I get the error it does not know about http://compoundcloud.wikibase.cloud/entity/Q3 not existing. This makes sense, because it should be https://compoundcloud.wikibase.cloud/entity/Q3 instead. With the 's'.

I am guessing the problem is that wikidata.org actually uses http in the URLs. I cannot see where in the code the translation to U3 to http://compoundcloud.wikibase.cloud/entity/Q3.

But since it is working as expected for other part of the QS, I am hoping the fix should be simple.

Default to Julian calendar for dates before 5 October 1582

When the Gregorian calendar was first introduced to replace the Julian calendar, Thursday 4 October 1582 was followed by Friday 15 October 1582. Therefore, we can safely assume that any date in this format before 5 October 1582 is in the Julian calendar and not the Gregorian calendar.

(Note that the final country to transition from the Julian calendar to the Gregorian calendar was Greece, with 15 Feb 1923 followed by 1 Mar 1923. Thus we can safely assume that any date 16 February 1923 or later is a Gregorian date. Any date in between could potentially be either calendar, depending on the country).

I would like to see QuickStatements default to the Julian calendar for all dates before 5 October 1582. A configuration option to specify a calendar type would be even better, but is not strictly necessary for this issue.

Skip values in CSV syntax

When using csv syntax in Quickstatements, is would be nice to be able to skip a value for a certain property. I know you can enter "somevalue" or "novalue" but this means that the property will always be visible for this certain item. In my spreadsheet I sometimes have values for this property and sometimes I don't. The only workaround now is doing it in several batches but that's a timeconsuming workaround.

Installation Instructions

Can you add to the README how to install this a local installation of wikibase? I've gone so far as to clone, configure, replace "/data/tools/" with my own paths, and a few other things, but the page doesn't load. Vue.js just hangs with a "loading" message.

Also, I see references to .ini files that don't exist in the repo. Can you provide examples of those?

Unable to manage my batches after having my SUL renamed

After having my Wikimedia-SUL renamed I'm no longer able to properly manage my batches.

Steps to reproduce

  1. Have your Wikimedia-SUL renamed
  2. Create a batch in QuickStatements 2

Expected behaviour
I should be able to manage my batches as it was possible before having my Wikimedia-SUL renamed. This especially includes being able to view a list of my batches and being able to stop them.

Actual behaviour
Batches created by me are actually created under my old username which leads to me not being able to manage them and them being not properly associated with my identity in QuickStatements. Edits made in Wikidata are nevertheless properly associated with my identity (and new username).
Also, there are now some inconsistencies in the GUI which brings me to the assumption that for identification purposes QuickStatements uses my current username except when creating batches. I'm not familiar with the design of QuickStatements so I suppose QuickStatements keeps its own database on users and uses this one to associate batches to their creators.

  1. Inconsistency:

    • In the header the button bringing me to my QuickStatements-user page is labled with my new username. The button next to it (Your previous batches) links to https://quickstatements.toolforge.org/#/batches/$NEW_USERNAME.
    • In the batch page (https://quickstatements.toolforge.org/#/batch/$BATCH_ID) the meta data of the batch displays my old username, links to my old Wikidata-userpage and to a batch overview with my old username (https://quickstatements.toolforge.org/#/batches/$OLD_USERNAME). However, after the batch has finished I can still Reset errors
    • image
  2. Missing functionality:

    • In https://quickstatements.toolforge.org/#/batches/$NEW_USERNAME no batches are listed.
    • In https://quickstatements.toolforge.org/#/batches/$OLD_USERNAME batches created after having my SUL renamed are displayed.
    • image

Version
Version deployed to quickstatements.toolforge.org as of 2021-01-22

Note: I previously reported this issue somewhere on BitBucket (cannot find it anymore) but received no reaction whatsoever. There are still issues related to QuickStatements under magnusmanske/wikidata-todo which might be worth migrating if GitHub is the new home for issue reports.

Cancelled items stop batch

A batch involving a cancelled item remains stuck. To resume it, you have to stop and restart manually.
QS could skip a cancelled item.
Many times , this issue occurs in sync operations from Mix-n-match. Thx.

Always set bot flag on API edits

QuickStatements should always use the bot flag whenever possible. The MediaWiki API will only make the request a bot request if the account has a bot flag, so it can't be abused by normal users.

Check constraints on created or modified claims

When creating a new claim or modifying an existing one using QuickStatements add a way to check constraints in the modified claims and add an indicator (like the one for the status of the row) to indicate the ones that have constraint violations. That way it will be easier to fix errors added while using QuickStatements that could be detected with the existing constraints.

Connecting redirects to existing objects / Creating new objects for redirects using PetScan/QuickStatements

Redirects, which are not connected to an wikidata object

can also be found using PetScan with Page Properties -> (Soft) Redirects

Is there a way to connect resp. create objects for redirects with redirect-badge using QuickStatements/PetScan, for example like

Also see

No error information when batch fails to upload to wikidata-test

Content I've attempted:

qid,Len,Den,P31,P170,P1476,P571,P276
,Il Penseroso,Watercolour painting by Julian Rossi Ashton,Q18761202,Q6306955,"en:""Il Penseroso""",+1894-01-01T00:00:00Z/9,Q63468534

I tried uploading this content to "Wikidata-test" and it failed. There's no information as to why it failed, or how I could continue debugging my issue. Screenshot:

image

When I hover over the red "error" text, the tooltip only has empty curly braces "{}". (Note that this same content was successfully uploaded when I tried "Wikidata" instead.)

Hard-coded error_reporting breaks API on PHP 8.1

Wondering why error_reporting is hardcoded in api.php?

error_reporting(E_ERROR|E_CORE_ERROR|E_ALL|E_COMPILE_ERROR); // 
ini_set('display_errors', 'On');

I spent quite some time wondering why my settings in php.ini weren't working to finally figure out they were overwritten.

Trouble is, your composer.json does not fix a PHP version, e.g. 7.4 and so we end up with dependencies that require 8.1 in some situations (Think docker multi-stage builds…).

With 8.1 and the level of error_reporting hard-coded in api.php, the result on an API call is:

<br />
<b>Deprecated</b>:  Implicit conversion from float 0.1 to int loses precision in <b>/var/www/html/quickstatements/public_html/quickstatements.php</b> on line <b>1096</b><br />
{"status":"OK","command":{"action":"create","type":"item","data":{"claims":[{"mainsnak":{"snaktype":"value","property":"P1","datavalue":{"type":"wikibase-entityid","value":{"entity-type":"item","id":"Q17"}}},"type":"statement","rank":"normal"},{"mainsnak":{"snaktype":"value","property":"P18","datavalue":{"type":"string","value":"I made a second attempt of a QS"}},"type":"statement","rank":"normal"}]},"meta":{"message":"","status":"RUN","id":0},"summary":"#temporary_batch_1660059860160","status":"done","run":{"action":"wbeditentity","new":"item","data":"{\"claims\":[{\"mainsnak\":{\"snaktype\":\"value\",\"property\":\"P1\",\"datavalue\":{\"type\":\"wikibase-entityid\",\"value\":{\"entity-type\":\"item\",\"id\":\"Q17\"}}},\"type\":\"statement\",\"rank\":\"normal\"},{\"mainsnak\":{\"snaktype\":\"value\",\"property\":\"P18\",\"datavalue\":{\"type\":\"string\",\"value\":\"I made a second attempt of a QS\"}},\"type\":\"statement\",\"rank\":\"normal\"}]}","summary":"#quickstatements; #temporary_batch_1660059860160","bot":1,"token":"************************+\\","format":"json"},"item":"Q1162"},"last_item":"Q1162"}

Error when removing aliases with QuickStatements in background mode

Steps to replicate the issue:
I want to remove a set of aliases from different items in different languages using QuickStatements, so I:

  1. go to https://quickstatements.toolforge.org/#/batch
  2. insert the following commands:
-Q745	Ahy	"մորի"
-Q17592	Aast	"Avestruz"
-Q7045	Aast	"Samartín"
-Q11575	Azh	"玉米"
  1. add a summary
  2. click on "Import V1 commands"
  3. click on "Run in background"

What happens?:
An example batch is here.
As you can see, all the commands produce an error.

What should have happened instead?:
All the aliases should have been removed.

Other information
If I try to click on "Run" instead of ("Run in background"), then everything is fine.

Note that it is not a Unicode-related problem, since it occurs even when only the second row is specified (see e.g. this batch).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.