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

translation: QS ---> wikibase-edit JSON #64

Open
rwst opened this issue Mar 20, 2021 · 7 comments
Open

translation: QS ---> wikibase-edit JSON #64

rwst opened this issue Mar 20, 2021 · 7 comments

Comments

@rwst
Copy link

rwst commented Mar 20, 2021

QuickStatements commands can be translated to JSON that is fed to the wd ee --batch (or create-entity) commaand by the user. Some commands may need an automated SPARQL query before translation. Still, such a tool would be valuable, if not for the reason that QS needs to be fixed, and no one wants to fix PHP.

@maxlath
Copy link
Owner

maxlath commented Mar 20, 2021

could you provide a sample of the QS JSON, with annotation of how it should be interpreted if there is anything non-trivial? (I have not worked with QS much, so I do need some guidance)

@rwst
Copy link
Author

rwst commented Mar 20, 2021

It is not JSON but a simple command language made for the purpose, please see https://www.wikidata.org/wiki/Help:QuickStatements#Command_sequence_syntax

@rwst rwst changed the title translation: QS ---> wikibase-CLI JSON translation: QS ---> wikibase-edit JSON Mar 21, 2021
@diegodlh
Copy link
Contributor

This is exactly what I'm looking for! I'm developing a WikiCite (a Wikidata project) plugin for the reference management software Zotero, and I would like to provide a way of creating new Wikidata entities from Zotero items. Right now there is this QuickStatements translator that translates a Zotero item into QuickStatements commands. Having a way to translate these QS commands into wikibase-edit JSON, as suggested in this issue, would be ideal.

This PHP file, from QuickStatements source code, takes care of converting QS commands into MediaWiki API actions. I wonder if it may be useful to create the JS tool proposed.

@maxlath
Copy link
Owner

maxlath commented Apr 4, 2021

I started experimenting in a separate repo https:/maxlath/quickstatements-to-wikibase-edit :

  • how practical would this approach be for your respective use-cases?
  • note the missing features section: those are due to those features being currently missing in wikibase-edit

@diegodlh
Copy link
Contributor

diegodlh commented Apr 5, 2021

Amazing! This is exactly what I was looking for. I installed it through npm and tried it with a simple set of QS commands returned by Zotero's QuickStatements export translator:

CREATE
LAST	P31	Q13442814
LAST	Len	\"Test article\"
LAST	Den	\"journal article\"
LAST	P1476	en:\"Test article\"
LAST	P407	Q1860

However, convert.js is failing at line 34 with edit.claims is undefined. I guess this is because you are still experimenting with it.

I couldn't debug it because I may not have time to implement this new feature immediately, but I have already posted an issue in my plugin's repository to keep track of this and use it as soon as possible.

Thanks!!

@maxlath
Copy link
Owner

maxlath commented May 2, 2021

@diegodlh could you provide a sample of the input that fails to be converted?

@diegodlh
Copy link
Contributor

I finally found the time to look into this more closely today. I submitted a PR that seems to fix it.

With this fix, and other time-value-related fixes, I'm using this package in Cita and it seems to work like a charm to convert QuickStatements commands for basic publications (journal articles, etc) into a JSON that wikibase-edit can understand.

Thank you!!

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

No branches or pull requests

3 participants