From: <lor...@us...> - 2012-02-24 10:37:01
|
Revision: 3586 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3586&view=rev Author: lorenz_b Date: 2012-02-24 10:36:50 +0000 (Fri, 24 Feb 2012) Log Message: ----------- Small changes for 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 08:59:06 UTC (rev 3585) +++ trunk/components-core/src/main/java/org/dllearner/utilities/JustificationBasedCoherentOntologyExtractor.java 2012-02-24 10:36:50 UTC (rev 3586) @@ -94,6 +94,8 @@ private OWLOntology dbpediaOntology; + private String fileName; + public JustificationBasedCoherentOntologyExtractor() { try { md5 = MessageDigest.getInstance("MD5"); @@ -115,6 +117,14 @@ 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); @@ -176,6 +186,12 @@ logger.info("...done in " + (System.currentTimeMillis()-startTime) + "ms."); int rootCnt = unsatClasses.size(); int derivedCnt = derivedUnsatClasses.size(); + + //if no roots are found we use all unsat classes + if(rootCnt == 0){ + unsatClasses = derivedUnsatClasses; + } + // Set<OWLClass> unsatClasses = reasoner.getUnsatisfiableClasses().getEntitiesMinusBottom(); int cnt = rootCnt + derivedCnt; int unsatPropCnt = unsatObjectProperties.size(); @@ -229,6 +245,11 @@ derivedCnt = derivedUnsatClasses.size(); logger.info("...done in " + (System.currentTimeMillis()-startTime) + "ms."); + //if no roots are found we use all unsat classes + if(rootCnt == 0){ + unsatClasses = derivedUnsatClasses; + } + logger.info("Remaining unsatisfiable classes: " + (rootCnt + derivedCnt) + "(" + rootCnt + " roots)."); if(unsatClasses.isEmpty()){ @@ -244,7 +265,7 @@ //save if(cnt - (rootCnt+derivedCnt) >= 1 || (unsatPropCnt - unsatObjectProperties.size()) >= 1){ cnt = rootCnt + derivedCnt; - save("log/dbpedia_" + cnt + "cls" + unsatPropCnt + "prop.owl"); + save("log/" + fileName + "_" + cnt + "cls" + unsatPropCnt + "prop.owl"); cnt = rootCnt + derivedCnt; unsatPropCnt = unsatObjectProperties.size(); if(computeParallel){ @@ -287,7 +308,7 @@ //save if((unsatPropCnt - unsatObjectProperties.size()) >= 1){ - save("log/dbpedia_" + cnt + "cls" + unsatPropCnt + "prop.owl"); + save("log/" + fileName + "_" + cnt + "cls" + unsatPropCnt + "prop.owl"); unsatPropCnt = unsatObjectProperties.size(); } @@ -338,7 +359,7 @@ entity2Explanations.putAll(getInitialExplanations(unsatObjectProperties)); logger.info("...done in " + (System.currentTimeMillis()-startTime) + "ms."); - while(!unsatClasses.isEmpty()){ + while(!unsatClasses.isEmpty() && !unsatObjectProperties.isEmpty()){ //we remove the most appropriate axiom from the ontology removeAppropriateAxiom(); @@ -357,7 +378,7 @@ //save if(cnt - unsatClasses.size() >= 10){ cnt = unsatClasses.size(); - save("log/dbpedia_" + cnt + ".owl"); + save("log/" + fileName + "_" + cnt + "cls" + unsatObjectProperties.size() + "prop.owl"); } //recompute explanations if necessary This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |