コード例 #1
0
ファイル: Alignment.java プロジェクト: anukat2015/Swip
  /**
   * 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());
    }
  }