SuLab / WikidataIntegrator

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

wikibase_item_engine_factory should also handle other wdi_core.config vars #172

Closed dlindem closed 1 year ago

dlindem commented 3 years ago

Hi, I'm trying to use wdi for an own wikibase instance, here is my test code:

https://github.com/dlindem/zotero_lexbib_rdf/blob/master/wikibase/wditest.py

I'm getting this error: "Please set P2302 and Q21502410 in your wikibase or set core_props manually.", and I'm failing to set them manually. If I'm not wrong, this could be included here, where other wdi_core.config vars are also updated to the own instance, and maybe the same will be true vor "calendar model":

https://github.com/SuLab/WikidataIntegrator/blob/7b8783fb9882b3bc48b1b0b5fb45582359b8fa1b/wikidataintegrator/wdi_core.py#L1714

..or how should I set these vars manually? Many thanks in advance for your help.

LeMyst commented 3 years ago

Hello @dlindem You can use the config global var:

from wikidataintegrator.wdi_config import config as wdi_config

wdi_config['MEDIAWIKI_API_URL'] = 'http://localhost:8181/api.php'
wdi_config['SPARQL_ENDPOINT_URL'] = 'http://localhost:8989/bigdata/sparql'
wdi_config['WIKIBASE_URL'] = 'http://wikibase.svc'
wdi_config['PROPERTY_CONSTRAINT_PID'] = 'P2302'
wdi_config['DISTINCT_VALUES_CONSTRAINT_QID'] = 'Q21502410'

etc.

There is more in the file wdi_config.py

dlindem commented 3 years ago

Thanks, that did not solve it, but ignoring warnings things seem to work anyway.