OntologyHelper { public static Map<String, IRI> getLabelIRIs(OWLOntology ontology) { Map<String, IRI> results = new HashMap<>(); OWLOntologyManager manager = ontology.getOWLOntologyManager(); OWLAnnotationProperty rdfsLabel = manager.getOWLDataFactory().getRDFSLabel(); Set<OWLAnnotationAssertionAxiom> axioms = getAnnotationAxioms(ontology, rdfsLabel); for (OWLAnnotationAssertionAxiom axiom : axioms) { String value = getValue(axiom); if (value == null) { continue; } OWLAnnotationSubject subject = axiom.getSubject(); if (!(subject instanceof IRI)) { continue; } if (results.containsKey(value)) { logger.warn("Duplicate rdfs:label \"" + value + "\" for subject " + subject); } results.put(value, (IRI) subject); } return results; }  static void addAxiomAnnotation(
      OWLOntology ontology, OWLAxiom axiom, IRI propertyIRI, OWLAnnotationValue value); static void addAxiomAnnotation(
      OWLOntology ontology, OWLAxiom axiom, Set<OWLAnnotation> annotations); static void addAxiomAnnotations(
      OWLOntology ontology, IRI propertyIRI, OWLAnnotationValue value); static void addOntologyAnnotation(
      OWLOntology ontology, IRI propertyIRI, OWLAnnotationValue value); static void addOntologyAnnotation(OWLOntology ontology, OWLAnnotation annotation); static void collapseOntology(OWLOntology ontology, Set<IRI> precious); static void collapseOntology(
      OWLOntology ontology, int threshold, Set<IRI> precious, boolean repeat); static void copy(
      OWLOntology inputOntology,
      OWLOntology outputOntology,
      OWLEntity entity,
      Set<OWLAnnotationProperty> annotationProperties); static void copyAnnotations(
      OWLOntology inputOntology,
      OWLOntology outputOntology,
      OWLEntity entity,
      Set<OWLAnnotationProperty> annotationProperties); static Set<IRI> filterExistingTerms(
      OWLOntology ontology, Set<IRI> IRIs, boolean allowEmpty); static Set<IRI> filterExistingTerms(
      OWLOntology ontology, Set<IRI> IRIs, boolean allowEmpty, Imports imports); static Set<OWLObject> getNamedObjects(OWLOntology ontology); static Set<OWLObject> getNamedObjects(OWLAxiom axiom); static Set<IRI> getIRIsInSignature(OWLAxiom axiom); static Set<OWLObject> getObjects(OWLOntology ontology); static Set<OWLObject> getObjects(OWLAxiom axiom); static Set<OWLAxiom> getAnonymousAncestorAxioms(OWLOntology ontology, OWLEntity entity); static Set<OWLAxiom> getAnonymousDescendantAxioms(OWLOntology ontology, OWLEntity entity); static Set<OWLAxiom> getAnonymousEquivalentAxioms(OWLOntology ontology, OWLEntity entity); static Set<OWLAxiom> getAnonymousParentAxioms(OWLOntology ontology, OWLEntity entity); static Set<OWLAnnotationAssertionAxiom> getAnnotationAxioms(
      OWLOntology ontology, OWLAnnotationProperty property); static Set<OWLAnnotationAssertionAxiom> getAnnotationAxioms(
      OWLOntology ontology, OWLAnnotationProperty property, IRI subject); static Set<OWLAnnotationAssertionAxiom> getAnnotationAxioms(
      OWLOntology ontology, Set<OWLAnnotationProperty> properties, Set<IRI> subjects); static String getAnnotationString(
      OWLOntology ontology, OWLAnnotationProperty property, IRI subject); static String getAnnotationString(
      OWLOntology ontology, Set<OWLAnnotationProperty> properties, Set<IRI> subjects); static Set<String> getAnnotationStrings(
      OWLOntology ontology, OWLAnnotationProperty property, IRI subject); static Set<String> getAnnotationStrings(
      OWLOntology ontology, Set<OWLAnnotationProperty> properties, Set<IRI> subjects); static Set<OWLAnnotationValue> getAnnotationValues(
      OWLOntology ontology, OWLAnnotationProperty property, IRI subject); static Set<OWLAnnotationValue> getAnnotationValues(
      OWLOntology ontology, Set<OWLAnnotationProperty> properties, Set<IRI> subjects); static OWLEntity getEntity(OWLOntology ontology, IRI iri); static OWLEntity getEntity(OWLOntology ontology, IRI iri, boolean allowNull); static Set<OWLEntity> getEntities(OWLOntology ontology, Set<IRI> iris); static Set<OWLEntity> getEntities(OWLOntology ontology); static Set<IRI> getIRIs(OWLOntology ontology); static Function<OWLNamedObject, String> getLabelFunction(
      OWLOntology ontology, boolean useIriAsDefault); static Map<String, IRI> getLabelIRIs(OWLOntology ontology); static Map<IRI, String> getLabels(OWLOntology ontology); static OWLDatatype getType(OWLAnnotationValue value); static IRI getTypeIRI(OWLAnnotationValue value); static String getValue(OWLAnnotationValue value); static String getValue(OWLAnnotation annotation); static String getValue(OWLAnnotationAssertionAxiom axiom); static String getValue(Set<OWLAnnotation> annotations); static Set<String> getValues(Set<OWLAnnotation> annotations); static boolean extendsAxiomTypes(
      OWLAxiom axiom, Set<Class<? extends OWLAxiom>> axiomTypes); static boolean extendsAxiomTypes(
      Class<? extends OWLAxiom> axiom, Set<Class<? extends OWLAxiom>> axiomTypes); static void removeImports(OWLOntology ontology); static void removeOntologyAnnotations(OWLOntology ontology); static String renderManchester(OWLObject object, ShortFormProvider provider); static String renderManchester(
      OWLObject object, ShortFormProvider provider, RendererType rt); static void setOntologyIRI(
      OWLOntology ontology, String ontologyIRIString, String versionIRIString); static void setOntologyIRI(OWLOntology ontology, IRI ontologyIRI, IRI versionIRI); static void trimOntology(OWLOntology ontology);  }
@Test public void testGetLabelIRIs() throws IOException { OWLOntology simple = loadOntology("/simple.owl"); Map<String, IRI> expected = new HashMap<>(); expected.put("Test 1", IRI.create(base + "simple.owl#test1")); expected.put("test one", IRI.create(base + "simple.owl#test1")); Map<String, IRI> actual = OntologyHelper.getLabelIRIs(simple); assertEquals(expected, actual); }