예제 #1
0
  /** Sets up the default matching configuration for the ontologies */
  public void defaultConfig() {
    bkSources = new Vector<String>();
    File ontRoot = new File(BK_PATH);
    if (ontRoot.exists()) {
      FileFilter ont =
          new ExtensionFilter(
              "Ontology Files (*.owl, *.rdf, *.rdfs, *.xml)",
              new String[] {".owl", ".rdf", ".rdfs", ".xml"},
              false);
      File[] ontFiles = ontRoot.listFiles(ont);
      for (File f : ontFiles) bkSources.add(f.getName());
      FileFilter lex =
          new ExtensionFilter("Lexicon Files (*.lexicon)", new String[] {".lexicon"}, false);
      File[] lexFiles = ontRoot.listFiles(lex);
      for (File f : lexFiles) bkSources.add(f.getName());
      bkSources.add("WordNet");
    } else {
      System.out.println("WARNING: 'store/knowledge' directory not found!");
    }
    selectedSources = new Vector<String>(bkSources);

    size = SizeCategory.getSizeCategory();
    lang = LanguageSetting.getLanguageSetting();
    languages = new HashSet<String>();
    for (String s : source.getLexicon().getLanguages())
      if (target.getLexicon().getLanguages().contains(s)) languages.add(s);
    if (languages.contains("en") || languages.size() == 0) language = "en";
    else language = languages.iterator().next();
    matchSteps = new Vector<MatchStep>();
    if (lang.equals(LanguageSetting.TRANSLATE)) matchSteps.add(MatchStep.TRANSLATE);
    matchSteps.add(MatchStep.LEXICAL);
    if (lang.equals(LanguageSetting.SINGLE)) matchSteps.add(MatchStep.BK);
    if (!size.equals(SizeCategory.HUGE)) matchSteps.add(MatchStep.WORD);
    matchSteps.add(MatchStep.STRING);
    if (size.equals(SizeCategory.SMALL) || size.equals(SizeCategory.MEDIUM))
      matchSteps.add(MatchStep.STRUCT);
    double sourceRatio =
        (source.dataPropertyCount() + source.objectPropertyCount()) * 1.0 / source.classCount();
    double targetRatio =
        (target.dataPropertyCount() + target.objectPropertyCount()) * 1.0 / target.classCount();
    if (sourceRatio >= 0.05 && targetRatio >= 0.05) matchSteps.add(MatchStep.PROPERTY);
    if (size.equals(SizeCategory.HUGE)) matchSteps.add(MatchStep.OBSOLETE);
    matchSteps.add(MatchStep.SELECT);
    matchSteps.add(MatchStep.REPAIR);
    hierarchic = true;
    wms = WordMatchStrategy.AVERAGE;
    ssm = StringSimMeasure.ISUB;
    primaryStringMatcher = size.equals(SizeCategory.SMALL);
    nss = NeighborSimilarityStrategy.DESCENDANTS;
    directNeighbors = false;
    sType = SelectionType.getSelectionType();
    structuralSelection = size.equals(SizeCategory.HUGE);
    flagSteps = new Vector<Problem>();
    for (Problem f : Problem.values()) flagSteps.add(f);
  }
예제 #2
0
 public void setSelectionType(SelectionType s) {
   if (s == null) sType = SelectionType.getSelectionType();
   else sType = s;
 }