maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
223 stars 24 forks source link

problems with update-claim in batch mode #129

Closed rwst closed 3 years ago

rwst commented 3 years ago

With {"guid":"Q417654$8a1313ea-74ee-4ed5-a7ed-90c8aae09762","newValue":"InChi=1S/C19H22N2/c1-16-7-9-17(10-8-16)18(19-6-2-3-12-20-19)11-15-21-13-4-5-14-21/h2-3,6-12H,4-5,13-15H2,1H3/b18-11+"} in tmp and wd uc -b <tmp I get:

edit group: https://tools.wmflabs.org/editgroups/b/wikibase-cli/4ba4bc7ea38ad/
processing line 1: { "guid": "Q417654$8a1313ea-74ee-4ed5-a7ed-90c8aae09762", "newValue": "InChi=1S/C19H22N2/c1-16-7-9-17(10-8-16)18(19-6-2-3-12-20-19)11-15-21-13-4-5-14-21/h2-3,6-12H,4-5,13-15H2,1H3/b18-11+" }
old and new claim values can't be the same { oldValue: undefined, newValue: undefined }

A similar attempt with the line Q417654$8A1313EA-74EE-4ED5-A7ED-90C8AAE09762 InChi=1S/C19H22N2/c1-16-7-9-17(10-8-16)18(19-6-2-3-12-20-19)11-15-21-13-4-5-14-21/h2-3,6-12H,4-5,13-15H2,1H3/b18-11+ gives

edit group: https://tools.wmflabs.org/editgroups/b/wikibase-cli/d2e5237510b47/
processing line 1: Q417654$8A1313EA-74EE-4ED5-A7ED-90C8AAE09762 InChi=1S/C19H22N2/c1-16-7-9-17(10-8-16)18(19-6-2-3-12-20-19)11-15-21-13-4-5-14-21/h2-3,6-12H,4-5,13-15H2,1H3/b18-11+
missing snak value { property: 'P234', value: undefined }

The format is the same as in the documentation so I'm quite surprised. Is batch uc possible at all?

rwst commented 3 years ago

Note the documentation says only the new value is needed. I tried with old and new value. First simple format:

ralf@ark:~/wikidata> wd uc -b -v <tt
edit group: https://tools.wmflabs.org/editgroups/b/wikibase-cli/a6a5371ff938a/
processing line 1: Q417654$8A1313EA-74EE-4ED5-A7ED-90C8AAE09762 1S/C19H22N2/c1-16-7-9-17(10-8-16)18(19-6-2-3-12-20-19)11-15-21-13-4-5-14-21/h2-3,6-12H,4-5,13-15H2,1H3/b18-11+ InChi=1S/C19H22N2/c1-16-7-9-17(10-8-16)18(19-6-2-3-12-20-19)11-15-21-13-4-5-14-21/h2-3,6-12H,4-5,13-15H2,1H3/b18-11+
invalid monolingualtext value { property: 'P1476', value: 'triprolidine' }

Note the statement is P234 not P1476. The other format:

ralf@ark:~/wikidata> wd uc -b -v <tt
edit group: https://tools.wmflabs.org/editgroups/b/wikibase-cli/d18a28a291187/
processing line 1: { "guid": "Q417654$8A1313EA-74EE-4ED5-A7ED-90C8AAE09762", "oldValue": "1S/C19H22N2/c1-16-7-9-17(10-8-16)18(19-6-2-3-12-20-19)11-15-21-13-4-5-14-21/h2-3,6-12H,4-5,13-15H2,1H3/b18-11+", "newValue": "InChi=1S/C19H22N2/c1-16-7-9-17(10-8-16)18(19-6-2-3-12-20-19)11-15-21-13-4-5-14-21/h2-3,6-12H,4-5,13-15H2,1H3/b18-11+" }
old and new claim values can't be the same { oldValue: undefined, newValue: undefined }
rwst commented 3 years ago

Actually, because of P1476 seems related to #128 . But note P1476 is not used by these items, at all.

maxlath commented 3 years ago

which version of wikibase-cli are you using?

rwst commented 3 years ago

The P1476 comes from the reference (which apparently gets rewritten)!

ralf@ark:~/wikidata> wd --version
12.0.3
rwst commented 3 years ago

Confirmed this happens with 15.2.1 too.

ralf@ark:~/wikidata> wd uc -b -v <tt
edit group: https://tools.wmflabs.org/editgroups/b/wikibase-cli/5faa7b628caa6/
processing line 1: Q202998$2723F6CE-99EF-4673-A132-3418B04BA799 1S/C11H12N2O2S/c1-7(13(15)11(12)14)10-6-8-4-2-3-5-9(8)16-10/h2-7,15H,1H3,(H2,12,14) InChi=1S/C11H12N2O2S/c1-7(13(15)11(12)14)10-6-8-4-2-3-5-9(8)16-10/h2-7,15H,1H3,(H2,12,14)
invalid monolingualtext value { property: 'P1476', value: 'ZILEUTON' }
rwst commented 3 years ago

I confirm uc batch works on items that don't have P1476 but only when I give four arguments: guid property oldValue newValue which needs to be changed in the documentation.

rwst commented 3 years ago

No sorry that's wrong. The two arguments work fine, as in docs. All the problems come from P1476.

maxlath commented 3 years ago

There were 2 problems here:

Both problems have now been patched and published in v15.2.2, and I was able to do the edit you provided

rwst commented 3 years ago

It works. Many thanks!