@PostConstruct
 public void init() throws Exception {
   nodeService = NodeService.getInstance();
   conceptMappingAE = UimaUtils.getAE(conceptMappingAEDescriptor, null);
 }
  @RequestMapping(value = "/map.html")
  public ModelAndView map(
      @RequestParam(value = "q1", required = false) String q1,
      @RequestParam(value = "q2", required = false) String q2,
      @RequestParam(value = "q3", required = false) String q3,
      @RequestParam(value = "if", required = false, defaultValue = UimaUtils.MIMETYPE_STRING)
          String inputFormat,
      @RequestParam(value = "of", required = true, defaultValue = "html") String outputFormat,
      @RequestParam(value = "ofs", required = false, defaultValue = "pretty")
          String outputFormatStyle,
      @RequestParam(value = "sgf", required = false) String[] styGroupFilter,
      @RequestParam(value = "scf", required = false) String[] styCodeFilter) {

    ModelAndView mav = new ModelAndView();
    mav.addObject("operation", "map");
    // validate parameters (at least one of o, q, u or t must
    // be supplied, otherwise show the input form
    mav.addObject("q1", StringUtils.isEmpty(q1) ? "" : q1);
    mav.addObject("q2", StringUtils.isEmpty(q2) ? "" : q2);
    mav.addObject("q3", StringUtils.isEmpty(q3) ? "" : q3);
    String q =
        StringUtils.isNotEmpty(q1)
            ? q1
            : StringUtils.isNotEmpty(q2) ? q2 : StringUtils.isNotEmpty(q3) ? q3 : null;
    if (StringUtils.isEmpty(q)) {
      setViewName(mav, outputFormat, outputFormatStyle);
      return mav;
    }
    try {
      if (NumberUtils.isNumber(q) && StringUtils.length(q) == 7) {
        return show(Integer.valueOf(q));
      } else {
        // show list of concepts
        String text = q;
        if ((q.startsWith("http://") && UimaUtils.MIMETYPE_HTML.equals(inputFormat))) {
          URL u = new URL(q);
          BufferedReader br = new BufferedReader(new InputStreamReader(u.openStream()));
          StringBuilder tbuf = new StringBuilder();
          String line = null;
          while ((line = br.readLine()) != null) {
            tbuf.append(line).append("\n");
          }
          br.close();
          text = tbuf.toString();
        }
        List<ConceptAnnotation> annotations = new ArrayList<ConceptAnnotation>();
        long startTs = System.currentTimeMillis();
        JCas jcas = UimaUtils.runAE(conceptMappingAE, text, inputFormat, null);
        FSIndex fsindex = jcas.getAnnotationIndex(ConceptAnnotation.type);
        for (Iterator<ConceptAnnotation> it = fsindex.iterator(); it.hasNext(); ) {
          ConceptAnnotation annotation = it.next();
          annotations.add(annotation);
        }
        CollectionUtils.filter(annotations, new StyGroupPredicate(styGroupFilter));
        CollectionUtils.filter(annotations, new StyCodePredicate(styCodeFilter));
        annotations = filterSubsumedConcepts(q, annotations);
        if (annotations.size() == 0) {
          mav.addObject("error", "No concepts found");
        } else {
          mav.addObject("text", text);
          mav.addObject("annotations", annotations);
          long endTs = System.currentTimeMillis();
          mav.addObject("elapsed", new Long(endTs - startTs));
        }
        setViewName(mav, outputFormat, outputFormatStyle);
      }
    } catch (Exception e) {
      mav.addObject("error", e.getMessage());
      setViewName(mav, outputFormat, outputFormatStyle);
    }
    return mav;
  }