@Override
  public SearchConfiguration merge(SearchConfiguration other) {
    if (other == null) {
      return this;
    }

    // set the documentRef to the other UITypesConfiguration to continue
    // merging, if needed
    docRef = other.getDocumentRef();
    if (allowedContentViews.isEmpty() && !other.getAllowedContentViewNames().isEmpty()) {
      this.allowedContentViews = Collections.unmodifiableList(other.getAllowedContentViewNames());
      canMerge = false;
    }

    return this;
  }
Example #2
0
  public Configuration(long seed) throws IOException {
    this.seed = seed;
    searchConfiguration = new SearchConfiguration(seed);
    cyclonConfiguration =
        new CyclonConfiguration(
            seed, 5, 10, 1000, 500000, (long) (Integer.MAX_VALUE - Integer.MIN_VALUE), 20);

    String c = File.createTempFile("bootstrap.", ".conf").getAbsolutePath();
    bootConfiguration.store(c);
    System.setProperty("bootstrap.configuration", c);

    c = File.createTempFile("cyclon.", ".conf").getAbsolutePath();
    cyclonConfiguration.store(c);
    System.setProperty("cyclon.configuration", c);

    c = File.createTempFile("search.", ".conf").getAbsolutePath();
    searchConfiguration.store(c);
    System.setProperty("search.configuration", c);
  }
  public static SearchConfiguration getDefaultConfig() {
    SearchConfiguration conf = new SearchConfiguration();

    conf.aBoxInBG = true;
    conf.tBoxInBG = false;
    conf.searchType = SearchConfiguration.SearchType.UNIFORM_COST;
    conf.treeType = SearchConfiguration.TreeType.REITER;
    conf.numOfLeadingDiags = 9;
    conf.qss = SearchConfiguration.QSS.MINSCORE;
    conf.reduceIncoherency = false;
    conf.minimizeQuery = true;
    conf.calcAllDiags = false;
    conf.inclEntSubClass = true;
    conf.incEntClassAssert = true;
    conf.incEntEquivClass = false;
    conf.incEntDisjClasses = false;
    conf.incEntPropAssert = false;
    conf.incOntolAxioms = false;
    conf.incAxiomsRefThing = false;
    conf.entailmentCalThres = 0.01;

    return conf;
  }
  public static SearchConfiguration readConfiguration() {
    String userHome = System.getProperty("user.home");
    if (userHome == null) throw new IllegalStateException("user home directory is null");
    File confFile = new File(new File(userHome), "querydebugger.properties");

    Properties properties = new Properties();
    SearchConfiguration c = new SearchConfiguration();

    if (!confFile.exists()) {
      writeConfiguration(getDefaultConfig());
      return getDefaultConfig();
    }

    try {
      properties.load(new FileInputStream(confFile));
    } catch (IOException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }

    c.aBoxInBG = Boolean.parseBoolean((String) properties.get("aBoxInBG"));
    c.tBoxInBG = Boolean.parseBoolean((String) properties.get("tBoxInBG"));
    c.numOfLeadingDiags = Integer.parseInt((String) properties.get("numOfLeadingDiags"));
    c.searchType = parseSearchType((String) properties.get("searchType"));
    c.treeType = parseTreeType((String) properties.get("treeType"));
    c.qss = parseQSS((String) properties.get("qss"));
    c.reduceIncoherency = Boolean.parseBoolean((String) properties.get("reduceIncoherency"));
    c.minimizeQuery = Boolean.parseBoolean((String) properties.get("minimizeQuery"));
    c.calcAllDiags = Boolean.parseBoolean((String) properties.get("calcAllDiags"));

    c.inclEntSubClass = Boolean.parseBoolean((String) properties.get("inclEntSubClass"));
    c.incEntClassAssert = Boolean.parseBoolean((String) properties.get("incEntClassAssert"));
    c.incEntEquivClass = Boolean.parseBoolean((String) properties.get("incEntEquivClass"));
    c.incEntDisjClasses = Boolean.parseBoolean((String) properties.get("incEntDisjClasses"));
    c.incEntPropAssert = Boolean.parseBoolean((String) properties.get("incEntPropAssert"));
    c.incOntolAxioms = Boolean.parseBoolean((String) properties.get("incOntolAxioms"));
    c.incAxiomsRefThing = Boolean.parseBoolean((String) properties.get("incAxiomsRefThing"));
    c.entailmentCalThres = Double.parseDouble((String) properties.get("entailmentCalThres"));

    try {
      properties.store(new FileOutputStream(confFile), null);
    } catch (IOException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }

    return c;
  }