0
我正在做耶拿開發。使用Jena響應filenotfoundexception讀取本地.owl文件
當我讀取本地文件時,即使它只有三行,我也無法正常工作。
這裏是我的代碼:
OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
model.read(owlPath, null);
Iterator<OntClass> it = model.listClasses();
while (it.hasNext()) {
OntClass ontclass = it.next();
System.out.println(ontclass.getLabel(null));
}
的owlpath
值是像file:\\animals-rdf.owl
,或file:\\D:\\Eclipse\\workspace\\jena_demo\\sources\\amimal-rdf.owl
,或者沒有file:\\
前綴,甚至當我用命名空間example.com# + filepath
,它仍然會通過。
具體錯誤報告是:
Exception in thread "main" com.hp.hpl.jena.shared.WrappedIOException:
java.io.FileNotFoundException: \animals-rdf.owl
可能有人舉個手?我完全困惑,爲什麼它不能工作。