|
28 | 28 | import org.apache.log4j.Logger; |
29 | 29 | import org.dllearner.kb.repository.OntologyRepository; |
30 | 30 | import org.dllearner.kb.repository.OntologyRepositoryEntry; |
| 31 | +import org.dllearner.utilities.Files; |
31 | 32 | import org.semanticweb.owlapi.apibinding.OWLManager; |
32 | 33 | import org.semanticweb.owlapi.model.*; |
33 | 34 |
|
@@ -236,10 +237,8 @@ public static void main(String[] args) throws Exception{ |
236 | 237 | System.out.println(entry.getOntologyShortName() + ": " + FileUtils.byteCountToDisplaySize(f.length())); |
237 | 238 | map.put(entry.getOntologyShortName(), FileUtils.byteCountToDisplaySize(f.length())); |
238 | 239 | } catch (Exception e) { |
239 | | - com.google.common.io.Files.write( |
240 | | - ExceptionUtils.getMessage(e), |
241 | | - new File(downloadFailedDir, entry.getOntologyShortName() + ".txt"), |
242 | | - Charsets.UTF_8); |
| 240 | + com.google.common.io.Files.asCharSink(new File(downloadFailedDir, entry.getOntologyShortName() + ".txt"), |
| 241 | + Charsets.UTF_8).write(ExceptionUtils.getMessage(e)); |
243 | 242 | return; |
244 | 243 | } |
245 | 244 | } |
@@ -267,24 +266,24 @@ public static void main(String[] args) throws Exception{ |
267 | 266 | OWLOntology ont = man.loadOntologyFromOntologyDocument(f); |
268 | 267 | System.out.println("#Axioms: " + ont.getLogicalAxiomCount()); |
269 | 268 |
|
270 | | - com.google.common.io.Files.write( |
| 269 | + com.google.common.io.Files.asCharSink( |
| 270 | + new File(parsedSuccessfulDir, entry.getOntologyShortName() + ".txt"), |
| 271 | + Charsets.UTF_8).write( |
271 | 272 | ont.getLogicalAxiomCount() + "\t" + |
272 | 273 | ont.getClassesInSignature().size() + "\t" + |
273 | 274 | ont.getObjectPropertiesInSignature().size() + "\t" + |
274 | 275 | ont.getDataPropertiesInSignature().size() + "\t" + |
275 | | - ont.getIndividualsInSignature().size(), |
276 | | - new File(parsedSuccessfulDir, entry.getOntologyShortName() + ".txt"), |
277 | | - Charsets.UTF_8); |
| 276 | + ont.getIndividualsInSignature().size() |
| 277 | + ); |
278 | 278 |
|
279 | 279 | map.replace(entry.getOntologyShortName(), map.get(entry.getOntologyShortName()) + "||#Axioms: " + ont.getLogicalAxiomCount()); |
280 | 280 | man.removeOntology(ont); |
281 | 281 | } catch (Exception e1) { |
282 | 282 | System.err.println("Failed to parse " + entry.getOntologyShortName()); |
283 | 283 | map.replace(entry.getOntologyShortName(), map.get(entry.getOntologyShortName()) + "||Parse Error"); |
284 | | - com.google.common.io.Files.write( |
285 | | - ExceptionUtils.getMessage(e1), |
| 284 | + com.google.common.io.Files.asCharSink( |
286 | 285 | new File(parsedFailedDir, entry.getOntologyShortName() + ".txt"), |
287 | | - Charsets.UTF_8); |
| 286 | + Charsets.UTF_8).write(ExceptionUtils.getMessage(e1)); |
288 | 287 | } |
289 | 288 | } |
290 | 289 | } catch (Exception e) { |
|
0 commit comments