Skip to content

Commit

Permalink
decrease warnings of fast instance checker
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonBin committed Oct 13, 2021
1 parent 7a07a41 commit f0f0452
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions owlapy/fast_instance_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
class OWLReasoner_FastInstanceChecker(OWLReasoner):
"""Tries to check instances fast (but maybe incomplete)"""
__slots__ = '_ontology', '_base_reasoner', \
'_ind_enc', '_cls_to_ind', '_obj_prop', '_obj_prop_inv', '_data_prop', '_objectsomevalues_cache', \
'_negation_default', '_datasomevalues_cache', '_objectcardinality_cache'
'_ind_enc', '_cls_to_ind', \
'_objectsomevalues_cache', '_datasomevalues_cache', '_objectcardinality_cache', \
'_obj_prop', '_obj_prop_inv', '_data_prop', \
'_negation_default', \
'__warned'

_ontology: OWLOntology
_base_reasoner: OWLReasoner
Expand All @@ -45,6 +48,7 @@ def __init__(self, ontology: OWLOntology, base_reasoner: OWLReasoner, *, negatio
self._ontology = ontology
self._base_reasoner = base_reasoner
self._negation_default = negation_default
self.__warned = 0
self._init()

def _init(self, osv_cache_size=128):
Expand Down Expand Up @@ -93,7 +97,9 @@ def flush(self) -> None:

def instances(self, ce: OWLClassExpression, direct: bool = False) -> Iterable[OWLNamedIndividual]:
if direct:
warning("direct not implemented")
if not self.__warned & 2:
logger.warning("direct not implemented")
self.__warned |= 2
temp = self._find_instances(ce)
yield from self._ind_enc(temp)

Expand Down Expand Up @@ -244,7 +250,9 @@ def _(self, ce: OWLObjectComplementOf):
return all ^ complement_ind_enc
else:
# TODO! XXX
logger.warning("Object Complement Of not implemented at %s", ce)
if not self.__warned & 1:
logger.warning("Object Complement Of not implemented at %s", ce)
self.__warned |= 1
return 0
# if self.complement_as_negation:
# ...
Expand Down

0 comments on commit f0f0452

Please sign in to comment.