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; }
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; }