如何获取OWLClassExpression中的元素

时间:2018-06-20 12:02:33

标签: owl-api

请问是否要在OWLClass element之类的ObjectUnionOf OWLClassExpression中提取ObjectUnionOf(<OWLClass> <OWLClass>) owl-api 中应使用哪种方法我用来获取这两个 OWLClasses

1 个答案:

答案 0 :(得分:0)

方法是OWLObjectVisitor:

OWLObjectVisitorAdapter visitorAdapter = new OWLObjectVisitorAdapter() {
 @Override
 public void visit(OWLObjectUnionOf ce) {
  for (OWLClassExpression e : ce.getOperands()) {
      if (!e.isAnonymous()) {
     System.out.println("VisitorAdaptor OWLClass:"+e);
         }
     }
    }
  };
classExpression.accept(visitorAdapter);