Last modified: 2014-11-09 21:06:41 UTC
At the moment when you try to add a sitelink to an item at Wikidata that's already used, you'll get a pywikibot.data.api.APIError. Sitelink to Commons Category:Mormonism based on P373 failed-save Site link [//commons.wikimedia.org/wiki/Category:Mormonism Category:Mormonism] is already used by item [[Q8808767]]. Perhaps the items should be [[Help:Merge|merged]] and one of them [[Wikidata:Deletion policy|deleted]]? Request deletion of one of the items at [[Wikidata:Requests for deletion]], or ask at [[Wikidata:Interwiki conflicts]] if you believe that they should not be merged. {u'messages': {u'0': {u'type': u'error', u'name': u'wikibase-error-sitelink-already-used', u'parameters': [u'//commons.wikimedia.org/wiki/Category:Mormonism', u'Category:Mormonism', u'Q8808767', u'commonswiki']}, u'html': {u'*': u'<p>Site link <a class="external text" href="//commons.wikimedia.org/wiki/Category:Mormonism">Category:Mormonism</a> is already used by item <a href="/wiki/Q8808767" title="Q8808767">Q8808767</a>. Perhaps the items should be <a href="/wiki/Help:Merge" title="Help:Merge">merged</a> and one of them <a href="/wiki/Wikidata:Deletion_policy" title="Wikidata:Deletion policy">deleted</a>? Request deletion of one of the items at <a href="/wiki/Wikidata:Requests_for_deletion" title="Wikidata:Requests for deletion" class="mw-redirect">Wikidata:Requests for deletion</a>, or ask at <a href="/wiki/Wikidata:Interwiki_conflicts" title="Wikidata:Interwiki conflicts">Wikidata:Interwiki conflicts</a> if you believe that they should not be merged.\n</p>'}}} This is a bit too low level for me. This should be caught by either site or page and a WikiBase exception should be thrown. The behavior should probably be modeled after the IsRedirectPage exception. We might want to create some more Wikibase exceptions while we're at it, but I haven't looked into that. PageRelatedError