diff --git a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java index 26a8389a2f8caa2543514331a23a305dc256700b..763241dd961e300632233ad8c99bc575cca3bf23 100644 --- a/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java +++ b/annotation/src/main/java/lcsb/mapviewer/annotation/services/annotators/ElementAnnotator.java @@ -162,7 +162,7 @@ public abstract class ElementAnnotator extends CachableInterface { * the description */ public String getDescription(MiriamType mt){ - return ""; + return getCommonName(); } /** @@ -176,7 +176,7 @@ public abstract class ElementAnnotator extends CachableInterface { * the description */ public String getDescription(MiriamType mt, MiriamRelationType relationType){ - return ""; + return getCommonName(); } /** diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/BaseRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/BaseRestImpl.java index caf4cbe87de7819c56f3331ba3bcae67102e7ceb..16b031af4c294d43a7de8ff140d5c4691a15b731 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/BaseRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/BaseRestImpl.java @@ -31,6 +31,7 @@ import lcsb.mapviewer.annotation.data.Target; import lcsb.mapviewer.annotation.services.MiriamConnector; import lcsb.mapviewer.annotation.services.PubmedParser; import lcsb.mapviewer.annotation.services.PubmedSearchException; +import lcsb.mapviewer.annotation.services.annotators.ElementAnnotator; import lcsb.mapviewer.common.exception.InvalidArgumentException; import lcsb.mapviewer.common.exception.InvalidStateException; import lcsb.mapviewer.common.exception.InvalidXmlSchemaException; @@ -125,6 +126,22 @@ public abstract class BaseRestImpl { result.put("type", annotation.getDataType().name()); result.put("resource", annotation.getResource()); result.put("id", annotation.getId()); + + if (annotation.getAnnotator() != null) { + try { + result.put("description", + ((ElementAnnotator) annotation.getAnnotator().getConstructor().newInstance()).getDescription( + annotation.getDataType(), + annotation.getRelationType()) + ); + }catch(Exception e) { //TODO + logger.error("Problem with retrieving description from annotator", e); + result.put("description", ""); + } + } else { + result.put("description", ""); + } + return result; } else { throw new InvalidArgumentException("invalid miriam data: " + annotation);