简体   繁体   English

如何使用owlexplanation项目获得不一致的解释

[英]How to get an explanation for an inconsistency using the owlexplanation project

I have a question regarding the owlexplanation project by Matthew Horridge on GitHub. 我有一个关于Matthew Horridge在GitHub上的owlexplanation项目的问题。

In the README file there is the following code : 在README文件中有以下代码:

import org.semanticweb.owl.explanation.api.*;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;

OWLReasonerFactory rf = ; // Get hold of a reasoner factory
OWLOntology ont = ; // Reference to an OWLOntology

// Create the explanation generator factory which uses reasoners provided by the specified
// reasoner factory
ExplanationGeneratorFactory<OWLAxiom> genFac = ExplanationManager.createExplanationGeneratorFactory(rf);

// Now create the actual explanation generator for our ontology
ExplanationGenerator<OWLAxiom> gen = genFac.createExplanationGenerator(ont);

// Ask for explanations for some entailment
OWLAxiom entailment ; // Get a reference to the axiom that represents the entailment that we want explanation for

// Get our explanations.  Ask for a maximum of 5.
Set<Explanation<OWLAxiom>> expl = gen.getExplanations(entailment, 5);

Please could somebody explain what exactly is the type of the parameter entailment ? 请问有人可以解释一下参数entailment确切类型是什么? I do not quite understand about what thing we get explanations. 我不太明白我们得到什么解释。 I am searching for code that gives me explanations when my ontology is inconsistent. 我正在寻找代码,当我的本体论不一致时,它会给我解释。

The entailment parameter is the axiom for which you are trying to determine how the entailment happened. entailment参数是你试图确定蕴涵发生的公理。

For explaining an inconsistency, you can follow the suggestion in the README to use a different factory. 为了解释不一致,您可以按照README中的建议使用其他工厂。 I've written an example that uses version 1.1.2 of OWLExplanation and version 1.2.1 of JFact (I needed a reasoner to test this; any reasoner will do). 我编写了一个使用OWLExplanation版本1.1.2和OWLExplanation版本1.2.1的示例(我需要一个推理器来测试它;任何推理都会这样做)。

import java.io.File;
import java.util.Set;
import org.semanticweb.owl.explanation.api.Explanation;
import org.semanticweb.owl.explanation.api.ExplanationGenerator;
import org.semanticweb.owl.explanation.impl.blackbox.checker.InconsistentOntologyExplanationGeneratorFactory;
import org.semanticweb.owlapi.apibinding.OWLManager;
import org.semanticweb.owlapi.model.*;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import uk.ac.manchester.cs.jfact.JFactFactory;
public class TestExplanation {
  public static void main(String[] args) throws Exception {
    OWLReasonerFactory rf = new JFactFactory();
    OWLOntology ont = OWLManager.createOWLOntologyManager().createOntology();
    OWLOntologyManager m = ont.getOWLOntologyManager();
    OWLDataFactory df = m.getOWLDataFactory();
    OWLClass class1 = df.getOWLClass(IRI.create("urn:test:class1"));
    OWLClass class2 = df.getOWLClass(IRI.create("urn:test:class2"));
    OWLIndividual i = df.getOWLNamedIndividual(IRI.create("urn:test:i"));
    // create an inconsistent ontology by declaring an individual member of two disjoint classes
    m.addAxiom(ont, df.getOWLDisjointClassesAxiom(class1, class2));
    m.addAxiom(ont, df.getOWLClassAssertionAxiom(class1, i));
    m.addAxiom(ont, df.getOWLClassAssertionAxiom(class2, i));
    // create the explanation generator
    ExplanationGenerator<OWLAxiom> explainInconsistency = new InconsistentOntologyExplanationGeneratorFactory(rf,
        1000L).createExplanationGenerator(ont);
    // Ask for an explanation of `Thing subclass of Nothing` - this axiom is entailed in any inconsistent ontology
    Set<Explanation<OWLAxiom>> explanations = explainInconsistency.getExplanations(df.getOWLSubClassOfAxiom(df
        .getOWLThing(), df.getOWLNothing()));
    System.out.println("TestExplanation.main() " + explanations);
  }
}

The Maven dependency shown at https://github.com/matthewhorridge/owlexplanation does not seem to currently exist. https://github.com/matthewhorridge/owlexplanation上显示的Maven依赖关系目前似乎不存在。 Is there an accurate Maven entry available? 是否有准确的Maven条目?

Here is what the above page says to use but can't be found: 以下是上面所说的使用但无法找到的内容:

<dependency>
    <groupId>net.sourceforge.owlapitools</groupId>
    <artifactId>owlexplanation</artifactId>
    <version>1.0.0</version>
</dependency>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM