A helper function to collect synonyms as well as label of ontologyterm

@return a list of synonyms plus label
428422
public Set<String> getOtLabelAndSynonyms(OntologyTerm ontologyTerm) {
    Set<String> allTerms = Sets.newLinkedHashSet(ontologyTerm.getSynonyms());
    allTerms.add(ontologyTerm.getLabel());
    return allTerms;
  }
312572
def get_ontology(self, id=None, uri=None, match=None):
        

        if not id and not uri and not match:
            return None

        if type(id) == type("string"):
            uri = id
            id = None
            if not is_http(uri):
                match = uri
                uri = None
        if match:
            if type(match) != type("string"):
                return []
            res = []
            for x in self.all_ontologies:
                if match.lower() in x.uri.lower():
                    res += [x]
            return res
        else:
            for x in self.all_ontologies:
                if id and x.id == id:
                    return x
                if uri and x.uri.lower() == uri.lower():
                    return x
            return None
717364
public Collection<Label> list(String name)
    {
        List<Label> ret = new ArrayList<Label>();
        Collection<Label> labels = list();
        for(Label label : labels)
        {
            if(name == null || label.getKey().toLowerCase().indexOf(name) != -1)
                ret.add(label);
        }
        return ret;
    }
259227
public List<SyntacticCategory> getArgumentList() {
    if (isAtomic()) {
      return Lists.newArrayList();
    } else {
      List<SyntacticCategory> args = getReturn().getArgumentList();
      args.add(getArgument());
      return args;
    }
  }
460352
private OntologyTermSynonym createSynonym(String synonym) {
    OntologyTermSynonym entity = ontologyTermSynonymFactory.create();
    entity.setId(idGenerator.generateId());
    entity.setOntologyTermSynonym(synonym);
    synonymRepository.add(entity);
    return entity;
  }
378613
def labels(self):
        
        return [
            name for name in os.listdir(self.root)
            if os.path.isdir(os.path.join(self.root, name))
        ]
953369
def labels(self):
        """"""
        if not self.is_tagged(LABEL):
            self.tag_labels()
        return [word[LABEL] for word in self.words]
349138
public java.util.List<String> getLabels() {
        if (labels == null) {
            labels = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return labels;
    }
877310
def index_synonym(self, syn, ont):
        
        if not syn.val:
            if syn.pred == 'label':
                if not self._is_meaningful_ids():
                    if not ont.is_obsolete(syn.class_id):
                        pass
                        #logging.error('Use meaningful ids if label not present: {}'.format(syn))
            else:
                logging.warning("Incomplete syn: {}".format(syn))
            return
        if self.exclude_obsolete and ont.is_obsolete(syn.class_id):
            return

        syn.ontology = ont
        prefix,_ = ont.prefix_fragment(syn.class_id)
        
        v = syn.val

        caps_match = re.match('[A-Z]+',v)
        if caps_match:
            # if > 75% of length is caps, assume abbreviation
            if caps_match.span()[1] >= len(v)/3:
                syn.is_abbreviation(True)
                
        # chebi 'synonyms' are often not real synonyms
        # https://github.com/ebi-chebi/ChEBI/issues/3294
        if not re.match('.*[a-zA-Z]',v):
            if prefix != 'CHEBI':
                logging.warning('Ignoring suspicous synonym: {}'.format(syn))
            return
        
        v = self._standardize_label(v)

        # TODO: do this once ahead of time
        wsmap = {}
        for w,s in self.wsmap.items():
            wsmap[w] = s
        for ss in self._get_config_val(prefix,'synsets',[]):
            # TODO: weights
            wsmap[ss['synonym']] = ss['word']
        nv = self._normalize_label(v, wsmap)
        
        self._index_synonym_val(syn, v)
        nweight = self._get_config_val(prefix, 'normalized_form_confidence', 0.8)
        if nweight > 0 and not syn.is_abbreviation():
            if nv != v:
                nsyn = Synonym(syn.class_id,
                               val=syn.val,
                               pred=syn.pred,
                               lextype=syn.lextype,
                               ontology=ont,
                               confidence=syn.confidence * nweight)
                self._index_synonym_val(nsyn, nv)
148728
def lookup_synonyms(self, lems):
        
        final_synonyms = []
        if type(lems) == list:
            for lemma in lems:
                if lemma.lower() in self.synonyms.keys():
                    syns = self.synonyms[lemma.lower()]
                    synlist = []
                    for syn in syns:
                        synlist.append((syn, 1/len(syns)))
                    synobj = (lemma, synlist)
                    final_synonyms.append(synobj)
                else:
                    pass
        if type(lems) == str:
            if lems.lower() in self.synonyms.keys():
                syns = self.synonyms[lems.lower()]
                synlist = []
                for syn in syns:
                    synlist.append((syn, 1/len(syns)))
                synobj = (lems, synlist)
                final_synonyms.append(synobj)
            else:
                pass
        return final_synonyms
1259565
def decoratornames(self):
        
        result = set()
        decoratornodes = []
        if self.decorators is not None:
            decoratornodes += self.decorators.nodes
        decoratornodes += self.extra_decorators
        for decnode in decoratornodes:
            try:
                for infnode in decnode.infer():
                    result.add(infnode.qname())
            except exceptions.InferenceError:
                continue
        return result
1159838
public Set<Synset> getHypernyms(@NonNull Synset node) {
        return getRelatedSynsets(node, WordNetRelation.HYPERNYM);
    }
632822
@SuppressWarnings("squid:S1643") // Strings should not be concatenated using '+' in a loop
  Hit<OntologyTerm> findTags(Attribute attribute, List<String> ontologyIds) {
    String description =
        attribute.getDescription() == null ? attribute.getLabel() : attribute.getDescription();
    Set<String> searchTerms = splitIntoTerms(description);

    if (LOG.isDebugEnabled()) {
      LOG.debug("findAttributeOntologyTerms({},{},{})", ontologyIds, searchTerms, MAX_NUM_TAGS);
    }

    List<OntologyTerm> candidates =
        ontologyService.findOntologyTerms(ontologyIds, searchTerms, MAX_NUM_TAGS);

    if (LOG.isDebugEnabled()) {
      LOG.debug("Candidates: {}", candidates);
    }

    List<Hit<OntologyTerm>> hits =
        candidates
            .stream()
            .filter(
                ontologyTerm ->
                    filterOntologyTerm(
                        splitIntoTerms(Stemmer.stemAndJoin(searchTerms)), ontologyTerm))
            .map(
                ontologyTerm ->
                    Hit.create(
                        ontologyTerm, bestMatchingSynonym(ontologyTerm, searchTerms).getScore()))
            .sorted(Ordering.natural().reverse())
            .collect(toList());

    if (LOG.isDebugEnabled()) {
      LOG.debug("Hits: {}", hits);
    }

    Hit<OntologyTerm> result = null;
    String bestMatchingSynonym = null;
    for (Hit<OntologyTerm> hit : hits) {
      String bestMatchingSynonymForHit =
          bestMatchingSynonym(hit.getResult(), searchTerms).getResult();
      if (result == null) {
        result = hit;
        bestMatchingSynonym = bestMatchingSynonymForHit;
      } else {
        Set<String> jointTerms =
            Sets.union(
                splitIntoTerms(bestMatchingSynonym), splitIntoTerms(bestMatchingSynonymForHit));
        String joinedSynonyms = String.join(" ", jointTerms);
        Hit<OntologyTerm> joinedHit =
            Hit.create(
                OntologyTerm.and(result.getResult(), hit.getResult()),
                distanceFrom(joinedSynonyms, searchTerms));
        if (joinedHit.compareTo(result) > 0) {
          result = joinedHit;
          bestMatchingSynonym = bestMatchingSynonym + " " + bestMatchingSynonymForHit;
        }
      }

      if (LOG.isDebugEnabled()) {
        LOG.debug("result: {}", result);
      }
    }
    if (result != null && result.getScore() >= CUTOFF) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Tag {} with {}", attribute, result);
      }
      return result;
    }
    return null;
  }
808107
private List<String> getLabels(GDLParser.HeaderContext header) {
    if (header != null && header.label() != null) {
      return header
        .label()
        .stream()
        .map(RuleContext::getText)
        .map(x -> x.substring(1))
        .collect(Collectors.toList());
    }
    return null;
  }
917530
public List<String> parseOntologyTermQueries(OntologyTerm ontologyTerm) {
    List<String> queryTerms =
        getOtLabelAndSynonyms(ontologyTerm)
            .stream()
            .map(this::processQueryString)
            .collect(Collectors.toList());

    for (OntologyTerm childOt : ontologyService.getChildren(ontologyTerm)) {
      double boostedNumber =
          Math.pow(0.5, ontologyService.getOntologyTermDistance(ontologyTerm, childOt));
      getOtLabelAndSynonyms(childOt)
          .forEach(synonym -> queryTerms.add(parseBoostQueryString(synonym, boostedNumber)));
    }
    return queryTerms;
  }
704126
public List<Term> getAllTerms() {
        List<Term> ret = new ArrayList<Term>();

        if (terms != null) {
            ret.addAll(terms);
            for (final Term term : terms) {
                ret.addAll(term.getAllTerms());
            }
        }

        return ret;
    }
959661
@SuppressWarnings("unchecked")
  public static Map<String, String> getLabels(ObjectMeta metadata) {
    if (metadata != null) {
      Map<String, String> labels = metadata.getLabels();
      if (labels != null) {
        return labels;
      }
    }
    return Collections.EMPTY_MAP;
  }