我想使用 Eclipse 通过 OWL API 访问我的本体和 SWRL 规则。任何人都可以提供可以告诉我该怎么做的确切程序吗?
我尝试了以下代码,但似乎没有得到任何响应。请记住,我的 Java 技能很差。
我需要一个关于如何处理和解决这个问题的确切程序。
我已经拥有的代码是:
public static void main(String[] args) {
File file = new File("file:c:/Users/DTN/Desktop/Final SubmissionFilteringMechanism_Ontology.owl");
OWLOntologyManager m = OWLManager.createOWLOntologyManager();
OWLDataFactory f = OWLManager.getOWLDataFactory();
OWLOntology o = null;
public void testAddAxioms() {
try {
o = m.loadOntologyFromOntologyDocument(Ont_Base_IRI);
OWLClass clsA = f.getOWLClass(IRI.create(Ont_Base_IRI + "ClassA"));
OWLClass clsB = f.getOWLClass(IRI.create(Ont_Base_IRI + "ClassB"));
OWLAxiom ax1 = f.getOWLSubClassOfAxiom(clsA, clsB);
AddAxiom addAxiom1 = new AddAxiom(o, ax1);
m.applyChange(addAxiom1);
for (OWLClass cls : o.getClassesInSignature()) {
EditText edit = (EditText) findViewById(R.id.editText1);
edit.setText((CharSequence) cls);
}
m.removeOntology(o);
} catch (Exception e) {
EditText edit = (EditText) findViewById(R.id.editText1);
edit.setText("Not successfull");
}
}
}