blob: 2b52a89450c634b7837b4982c479ce41a47cd306 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
package uk.ac.ox.cs.pagoda.util;
import org.apache.log4j.Logger;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties;
public class PagodaProperties {
public enum SkolemUpperBoundOptions {DISABLED, BEFORE_SUMMARISATION, AFTER_SUMMARISATION}
public static final String DEFAULT_CONFIG_FILE = "_default_pagoda.properties";
public static final String CONFIG_FILE = "pagoda.properties";
public static final boolean DEFAULT_DEBUG = false;
private static final boolean DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND;
private static final SkolemUpperBoundOptions DEFAULT_SKOLEM_UPPER_BOUND;
private static final int DEFAULT_SKOLEM_DEPTH;
private static final boolean DEFAULT_TO_CALL_HERMIT;
private static final Path DEFAULT_STATISTICS_DIR;
private static final long DEFAULT_MAX_TRIPLES_IN_SKOLEM_STORE;
public static boolean shellModeDefault = false;
private static boolean debug = DEFAULT_DEBUG;
static {
Logger logger = Logger.getLogger("PagodaProperties");
boolean defaultUseAlwaysSimpleUpperBound = false;
SkolemUpperBoundOptions defaultSkolemUpperBound = SkolemUpperBoundOptions.DISABLED;
int defaultSkolemDepth = 1;
boolean toCallHermit = true;
Path defaultStatisticsDir = null;
long defaultMaxTriplesInSkolemStore = 1000000;
InputStream configStream = PagodaProperties.class.getClassLoader().getResourceAsStream(CONFIG_FILE);
if(configStream == null) {
logger.info("Unable to find user-defined configuration file (\"" + CONFIG_FILE + "\" in classpath)");
logger.info("Using default configuration");
configStream = PagodaProperties.class.getClassLoader().getResourceAsStream(DEFAULT_CONFIG_FILE);
}
try {
Properties config = new Properties();
config.load(configStream);
configStream.close();
if (config.containsKey("debug")) {
debug = Boolean.parseBoolean(config.getProperty("debug"));
logger.info("Debugging mode is enabled");
if (config.containsKey("statisticsDir")) {
defaultStatisticsDir = Paths.get(config.getProperty("statisticsDir"));
logger.info("The directory where statistics are saved is: \"" + defaultStatisticsDir + "\"");
}
}
if (config.containsKey("useAlwaysSimpleUpperBound")) {
defaultUseAlwaysSimpleUpperBound =
Boolean.parseBoolean(config.getProperty("useAlwaysSimpleUpperBound"));
if (defaultUseAlwaysSimpleUpperBound)
logger.debug("By default the simple upper bound is always used");
}
if (config.containsKey("skolemUpperBound")) {
defaultSkolemUpperBound = SkolemUpperBoundOptions.valueOf(config.getProperty("skolemUpperBound"));
switch (defaultSkolemUpperBound) {
case AFTER_SUMMARISATION:
logger.debug("By default the Skolem upper bound is applied AFTER Summarisation");
break;
case BEFORE_SUMMARISATION:
logger.debug("By default the Skolem upper bound is applied BEFORE Summarisation");
break;
default:
defaultSkolemUpperBound = SkolemUpperBoundOptions.DISABLED;
case DISABLED:
logger.debug("By default the Skolem upper bound is disabled");
}
}
if (config.containsKey("toCallHermit")) {
toCallHermit = Boolean.parseBoolean(config.getProperty("toCallHermit"));
if (toCallHermit)
logger.debug("By default Hermit is enabled");
else
logger.debug("By default Hermit is disabled");
}
if (config.containsKey("skolemDepth")) {
defaultSkolemDepth = Integer.parseInt(config.getProperty("skolemDepth"));
logger.debug("By default the max skolemisation depth is " + defaultSkolemDepth);
}
if (config.containsKey("maxTriplesInSkolemStore")) {
defaultMaxTriplesInSkolemStore = Long.parseLong(config.getProperty("maxTriplesInSkolemStore"));
logger.debug("By default the maximum number of triples in the Skolem store is " + defaultMaxTriplesInSkolemStore);
}
} catch (IOException e) {
e.printStackTrace();
}
DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND = defaultUseAlwaysSimpleUpperBound;
DEFAULT_SKOLEM_UPPER_BOUND = defaultSkolemUpperBound;
DEFAULT_TO_CALL_HERMIT = toCallHermit;
DEFAULT_STATISTICS_DIR = defaultStatisticsDir;
DEFAULT_SKOLEM_DEPTH = defaultSkolemDepth;
DEFAULT_MAX_TRIPLES_IN_SKOLEM_STORE = defaultMaxTriplesInSkolemStore;
}
String dataPath = null;
String ontologyPath;
String queryPath = null;
String answerPath = null;
boolean toClassify = true;
boolean toCallHermiT = DEFAULT_TO_CALL_HERMIT;
public int getSkolemDepth() {
return skolemDepth;
}
public void setSkolemDepth(int skolemDepth) {
this.skolemDepth = skolemDepth;
}
int skolemDepth = DEFAULT_SKOLEM_DEPTH;
boolean shellMode = shellModeDefault;
private boolean useAlwaysSimpleUpperBound = DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND;
private SkolemUpperBoundOptions skolemUpperBound = DEFAULT_SKOLEM_UPPER_BOUND;
private Path statisticsDir = DEFAULT_STATISTICS_DIR;
private long maxTriplesInSkolemStore = DEFAULT_MAX_TRIPLES_IN_SKOLEM_STORE;
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 static boolean getDefaultUseAlwaysSimpleUpperBound() {
return DEFAULT_USE_ALWAYS_SIMPLE_UPPER_BOUND;
}
public static Path getDefaultStatisticsDir() {
return DEFAULT_STATISTICS_DIR;
}
public static SkolemUpperBoundOptions getDefaultSkolemUpperBound() {
return DEFAULT_SKOLEM_UPPER_BOUND;
}
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;
}
public boolean getUseAlwaysSimpleUpperBound() {
return useAlwaysSimpleUpperBound;
}
public void setUseAlwaysSimpleUpperBound(boolean flag) {
useAlwaysSimpleUpperBound = flag;
}
public SkolemUpperBoundOptions getSkolemUpperBound() {
return skolemUpperBound;
}
public void setSkolemUpperBound(SkolemUpperBoundOptions flag) {
skolemUpperBound = flag;
}
public Path getStatisticsDir() {
return statisticsDir;
}
public void setStatisticsDir(Path statisticsDir) {
this.statisticsDir = statisticsDir;
}
public long getMaxTriplesInSkolemStore() {
return maxTriplesInSkolemStore;
}
}
|