From: <lor...@us...> - 2012-02-26 10:02:35
|
Revision: 3589 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3589&view=rev Author: lorenz_b Date: 2012-02-26 10:02:29 +0000 (Sun, 26 Feb 2012) Log Message: ----------- Small changes to save ontologies with given filename. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/utilities/JustificationBasedCoherentOntologyExtractor.java Modified: trunk/components-core/src/main/java/org/dllearner/utilities/JustificationBasedCoherentOntologyExtractor.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/utilities/JustificationBasedCoherentOntologyExtractor.java 2012-02-24 14:15:56 UTC (rev 3588) +++ trunk/components-core/src/main/java/org/dllearner/utilities/JustificationBasedCoherentOntologyExtractor.java 2012-02-26 10:02:29 UTC (rev 3589) @@ -94,7 +94,8 @@ private OWLOntology dbpediaOntology; - private String fileName; + private String fileName = "dbpedia"; + private String diffFileName = "diff.owl"; public JustificationBasedCoherentOntologyExtractor() { try { @@ -117,14 +118,6 @@ this.ontology = ontology; this.incoherentOntology = getOntologyWithoutAnnotations(ontology); - IRI iri = ontology.getOWLOntologyManager().getOntologyDocumentIRI(ontology); - fileName = "dbpedia"; - if(iri != null){ - fileName = iri.toString().substring( iri.toString().lastIndexOf('/')+1, iri.toString().length() ); - } else { - - } - new File("log").mkdir(); File diffFile = new File("log/" + DIFF_ONTOLOGY_NAME); @@ -165,6 +158,11 @@ } } + public void setFileName(String fileName) { + this.fileName = fileName; + diffFileName = "diff_" + fileName; + } + private OWLOntology computeCoherentOntologyRootBased(OWLOntology ontology) { // startTime = System.currentTimeMillis(); @@ -426,7 +424,7 @@ OWLOntology toSave = getOntologyWithAnnotations(incoherentOntology); try { toSave.getOWLOntologyManager().saveOntology(incoherentOntology, new RDFXMLOntologyFormat(), new BufferedOutputStream(new FileOutputStream(fileName))); - toSave.getOWLOntologyManager().saveOntology(diffOntology, new RDFXMLOntologyFormat(), new BufferedOutputStream(new FileOutputStream("log/diff.owl"))); + toSave.getOWLOntologyManager().saveOntology(diffOntology, new RDFXMLOntologyFormat(), new BufferedOutputStream(new FileOutputStream("log/" + diffFileName))); } catch (OWLOntologyStorageException e) { e.printStackTrace(); } catch (FileNotFoundException e) { @@ -743,6 +741,11 @@ JustificationBasedCoherentOntologyExtractor extractor = new JustificationBasedCoherentOntologyExtractor(); extractor.setNumberOfJustifications(numberOfJustifications); extractor.setComputeParallel(computeParallel); + if(filename.indexOf('/') >= 0){ + filename = filename.substring( filename.lastIndexOf('/')+1, filename.length() ); + } + + extractor.setFileName(filename); OWLOntology coherentOntology = extractor.getCoherentOntology(schema, preferRoots); System.out.println("Coherent ontology contains " + coherentOntology.getLogicalAxiomCount() + " logical axioms."); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |