Closed simon04 closed 4 years ago
Agreed. This seems harder than it ought to be. For example, the following doesn't work:
claim_guid=$(wd claims Q4115189 P709 LB3085)
wb remove-claim $claim_guid
doesn't work (even for one claim), because the $ sign gets in the guid gets double-escaped; nor is it straightforward to see how to proceed if the wd claims
returns multiple claims.
Showing how to do this in the how-to pages would be helpful.
I removed the escaping (00b6ccc) so that should work in v8.2.0
Hi Max, this has been very helpful. Thank you !!
Follow-up question: is there an easy way to extract the GUID for a claim with a particular qualifier and qualifier-value (item-values, say, for simplicity), if there is more than one claim on an item with the same value for the same property, that are distinguished by qualifiers?
@Jheald I'm not fully sure to get the use case, but that looks like quite a specific use-case already. It could be that the simplest solution would be to have a SPARQL query find the GUIDs matching those conditions, that could then be removed:
wd remove-claim $(wd sparql ./find_guid.rq)
if you're SPARQL query can be generalized, you could make a JS template of it:
wd remove-claim $(wd sparql ./find_guid.js Q4115189 P31)
Thanks. I suppose I was wondering if there was some way to pipe the output of wd claims
to a script that could then effectively grep out the guid for the particular claim that had the qualifier.
But yes, I realised that WDQS would give me the guids, so I just wrote a sparql query to find all the statements I wanted, with the qualifier values to be added to them, and then a script to write of file of corresponding wd
commands. Wikibase-cli is a powerful tool -- thank you very much for all your work on it!
@Jheald thanks :D
I would like to
wd claims Q123 P456 | wd remove-claim
. Maybe add a--guid
flag to claims? Maybe add a--regex=<filter>
?