aboutsummaryrefslogtreecommitdiff
path: root/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java')
-rw-r--r--src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java1132
1 files changed, 570 insertions, 562 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java b/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
index b92bceb..638a151 100644
--- a/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
+++ b/src/uk/ac/ox/cs/pagoda/approx/RLPlusOntology.java
@@ -23,577 +23,585 @@ import java.util.regex.Pattern;
23 23
24public class RLPlusOntology implements KnowledgeBase { 24public class RLPlusOntology implements KnowledgeBase {
25 25
26 private static final String DEFAULT_ONTOLOGY_FILE_EXTENSION = "owl"; 26 private static final String DEFAULT_ONTOLOGY_FILE_EXTENSION = "owl";
27 private static final Pattern ONTOLOGY_ID_REGEX = Pattern.compile("ontologyid\\((?<id>[a-z0-9\\-]+)\\)"); 27 private static final Pattern ONTOLOGY_ID_REGEX = Pattern.compile("ontologyid\\((?<id>[a-z0-9\\-]+)\\)");
28 OWLOntologyManager manager; 28 OWLOntologyManager manager;
29 OWLDataFactory factory; 29 OWLDataFactory factory;
30 String ontologyIRI; 30 String ontologyIRI;
31 String corrFileName = null; 31 String corrFileName = null;
32 String outputPath, aBoxPath; 32 String outputPath, aBoxPath;
33 OWLOntology inputOntology = null; 33 OWLOntology inputOntology = null;
34 OWLOntology tBox = null; 34 OWLOntology tBox = null;
35 OWLOntology aBox = null; 35 OWLOntology aBox = null;
36 OWLOntology restOntology = null; 36 OWLOntology restOntology = null;
37 OWLOntology outputOntology = null; //RL ontology 37 OWLOntology outputOntology = null; //RL ontology
38 DLOntology dlOntology = null; 38 DLOntology dlOntology = null;
39 int rlCounter = 0; 39 int rlCounter = 0;
40 LinkedList<Clause> clauses; 40 LinkedList<Clause> clauses;
41 Map<OWLAxiom, OWLAxiom> correspondence; 41 Map<OWLAxiom, OWLAxiom> correspondence;
42 BottomStrategy botStrategy; 42 BottomStrategy botStrategy;
43 Random random = new Random(19900114); 43 Random random = new Random(19900114);
44 private Map<OWLClassExpression, Integer> subCounter = null; 44 private Map<OWLClassExpression, Integer> subCounter = null;
45 private Map<OWLClass, OWLClass> atomic2negation = new HashMap<OWLClass, OWLClass>(); 45 private Map<OWLClass, OWLClass> atomic2negation = new HashMap<OWLClass, OWLClass>();
46 46
47 // FIXME multiple anonymous ontologies 47 // TODO don't know if it is correct
48 @Override 48 @Override
49 public void load(OWLOntology ontology, uk.ac.ox.cs.pagoda.constraints.BottomStrategy bottomStrategy) { 49 public void load(OWLOntology ontology, uk.ac.ox.cs.pagoda.constraints.BottomStrategy bottomStrategy) {
50 if (bottomStrategy instanceof UnaryBottom) 50 if(bottomStrategy instanceof UnaryBottom)
51 botStrategy = BottomStrategy.UNARY; 51 botStrategy = BottomStrategy.UNARY;
52 else if (bottomStrategy instanceof NullaryBottom) 52 else if(bottomStrategy instanceof NullaryBottom)
53 botStrategy = BottomStrategy.NULLARY; 53 botStrategy = BottomStrategy.NULLARY;
54 else 54 else
55 botStrategy = BottomStrategy.TOREMOVE; 55 botStrategy = BottomStrategy.TOREMOVE;
56 56
57 if(corrFileName == null) 57 if(corrFileName == null)
58 corrFileName = "rlplus.crr"; 58 corrFileName = "rlplus.crr";
59 manager = ontology.getOWLOntologyManager(); 59 manager = ontology.getOWLOntologyManager();
60// manager = OWLManager.createOWLOntologyManager(); 60// manager = OWLManager.createOWLOntologyManager();
61 factory = manager.getOWLDataFactory(); 61 factory = manager.getOWLDataFactory();
62 inputOntology = ontology; 62 inputOntology = ontology;
63 63
64 try { 64 try {
65 IRI ontologyIri; 65 IRI ontologyIri;
66 if(ontology.isAnonymous()) { 66 if(ontology.isAnonymous()) {
67 Matcher matcher = ONTOLOGY_ID_REGEX.matcher(ontology.getOntologyID().toString().toLowerCase()); 67 Matcher matcher = ONTOLOGY_ID_REGEX.matcher(ontology.getOntologyID().toString().toLowerCase());
68 if(!matcher.matches()) throw new Error("Anonymous ontology without internal id"); 68 if(!matcher.matches()) throw new Error("Anonymous ontology without internal id");
69 ontologyIri = 69 ontologyIri =
70 IRI.create("http://www.example.org/", matcher.group("id") + "." + DEFAULT_ONTOLOGY_FILE_EXTENSION); 70 IRI.create("http://www.example.org/", matcher.group("id") + "." + DEFAULT_ONTOLOGY_FILE_EXTENSION);
71 } 71 }
72 else 72 else
73 ontologyIri = inputOntology.getOntologyID().getOntologyIRI(); 73 ontologyIri = inputOntology.getOntologyID().getOntologyIRI();
74 74
75 String ontologyIriPrefix = ontologyIri.getNamespace(); 75 String ontologyIriPrefix = ontologyIri.getNamespace();
76 ontologyIRI = ontologyIri.toString(); 76 ontologyIRI = ontologyIri.toString();
77 String ontologyIriFragment = ontologyIri.getFragment(); 77 String ontologyIriFragment = ontologyIri.getFragment();
78 String originalFileName = FilenameUtils.removeExtension(ontologyIriFragment); 78 String originalFileName = FilenameUtils.removeExtension(ontologyIriFragment);
79 String originalExtension = FilenameUtils.getExtension(ontologyIriFragment); 79 String originalExtension = FilenameUtils.getExtension(ontologyIriFragment);
80 if(originalExtension.isEmpty()) originalExtension = DEFAULT_ONTOLOGY_FILE_EXTENSION; 80 if(originalExtension.isEmpty()) originalExtension = DEFAULT_ONTOLOGY_FILE_EXTENSION;
81 81
82 82
83 IRI rlOntologyIRI = IRI.create(ontologyIriPrefix, originalFileName + "-RL." + originalExtension); 83 IRI rlOntologyIRI = IRI.create(ontologyIriPrefix, originalFileName + "-RL." + originalExtension);
84 outputPath = Paths.get(Utility.getGlobalTempDirAbsolutePath(), 84 outputPath = Paths.get(Utility.getGlobalTempDirAbsolutePath(),
85 originalFileName + "-RL." + originalExtension).toString(); 85 originalFileName + "-RL." + originalExtension).toString();
86 IRI rlDocumentIRI = IRI.create("file://" + outputPath); 86 IRI rlDocumentIRI = IRI.create("file://" + outputPath);
87 outputOntology = manager.createOntology(rlOntologyIRI); 87 outputOntology = manager.createOntology(rlOntologyIRI);
88 manager.setOntologyDocumentIRI(outputOntology, rlDocumentIRI); 88 manager.setOntologyDocumentIRI(outputOntology, rlDocumentIRI);
89 89
90 String tBoxOntologyFragment = originalFileName + "-TBox." + originalExtension; 90 String tBoxOntologyFragment = originalFileName + "-TBox." + originalExtension;
91 IRI tBoxOntologyIRI = IRI.create(ontologyIriPrefix, tBoxOntologyFragment); 91 IRI tBoxOntologyIRI = IRI.create(ontologyIriPrefix, tBoxOntologyFragment);
92 IRI tBoxDocumentIRI = 92 IRI tBoxDocumentIRI =
93 IRI.create("file://" + Paths.get(Utility.getGlobalTempDirAbsolutePath(), tBoxOntologyFragment)); 93 IRI.create("file://" + Paths.get(Utility.getGlobalTempDirAbsolutePath(), tBoxOntologyFragment));
94 94
95 String aBoxOntologyFragment = originalFileName + "-ABox." + originalExtension; 95 String aBoxOntologyFragment = originalFileName + "-ABox." + originalExtension;
96 IRI aBoxOntologyIRI = IRI.create(ontologyIriPrefix, aBoxOntologyFragment); 96 IRI aBoxOntologyIRI = IRI.create(ontologyIriPrefix, aBoxOntologyFragment);
97 aBoxPath = Paths.get(Utility.getGlobalTempDirAbsolutePath()) + aBoxOntologyFragment; 97 aBoxPath = Paths.get(Utility.getGlobalTempDirAbsolutePath(), aBoxOntologyFragment).toString();
98 IRI aBoxDocumentIRI = 98 IRI aBoxDocumentIRI =
99 IRI.create("file://" + Paths.get(Utility.getGlobalTempDirAbsolutePath(), aBoxOntologyFragment)); 99 IRI.create("file://" + Paths.get(Utility.getGlobalTempDirAbsolutePath(), aBoxOntologyFragment));
100 100
101 tBox = manager.createOntology(tBoxOntologyIRI); 101 tBox = manager.createOntology(tBoxOntologyIRI);
102 aBox = manager.createOntology(aBoxOntologyIRI); 102 aBox = manager.createOntology(aBoxOntologyIRI);
103 manager.setOntologyDocumentIRI(tBox, tBoxDocumentIRI); 103 manager.setOntologyDocumentIRI(tBox, tBoxDocumentIRI);
104 manager.setOntologyDocumentIRI(aBox, aBoxDocumentIRI); 104 manager.setOntologyDocumentIRI(aBox, aBoxDocumentIRI);
105 105
106 FileOutputStream aBoxOut = new FileOutputStream(aBoxPath); 106 FileOutputStream aBoxOut = new FileOutputStream(aBoxPath);
107 manager.saveOntology(aBox, aBoxOut); 107 manager.saveOntology(aBox, aBoxOut);
108 aBoxOut.close(); 108 aBoxOut.close();
109 109
110 restOntology = manager.createOntology(); 110 restOntology = manager.createOntology();
111 } catch(OWLOntologyCreationException | OWLOntologyStorageException | IOException e) { 111 } catch(OWLOntologyCreationException | OWLOntologyStorageException | IOException e) {
112 e.printStackTrace(); 112 e.printStackTrace();
113 System.exit(1); 113 System.exit(1);
114 } 114 }
115 } 115 }
116 116
117 public OWLOntology getTBox() { 117 public OWLOntology getTBox() {
118 return tBox; 118 return tBox;
119 } 119 }
120 120
121 public String getABoxPath() { 121 public String getABoxPath() {
122 return aBoxPath; 122 return aBoxPath;
123 } 123 }
124 124
125 private void add2SubCounter(OWLClassExpression exp) { 125 public void simplify() {
126 Integer count = subCounter.get(exp); 126 if(simplifyABox()) {
127 if (count == null) count = 0; 127 save(aBox);
128 ++count;
129 subCounter.put(exp, count);
130 }
131
132 public void simplify() {
133 if(simplifyABox()) {
134 save(aBox);
135// save(tBox); 128// save(tBox);
136 } else 129 }
137 tBox = inputOntology; 130 else
138 } 131 tBox = inputOntology;
132 }
139 133
140 @Override 134 @Override
141 public void transform() { 135 public void transform() {
142 simplify(); 136 simplify();
143 filter(); 137 filter();
144 clausify(); 138 clausify();
145 139
146 subCounter = new HashMap<OWLClassExpression, Integer>(); 140 subCounter = new HashMap<OWLClassExpression, Integer>();
147 clauses = new LinkedList<Clause>(); 141 clauses = new LinkedList<Clause>();
148 Clausifier clausifier = Clausifier.getInstance(restOntology); 142 Clausifier clausifier = Clausifier.getInstance(restOntology);
149 143
150 for (DLClause c: dlOntology.getDLClauses()) { 144 for(DLClause c : dlOntology.getDLClauses()) {
151 Clause clause = new Clause(clausifier, c); 145 Clause clause = new Clause(clausifier, c);
152 clauses.add(clause); 146 clauses.add(clause);
153 147
154 /* 148 /*
155 * count the expressions in the left 149 * count the expressions in the left
156 */ 150 */
157 for (OWLClassExpression exp: clause.getSubClasses()) { 151 for(OWLClassExpression exp : clause.getSubClasses()) {
158 if(exp instanceof OWLClass) 152 if(exp instanceof OWLClass)
159 add2SubCounter(exp); 153 add2SubCounter(exp);
160 else if (exp instanceof OWLObjectSomeValuesFrom) { 154 else if(exp instanceof OWLObjectSomeValuesFrom) {
161 OWLObjectSomeValuesFrom someValue = (OWLObjectSomeValuesFrom)exp; 155 OWLObjectSomeValuesFrom someValue = (OWLObjectSomeValuesFrom) exp;
162 add2SubCounter(factory.getOWLObjectSomeValuesFrom(someValue.getProperty(), factory.getOWLThing())); 156 add2SubCounter(factory.getOWLObjectSomeValuesFrom(someValue.getProperty(), factory.getOWLThing()));
163 add2SubCounter(someValue.getFiller()); 157 add2SubCounter(someValue.getFiller());
164 } 158 }
165 else if (exp instanceof OWLObjectMinCardinality) { 159 else if(exp instanceof OWLObjectMinCardinality) {
166 OWLObjectMinCardinality minCard = (OWLObjectMinCardinality)exp; 160 OWLObjectMinCardinality minCard = (OWLObjectMinCardinality) exp;
167 add2SubCounter(factory.getOWLObjectSomeValuesFrom(minCard.getProperty(), factory.getOWLThing())); 161 add2SubCounter(factory.getOWLObjectSomeValuesFrom(minCard.getProperty(), factory.getOWLThing()));
168 add2SubCounter(minCard.getFiller()); 162 add2SubCounter(minCard.getFiller());
169 } else 163 }
170 Utility.logError("strange class expression: " + exp); 164 else
171 165 Utility.logError("strange class expression: " + exp);
172 } 166
173 } 167 }
174 168 }
175 correspondence = new HashMap<OWLAxiom, OWLAxiom>(); 169
176 Set<OWLAxiom> addedAxioms = new HashSet<OWLAxiom>(); 170 correspondence = new HashMap<OWLAxiom, OWLAxiom>();
177 OWLClassExpression subExp; 171 Set<OWLAxiom> addedAxioms = new HashSet<OWLAxiom>();
178 for (Clause clause: clauses) { 172 OWLClassExpression subExp;
179 subExp = uk.ac.ox.cs.pagoda.owl.OWLHelper.getSimplifiedConjunction(factory, clause.getSubClasses()); 173 for(Clause clause : clauses) {
180 addedAxioms.clear(); 174 subExp = uk.ac.ox.cs.pagoda.owl.OWLHelper.getSimplifiedConjunction(factory, clause.getSubClasses());
181 for (OWLClassExpression exp: getDisjunctionApprox0(clause.getSuperClasses())) { 175 addedAxioms.clear();
182 addedAxioms.add(factory.getOWLSubClassOfAxiom(subExp, transform(exp, addedAxioms))); 176 for(OWLClassExpression exp : getDisjunctionApprox0(clause.getSuperClasses())) {
183 for(OWLAxiom a : addedAxioms) 177 addedAxioms.add(factory.getOWLSubClassOfAxiom(subExp, transform(exp, addedAxioms)));
184 addAxiom2output(a, factory.getOWLSubClassOfAxiom(subExp, 178 for(OWLAxiom a : addedAxioms)
185 OWLHelper.getSimplifiedDisjunction(factory, clause.getSuperClasses()))); 179 addAxiom2output(a, factory.getOWLSubClassOfAxiom(subExp,
186 } 180 OWLHelper.getSimplifiedDisjunction(factory, clause.getSuperClasses())));
187 } 181 }
188 182 }
189 subCounter.clear(); 183
190 } 184 subCounter.clear();
191 185 }
192 @Override 186
193 public void save() { 187 @Override
194 if (corrFileName != null) 188 public void save() {
195 save(correspondence, corrFileName); 189 if(corrFileName != null)
196 save(outputOntology); 190 save(correspondence, corrFileName);
197 } 191 save(outputOntology);
198 192 }
199 private void save(Map<OWLAxiom, OWLAxiom> map, String corrFileName) { 193
200 if (corrFileName == null) return ; 194 public OWLOntologyManager getOWLOntologyManager() {
201 ObjectOutput output; 195 return inputOntology.getOWLOntologyManager();
202 try { 196 }
203 output = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(corrFileName))); 197
204 output.writeObject(map); 198 public String getOntologyIRI() {
205 output.close(); 199 return ontologyIRI;
206 } catch (IOException e) { 200 }
207 e.printStackTrace(); 201
208 } 202 public OWLOntology getOutputOntology() {
209 } 203 return outputOntology;
210 204 }
211 protected void save(OWLOntology onto) { 205
212 try { 206 @Override
213 onto.getOWLOntologyManager().saveOntology(onto); 207 public String getOutputPath() {
214 } catch (OWLOntologyStorageException e) { 208 return outputPath;
215 e.printStackTrace(); 209 }
216 } 210
217 } 211 @Override
218 212 public String getDirectory() {
219 /* 213 return outputPath.substring(0, outputPath.lastIndexOf(Utility.FILE_SEPARATOR));
220 * treat disjunction as conjunction 214 }
221 */ 215
222 private Set<OWLClassExpression> getDisjunctionApprox0(Set<OWLClassExpression> superClasses) { 216 public void setCorrespondenceFileLoc(String path) {
223 return superClasses; 217 corrFileName = path;
224 } 218 }
225 219
226 /* 220 private void add2SubCounter(OWLClassExpression exp) {
227 * choose one simple class disjunct 221 Integer count = subCounter.get(exp);
228 */ 222 if(count == null) count = 0;
229 @SuppressWarnings("unused") 223 ++count;
230 private Set<OWLClassExpression> getDisjunctionApprox1(Set<OWLClassExpression> superClasses) { 224 subCounter.put(exp, count);
231 if(superClasses.isEmpty() || superClasses.size() == 1) 225 }
232 return superClasses; 226
233 227 private void save(Map<OWLAxiom, OWLAxiom> map, String corrFileName) {
234 OWLClassExpression rep = null; 228 if(corrFileName == null) return;
235 int min = Integer.MAX_VALUE, o; 229 ObjectOutput output;
236 for(OWLClassExpression exp : superClasses) 230 try {
237 if(exp instanceof OWLClass && (o = getOccurrence(exp)) < min) { 231 output = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(corrFileName)));
238 min = o; 232 output.writeObject(map);
239 rep = exp; 233 output.close();
240 } 234 } catch(IOException e) {
241 235 e.printStackTrace();
242 if(rep == null) rep = superClasses.iterator().next(); 236 }
243 237 }
244 return Collections.singleton(rep); 238
245 } 239 protected void save(OWLOntology onto) {
246 240 try {
247 /* 241 onto.getOWLOntologyManager().saveOntology(onto);
248 * randomly choose a class expression to represent this disjunction 242 } catch(OWLOntologyStorageException e) {
249 */ 243 e.printStackTrace();
250 @SuppressWarnings("unused") 244 }
251 private Set<OWLClassExpression> getDisjunctionApprox2(Set<OWLClassExpression> superClasses) { 245 }
252 if(superClasses.isEmpty() || superClasses.size() == 1) 246
253 return superClasses; 247 /*
254 248 * treat disjunction as conjunction
255 int index = random.nextInt() % superClasses.size(); 249 */
256 if (index < 0) index += superClasses.size(); 250 private Set<OWLClassExpression> getDisjunctionApprox0(Set<OWLClassExpression> superClasses) {
257 251 return superClasses;
258 int i = 0; 252 }
259 for(OWLClassExpression exp : superClasses) 253
260 if (i++ == index) 254 /*
261 return Collections.singleton(exp); 255 * choose one simple class disjunct
262 return null; 256 */
263 } 257 @SuppressWarnings("unused")
264 258 private Set<OWLClassExpression> getDisjunctionApprox1(Set<OWLClassExpression> superClasses) {
265 /* 259 if(superClasses.isEmpty() || superClasses.size() == 1)
266 * choose the one that appears least in the l.h.s. 260 return superClasses;
267 */ 261
268 @SuppressWarnings("unused") 262 OWLClassExpression rep = null;
269 private Set<OWLClassExpression> getDisjunctionApprox3(Set<OWLClassExpression> superClasses) { 263 int min = Integer.MAX_VALUE, o;
270 if(superClasses.isEmpty() || superClasses.size() == 1) 264 for(OWLClassExpression exp : superClasses)
271 return superClasses; 265 if(exp instanceof OWLClass && (o = getOccurrence(exp)) < min) {
272 266 min = o;
273 OWLClassExpression rep = null, exp1; 267 rep = exp;
274 int occurrence = Integer.MAX_VALUE, o; 268 }
275 for (OWLClassExpression exp: superClasses) { 269
276 o = 0; 270 if(rep == null) rep = superClasses.iterator().next();
277 exp1 = exp; 271
278 if (exp instanceof OWLObjectMinCardinality) { 272 return Collections.singleton(rep);
279 OWLObjectMinCardinality minCard = (OWLObjectMinCardinality)exp; 273 }
280 if (minCard.getCardinality() == 1) 274
281 exp1 = factory.getOWLObjectSomeValuesFrom(minCard.getProperty(), minCard.getFiller()); 275 /*
282 } 276 * randomly choose a class expression to represent this disjunction
283 277 */
284 if (!subCounter.containsKey(exp1) || (o = subCounter.get(exp1)) < occurrence) { 278 @SuppressWarnings("unused")
285 rep = exp; 279 private Set<OWLClassExpression> getDisjunctionApprox2(Set<OWLClassExpression> superClasses) {
286 occurrence = o; 280 if(superClasses.isEmpty() || superClasses.size() == 1)
287 } 281 return superClasses;
288 } 282
289 283 int index = random.nextInt() % superClasses.size();
290 return Collections.singleton(rep); 284 if(index < 0) index += superClasses.size();
291 } 285
292 286 int i = 0;
293 private int getOccurrence(OWLClassExpression exp) { 287 for(OWLClassExpression exp : superClasses)
294 if (!subCounter.containsKey(exp)) 288 if(i++ == index)
295 return 0; 289 return Collections.singleton(exp);
296 return subCounter.get(exp); 290 return null;
297 } 291 }
298 292
299 @SuppressWarnings("unused") 293 /*
300 private Set<OWLClassExpression> getDisjunctionApprox4(Set<OWLClassExpression> superClasses) { 294 * choose the one that appears least in the l.h.s.
301 if(superClasses.isEmpty() || superClasses.size() == 1) 295 */
302 return superClasses; 296 @SuppressWarnings("unused")
303 297 private Set<OWLClassExpression> getDisjunctionApprox3(Set<OWLClassExpression> superClasses) {
304 OWLClassExpression rep = null; 298 if(superClasses.isEmpty() || superClasses.size() == 1)
305 int occurrence = Integer.MAX_VALUE, o; 299 return superClasses;
306 for (OWLClassExpression exp: superClasses) { 300
307 o = 0; 301 OWLClassExpression rep = null, exp1;
308 if (exp instanceof OWLObjectMinCardinality) { 302 int occurrence = Integer.MAX_VALUE, o;
309 OWLObjectMinCardinality minCard = (OWLObjectMinCardinality)exp; 303 for(OWLClassExpression exp : superClasses) {
310 if (minCard.getCardinality() == 1) { 304 o = 0;
311 o = getOccurrence((factory.getOWLObjectSomeValuesFrom(minCard.getProperty(), factory.getOWLThing()))); 305 exp1 = exp;
312 o += getOccurrence(minCard.getFiller()); 306 if(exp instanceof OWLObjectMinCardinality) {
307 OWLObjectMinCardinality minCard = (OWLObjectMinCardinality) exp;
308 if(minCard.getCardinality() == 1)
309 exp1 = factory.getOWLObjectSomeValuesFrom(minCard.getProperty(), minCard.getFiller());
310 }
311
312 if(!subCounter.containsKey(exp1) || (o = subCounter.get(exp1)) < occurrence) {
313 rep = exp;
314 occurrence = o;
315 }
316 }
317
318 return Collections.singleton(rep);
319 }
320
321 private int getOccurrence(OWLClassExpression exp) {
322 if(!subCounter.containsKey(exp))
323 return 0;
324 return subCounter.get(exp);
325 }
326
327 @SuppressWarnings("unused")
328 private Set<OWLClassExpression> getDisjunctionApprox4(Set<OWLClassExpression> superClasses) {
329 if(superClasses.isEmpty() || superClasses.size() == 1)
330 return superClasses;
331
332 OWLClassExpression rep = null;
333 int occurrence = Integer.MAX_VALUE, o;
334 for(OWLClassExpression exp : superClasses) {
335 o = 0;
336 if(exp instanceof OWLObjectMinCardinality) {
337 OWLObjectMinCardinality minCard = (OWLObjectMinCardinality) exp;
338 if(minCard.getCardinality() == 1) {
339 o =
340 getOccurrence((factory.getOWLObjectSomeValuesFrom(minCard.getProperty(), factory.getOWLThing())));
341 o += getOccurrence(minCard.getFiller());
313// if (o < o1) o = o1; 342// if (o < o1) o = o1;
314 } 343 }
315 } else 344 }
316 o = getOccurrence(exp); 345 else
317 346 o = getOccurrence(exp);
318 if (o < occurrence || o == occurrence && !(rep instanceof OWLClass)) { 347
319 rep = exp; 348 if(o < occurrence || o == occurrence && !(rep instanceof OWLClass)) {
320 occurrence = o; 349 rep = exp;
321 } 350 occurrence = o;
322 } 351 }
323 352 }
324 return Collections.singleton(rep); 353
325 } 354 return Collections.singleton(rep);
326 355 }
327 private boolean simplifyABox() { 356
328 boolean flag = false; 357 private boolean simplifyABox() {
329 Map<OWLClassExpression, OWLClass> complex2atomic= new HashMap<OWLClassExpression, OWLClass>(); 358 boolean flag = false;
330 359 Map<OWLClassExpression, OWLClass> complex2atomic = new HashMap<OWLClassExpression, OWLClass>();
331 OWLDatatype anyURI = factory.getOWLDatatype(IRI.create(Namespace.XSD_NS + "anyURI")); 360
332 OWLObjectProperty sameAs = factory.getOWLObjectProperty(IRI.create(Namespace.EQUALITY)); 361 OWLDatatype anyURI = factory.getOWLDatatype(IRI.create(Namespace.XSD_NS + "anyURI"));
333 OWLObjectProperty differentFrom = factory.getOWLObjectProperty(IRI.create(Namespace.INEQUALITY)); 362 OWLObjectProperty sameAs = factory.getOWLObjectProperty(IRI.create(Namespace.EQUALITY));
334 363 OWLObjectProperty differentFrom = factory.getOWLObjectProperty(IRI.create(Namespace.INEQUALITY));
335 for (OWLOntology imported: inputOntology.getImportsClosure()) 364
336 for (OWLAxiom axiom: imported.getAxioms()) { 365 for(OWLOntology imported : inputOntology.getImportsClosure())
337 if (axiom instanceof OWLClassAssertionAxiom) { 366 for(OWLAxiom axiom : imported.getAxioms()) {
338 flag = true; 367 if(axiom instanceof OWLClassAssertionAxiom) {
339 OWLClassAssertionAxiom assertion = (OWLClassAssertionAxiom)axiom; 368 flag = true;
340 OWLClassExpression clsExp = assertion.getClassExpression(); 369 OWLClassAssertionAxiom assertion = (OWLClassAssertionAxiom) axiom;
341 OWLClass cls; 370 OWLClassExpression clsExp = assertion.getClassExpression();
342 if (clsExp instanceof OWLClass) { 371 OWLClass cls;
343 if (((OWLClass) clsExp).toStringID().startsWith("owl:")) 372 if(clsExp instanceof OWLClass) {
344 manager.addAxiom(tBox, axiom); 373 if(((OWLClass) clsExp).toStringID().startsWith("owl:"))
345 else manager.addAxiom(aBox, axiom); 374 manager.addAxiom(tBox, axiom);
346 } 375 else manager.addAxiom(aBox, axiom);
347 else { 376 }
348 if ((cls = complex2atomic.get(clsExp)) == null) { 377 else {
349 complex2atomic.put(clsExp, cls = getNewConcept(tBox, rlCounter++)); 378 if((cls = complex2atomic.get(clsExp)) == null) {
350 manager.addAxiom(tBox, factory.getOWLSubClassOfAxiom(cls, clsExp)); 379 complex2atomic.put(clsExp, cls = getNewConcept(tBox, rlCounter++));
351 } 380 manager.addAxiom(tBox, factory.getOWLSubClassOfAxiom(cls, clsExp));
352 manager.addAxiom(aBox, factory.getOWLClassAssertionAxiom(cls, assertion.getIndividual())); 381 }
353 } 382 manager.addAxiom(aBox, factory.getOWLClassAssertionAxiom(cls, assertion.getIndividual()));
354 } 383 }
355 else if (axiom instanceof OWLObjectPropertyAssertionAxiom || axiom instanceof OWLDataPropertyAssertionAxiom || axiom instanceof OWLAnnotationAssertionAxiom) { 384 }
356 if(axiom.getDataPropertiesInSignature().contains(anyURI)) continue; 385 else if(axiom instanceof OWLObjectPropertyAssertionAxiom || axiom instanceof OWLDataPropertyAssertionAxiom || axiom instanceof OWLAnnotationAssertionAxiom) {
357 flag = true; 386 if(axiom.getDataPropertiesInSignature().contains(anyURI)) continue;
358 manager.addAxiom(aBox, axiom); 387 flag = true;
359 } 388 manager.addAxiom(aBox, axiom);
360 else if (axiom instanceof OWLSameIndividualAxiom) { 389 }
361 OWLIndividual firstIndividual = null, previousIndividual = null, lastIndividual = null; 390 else if(axiom instanceof OWLSameIndividualAxiom) {
362 for (OWLIndividual next: ((OWLSameIndividualAxiom) axiom).getIndividuals()) { 391 OWLIndividual firstIndividual = null, previousIndividual = null, lastIndividual = null;
363 if(firstIndividual == null) firstIndividual = previousIndividual = next; 392 for(OWLIndividual next : ((OWLSameIndividualAxiom) axiom).getIndividuals()) {
364 else 393 if(firstIndividual == null) firstIndividual = previousIndividual = next;
365 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(sameAs, previousIndividual, next)); 394 else
366 previousIndividual = lastIndividual = next; 395 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(sameAs, previousIndividual, next));
367 } 396 previousIndividual = lastIndividual = next;
368 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(sameAs, lastIndividual, firstIndividual)); 397 }
369 } 398 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(sameAs, lastIndividual, firstIndividual));
370 else if (axiom instanceof OWLDifferentIndividualsAxiom) { 399 }
371 int index1 = 0, index2; 400 else if(axiom instanceof OWLDifferentIndividualsAxiom) {
372 for (OWLIndividual individual1: ((OWLDifferentIndividualsAxiom) axiom).getIndividuals()) { 401 int index1 = 0, index2;
373 ++index1; 402 for(OWLIndividual individual1 : ((OWLDifferentIndividualsAxiom) axiom).getIndividuals()) {
374 index2 = 0; 403 ++index1;
375 for (OWLIndividual individual2: ((OWLDifferentIndividualsAxiom) axiom).getIndividuals()) { 404 index2 = 0;
376 if (index2++ < index1) { 405 for(OWLIndividual individual2 : ((OWLDifferentIndividualsAxiom) axiom).getIndividuals()) {
377 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(differentFrom, individual1, individual2)); 406 if(index2++ < index1) {
378 } else break; 407 manager.addAxiom(aBox, factory.getOWLObjectPropertyAssertionAxiom(differentFrom, individual1, individual2));
379 } 408 }
380 } 409 else break;
381 } else 410 }
382 manager.addAxiom(tBox, axiom); 411 }
383 } 412 }
384 413 else
385 return flag; 414 manager.addAxiom(tBox, axiom);
386 } 415 }
387 416
388 private void filter() { 417 return flag;
389 OWL2RLProfile profile = new OWL2RLProfile(); 418 }
390 OWLProfileReport report = profile.checkOntology(tBox); 419
391 Set<OWLAxiom> rlAxioms = tBox.getAxioms(); 420 private void filter() {
392 OWLAxiom axiom; 421 OWL2RLProfile profile = new OWL2RLProfile();
393 422 OWLProfileReport report = profile.checkOntology(tBox);
394 for (OWLProfileViolation violation: report.getViolations()) { 423 Set<OWLAxiom> rlAxioms = tBox.getAxioms();
395 manager.addAxiom(restOntology, axiom = violation.getAxiom()); 424 OWLAxiom axiom;
396 rlAxioms.remove(axiom); 425
397 } 426 for(OWLProfileViolation violation : report.getViolations()) {
398 427 manager.addAxiom(restOntology, axiom = violation.getAxiom());
399 for (Iterator<OWLAxiom> iter = rlAxioms.iterator(); iter.hasNext(); ) 428 rlAxioms.remove(axiom);
400 addAxiom2output(iter.next(), null); 429 }
401 } 430
402 431 for(Iterator<OWLAxiom> iter = rlAxioms.iterator(); iter.hasNext(); )
403 private void clausify() { 432 addAxiom2output(iter.next(), null);
404 Configuration conf = new Configuration(); 433 }
405 OWLClausification clausifier = new OWLClausification(conf); 434
406 dlOntology = (DLOntology)clausifier.preprocessAndClausify(restOntology, null)[1]; 435 private void clausify() {
407 clausifier = null; 436 Configuration conf = new Configuration();
408 } 437 OWLClausification clausifier = new OWLClausification(conf);
409 438 dlOntology = (DLOntology) clausifier.preprocessAndClausify(restOntology, null)[1];
410 protected void addAxiom2output(OWLAxiom axiom, OWLAxiom correspondingAxiom) { 439 clausifier = null;
411 manager.addAxiom(outputOntology, axiom); 440 }
412 if (correspondingAxiom != null) 441
413 correspondence.put(axiom, correspondingAxiom); 442 protected void addAxiom2output(OWLAxiom axiom, OWLAxiom correspondingAxiom) {
414 } 443 manager.addAxiom(outputOntology, axiom);
415 444 if(correspondingAxiom != null)
416 private OWLClassExpression transform(OWLClassExpression exp, Set<OWLAxiom> addedAxioms) { 445 correspondence.put(axiom, correspondingAxiom);
417 if (exp instanceof OWLClass) 446 }
418 return exp; 447
419 448 private OWLClassExpression transform(OWLClassExpression exp, Set<OWLAxiom> addedAxioms) {
420 if (exp instanceof OWLObjectHasValue) 449 if(exp instanceof OWLClass)
421 return exp; 450 return exp;
422 451
423 if (exp instanceof OWLObjectSomeValuesFrom) { 452 if(exp instanceof OWLObjectHasValue)
424 OWLObjectSomeValuesFrom someValueExp = (OWLObjectSomeValuesFrom)exp; 453 return exp;
425 454
426 OWLClassExpression tExp = someValueExp.getFiller(); 455 if(exp instanceof OWLObjectSomeValuesFrom) {
427 if (tExp.equals(factory.getOWLThing())) 456 OWLObjectSomeValuesFrom someValueExp = (OWLObjectSomeValuesFrom) exp;
428 exp = factory.getOWLObjectMinCardinality(1, someValueExp.getProperty()); 457
429 else 458 OWLClassExpression tExp = someValueExp.getFiller();
430 exp = factory.getOWLObjectMinCardinality(1, someValueExp.getProperty(), someValueExp.getFiller()); 459 if(tExp.equals(factory.getOWLThing()))
431 } 460 exp = factory.getOWLObjectMinCardinality(1, someValueExp.getProperty());
432 461 else
433 if (exp instanceof OWLObjectMinCardinality) { 462 exp = factory.getOWLObjectMinCardinality(1, someValueExp.getProperty(), someValueExp.getFiller());
434 OWLObjectMinCardinality minExp = (OWLObjectMinCardinality)exp; 463 }
435 OWLObjectPropertyExpression r; 464
436 465 if(exp instanceof OWLObjectMinCardinality) {
437 if (minExp.getFiller().equals(factory.getOWLThing())) { 466 OWLObjectMinCardinality minExp = (OWLObjectMinCardinality) exp;
438 r = minExp.getProperty(); 467 OWLObjectPropertyExpression r;
439 } 468
440 //TODO to be restored ... 469 if(minExp.getFiller().equals(factory.getOWLThing())) {
441 //else if ((r = exists2role.get(someValueExp)) == null) { 470 r = minExp.getProperty();
442 // deal with r' \subseteq r & range(r') \subseteq C 471 }
443 else { 472 //TODO to be restored ...
444 r = getNewRole(outputOntology, rlCounter); 473 //else if ((r = exists2role.get(someValueExp)) == null) {
445 addedAxioms.add(factory.getOWLSubObjectPropertyOfAxiom(r, minExp.getProperty())); 474 // deal with r' \subseteq r & range(r') \subseteq C
446 OWLClassExpression tExp = minExp.getFiller(); 475 else {
447 if (!(tExp instanceof OWLObjectComplementOf)) { 476 r = getNewRole(outputOntology, rlCounter);
448 if (tExp.equals(factory.getOWLThing())); 477 addedAxioms.add(factory.getOWLSubObjectPropertyOfAxiom(r, minExp.getProperty()));
449 else 478 OWLClassExpression tExp = minExp.getFiller();
450 addedAxioms.add(factory.getOWLObjectPropertyRangeAxiom(r, tExp)); 479 if(!(tExp instanceof OWLObjectComplementOf)) {
451 } 480 if(tExp.equals(factory.getOWLThing())) ;
452 else if (botStrategy != BottomStrategy.TOREMOVE) { 481 else
453 OWLClass cls = (OWLClass) tExp.getComplementNNF(); 482 addedAxioms.add(factory.getOWLObjectPropertyRangeAxiom(r, tExp));
454 OWLClass neg; 483 }
455 if ((neg = atomic2negation.get(cls)) == null) { 484 else if(botStrategy != BottomStrategy.TOREMOVE) {
456 neg = getNewConcept(outputOntology, rlCounter); 485 OWLClass cls = (OWLClass) tExp.getComplementNNF();
457 addedAxioms.add(factory.getOWLDisjointClassesAxiom(neg, cls)); 486 OWLClass neg;
458 atomic2negation.put(cls, neg); 487 if((neg = atomic2negation.get(cls)) == null) {
459 } 488 neg = getNewConcept(outputOntology, rlCounter);
460 addedAxioms.add(factory.getOWLObjectPropertyRangeAxiom(r, neg)); 489 addedAxioms.add(factory.getOWLDisjointClassesAxiom(neg, cls));
461 } 490 atomic2negation.put(cls, neg);
491 }
492 addedAxioms.add(factory.getOWLObjectPropertyRangeAxiom(r, neg));
493 }
462// exists2role.put(someValueExp, (OWLObjectProperty) r); 494// exists2role.put(someValueExp, (OWLObjectProperty) r);
463 } 495 }
464 496
465 // deal with r'(x,c) 497 // deal with r'(x,c)
466 Set<OWLClassExpression> ret = new HashSet<OWLClassExpression>(); 498 Set<OWLClassExpression> ret = new HashSet<OWLClassExpression>();
467 int num = minExp.getCardinality(); 499 int num = minExp.getCardinality();
468 500
469 Set<OWLNamedIndividual> cs = new HashSet<OWLNamedIndividual>(); 501 Set<OWLNamedIndividual> cs = new HashSet<OWLNamedIndividual>();
470 OWLNamedIndividual c; 502 OWLNamedIndividual c;
471 for (int i = 0; i < num; ++i) { 503 for(int i = 0; i < num; ++i) {
472 c = getNewIndividual(outputOntology, rlCounter++); 504 c = getNewIndividual(outputOntology, rlCounter++);
473 ret.add(factory.getOWLObjectHasValue(r, c)); 505 ret.add(factory.getOWLObjectHasValue(r, c));
474 cs.add(c); 506 cs.add(c);
475 } 507 }
476 508
477 if (botStrategy != BottomStrategy.TOREMOVE && cs.size() > 1) { 509 if(botStrategy != BottomStrategy.TOREMOVE && cs.size() > 1) {
478 addedAxioms.add(factory.getOWLDifferentIndividualsAxiom(cs)); 510 addedAxioms.add(factory.getOWLDifferentIndividualsAxiom(cs));
479 } 511 }
480 512
481 return OWLHelper.getSimplifiedConjunction(factory, ret); 513 return OWLHelper.getSimplifiedConjunction(factory, ret);
482 } 514 }
483 515
484 if (exp instanceof OWLObjectMaxCardinality) { 516 if(exp instanceof OWLObjectMaxCardinality) {
485 OWLObjectMaxCardinality maxExp = (OWLObjectMaxCardinality)exp; 517 OWLObjectMaxCardinality maxExp = (OWLObjectMaxCardinality) exp;
486 OWLClassExpression tExp = maxExp.getFiller(); 518 OWLClassExpression tExp = maxExp.getFiller();
487 int card = maxExp.getCardinality() >= 1 ? 1 : 0; 519 int card = maxExp.getCardinality() >= 1 ? 1 : 0;
488 if (!(tExp instanceof OWLObjectComplementOf)) 520 if(!(tExp instanceof OWLObjectComplementOf))
489 return factory.getOWLObjectMaxCardinality(card, maxExp.getProperty(), tExp); 521 return factory.getOWLObjectMaxCardinality(card, maxExp.getProperty(), tExp);
490 else { 522 else {
491 Utility.logDebug("oh, to be tested ... "); 523 Utility.logDebug("oh, to be tested ... ");
492 OWLClassExpression tExp1 = factory.getOWLObjectAllValuesFrom(maxExp.getProperty(), tExp.getComplementNNF()); 524 OWLClassExpression tExp1 =
493 if (card == 0) 525 factory.getOWLObjectAllValuesFrom(maxExp.getProperty(), tExp.getComplementNNF());
494 return tExp1; 526 if(card == 0)
495 else { 527 return tExp1;
496 OWLClassExpression tExp2 = factory.getOWLObjectMaxCardinality(1, maxExp.getProperty()); 528 else {
497 return factory.getOWLObjectIntersectionOf(tExp1, tExp2); 529 OWLClassExpression tExp2 = factory.getOWLObjectMaxCardinality(1, maxExp.getProperty());
498 } 530 return factory.getOWLObjectIntersectionOf(tExp1, tExp2);
499 } 531 }
500 } 532 }
501 533 }
502 if (exp instanceof OWLObjectAllValuesFrom) 534
503 return exp; 535 if(exp instanceof OWLObjectAllValuesFrom)
504 536 return exp;
505 if (exp instanceof OWLObjectOneOf) 537
506 if (((OWLObjectOneOf) exp).getIndividuals().size() == 1) 538 if(exp instanceof OWLObjectOneOf)
507 return exp; 539 if(((OWLObjectOneOf) exp).getIndividuals().size() == 1)
508 else 540 return exp;
509 return null; 541 else
510 542 return null;
511 if (exp instanceof OWLDataHasValue) 543
512 return exp; 544 if(exp instanceof OWLDataHasValue)
513 545 return exp;
514 //TODO overapproximation - dealing with OWLDataMinCardinality 546
515 547 //TODO overapproximation - dealing with OWLDataMinCardinality
516 if (exp instanceof OWLDataSomeValuesFrom) { 548
517 return exp; 549 if(exp instanceof OWLDataSomeValuesFrom) {
518 } 550 return exp;
519 551 }
520 if (exp instanceof OWLDataMinCardinality) { 552
521 return exp; 553 if(exp instanceof OWLDataMinCardinality) {
522 } 554 return exp;
523 555 }
524 if (exp instanceof OWLDataMaxCardinality) { 556
525 return exp; 557 if(exp instanceof OWLDataMaxCardinality) {
526 } 558 return exp;
527 559 }
528 560
529 Set<OWLClassExpression> exps = exp.asConjunctSet(); 561
530 if (exps.size() == 1 && exps.iterator().next() == exp) { 562 Set<OWLClassExpression> exps = exp.asConjunctSet();
531 Utility.logError(exp, "error in transform of Ontology~~~~"); 563 if(exps.size() == 1 && exps.iterator().next() == exp) {
532 } 564 Utility.logError(exp, "error in transform of Ontology~~~~");
533 Set<OWLClassExpression> nexps = new HashSet<OWLClassExpression>(); 565 }
534 OWLClassExpression ne; 566 Set<OWLClassExpression> nexps = new HashSet<OWLClassExpression>();
535 boolean changes = false; 567 OWLClassExpression ne;
536 for (OWLClassExpression e: exps) { 568 boolean changes = false;
537 ne = transform(e, addedAxioms); 569 for(OWLClassExpression e : exps) {
538 if (ne != e) changes = true; 570 ne = transform(e, addedAxioms);
539 nexps.add(ne); 571 if(ne != e) changes = true;
540 } 572 nexps.add(ne);
541 if (changes) 573 }
542 return OWLHelper.getSimplifiedConjunction(factory, nexps); 574 if(changes)
543 else 575 return OWLHelper.getSimplifiedConjunction(factory, nexps);
544 return exp; 576 else
545 } 577 return exp;
546 578 }
547 protected OWLNamedIndividual getNewIndividual(OWLOntology onto, int number) { 579
548 OWLOntologyManager manager = onto.getOWLOntologyManager(); 580 protected OWLNamedIndividual getNewIndividual(OWLOntology onto, int number) {
549 OWLDataFactory factory = manager.getOWLDataFactory(); 581 OWLOntologyManager manager = onto.getOWLOntologyManager();
550 OWLNamedIndividual newIndividual = factory.getOWLNamedIndividual(IRI.create(Namespace.PAGODA_ANONY + "NI" + number)); 582 OWLDataFactory factory = manager.getOWLDataFactory();
551 manager.addAxiom(onto, factory.getOWLDeclarationAxiom(newIndividual)); 583 OWLNamedIndividual newIndividual =
552 return newIndividual; 584 factory.getOWLNamedIndividual(IRI.create(Namespace.PAGODA_ANONY + "NI" + number));
553 } 585 manager.addAxiom(onto, factory.getOWLDeclarationAxiom(newIndividual));
554 586 return newIndividual;
555 protected OWLObjectProperty getNewRole(OWLOntology onto, int number) { 587 }
556 OWLOntologyManager manager = onto.getOWLOntologyManager(); 588
557 OWLDataFactory factory = manager.getOWLDataFactory(); 589 protected OWLObjectProperty getNewRole(OWLOntology onto, int number) {
558 OWLObjectProperty newProperty = factory.getOWLObjectProperty(IRI.create(Namespace.PAGODA_AUX + "NR" + number)); 590 OWLOntologyManager manager = onto.getOWLOntologyManager();
559 manager.addAxiom(onto, factory.getOWLDeclarationAxiom(newProperty)); 591 OWLDataFactory factory = manager.getOWLDataFactory();
560 return newProperty; 592 OWLObjectProperty newProperty = factory.getOWLObjectProperty(IRI.create(Namespace.PAGODA_AUX + "NR" + number));
561 } 593 manager.addAxiom(onto, factory.getOWLDeclarationAxiom(newProperty));
562 594 return newProperty;
563 private OWLClass getNewConcept(OWLOntology onto, int number) { 595 }
564 OWLOntologyManager manager = onto.getOWLOntologyManager(); 596
565 OWLDataFactory factory = manager.getOWLDataFactory(); 597 private OWLClass getNewConcept(OWLOntology onto, int number) {
566 OWLClass newClass = factory.getOWLClass(IRI.create(Namespace.PAGODA_AUX + "NC" + number)); 598 OWLOntologyManager manager = onto.getOWLOntologyManager();
567 manager.addAxiom(onto, factory.getOWLDeclarationAxiom(newClass)); 599 OWLDataFactory factory = manager.getOWLDataFactory();
568 return newClass; 600 OWLClass newClass = factory.getOWLClass(IRI.create(Namespace.PAGODA_AUX + "NC" + number));
569 } 601 manager.addAxiom(onto, factory.getOWLDeclarationAxiom(newClass));
570 602 return newClass;
571 public OWLOntologyManager getOWLOntologyManager() { 603 }
572 return inputOntology.getOWLOntologyManager(); 604
573 } 605 private enum BottomStrategy {TOREMOVE, NULLARY, UNARY}
574
575 public String getOntologyIRI() {
576 return ontologyIRI;
577 }
578
579 public OWLOntology getOutputOntology() {
580 return outputOntology;
581 }
582
583 @Override
584 public String getOutputPath() {
585 return outputPath;
586 }
587
588 @Override
589 public String getDirectory() {
590 return outputPath.substring(0, outputPath.lastIndexOf(Utility.FILE_SEPARATOR));
591 }
592
593 public void setCorrespondenceFileLoc(String path) {
594 corrFileName = path;
595 }
596
597 private enum BottomStrategy { TOREMOVE, NULLARY, UNARY }
598} 606}
599 607