WolfgangFahl / pyOnlineSpreadSheetEditing

python Online SpreadSheet Editing tool with configurable enhancer/importer and check phase
Apache License 2.0
2 stars 0 forks source link

WdBrowser - Unexpected error on items with many instances #36

Open tholzheim opened 2 years ago

tholzheim commented 2 years ago

When searching for Q13442814 the following error occurs

'WikiDataBrowser' object has no attribute 'propertySelection'

Traceback (most recent call last):
  File "wd/wdbrowser.py", line 670, in selectItem
    await self.trulyTabularAnalysis(self.tt)
  File "wd/wdbrowser.py", line 480, in trulyTabularAnalysis
    if self.propertySelection is None:
AttributeError: 'WikiDataBrowser' object has no attribute 'propertySelection'
tholzheim commented 2 years ago

The issue emerges from this section: https://github.com/WolfgangFahl/pyOnlineSpreadSheetEditing/blob/e265a6358cb29c1d2a038a2dfabd5086e0ad424f/wd/wdbrowser.py#L667-L672

The methods have all their own exception handling and also define properties for the following methods to use. Thus, side effects occur of the case that expected properties are not defined.

await self.getCountQuery(self.tt),  #defines: ttcount
await self.getMostFrequentlyUsedProperties(self.tt),  #uses: ttcount | defines: ttquery,propertyQueryDisplay
await self.getPropertiesTable(self.tt, self.ttquery), #uses: ttquery  | defines: propertyList, propertySelection, ttTable
await self.trulyTabularAnalysis(self.tt) #uses: propertySelection

Resolved these side effects by removing the global exception handling within the methods and instead use more specific Exception handling such as:

try:
    self.propertyList=tt.sparql.queryAsListOfDicts(ttquery.query)
except EndPointInternalError as ex:
    if self.isTimeoutException(ex):
        raise Exception("Query timeout of the property table query")
tholzheim commented 2 years ago

With these fixes for the search Q13442814 we now get:

Thus, the Exception for items with many instances is not resolved but now the error messages indicate that the issue depends on the endpoints

tholzheim commented 2 years ago

The dependency and and possible side effects still need further investigation e.g. https://github.com/WolfgangFahl/pyOnlineSpreadSheetEditing/blob/8a19ba34c24cbeef7dcd04bfd07c46a0406244a8/wd/wdbrowser.py#L633-L637

WolfgangFahl commented 2 years ago

this might be a motivation to work on our own endpoint especially since the Wikidata Workshop paper has been accepted.