public static Map<EdamUri, Concept> load(String edamPath) throws OWLOntologyCreationException { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = manager.loadOntologyFromOntologyDocument(new File(edamPath)); String prefix = ontology.getOntologyID().getOntologyIRI().get().toString(); return ontology .classesInSignature() .filter(c -> EdamUri.isEdamUri(c.getIRI().toString(), prefix)) .collect( Collectors.toMap( c -> new EdamUri(c.getIRI().toString(), prefix), c -> { Concept concept = new Concept(); EntitySearcher.getAnnotations(c, ontology) .forEachOrdered( a -> { if (a.getProperty().isLabel()) concept.setLabel(a.getValue().asLiteral().get().getLiteral()); else if (a.getProperty().isDeprecated()) concept.setObsolete(true); else if (a.getProperty() .toStringID() .equals( "http://www.geneontology.org/formats/oboInOwl#hasExactSynonym") && a.getValue().asLiteral().isPresent()) concept.addExactSynonym(a.getValue().asLiteral().get().getLiteral()); else if (a.getProperty() .toStringID() .equals( "http://www.geneontology.org/formats/oboInOwl#hasNarrowSynonym") && a.getValue().asLiteral().isPresent()) concept.addNarrowSynonym(a.getValue().asLiteral().get().getLiteral()); else if (a.getProperty() .toStringID() .equals( "http://www.geneontology.org/formats/oboInOwl#hasBroadSynonym") && a.getValue().asLiteral().isPresent()) concept.addBroadSynonym(a.getValue().asLiteral().get().getLiteral()); else if (a.getProperty() .toStringID() .equals( "http://www.geneontology.org/formats/oboInOwl#hasDefinition") && a.getValue().asLiteral().isPresent()) concept.setDefinition(a.getValue().asLiteral().get().getLiteral()); else if (a.getProperty().isComment() && a.getValue().asLiteral().isPresent()) concept.setComment(a.getValue().asLiteral().get().getLiteral()); }); if (concept.getLabel().isEmpty()) throw new IllegalStateException( String.format("Label of concept %s is empty", c.getIRI())); return concept; }, (u, v) -> { throw new IllegalStateException(String.format("Duplicate key %s", u)); }, LinkedHashMap::new)); }