public void importAnnotationMapping(AnnotationMapping iam) { List<VersionMetadata> metadata = APIFactory.getInstance() .getAnnotationAPI() .checkInvolvedVersion(iam.getSrcVersion(), iam.getTargetVersion()); APIFactory.getInstance().getAnnotationAPI().importMapping(metadata, iam); }
public static Map<Integer, List<EntityAnnotation>> groupByItem(AnnotationMapping corSet) { HashMap<Integer, List<EntityAnnotation>> groups = new HashMap<Integer, List<EntityAnnotation>>(); for (EntityAnnotation cor : corSet.getAnnotations()) { List<EntityAnnotation> umlsCon = groups.get(cor.getSrcId()); if (umlsCon == null) { umlsCon = new ArrayList<EntityAnnotation>(); groups.put(cor.getSrcId(), umlsCon); } umlsCon.add(cor); } return groups; }
public static HashMap<Integer, List<Integer>> groupSimilarUMLSConsByCommonToken( EncodedEntityStructure umlsGroup, int srcId, AnnotationMapping am) { HashMap<Integer, List<Integer>> umlsGroups = new HashMap<Integer, List<Integer>>(); Map<Integer, Set<Integer>> conceptToEvidenceSet = new HashMap<Integer, Set<Integer>>(); for (int targetId : umlsGroup.getObjIds().keySet()) { long anid = CantorDecoder.code(srcId, targetId); Set<Integer> evidence = am.getEvidenceMap().get(anid); conceptToEvidenceSet.put(targetId, evidence); for (int tid : evidence) { List<Integer> group = umlsGroups.get(tid); if (group == null) { group = new ArrayList<Integer>(); umlsGroups.put(tid, group); } group.add(targetId); } } Map<Integer, Set<Integer>> conceptTosupersets = getSupersetConceptRelationships(conceptToEvidenceSet); for (Entry<Integer, List<Integer>> entry : umlsGroups.entrySet()) { for (int i = 0; i < entry.getValue().size(); i++) { int concept = entry.getValue().get(i); if (conceptTosupersets.containsKey(concept)) { boolean found = false; Set<Integer> supersetConcepts = conceptTosupersets.get(concept); for (int superConcept : entry.getValue()) { if (supersetConcepts.contains(superConcept)) { found = true; break; } } if (found) { entry.getValue().remove(i); i--; } } } } return umlsGroups; }