Пример #1
0
  public static void testWithDatabase() {
    TRepository.setDatabaseProperties();
    boolean dbInsert = true;
    Manager manager = new Manager();

    DataImport importer = manager.getImporter();
    importer.dropRepositorySchema();
    importer.createRepositorySchema();
    for (int i = 0; i < data3.length; i++) {
      OWLParser_V3 par = new OWLParser_V3(dbInsert);
      String srcFile = (directory + data3[i][0]).replace("\\", "/");
      int srcId = par.parseSingleSource(srcFile);
      String trgFile = (directory + data3[i][1]).replace("\\", "/");
      int trgId = par.parseSingleSource(trgFile);

      manager.loadRepository();

      RDFAlignmentParser parser = new RDFAlignmentParser(manager, dbInsert);
      String alignFile = directory + data3[i][2];
      parser.loadOWLAlignmentFile(alignFile, null, srcFile, trgFile);
      MatchResult result = manager.loadMatchResult(srcId, trgId, parser.getMappingId());
      assertEquals(Integer.parseInt(data3[i][3]), result.getMatchCount());
    }

    manager.closeDatabaseConnection();
  }
Пример #2
0
  public static void testWithoutDatabase() {
    for (int i = 0; i < data3.length; i++) {
      boolean dbInsert = false;
      OWLParser_V3 par = new OWLParser_V3(dbInsert);
      String srcFile = directory + data3[i][0];
      par.parseSingleSource(srcFile);
      Graph srcGraph = par.getGraph();
      String trgFile = directory + data3[i][1];
      par.parseSingleSource(trgFile);
      Graph trgGraph = par.getGraph();

      RDFAlignmentParser parser = new RDFAlignmentParser(null, dbInsert);
      String alignFile = directory + data3[i][2];
      MatchResult result = parser.loadOWLAlignmentFile(null, alignFile, srcGraph, trgGraph);
      assertEquals(Integer.parseInt(data3[i][3]), result.getMatchCount());
    }
  }
Пример #3
0
  /**
   * executes the specified selection for the given result
   *
   * @param result MatchResult (either array or db based)
   * @return MatchResult with the selected correspondences
   */
  public MatchResult select(MatchResult result) {
    // nothing to select
    if (result == null) {
      return null;
    }
    // nothing to select therefore return copy of result
    if (result.getMatchCount() <= 0
        || result.getSrcObjects().isEmpty()
        || result.getTrgObjects().isEmpty()) return result.clone();
    if ((selection == SEL_MAXN && maxN <= 0)
        || (selection == SEL_DELTA && delta <= 0)
        || (selection == SEL_THRESHOLD && threshold <= 0)) return result.clone();

    if (selection == SEL_MULTIPLE) {
      if (maxN <= 0 && delta <= 0 && threshold <= 0) {
        // nothing to select therefore return copy of result
        return result.clone();
      } else if (maxN > 0 && delta <= 0 && threshold <= 0) {
        // only maxn selection, for optimization change from multiple
        selection = SEL_MAXN;
      } else if (maxN <= 0 && delta > 0 && threshold <= 0) {
        // only delta selection, for optimization change from multiple
        selection = SEL_DELTA;
      } else if (maxN <= 0 && delta <= 0 && threshold > 0) {
        // only threshold selection, for optimization change from multiple
        selection = SEL_THRESHOLD;
      }
    }

    int kind = MatchResult.getMatchResultKind(result);
    if (kind == MatchResult.UNDEF) {
      return null;
    }

    switch (kind) {
      case MatchResult.ARRAY:
        return selectArray((MatchResultArray) result);
    }
    return null;
  }