aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java
diff options
context:
space:
mode:
authorRncLsn <rnc.lsn@gmail.com>2015-05-20 18:52:47 +0100
committerRncLsn <rnc.lsn@gmail.com>2015-05-20 18:52:47 +0100
commitd81b086fe329fa69891eba0a4b1f73e44183620d (patch)
tree7c55c80678660cdbd3dae18e94c4baf5b0680e11 /src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java
parent7a68441a541b12b22587fb53072193e1130049ff (diff)
downloadACQuA-d81b086fe329fa69891eba0a4b1f73e44183620d.tar.gz
ACQuA-d81b086fe329fa69891eba0a4b1f73e44183620d.zip
Added more tests.
Querying of the upper bound is currently unstable.
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java')
-rw-r--r--src/uk/ac/ox/cs/pagoda/util/PagodaProperties.java126
1 files changed, 126 insertions, 0 deletions
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 @@
1package uk.ac.ox.cs.pagoda.util;
2
3import java.io.FileInputStream;
4import java.io.IOException;
5import java.io.InputStream;
6import java.util.Properties;
7
8public class PagodaProperties {
9
10 public static final String CONFIG_FILE = "pagoda.properties";
11
12 public static final boolean DEFAULT_DEBUG = false;
13 public static boolean shellModeDefault = false;
14 private static boolean debug = DEFAULT_DEBUG;
15
16 static {
17 try(InputStream in = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE)) {
18 Properties config = new Properties();
19 config.load(in);
20 in.close();
21 if(config.containsKey("debug")) {
22 debug = Boolean.parseBoolean(config.getProperty("debug"));
23 }
24 } catch(IOException e) {
25 e.printStackTrace();
26 }
27 }
28
29 String dataPath = null;
30 String ontologyPath;
31 String queryPath = null;
32 String answerPath = null;
33 boolean toClassify = true;
34 boolean toCallHermiT = true;
35 boolean shellMode = shellModeDefault;
36
37 public PagodaProperties(String path) {
38 java.util.Properties m_properties = new java.util.Properties();
39 InputStream inputStream = null;
40 try {
41 inputStream = new FileInputStream(path);
42 m_properties.load(inputStream);
43
44 setOntologyPath(m_properties.getProperty("ONTOLOGY"));
45 setDataPath(m_properties.getProperty("DATA"));
46 setQueryPath(m_properties.getProperty("QUERY"));
47 setAnswerPath(m_properties.getProperty("ANSWER"));
48 setToClassify(Boolean.parseBoolean(m_properties.getProperty("TO_CLASSIFY")));
49 setToCallHermiT(Boolean.parseBoolean(m_properties.getProperty("CALL_HERMIT")));
50
51 } catch (IOException e) {
52 e.printStackTrace();
53 } finally {
54 if (inputStream != null)
55 try {
56 inputStream.close();
57 } catch (IOException e) {
58 e.printStackTrace();
59 }
60 }
61 }
62
63 public PagodaProperties() {
64 }
65
66 public static boolean isDebuggingMode() {
67 return debug;
68 }
69
70 public String getDataPath() {
71 return dataPath;
72 }
73
74 public void setDataPath(String path) {
75 dataPath = path;
76 }
77
78 public String getOntologyPath() {
79 return ontologyPath;
80 }
81
82 public void setOntologyPath(String path) {
83 ontologyPath = path;
84 }
85
86 public String getQueryPath() {
87 return queryPath;
88 }
89
90 public void setQueryPath(String path) {
91 queryPath = path;
92 }
93
94 public String getAnswerPath() {
95 return answerPath;
96 }
97
98 public void setAnswerPath(String path) {
99 answerPath = path;
100 }
101
102 public boolean getToClassify() {
103 return toClassify;
104 }
105
106 public void setToClassify(boolean flag) {
107 toClassify = flag;
108 }
109
110 public boolean getToCallHermiT() {
111 return toCallHermiT;
112 }
113
114 public void setToCallHermiT(boolean flag) {
115 toCallHermiT = flag;
116 }
117
118 public boolean getShellMode() {
119 return shellMode;
120 }
121
122 public void setShellMode(boolean flag) {
123 shellMode = flag;
124 }
125
126}