/** * Inverts this mapping. This operation changes source and target entities of the correspondences * as well as replaces the semantic relations with inverse relations. */ public void invert() { String sourceEntity; String targetEntity; SemanticRelation semanticRelation; for (Correspondence c : this.correspondences) { sourceEntity = c.getSourceEntityUri(); targetEntity = c.getTargetEntityUri(); semanticRelation = c.getRelation(); try { c.setSourceEntityUri(targetEntity); c.setTargetEntityUri(sourceEntity); } catch (CorrespondenceException e) { // cannot occur in this context } c.setRelation(semanticRelation.getInverse()); } }