org.intermine.metadata.Util.addToSetMap()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.intermine.metadata.Util.addToSetMap()方法的一些代码示例,展示了Util.addToSetMap()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.addToSetMap()方法的具体详情如下:
包路径:org.intermine.metadata.Util
类名称:Util
方法名:addToSetMap

Util.addToSetMap介绍

[英]Add a value to a Map from keys to Set of values, creating the value list as needed.
[中]将值添加到从键到值集的映射中,根据需要创建值列表。

代码示例

代码示例来源:origin: org.intermine/bio-core

private void assignPartOf(String parent, String child) {
  if (!StringUtils.isEmpty(child) && !StringUtils.isEmpty(parent)) {
    Util.addToSetMap(partOfs, child, parent);
  }
}

代码示例来源:origin: org.intermine/bio-core

private void buildParentsMap() {
  parentToChildren = new HashMap<String, Set<String>>();
  for (String child : childToParents.keySet()) {
    Set<String> parents = childToParents.get(child);
    for (String parent : parents) {
      if (!StringUtils.isEmpty(child) && !StringUtils.isEmpty(parent)) {
        Util.addToSetMap(parentToChildren, parent, child);
      }
    }
  }
}

代码示例来源:origin: org.intermine/bio-core

private void setReverseReferences() {
  Map<String, Set<String>> partOfsCopy = new HashMap<String, Set<String>>(partOfs);
  for (Map.Entry<String, Set<String>> entry : partOfsCopy.entrySet()) {
    String oboTerm = entry.getKey();
    Set<String> parents = new HashSet<String>(entry.getValue());
    for (String parent : parents) {
      if (parent.equals(CHROMOSOME)) {
        continue;
      }
      if (!StringUtils.isEmpty(oboTerm) && !StringUtils.isEmpty(parent)) {
        Util.addToSetMap(reversePartOfs, parent, oboTerm);
      }
    }
  }
}

代码示例来源:origin: org.intermine/bio-core

/**
   * Parse all xref, some gene will have multiple id from same source
   * e.g. P2RX5 HGNC:8536|MIM:602836|Ensembl:ENSG00000083454|Ensembl:ENSG00000257950|HPRD:09110|
   * Vega:OTTHUMG00000090700|Vega:OTTHUMG00000169623
   *
   * @param xrefs a "|" separated string
   * @return a map of xrefs
   */
  private static Map<String, Set<String>> parseXrefs(String xrefs) {
    Map<String, Set<String>> xrefMap = new HashMap<String, Set<String>>();
    for (String xref : xrefs.split("\\|")) {
      if (!xref.startsWith("-")) {
        String[] bits = xref.split(":", 2);
        Util.addToSetMap(xrefMap, bits[0], bits[1]);
      }
    }
    return xrefMap;
  }
}

代码示例来源:origin: org.intermine/bio-core

String parent = bits[1];
if (!StringUtils.isEmpty(parent) && !StringUtils.isEmpty(child)) {
  Util.addToSetMap(manyToMany, child, parent.trim());

代码示例来源:origin: org.intermine/bio-core

private Map<String, Set<String>> removeRelationshipFromChildren(Map<String, Set<String>> map1,
    Map<String, Set<String>> map2, Map<String, Set<String>> invalidPartOfs, String parent,
    String collectionName) {
  Set<String> children = parentToChildren.get(parent);
  if (children == null) {
    return Collections.emptyMap();
  }
  for (String child : children) {
    // this relationship is in config, so we can't delete
    // remove parent relationship instead
    if (isManyToMany(collectionName, child)) {
      if (!StringUtils.isEmpty(collectionName) && !StringUtils.isEmpty(parent)) {
        Util.addToSetMap(invalidPartOfs, parent, collectionName);
      }
      continue;
    }
    removeRelationship(map1, map2, child, collectionName);
    removeRelationshipFromChildren(map1, map2, invalidPartOfs, child, collectionName);
  }
  return invalidPartOfs;
}

代码示例来源:origin: org.intermine/intermine-api

private void processAdditionalConverters(Attributes attrs) {
  String fullyQualifiedName = attrs.getValue("class-name");
  String constraintPath = attrs.getValue("constraint-path");
  String targetType = attrs.getValue("target-type");
  String title = attrs.getValue("title");
  String urlField = attrs.getValue("urlField");
  ClassDescriptor typeCld = model.getClassDescriptorByName(targetType);
  if (typeCld == null) {
    LOG.warn("Invalid target type for additional converter: " + targetType);
    return;
  }
  try {
    new Path(model, constraintPath);
  } catch (PathException e) {
    LOG.warn("Can't add converter to bag-queries.xml, constraint-path '" + constraintPath
        + "' isn't in " + model.getName() + " model.");
    return;
  }
  Set<String> clds = new HashSet<String>();
  clds.add(typeCld.getName());
  for (ClassDescriptor cld : model.getAllSubs(typeCld)) {
    clds.add(cld.getName());
  }
  AdditionalConverter additionalConverter = new AdditionalConverter(constraintPath,
      targetType, fullyQualifiedName, title, urlField);
  for (String nextCld : clds) {
    Util.addToSetMap(additionalConverters, TypeUtil.unqualifiedName(nextCld),
        additionalConverter);
  }
}

代码示例来源:origin: intermine/intermine

private void processAdditionalConverters(Attributes attrs) {
  String fullyQualifiedName = attrs.getValue("class-name");
  String constraintPath = attrs.getValue("constraint-path");
  String targetType = attrs.getValue("target-type");
  String title = attrs.getValue("title");
  String urlField = attrs.getValue("urlField");
  ClassDescriptor typeCld = model.getClassDescriptorByName(targetType);
  if (typeCld == null) {
    LOG.warn("Invalid target type for additional converter: " + targetType);
    return;
  }
  try {
    new Path(model, constraintPath);
  } catch (PathException e) {
    LOG.warn("Can't add converter to bag-queries.xml, constraint-path '" + constraintPath
        + "' isn't in " + model.getName() + " model.");
    return;
  }
  Set<String> clds = new HashSet<String>();
  clds.add(typeCld.getName());
  for (ClassDescriptor cld : model.getAllSubs(typeCld)) {
    clds.add(cld.getName());
  }
  AdditionalConverter additionalConverter = new AdditionalConverter(constraintPath,
      targetType, fullyQualifiedName, title, urlField);
  for (String nextCld : clds) {
    Util.addToSetMap(additionalConverters, TypeUtil.unqualifiedName(nextCld),
        additionalConverter);
  }
}

代码示例来源:origin: org.intermine/bio-core

assignPartOf(parent, child);
} else if ("is_a".equals(relationshipType) && r.direct) {
  Util.addToSetMap(childToParents, child, parent);

相关文章