/** * Retrieve the identifier for a given {@link OWLObject}. * This methods uses also shorthand hints to resolve the * identifier. * Should the translation process encounter a problem or * not find an identifier the defaultValue is returned. * * @param obj the {@link OWLObject} to resolve * @param ont the target ontology * @param defaultValue the value to return in case of an error or no id * @return identifier or the default value */ public static String getIdentifierFromObject(OWLObject obj, OWLOntology ont, String defaultValue) { String id = defaultValue; try { id = getIdentifierFromObject(obj, ont); if (id == null) { id = defaultValue; } } catch (UntranslatableAxiomException e) { LOG.log(Level.WARNING, e.getMessage()); } return id; }
public String getIdentifier(OWLObject obj) { try { return getIdentifierFromObject(obj, owlOntology); } catch (UntranslatableAxiomException e) { error(e.getMessage()); } return null; }
final Set<OWLAnnotationAssertionAxiom> axioms = entity.getAnnotationAssertionAxioms(ont); for(OWLAnnotationAssertionAxiom ax: axioms){ String propId = getIdentifierFromObject(ax.getProperty().getIRI(), ont);