简体   繁体   中英

how to get all the classes defined in an ontology, using owlapi in a none deprecated way

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM