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

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

本文整理了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

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

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

  1. private void buildParentsMap() {
  2. parentToChildren = new HashMap<String, Set<String>>();
  3. for (String child : childToParents.keySet()) {
  4. Set<String> parents = childToParents.get(child);
  5. for (String parent : parents) {
  6. if (!StringUtils.isEmpty(child) && !StringUtils.isEmpty(parent)) {
  7. Util.addToSetMap(parentToChildren, parent, child);
  8. }
  9. }
  10. }
  11. }

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

  1. private void setReverseReferences() {
  2. Map<String, Set<String>> partOfsCopy = new HashMap<String, Set<String>>(partOfs);
  3. for (Map.Entry<String, Set<String>> entry : partOfsCopy.entrySet()) {
  4. String oboTerm = entry.getKey();
  5. Set<String> parents = new HashSet<String>(entry.getValue());
  6. for (String parent : parents) {
  7. if (parent.equals(CHROMOSOME)) {
  8. continue;
  9. }
  10. if (!StringUtils.isEmpty(oboTerm) && !StringUtils.isEmpty(parent)) {
  11. Util.addToSetMap(reversePartOfs, parent, oboTerm);
  12. }
  13. }
  14. }
  15. }

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

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

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

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

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

  1. private Map<String, Set<String>> removeRelationshipFromChildren(Map<String, Set<String>> map1,
  2. Map<String, Set<String>> map2, Map<String, Set<String>> invalidPartOfs, String parent,
  3. String collectionName) {
  4. Set<String> children = parentToChildren.get(parent);
  5. if (children == null) {
  6. return Collections.emptyMap();
  7. }
  8. for (String child : children) {
  9. // this relationship is in config, so we can't delete
  10. // remove parent relationship instead
  11. if (isManyToMany(collectionName, child)) {
  12. if (!StringUtils.isEmpty(collectionName) && !StringUtils.isEmpty(parent)) {
  13. Util.addToSetMap(invalidPartOfs, parent, collectionName);
  14. }
  15. continue;
  16. }
  17. removeRelationship(map1, map2, child, collectionName);
  18. removeRelationshipFromChildren(map1, map2, invalidPartOfs, child, collectionName);
  19. }
  20. return invalidPartOfs;
  21. }

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

  1. private void processAdditionalConverters(Attributes attrs) {
  2. String fullyQualifiedName = attrs.getValue("class-name");
  3. String constraintPath = attrs.getValue("constraint-path");
  4. String targetType = attrs.getValue("target-type");
  5. String title = attrs.getValue("title");
  6. String urlField = attrs.getValue("urlField");
  7. ClassDescriptor typeCld = model.getClassDescriptorByName(targetType);
  8. if (typeCld == null) {
  9. LOG.warn("Invalid target type for additional converter: " + targetType);
  10. return;
  11. }
  12. try {
  13. new Path(model, constraintPath);
  14. } catch (PathException e) {
  15. LOG.warn("Can't add converter to bag-queries.xml, constraint-path '" + constraintPath
  16. + "' isn't in " + model.getName() + " model.");
  17. return;
  18. }
  19. Set<String> clds = new HashSet<String>();
  20. clds.add(typeCld.getName());
  21. for (ClassDescriptor cld : model.getAllSubs(typeCld)) {
  22. clds.add(cld.getName());
  23. }
  24. AdditionalConverter additionalConverter = new AdditionalConverter(constraintPath,
  25. targetType, fullyQualifiedName, title, urlField);
  26. for (String nextCld : clds) {
  27. Util.addToSetMap(additionalConverters, TypeUtil.unqualifiedName(nextCld),
  28. additionalConverter);
  29. }
  30. }

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

  1. private void processAdditionalConverters(Attributes attrs) {
  2. String fullyQualifiedName = attrs.getValue("class-name");
  3. String constraintPath = attrs.getValue("constraint-path");
  4. String targetType = attrs.getValue("target-type");
  5. String title = attrs.getValue("title");
  6. String urlField = attrs.getValue("urlField");
  7. ClassDescriptor typeCld = model.getClassDescriptorByName(targetType);
  8. if (typeCld == null) {
  9. LOG.warn("Invalid target type for additional converter: " + targetType);
  10. return;
  11. }
  12. try {
  13. new Path(model, constraintPath);
  14. } catch (PathException e) {
  15. LOG.warn("Can't add converter to bag-queries.xml, constraint-path '" + constraintPath
  16. + "' isn't in " + model.getName() + " model.");
  17. return;
  18. }
  19. Set<String> clds = new HashSet<String>();
  20. clds.add(typeCld.getName());
  21. for (ClassDescriptor cld : model.getAllSubs(typeCld)) {
  22. clds.add(cld.getName());
  23. }
  24. AdditionalConverter additionalConverter = new AdditionalConverter(constraintPath,
  25. targetType, fullyQualifiedName, title, urlField);
  26. for (String nextCld : clds) {
  27. Util.addToSetMap(additionalConverters, TypeUtil.unqualifiedName(nextCld),
  28. additionalConverter);
  29. }
  30. }

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

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

相关文章