Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to write from [R] to wikidata via API #15

Open
TS404 opened this issue Mar 18, 2020 · 7 comments
Open

Need to write from [R] to wikidata via API #15

TS404 opened this issue Mar 18, 2020 · 7 comments

Comments

@TS404
Copy link
Collaborator

TS404 commented Mar 18, 2020

There s a current capability gap in the WikidataR package in that it can only read from, not write to wikidata. This will be a key and valuable feature. I've also added a note at that repo.

@serenasignorelli
Copy link

I'm checking how this can be done. The COVID-19 Wikidata item already exists (https://www.wikidata.org/wiki/Q84263196) and inside it you have different things.

First, you have a series of 'statements' identified by a specific property numner (i.e. 'instance of' P31) and each of them lists a serires of other Wikidata items (i.e. 'disease' Q12136).

Then we have 'identifiers', where we have again properties but that only list one ID (not a Wikidata item).

And at the end we have all the pages on that item in all Wikimedia foundation projects.

My question is: what do you want to be able to edit? Everything? Or just statements and identifiers? This is crucial as we need to think about a way to possibly structure the queries.

@TS404
Copy link
Collaborator Author

TS404 commented Mar 19, 2020

Hmm, ideally everything, since being able to edit aliases and descriptions would be useful.
However the two highest priority capabilities would be:

  • being able to add specific statements to existing item
  • being able to create a new item that is missing (may require descriptions and aliases anyway)

Backup option: outputting Quickstatments tables. Relevant issue link.

@magnusmanske
Copy link

The QS API and its token system are detailed here (if you are logged into QS)

@TS404
Copy link
Collaborator Author

TS404 commented Mar 25, 2020

&data=COMMANDS [commands in the above format]

@magnusmanske, could you confirm what the relevant quickstatements API format is?

@TS404
Copy link
Collaborator Author

TS404 commented Apr 3, 2020

@TS404
Copy link
Collaborator Author

TS404 commented Apr 3, 2020

Successful first test (using token code as per my QS userpage)!

https://tools.wmflabs.org/quickstatements/api.php
	?action=import
	&submit=1
	&username=Evolution_and_evolvability
	&token=[the token code as per my QS userpage]
	&format=v1
	&data=Q89093122%09P7347%09%22https:%2F%2Fen.wikiversity.org%2Fwiki%2FTalk:WikiJournal_of_Medicine%2FEpidemiology_of_the_Hepatitis_D_virus%22
	&batchname=ts_API_test1

Resulting in this batch being correctly implemented.

@TS404
Copy link
Collaborator Author

TS404 commented Apr 4, 2020

The new API almost works (now committed to wikiPackageTesting.R).
There seem to currently be some problems with qualifiers submitted via the API. When the exact same submission is made via the API it returns errors, whereas submitted as a table via the website it runs fine:

I've also added a query about this at Wikidata Help_talk:QuickStatements.
Next requirement will be proper handling of CREATE and LAST capabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants