From: <ji...@us...> - 2011-05-03 14:57:32
|
Revision: 2780 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2780&view=rev Author: jialva Date: 2011-05-03 14:57:22 +0000 (Tue, 03 May 2011) Log Message: ----------- New update of fuzzyDL-Learner Modified Paths: -------------- trunk/components-core/pom.xml trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLPStandard.java trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyDLReasonerManager.java Modified: trunk/components-core/pom.xml =================================================================== --- trunk/components-core/pom.xml 2011-05-03 14:22:29 UTC (rev 2779) +++ trunk/components-core/pom.xml 2011-05-03 14:57:22 UTC (rev 2780) @@ -200,12 +200,12 @@ <artifactId>fuzzydl</artifactId> <version>1.0</version> </dependency> - + <dependency> <groupId>fuzzydll</groupId> <artifactId>fuzzyowl2fuzzydlparser</artifactId> <version>1.0</version> </dependency> - + </dependencies> </project> Modified: trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLPStandard.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLPStandard.java 2011-05-03 14:22:29 UTC (rev 2779) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLPStandard.java 2011-05-03 14:57:22 UTC (rev 2780) @@ -511,7 +511,10 @@ double crispAccuracy = crispAccuracy(description, noise); // if I erase next line, fuzzy reasoning fails - if (crispAccuracy == -1) return -1; + if (crispAccuracy == -1) { + System.out.println("crisp return -1"); + // return -1; + } // BEGIN // added by Josue @@ -520,15 +523,20 @@ // double negMembership = 0; double descriptionMembership = 0; - //System.out.println("d: " + description); - //System.out.println(); + System.out.println("noise = " + noise); + int individualCounter = fuzzyExamples.size(); for (FuzzyIndividual fuzzyExample : fuzzyExamples) { descriptionMembership += reasoner.hasTypeFuzzyMembership(description, fuzzyExample); + individualCounter--; + if ((descriptionMembership + individualCounter) / fuzzyExamples.size() < noise) + return -1; } double fuzzyAccuracy = descriptionMembership / (double)fuzzyExamples.size(); + + if (crispAccuracy != fuzzyAccuracy) { System.err.println("***********************************************"); System.err.println("* " + (errorIndex++)); Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyDLReasonerManager.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyDLReasonerManager.java 2011-05-03 14:22:29 UTC (rev 2779) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyDLReasonerManager.java 2011-05-03 14:57:22 UTC (rev 2780) @@ -1,6 +1,9 @@ package org.dllearner.reasoning.fuzzydll; import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.Iterator; import java.util.Scanner; import org.semanticweb.owlapi.model.OWLClassExpression; @@ -26,6 +29,7 @@ private FuzzyOwl2toFuzzyDL fuzzyFileParser; private int auxCounter = 0; + private FileOutputStream errorFile; public FuzzyDLReasonerManager(String ontologyFile) throws Exception { queryResult = null; @@ -40,6 +44,8 @@ OWLAPI_fuzzyDLObjectParser.setParsingFuzzyKB(fuzzyFileParser, fuzzyKB); solveKB(); + + errorFile = new FileOutputStream("errorFile.txt"); } private void solveKB() { @@ -71,21 +77,25 @@ Individual fIndividual = fuzzyKB.getIndividual(shortFormParser.getShortForm((OWLEntity) i)); Concept fConcept = OWLAPI_fuzzyDLObjectParser.getFuzzyDLExpresion(oce); - // added by Josue - // this if is to jump a fuzyDL's bug - if (!fConcept.toString().equalsIgnoreCase("SOME_hasCar_SOME_hasLoad_*top*") && - !fConcept.toString().equalsIgnoreCase("SOME_hasCar_ALL_hasLoad_*top*") && - !fConcept.toString().equalsIgnoreCase("SOME_hasCar_(LongCar)_OR_(ShortCar)") && - !fConcept.toString().equalsIgnoreCase("(Car)_OR_(SOME_hasCar_*top*)") && - !fConcept.toString().equalsIgnoreCase("(Load)_OR_(SOME_hasCar_*top*)") && - !fConcept.toString().equalsIgnoreCase("(Train)_OR_(SOME_hasCar_*top*)") && - !fConcept.toString().equalsIgnoreCase("(Train)_AND_(SOME_hasCar_SOME_hasLoad_*top*)") && - !fConcept.toString().equalsIgnoreCase("(Train)_AND_(SOME_hasCar_ALL_hasLoad_*top*)") && - !fConcept.toString().equalsIgnoreCase("(Train)_AND_(SOME_hasCar_LongCar)") && - !fConcept.toString().equalsIgnoreCase("(Train)_AND_(SOME_hasCar_(LongCar)_OR_(ShortCar))") && - !fConcept.toString().equalsIgnoreCase("(Train)_AND_(SOME_hasCar_*top*)") && - !fConcept.toString().equalsIgnoreCase("SOME_hasCar_LongCar")) { - + try { + errorFile.write(fConcept.toString().getBytes()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + +// try { +// fuzzyKB.saveToFile("file.txt"); +// Parser parser = new Parser(new FileInputStream("file.txt")); +// parser.Start(); +// fuzzyKB = parser.getKB(); +// } catch (Exception e1) { +// e1.printStackTrace(); +// } + + if (fConcept.toString().equalsIgnoreCase("SOME_hasFirstCar_SOME_inFrontOf_LongCar")) + System.err.println(fConcept); + System.err.println(fConcept); Query q = new MinInstanceQuery(fConcept, fIndividual); @@ -101,14 +111,24 @@ sc.nextLine(); // System.exit(0); } - } catch (FuzzyOntologyException e) { + } catch (Exception e) { e.printStackTrace(); + try { + errorFile.write(" 1".getBytes()); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } } - + + try { + errorFile.write("\n".getBytes()); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return (1 - Math.abs(truthDegree - queryResult.getSolution())); - } - System.err.println("* " + fConcept); - return 0; } public KnowledgeBase getFuzzyKB() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |