SuLab / WikidataIntegrator

A Wikidata Python module integrating the MediaWiki API and the Wikidata SPARQL endpoint
MIT License
244 stars 46 forks source link

item.get_or_create failing to add PMID to Wikidata #155

Closed lubianat closed 1 year ago

lubianat commented 4 years ago

Hello,

I have tried to use the publication module to update wikidata and got an error. This is the code I run:

import wikidataintegrator as wdi
from src.local import WDUSER, WDPASS

pubmed_id = 32731258
login_instance = wdi.wdi_login.WDLogin(WDUSER, WDPASS)

item = wdi.wdi_helpers.publication.europepmc_api_to_publication(pubmed_id, id_type="pmid")

item.get_or_create(login_instance) 

And that is the error I got:

Error while writing to Wikidata
    {'error': {'code': 'modification-failed', 'info': 'Must be at least one character long', 'messages': [{'name': 'wikibase-validator-too-short', 'parameters': ['1', ''], 'html': {'*': 'Must be at least one character long'}}], '*': 'See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.'}, 'servedby': 'mw1289'}

Does anyone know why that happens? I could not figure out if it is an actual bug or if it is something in my code.

The full analysis notebook is here.

Thanks!

andrawaag commented 1 year ago

PMID has been deprecated in favour of the DOI.