diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/MiriamConnector.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/MiriamConnector.java index 00b97432ce57533fe8d079cbeefa85eb88914a91..af5982d3d0c6060a8ce5cdc6c18d323bcd8327ae 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/MiriamConnector.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/MiriamConnector.java @@ -1,14 +1,11 @@ package lcsb.mapviewer.annotation.services; import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import org.apache.log4j.Logger; import org.hibernate.AnnotationException; - -import com.google.gson.Gson; +import org.w3c.dom.Document; +import org.w3c.dom.Node; import lcsb.mapviewer.annotation.cache.CachableInterface; import lcsb.mapviewer.annotation.cache.GeneralCacheInterface; @@ -219,19 +216,13 @@ public final class MiriamConnector extends CachableInterface implements IExterna */ protected String getUrlString2(MiriamData md) throws AnnotationException { try { - String result = null; String queryUri = md.getDataType().getUris().get(0) + ":" + md.getResource(); String query = "https://www.ebi.ac.uk/miriamws/main/rest/resolve/" + queryUri; String page = getWebPageContent(query); - Gson gson = new Gson(); - - Map<?, ?> gsonObject = new HashMap<String, Object>(); - gsonObject = (Map<?, ?>) gson.fromJson(page, gsonObject.getClass()); - Object uris = gsonObject.get("uri"); - Map<?, ?> entry = (Map<?, ?>) ((List<?>) uris).get(0); - result = (String) entry.get("$"); + Document document = getXmlDocumentFromString(page); + Node uri = getNode("uri", document.getChildNodes()); + return getNodeValue(uri); - return result; } catch (Exception e) { throw new AnnotationException("Problem with accessing miriam REST API", e); }