From: <jen...@us...> - 2010-08-04 11:30:06
|
Revision: 2236 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2236&view=rev Author: jenslehmann Date: 2010-08-04 11:29:59 +0000 (Wed, 04 Aug 2010) Log Message: ----------- example cleanup and unit test improvements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java Removed Paths: ------------- trunk/examples/testCaseSPARQLDescription/ Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java 2010-08-04 11:11:54 UTC (rev 2235) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java 2010-08-04 11:29:59 UTC (rev 2236) @@ -186,11 +186,11 @@ horizExp.setUpperLimit(1.0); options.add(horizExp); options.add(new BooleanConfigOption("improveSubsumptionHierarchy", "simplify subsumption hierarchy to reduce search space (see publication for description)", true)); - // allowed/ignored concepts/roles could also be a reasoner option (?) options.add(CommonConfigOptions.allowedConcepts()); options.add(CommonConfigOptions.ignoredConcepts()); -// options.add(CommonConfigOptions.allowedRoles()); -// options.add(CommonConfigOptions.ignoredRoles()); + // allowed/ignored roles are an unstable/untested feature + options.add(CommonConfigOptions.allowedRoles()); + options.add(CommonConfigOptions.ignoredRoles()); options.add(CommonConfigOptions.useAllConstructor()); options.add(CommonConfigOptions.useExistsConstructor()); options.add(CommonConfigOptions.useHasValueConstructor()); @@ -428,7 +428,8 @@ } public static String getName() { - return "refinement operator based learning algorithm II"; +// return "refinement operator based learning algorithm II"; + return "OCEL"; } public static String getUsage() { Modified: trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2010-08-04 11:11:54 UTC (rev 2235) +++ trunk/src/dl-learner/org/dllearner/test/junit/ExampleTests.java 2010-08-04 11:29:59 UTC (rev 2236) @@ -41,6 +41,7 @@ import org.dllearner.cli.Start; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; +import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.utilities.Helper; import org.junit.Test; @@ -72,6 +73,10 @@ // GPs can be excluded temporarily (because those tests are very time-consuming) boolean testGP = false; + // setting for SPARQL based tests (0 = no special treatment, 1 = test only SPARQL + // examples, 2 = skip SPARQL tests) + int sparql = 0; + // we use a logger, which outputs few messages (warnings, errors) SimpleLayout layout = new SimpleLayout(); ConsoleAppender consoleAppender = new ConsoleAppender(layout); @@ -118,10 +123,7 @@ // ignored due to errors (should be fixed; in case of long running problems or // our of memory, it is better to increase the noise parameter and add comments // in the conf file about "optimal" parameters) - - // problems before latest release (kept to see if errors re-occurr, - // delete before next release) - // ignore.add("./examples/sparql/govtrack.conf"); // HTTP 500 Server error + ignore.add("./examples/sparql/govtrack.conf"); // blank node handling error //working fine here ignore.add("./examples/sparql/SKOSTEST_local.conf"); // Out of Memory Error // ignore.add("./examples/sparql/scrobble.conf"); // HTTP 502 Proxy Error // ignore.add("./examples/family-benchmark/Cousin.conf"); // Out of Memory Error => disallowing ALL helps (TODO find out details) @@ -148,16 +150,22 @@ } else { System.out.println("Testing " + conf + " (example " + counter + " of " + total + ", time: " + sdf.format(new Date()) + ")."); long startTime = System.nanoTime(); - boolean success = false; + boolean success = false, started = false; try { // start example Start start = new Start(new File(conf)); - if(testGP || !(start.getLearningAlgorithm() instanceof GP)) { +// System.out.println("algorithm: " + start.getLearningAlgorithm()); + boolean isSparql = start.getSources().iterator().next() instanceof SparqlKnowledgeSource; + if((testGP || !(start.getLearningAlgorithm() instanceof GP)) && + (sparql == 0 || (sparql == 1 && isSparql) || (sparql == 2 && !isSparql) ) ) { + started = true; start.start(false); // test is successful if a concept was learned assert (start.getLearningAlgorithm().getCurrentlyBestDescription() != null); start.getReasonerComponent().releaseKB(); success = true; + } else { + System.out.println("Test skipped, because of GP/SPARQL settings."); } } catch (Exception e) { // unit test not succesful (exceptions are caught explicitly to find @@ -167,10 +175,12 @@ } long timeNeeded = System.nanoTime() - startTime; ComponentManager.getInstance().freeAllComponents(); - if(!success) { + if(!success && started) { System.out.println("TEST FAILED."); } - System.out.println("Test of " + conf + " completed in " + Helper.prettyPrintNanoSeconds(timeNeeded) + "."); + if(started) { + System.out.println("Test of " + conf + " completed in " + Helper.prettyPrintNanoSeconds(timeNeeded) + "."); + } } counter++; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |