0
我一直在嘗試加載我在Protégé中創建的OWL文件。我將OWL API 3.4.3導入到我的項目中,並將sample.owl
文件傳遞到原始文件夾,但是當我嘗試加載OWL文件時,它不起作用。有沒有錯誤,但我只是得到這個消息無法使用owl api將owl文件加載到android項目
不幸的是,sampleproject已經停止
下面是部分代碼正在使用。當我在標準Java環境中嘗試代碼時,它可以毫無問題地工作。
OWLOntology localOntology = null;
int rID = resources.getIdentifier("com.example.cammclient1:raw/"+"sample", null, null);
InputStream input = resources.openRawResource(rID);
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
ontology = manager.loadOntologyFromOntologyDocument(input);
try {
for (OWLClass cls : localOntology.getClassesInSignature()) {
Log.d("class in the ontology", ((CharSequence) cls).toString());
}
TV1.setText("reading classes...............");
}
catch (Exception e) {
TV1.setText("Not successfull");
}
您沒有獲取堆棧跟蹤,因爲您正在吞服try/catch塊中的異常。您可以打印e的堆棧跟蹤,也可以將TV1上的文本設置爲e.getMessage()。 – Ignazio
tnx爲您的重播,我也嘗試了您的建議,但它仍然不工作...它在應用程序啓動之前崩潰... – user2897572
很難建議任何其他事情。嘗試使用3.4.10 – Ignazio