检查一个特定的OWL公理是否一致(即不存在矛盾的知识)?

时间:2014-10-22 16:42:08

标签: java owl ontology consistency owl-api

我目前正在使用Hermit OWL推理器来检查给定本体中的一致性,并且它工作正常。

据我所知,由于本体论不一致,OWL推理人无法推断出任何有用的信息及其严重错误。

我在寻找:有没有一种方法可以让推理人检查特定的公理“A / B”是否不一致?。

    import org.semanticweb.HermiT.Reasoner;
    import org.semanticweb.owlapi.apibinding.OWLManager;
    import org.semanticweb.owlapi.model.IRI;
    import org.semanticweb.owlapi.model.OWLClass;
    import org.semanticweb.owlapi.model.OWLOntology;
    import org.semanticweb.owlapi.model.OWLOntologyManager;
    import org.semanticweb.owlapi.reasoner.Node;

    /**
     * This example demonstrates how HermiT can be used to check the consistency of the Pizza ontology
     */
    public class ConsistencyChecker {

        public static void main(String[] args) throws Exception {
            // First, we create an OWLOntologyManager object. The manager will load and save ontologies.
            OWLOntologyManager m=OWLManager.createOWLOntologyManager();
            // We use the OWL API to load the Pizza ontology.
            OWLOntology o=m.loadOntologyFromOntologyDocument(IRI.create("http://www.cs.ox.ac.uk/isg/ontologies/UID/00793.owl"));
            // Now, we instantiate HermiT by creating an instance of the Reasoner class in the package org.semanticweb.HermiT.
            Reasoner hermit=new Reasoner(o);
            // Finally, we output whether the ontology is consistent.
            System.out.println(hermit.isConsistent());

//------
                Node<OWLClass> unsatisfiableClasses = hermit.getUnsatisfiableClasses();
                for (OWLClass owlClass : unsatisfiableClasses) {
                    System.out.println(owlClass.getIRI());
                }

            }
        }

0 个答案:

没有答案