Reputation: 2605
Is it possible to get name of all the classes present in OWL file using JENA and store in the Array List?
OntModel base = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, null);
OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF, null);
String NS = "http://www.abc.com/abcportal/abc.owl" + "#";
base.read("file:abcInstance.owl");
ExtendedIterator<OntClass> iter = base.listClasses();
while ( iter.hasNext()){
System.out.println(iter.next());
}
Upvotes: 1
Views: 4052
Reputation: 13315
Yes it is, see the Javadoc for OntModel.listClasses. You can easily copy the contents of the Iterator
into an array or List
. That you're asking the question suggests that you'll probably benefit from reading the Jena ontology API documentation
Upvotes: 5