}
public static String getLabel(OWLEntity e, OWLOntology ont) {
for (OWLAnnotation an : e.getAnnotations(ont)) {
if (an.getProperty().isLabel()) {
OWLAnnotationValue val = an.getValue();
if (val instanceof IRI) {
return ((IRI) val).toString();
} else if (val instanceof OWLLiteral) {
OWLLiteral lit = (OWLLiteral) val;
return lit.getLiteral();
} else if (val instanceof OWLAnonymousIndividual) {
OWLAnonymousIndividual ind = (OWLAnonymousIndividual) val;
return ind.toStringID();
} else {
throw new RuntimeException("Unexpected class "
+ val.getClass());
}
}
}
return e.toStringID();
}