Closed tmtmtmtm closed 4 years ago
the command wb move-qualifier
was added in v12.1.0
, can you try it and see if that works for your use-case?
@maxlath thanks for adding this so quickly, but I'm having some difficulty working out how to actually install that version. After a simple npm update
running wb -V
still shows only 12.0.3
I'm not really familiar enough with the npm ecosystem to know where to go from here
@tmtmtmtm npm update
runs update in the current directory (and following the version constraints of the the package.json
file in that directory if any), so that's not what you need to update a global package. Instead you could run:
npm install --global wikibase-cli@latest
or for short
npm i -g wikibase-cli@latest
@maxlath Yep that worked (might be worth adding something like that the documentation!), and with that in place the move-qualifier
command worked perfectly: https://www.wikidata.org/w/index.php?title=Q73924&type=revision&diff=1210122615&oldid=1207624760
Thanks for doing this so quickly: it'll be super-helpful!
documentation added in af3b394
I'm not totally sure if this is a feature request or a documentation request, but I can't figure out how to change the property of a qualifier, whilst keeping the value.
For example, lots of 'position held' statements have 'part of': 'some cabinet' (e.g. https://www.wikidata.org/wiki/Q95574#P39), but we now have a dedicated 'cabinet' property, so we want to replace all P39/P361 uses with P39/P5054 instead.
I think this could be done by adding a new qualifier with the same value and then removing the old one (though, again, I can't quite figure out how to do that from the documentation, as I can't see any explanation for what the 'qualifier hash' is for the removal, or how to get that[1]), but it would be much simpler if it could be done in one command, similar to 'move-claim'. It might be that existing commands do allow that, but I haven't been able to figure it out.
[1] I can see that it's provided in the return value from adding the new qualifier, and I could probably do something fancy with
jq
to extract that, and then feed it back into a follow-upadd qualifier
command, but that seems a little nasty. I suspect there must be a way to get it from the Query Service when getting all the statements that need changed, but I'm also drawing a blank on how to do that at the minute.