本文介绍了检查本体一致性&OWL API 4 的可满足性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试检查本体的一致性.本体只包含对个体的描述,类和语义规则由导入的本体描述.

I'm trying to check an ontology for its consistency. The ontology includes only descriptions of individuals, the class and semantic rules are described by an imported ontology.

我认为使用 isConsistent 方法是正确的选择.

I thougt using the isConsistenct method would be the right choice.

OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory();
OWLReasoner reasoner =     reasonerFactory.createNonBufferingReasoner(mergedOntology);
    if(reasoner.isConsistent()){
        return "Merged ontology PASSED the consistency test";
    }else{
        return "Ontology FAILED the consistency test";
    }

检查本体一致性的正确方法是什么,例如在启动推理器时应用 Protege 5?

What would be the correct approach to check the ontology's consistency, like Protege 5 applies when starting a reasoner?

使用 Pellet 更新代码

Code update using Pellet

        OWLReasonerFactory reasonerFactory = new PelletReasonerFactory();
        OWLReasoner reasoner = reasonerFactory.createNonBufferingReasoner(mergedOntology);
        String answer = "";
        if(reasoner.isConsistent()){
            if(reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom().size()>0){
                answer = "Merged ontology FAILED satisfiability test. Unsatisfiable classes detected: " + reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom().size();
            }
            answer = "Merged ontology PASSED the consistency test";
        }else{
            answer = "Merged ontology FAILED the consistency test, please review the Axioms or debug using Protege";
            //FYI an example how to implement a working debugger can be found on sourceforge's OWL API page under Debugger
        }
        reasoner.dispose();
        return answer;

推荐答案

该方法是正确的,但 StructuralReasonerFactory 的使用是一个问题.推理器没有真正的推理,它只是使用断言的公理来回答一些基本的查询.它无法检查一致性.

The approach is right but the use of the StructuralReasonerFactory is an issue. That reasoner does no real reasoning, it merely uses asserted axioms to answer some basic queries. It cannot check consistency.

您需要使用真正的推理机来进行一致性检查.有一些推理器已经支持 OWLAPI 4,请参阅 https://github.com/owlcs/owlapi/wiki

You need to use a real reasoner to carry out the consistency check. There are a few reasoners already supporting OWLAPI 4, see https://github.com/owlcs/owlapi/wiki

这篇关于检查本体一致性&OWL API 4 的可满足性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 03:48