我有一個在Protege 4.3.0中創建並存儲在OWL文件中的本體。爲了使用OWL API加載這個本體,我使用下面的代碼示例。UnloadableImportException:無法加載導入的本體
public class MySampleClass {
private final OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
private final OWLDataFactory df = manager.getOWLDataFactory();
private final OWLReasonerFactory rf = new StructuralReasonerFactory();
private final OWLOntology ontology;
private final OWLOntologyID id;
private final IRI iri;
private final PrefixManager pm;
private final OWLReasoner reasoner;
/**
*
* @param file
*/
public MySampleClass(File file) {
try {
ontology = manager.loadOntologyFromOntologyDocument(file);
} catch (OWLOntologyInputSourceException | OWLOntologyCreationException ex) {
// throw custom exception
}
id = ontology.getOntologyID();
iri = id.getOntologyIRI();
pm = new DefaultPrefixManager(iri.toString().concat("#"));
reasoner = rf.createReasoner(ontology);
reasoner.precomputeInferences(InferenceType.OBJECT_PROPERTY_ASSERTIONS);
}
}
但是,如果我嘗試加載包含一個或多個進口,如果這些進口不可本體,一個UnloadableImportException被拋出,如下面的例子:
org.semanticweb。 owlapi.model.UnloadableImportException:無法加載 進口本體:http://www.w3.org/2004/02/skos/core原因: 連接超時
如何解決這個問題呢? 如果導入的本體可以離線使用,在載入本體時如何導入本體?
請注意,結構推理不是一個完整的推理。如果您需要正確的推理,請使用HermiT或Pellet等推理器。 – Ignazio