1

我目前正在使用 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());
                }

            }
        }
4

0 回答 0