我有使用 Protege 创建的本体文件。对于我的 java 应用程序,我需要检索类及其属性。我尝试了以下代码,但它只检索三元组。我是 Jena Api 和 Ontology 的新手,所以请帮忙
String URI = "http://www.semanticweb.org/ontologies/2012/0/SBIRS.owl";
String inputFileName = "D:\\SBIRS.owl";
System.out.println("File Name" + inputFileName);
OntModel model = ModelFactory.createOntologyModel();
StmtIterator si=model.listStatements();
ResIterator iter=model.listSubjects();
while(iter.hasNext())
{
Resource res=iter.nextResource();
System.out.println("Property==>" + res.getProperty(null).toString());
System.out.println("Resource URI==>" + res.getURI());
}