From d81b086fe329fa69891eba0a4b1f73e44183620d Mon Sep 17 00:00:00 2001 From: RncLsn Date: Wed, 20 May 2015 18:52:47 +0100 Subject: Added more tests. Querying of the upper bound is currently unstable. --- src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java | 126 ++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java (limited to 'src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java') diff --git a/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java new file mode 100644 index 0000000..be6627a --- /dev/null +++ b/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java @@ -0,0 +1,126 @@ +package uk.ac.ox.cs.pagoda.util; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +public class PagodaProperties { + + public static final String CONFIG_FILE = "pagoda.properties"; + + public static final boolean DEFAULT_DEBUG = false; + public static boolean shellModeDefault = false; + private static boolean debug = DEFAULT_DEBUG; + + static { + try(InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) { + Properties config = new Properties(); + config.load(in); + in.close(); + if(config.containsKey("debug")) { + debug = Boolean.parseBoolean(config.getProperty("debug")); + } + } catch(IOException e) { + e.printStackTrace(); + } + } + + String dataPath = null; + String ontologyPath; + String queryPath = null; + String answerPath = null; + boolean toClassify = true; + boolean toCallHermiT = true; + boolean shellMode = shellModeDefault; + + public PagodaProperties(String path) { + java.util.Properties m_properties = new java.util.Properties(); + InputStream inputStream = null; + try { + inputStream = new FileInputStream(path); + m_properties.load(inputStream); + + setOntologyPath(m_properties.getProperty("ONTOLOGY")); + setDataPath(m_properties.getProperty("DATA")); + setQueryPath(m_properties.getProperty("QUERY")); + setAnswerPath(m_properties.getProperty("ANSWER")); + setToClassify(Boolean.parseBoolean(m_properties.getProperty("TO_CLASSIFY"))); + setToCallHermiT(Boolean.parseBoolean(m_properties.getProperty("CALL_HERMIT"))); + + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (inputStream != null) + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public PagodaProperties() { + } + + public static boolean isDebuggingMode() { + return debug; + } + + public String getDataPath() { + return dataPath; + } + + public void setDataPath(String path) { + dataPath = path; + } + + public String getOntologyPath() { + return ontologyPath; + } + + public void setOntologyPath(String path) { + ontologyPath = path; + } + + public String getQueryPath() { + return queryPath; + } + + public void setQueryPath(String path) { + queryPath = path; + } + + public String getAnswerPath() { + return answerPath; + } + + public void setAnswerPath(String path) { + answerPath = path; + } + + public boolean getToClassify() { + return toClassify; + } + + public void setToClassify(boolean flag) { + toClassify = flag; + } + + public boolean getToCallHermiT() { + return toCallHermiT; + } + + public void setToCallHermiT(boolean flag) { + toCallHermiT = flag; + } + + public boolean getShellMode() { + return shellMode; + } + + public void setShellMode(boolean flag) { + shellMode = flag; + } + +} -- cgit v1.2.3