简体   繁体   English

如何以不推荐的方式使用owlapi获取本体中定义的所有类

[英]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? 如何在Java中使用owlapi找到所有已定义的类? I'm aware of the deprecated getClassesInSignature method, but the documentation (JavaDocs) are lacking a bit in regards, what should be used instead? 我知道已弃用的getClassesInSignature方法,但是文档(JavaDocs)缺少方面,应该使用什么代替?

The modern way is to use the java Stream . 现代的方法是使用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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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