OWLOntology ont = m.createOntology();
OWLClass clsA = Class(IRI("http://ont.com#A"));
OWLClass clsB = Class(IRI("http://ont.com#B"));
OWLSubClassOfAxiom sca = SubClassOf(clsA, clsB);
m.addAxiom(ont, sca);
OWLAnnotationProperty rdfsComment = RDFSComment();
OWLLiteral lit = Literal("Hello world");
OWLAnnotationAssertionAxiom annoAx1 = AnnotationAssertion(rdfsComment,
clsA.getIRI(), lit);
m.addAxiom(ont, annoAx1);
OWLAnnotationPropertyDomainAxiom annoAx2 = df
.getOWLAnnotationPropertyDomainAxiom(rdfsComment, clsA.getIRI());
m.addAxiom(ont, annoAx2);
OWLAnnotationPropertyRangeAxiom annoAx3 = df
.getOWLAnnotationPropertyRangeAxiom(rdfsComment, clsB.getIRI());
m.addAxiom(ont, annoAx3);
OWLAnnotationProperty myComment = AnnotationProperty(IRI("http://ont.com#myComment"));
OWLSubAnnotationPropertyOfAxiom annoAx4 = df
.getOWLSubAnnotationPropertyOfAxiom(myComment, rdfsComment);
m.addAxiom(ont, annoAx4);
reload(ont, new RDFXMLDocumentFormat());
reload(ont, new OWLXMLDocumentFormat());