use of org.edamontology.edammap.core.edam.EdamUri in project edammap by edamontology.
the class QueryLoader method edamUriJson.
private static EdamUri edamUriJson(Edam edam, Map<EdamUri, Concept> concepts) {
if (edam.getUri() != null && !edam.getUri().trim().isEmpty()) {
EdamUri edamUri = new EdamUri(edam.getUri().trim().toLowerCase(Locale.ROOT), EDAM_PREFIX);
if (!checkEdamUri(edamUri, concepts))
return null;
return edamUri;
}
if (edam.getTerm() != null && !edam.getTerm().trim().isEmpty()) {
String term = edam.getTerm().trim();
if (concepts != null) {
for (Entry<EdamUri, Concept> e : concepts.entrySet()) {
if (e.getValue().getLabel().equals(term))
return e.getKey();
}
for (Entry<EdamUri, Concept> e : concepts.entrySet()) {
if (e.getValue().getExactSynonyms().contains(term))
return e.getKey();
}
for (Entry<EdamUri, Concept> e : concepts.entrySet()) {
if (e.getValue().getNarrowSynonyms().contains(term))
return e.getKey();
if (e.getValue().getBroadSynonyms().contains(term))
return e.getKey();
}
}
logger.warn("Can't find EDAM URI for term {} in JSON", term);
return null;
} else {
logger.warn("An EDAM object is empty in JSON");
return null;
}
}
Aggregations