SuLab / WikidataIntegrator

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

Issue with WDUrl and core_props #83

Closed stuppie closed 6 years ago

stuppie commented 6 years ago
from wikidataintegrator import wdi_core
s = wdi_core.WDUrl("http://www.google.com", "P2888")
wdi_core.WDItemEngine(data=[s], domain="pathways", item_name="zdsfg", core_props={'P2888'})

results in:

/home/gstupp/projects/WikidataIntegrator/wikidataintegrator/wdi_core.py in __init__(self, wd_item_id, item_name, domain, data, mediawiki_api_url, sparql_endpoint_url, append_value, fast_run, fast_run_base_filter, fast_run_use_refs, ref_handler, global_ref_mode, good_refs, keep_good_ref_statements, search_only, item_data, user_agent, core_props, core_prop_match_thresh)
    189             if not self.domain:
    190                 raise ValueError('Domain parameter has not been set')
--> 191             self.init_data_load()
    192 
    193     @classmethod

/home/gstupp/projects/WikidataIntegrator/wikidataintegrator/wdi_core.py in init_data_load(self)
    227             qids_by_props = ''
    228             try:
--> 229                 qids_by_props = self.__select_wd_item()
    230             except WDSearchError as e:
    231                 self.log('ERROR', str(e))

/home/gstupp/projects/WikidataIntegrator/wikidataintegrator/wdi_core.py in __select_wd_item(self)
    402                 tmp_qids = set()
    403 
--> 404                 query = statement.sparql_query.format(mrt_pid=mrt_pid, pid=wd_property, value=data_point)
    405                 results = WDItemEngine.execute_sparql_query(query=query, endpoint=self.sparql_endpoint_url)
    406 

IndexError: tuple index out of range
stuppie commented 6 years ago

Caused by https://github.com/SuLab/WikidataIntegrator/blob/master/wikidataintegrator/wdi_core.py#L2165 which shouldn't override the parent class