/**
   * Returns Associated Concepts
   *
   * @param scheme
   * @param version
   * @param code
   * @param assocName
   * @param forward
   * @return
   */
  public Vector<String> getAssociatedConcepts(String cui, boolean parents) {

    Vector<String> v = new Vector<String>();

    try {
      LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
      MetaBrowserService mbs =
          (MetaBrowserService) lbSvc.getGenericExtension("metabrowser-extension");
      if (mbs == null) {
        _logger.error("Error! metabrowser-extension is null!");
      }

      Map<String, List<RelationshipTabResults>> map = null;
      map = mbs.getRelationshipsDisplay(cui, null, Direction.SOURCEOF);

      Iterator it = map.entrySet().iterator();
      while (it.hasNext()) {
        Entry thisEntry = (Entry) it.next();
        String rel = (String) thisEntry.getKey();
        List<RelationshipTabResults> relations =
            (List<RelationshipTabResults>) thisEntry.getValue();

        // for (String rel : map.keySet()) {
        // List<RelationshipTabResults> relations = map.get(rel);

        // Add parents
        if (parents && _hierAssocToChildNodes.contains(rel)) {
          for (RelationshipTabResults result : relations) {
            String name = result.getName();
            if (!v.contains(name)) v.add(name);
          }
        }

        // Add children
        if (!parents && _hierAssocToParentNodes.contains(rel)) {
          for (RelationshipTabResults result : relations) {
            String name = result.getName();
            if (!v.contains(name)) v.add(name);
          }
        }
      }

    } catch (Exception ex) {
      _logger.warn(ex.getMessage());
    }
    return v;
  }
  /**
   * Get concept Entity by code
   *
   * @param codingScheme
   * @param code
   * @return
   */
  public ResolvedConceptReference getConceptByCode(String codingScheme, String code) {
    CodedNodeSet cns = null;
    ResolvedConceptReferencesIterator iterator = null;

    try {
      LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
      cns = lbSvc.getCodingSchemeConcepts(codingScheme, null);
      ConceptReferenceList crefs = createConceptReferenceList(new String[] {code}, codingScheme);
      cns.restrictToCodes(crefs);
      iterator = cns.resolve(null, null, null);
      if (iterator.numberRemaining() > 0) {
        ResolvedConceptReference ref = (ResolvedConceptReference) iterator.next();
        return ref;
      }
    } catch (LBException e) {
      _logger.info("Error: " + e.getMessage());
    }

    return null;
  }
  /**
   * Return a list of Association names
   *
   * @param scheme
   * @param version
   * @return
   */
  public Vector<String> getAssociationNames(String scheme, String version) {
    Vector<String> association_vec = new Vector<String>();
    try {
      LexBIGService lbSvc = RemoteServerUtil.createLexBIGService();
      CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag();
      if (version != null) {
        versionOrTag.setVersion(version);
      }
      CodingScheme cs = lbSvc.resolveCodingScheme(scheme, versionOrTag);

      SupportedHierarchy[] hierarchies = cs.getMappings().getSupportedHierarchy();
      String[] ids = hierarchies[0].getAssociationNames();
      for (int i = 0; i < ids.length; i++) {
        if (!association_vec.contains(ids[i])) {
          association_vec.add(ids[i]);
          _logger.debug("AssociationName: " + ids[i]);
        }
      }
    } catch (Exception ex) {
      _logger.warn(ex.getMessage());
    }
    return association_vec;
  }