wikibase-edit
wikibase-edit copied to clipboard
translation: QS ---> wikibase-edit JSON
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.
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)
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
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.
I started experimenting in a separate repo https://github.com/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
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!!
@diegodlh could you provide a sample of the input that fails to be converted?
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!!