Reputation: 366
I am finding my current way of iterating over all the annotations bit time consuming...can you please suggest better way to do this ? Here is my current code :-
Set<OWLAnnotationAssertionAxiom> annotations = ont.getAnnotationAssertionAxioms(relationIRI);
if (annotations != null && annotations.size() > 0)
for (OWLAnnotationAssertionAxiom annotation : annotations) {
if (annotation.getProperty().getIRI().getShortForm().equals(OntologyConstants.ABSTRACT))
abstractProperty = true;
}
Upvotes: 0
Views: 42
Reputation: 10684
In OWLAPI 3, there is no simpler way of doing what you need.
In OWLAPI 4, provided you know the full IRI for the property you are searching (not just the short form) you can do:
OWLAnnotationProperty p = owlDataFactory.getOWLAnnotationProperty(iri);
abstractProperty= !EntitySearcher.getAnnotationObjects(relationIRI, ont, p).isEmpty();
If you only have the short form, you cannot take advantage of any shortcuts and your original code is still the best way.
Upvotes: 2