Java 检查特定OWL公理是否一致(即不存在相互矛盾的知识)?
我目前正在使用Hermit OWL reasoner来检查给定本体中的一致性,它工作得很好 我理解,由于本体不一致,OWL推理者无法推断出任何有用的信息,这是一个严重的错误 我在寻找的是:是否有一种方法可以让推理者检查特定的公理“a/B”是否不一致Java 检查特定OWL公理是否一致(即不存在相互矛盾的知识)?,java,owl,ontology,consistency,owl-api,Java,Owl,Ontology,Consistency,Owl Api,我目前正在使用Hermit OWL reasoner来检查给定本体中的一致性,它工作得很好 我理解,由于本体不一致,OWL推理者无法推断出任何有用的信息,这是一个严重的错误 我在寻找的是:是否有一种方法可以让推理者检查特定的公理“a/B”是否不一致 import org.semanticweb.HermiT.Reasoner; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticw
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());
}
}
}
import org.semanticweb.HermiT.Reasoner;
导入org.semanticweb.owlapi.apibinding.OWLManager;
导入org.semanticweb.owlapi.model.IRI;
导入org.semanticweb.owlapi.model.OWLClass;
导入org.semanticweb.owlapi.model.OWLOntology;
导入org.semanticweb.owlapi.model.owletologyManager;
导入org.semanticweb.owlapi.reasoner.Node;
/**
*此示例演示如何使用HermiT检查比萨饼本体的一致性
*/
公共类一致性检查器{
公共静态void main(字符串[]args)引发异常{
//首先,我们创建一个OWLOntologyManager对象。管理器将加载和保存本体。
OWLOntologyManager m=OWLManager.createOWLOntologyManager();
//我们使用owlapi加载Pizza本体。
OWLOontology=m.loadOntologyFromOntologyDocument(IRI.create(“http://www.cs.ox.ac.uk/isg/ontologies/UID/00793.owl"));
//现在,我们通过在org.semanticweb.HermiT包中创建Reasoner类的实例来实例化HermiT。
推理者隐士=新推理者(o);
//最后,我们输出本体是否一致。
System.out.println(hermit.isConsistent());
//------
Node unsatifiableclasses=hermit.getunsatifiableclasses();
for(OWLClass OWLClass:unsatifiableclasses){
System.out.println(owlClass.getIRI());
}
}
}
公理本身并不矛盾,除非其形式为“owl的X实例:无”。有一些库可以找到关于本体为何不一致的解释,例如,请参见Yes,@Ignazio的观点很重要。很少有公理本身是不一致的。通常,这是一个不一致的公理组合。例如,当a和b是数字时,a