Search in sources :

Example 6 with CvTermGraph

use of org.nextprot.api.core.domain.CvTermGraph in project nextprot-api by calipho-sib.

the class TermController method getDescendantGraph.

@ApiMethod(path = "/term/{term}/descendant-graph", verb = ApiVerb.GET, description = "Get the descendant graph of the given term", produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/term/{term}/descendant-graph", method = { RequestMethod.GET }, produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, CvTermGraph.View> getDescendantGraph(@ApiPathParam(name = "term", description = "The accession of the cv term", allowedvalues = { "TS-0079" }) @PathVariable("term") String term) {
    CvTerm cvTerm = terminologyService.findCvTermByAccession(term);
    CvTermGraph graph = cvTermGraphService.findCvTermGraph(TerminologyCv.getTerminologyOf(cvTerm.getOntology()));
    return Collections.singletonMap("descendant-graph", graph.calcDescendantSubgraph(cvTerm.getId().intValue()).toView());
}
Also used : CvTerm(org.nextprot.api.core.domain.CvTerm) CvTermGraph(org.nextprot.api.core.domain.CvTermGraph) ApiMethod(org.jsondoc.core.annotation.ApiMethod) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

CvTermGraph (org.nextprot.api.core.domain.CvTermGraph)6 CvTerm (org.nextprot.api.core.domain.CvTerm)4 Instant (java.time.Instant)2 ApiMethod (org.jsondoc.core.annotation.ApiMethod)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 PrintWriter (java.io.PrintWriter)1 DecimalFormat (java.text.DecimalFormat)1 TerminologyCv (org.nextprot.api.commons.constants.TerminologyCv)1