wikibase-cli
wikibase-cli copied to clipboard
Avoid creation of duplicates
When creating entities it is easy to accidentally create duplicates. Given the use case that:
- you want to create a set of new entities
- each entity can be identified by a unique value (aka "external identifier")
The creation of duplicates can be avoided by addition of an option --unique <property>
(the letter i
is already taken, so no --identifier
). If this option is used, the creation of an entity will be rejected if
- the entity to be created does not use the property
- no entity with this property and its given value exist (requires to call MediaWiki API with
haswbstatement
)
the uniqueness requirements of a property could actually be pulled from the properties constraints (ex: P268 constraints); we could default to applying the property constraints and having a flag to disable those checks(?) That would have a complexity and performance cost, but that could very much be worth it
Support of constraints seems more complex, might require SPARQL (which sometimes lags a few minutes), not all Wikibase instances use constraints, and Wikidata constraints are sometimes too strict but you don't want to turn of all of them . For my use case I'd prefer to check uniqueness but general support of constraints could be more useful in the end.