How can I find all the defined classes using owlapi in Java? I'm aware of the deprecated getClassesInSignature
method, but the documentation (JavaDocs) are lacking a bit in regards, what should be used instead?
The modern way is to use the java Stream
. You can use it like the following :
Stream<OWLClass> stream = ontology.classesInSignature();
Set<OWLClass> set = ontology.classesInSignature().collect(Collectors.toSet());
OWLClass[] array = ontology.classesInSignature().toArray(OWLClass[]::new);