Beispiel #1
0
    def _run(self):
        """
        Checks for entailment errors in the main ontology.
        """
        mainont = Ontology(self.obt.getOutputFilePath())
        timer = BasicTimer()

        logger.info('Checking for entailment errors...')
        timer.start()
        entcheck_res = mainont.checkEntailmentErrors(
            self.config.getReasonerStr())
        logger.info('Logical error check completed in {0} s'.format(
            timer.stop()))

        if not (entcheck_res['is_consistent']):
            logger.info(
                '\nERROR: The ontology is inconsistent (that is, it has no '
                'models).  This is often caused by the presence of an '
                'individual (that is, a class instance) that is explicitly or '
                'implicitly a member of two disjoint classes.  It might also '
                'indicate an underlying modeling error.  Regardless, it is a '
                'serious problem because an inconsistent ontology cannot be '
                'used for logical inference.\n')
        else:
            class_list = entcheck_res['unsatisfiable_classes']
            if len(class_list) > 0:
                iri_strs = [ent.getIRI().toString() for ent in class_list]
                classes_str = '<' + '>\n<'.join(iri_strs) + '>'

                logger.info(
                    '\nERROR: The ontology is consistent but incoherent '
                    'because it contains one or more unsatisfiable classes.  '
                    'This usually indicates a modeling error.  The following '
                    'classes are unsatisfiable:\n' + classes_str + '\n')
            else:
                logger.info('\nThe ontology is consistent and coherent.  No '
                            'entailment problems were found.\n')