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