コード例 #1
0
 @RequestMapping(value = "/show.html", method = RequestMethod.GET)
 public ModelAndView show(@RequestParam(value = "q", required = true) int q) {
   ModelAndView mav = new ModelAndView();
   mav.addObject("operation", "show");
   try {
     long startTs = System.currentTimeMillis();
     // show all details about the concept
     TConcept concept = nodeService.getConcept(q);
     Bag<TRelTypes> relCounts = nodeService.getRelationCounts(concept);
     Map<String, List<TRelation>> relmap = new HashMap<String, List<TRelation>>();
     Map<Integer, String> oidmap = new HashMap<Integer, String>();
     for (TRelTypes reltype : relCounts.uniqueSet()) {
       List<TRelation> rels = nodeService.getRelatedConcepts(concept, reltype);
       for (TRelation rel : rels) {
         TConcept toConcept = nodeService.getConcept(rel.getToOid());
         oidmap.put(rel.getToOid(), toConcept.getPname());
       }
       relmap.put(reltype.name(), rels);
     }
     mav.addObject("concept", concept);
     mav.addObject("relmap", relmap);
     mav.addObject("oidmap", oidmap);
     long endTs = System.currentTimeMillis();
     mav.addObject("elapsed", new Long(endTs - startTs));
   } catch (Exception e) {
     mav.addObject("error", e.getMessage());
   }
   mav.setViewName("show");
   return mav;
 }
コード例 #2
0
 @RequestMapping(value = "/find.html")
 public ModelAndView find(@RequestParam(value = "q", required = false) String q) {
   ModelAndView mav = new ModelAndView();
   mav.addObject("operation", "find");
   if (StringUtils.isEmpty(q)) {
     mav.setViewName("find");
     return mav;
   }
   try {
     if (NumberUtils.isNumber(q) && StringUtils.length(q) == 7) {
       return show(Integer.valueOf(q));
     } else {
       long startTs = System.currentTimeMillis();
       List<TConcept> concepts = nodeService.findConcepts(q);
       mav.addObject("concepts", concepts);
       long endTs = System.currentTimeMillis();
       mav.addObject("q", q);
       mav.addObject("elapsed", new Long(endTs - startTs));
     }
   } catch (Exception e) {
     mav.addObject("error", e.getMessage());
   }
   mav.setViewName("find");
   return mav;
 }
コード例 #3
0
 @PostConstruct
 public void init() throws Exception {
   nodeService = NodeService.getInstance();
   conceptMappingAE = UimaUtils.getAE(conceptMappingAEDescriptor, null);
 }