collecting expressions in disjoint axioms using owlapi

Viewed 24

How can i retrieve the below disjoint axioms separately. By separately i mean simple class expression separate from inverse class expression. Because the current code gave me inverse and without inverse expression but i do not know how to get axiom 3,4,and 5. I need to translate these axioms separately. Thankyou!

enter image description here

for(OWLClass c : ontology.getClassesInSignature()) {
            for(OWLAxiom ax : ontology.getDisjointClassesAxioms(c)) {
                for (OWLClassExpression x : ((OWLDisjointClassesAxiom)ax).getClassExpressions()) {
                    if (x.isAnonymous()) {
                        System.out.println(x);
                        if (x instanceof OWLObjectSomeValuesFrom) {
                             OWLObjectSomeValuesFrom someValuesFrom = (OWLObjectSomeValuesFrom) x;
                             OWLObjectPropertyExpression property = someValuesFrom.getProperty();
                             
                      if(property.getInverseProperty().isAnonymous()) {
                                 System.out.println("disjointwithoutInverse("+c.asOWLClass().getIRI().getShortForm()+","+property.asOWLObjectProperty().getIRI().getShortForm()+").");
                             }
                             else {
                             System.out.println("disjointwithInverse("+c.asOWLClass().getIRI().getShortForm()+","+property.getNamedProperty().asOWLObjectProperty().getIRI().getShortForm()+").");
                             }
                 }
               }
             }
           }
0 Answers
Related