From: <sha...@us...> - 2011-08-27 21:13:44
|
Revision: 3144 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3144&view=rev Author: shadowtm Date: 2011-08-27 21:13:37 +0000 (Sat, 27 Aug 2011) Log Message: ----------- Made the OWLAPIReasoner optional on the Fast Instance Checker - and added MoosiqueCLITest for testing purposes - it's not working yet though. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java trunk/examples/sparql/moosique_new.conf trunk/interfaces/pom.xml Added Paths: ----------- trunk/interfaces/src/test/java/org/dllearner/cli/MoosiqueCLITest.java Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2011-08-27 20:51:32 UTC (rev 3143) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2011-08-27 21:13:37 UTC (rev 3144) @@ -1035,7 +1035,7 @@ return rc; } - @Autowired + @Autowired(required = false) public void setReasonerComponent(OWLAPIReasoner rc) { this.rc = rc; } Modified: trunk/examples/sparql/moosique_new.conf =================================================================== --- trunk/examples/sparql/moosique_new.conf 2011-08-27 20:51:32 UTC (rev 3143) +++ trunk/examples/sparql/moosique_new.conf 2011-08-27 21:13:37 UTC (rev 3144) @@ -48,7 +48,7 @@ jamendoOntology.url = "jamendo.owl" reasoner.type = "fast instance checker" -reasoner.sources = {component:jamendo, component:jamendoOntology} +reasoner.sources = {jamendo, jamendoOntology} // we want to learn from positive examples only lp.type = "positive only learning problem" @@ -56,12 +56,12 @@ "http://dbtune.org/jamendo/record/1059", "http://dbtune.org/jamendo/record/1162", "http://dbtune.org/jamendo/record/1262" } -lp.reasoner = component:reasoner +lp.reasoner = reasoner // we use the CELOE algorithm alg.type = "celoe" -alg.reasoner = component:reasoner -alg.learningProblem = component:lp +alg.reasoner = reasoner +alg.learningProblem = lp // set the start class to the correct type (Record in this case) - not supported yet // celoe.startClass = "http://purl.org/ontology/mo/Record"; // let it run for a short amount of time (we only want simple expressions) Modified: trunk/interfaces/pom.xml =================================================================== --- trunk/interfaces/pom.xml 2011-08-27 20:51:32 UTC (rev 3143) +++ trunk/interfaces/pom.xml 2011-08-27 21:13:37 UTC (rev 3144) @@ -168,6 +168,7 @@ <exclude>org/dllearner/configuration/spring/TestBean.java</exclude> <exclude>org/dllearner/test/SpringTest.java</exclude> <exclude>org/dllearner/test/junit/GeizhalsTest.java</exclude> + <exclude>org/dllearner/cli/MoosiqueCLITest</exclude> </excludes> </configuration> </plugin> Copied: trunk/interfaces/src/test/java/org/dllearner/cli/MoosiqueCLITest.java (from rev 3142, trunk/interfaces/src/test/java/org/dllearner/cli/FatherCLITest.java) =================================================================== --- trunk/interfaces/src/test/java/org/dllearner/cli/MoosiqueCLITest.java (rev 0) +++ trunk/interfaces/src/test/java/org/dllearner/cli/MoosiqueCLITest.java 2011-08-27 21:13:37 UTC (rev 3144) @@ -0,0 +1,68 @@ +package org.dllearner.cli; + +import junit.framework.Assert; +import org.dllearner.algorithms.celoe.CELOE; +import org.dllearner.configuration.IConfiguration; +import org.dllearner.configuration.spring.ApplicationContextBuilder; +import org.dllearner.configuration.spring.DefaultApplicationContextBuilder; +import org.dllearner.confparser3.ConfParserConfiguration; +import org.dllearner.learningproblems.PosNegLPStandard; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.core.io.FileSystemResource; +import org.springframework.core.io.Resource; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * Created by IntelliJ IDEA. + * User: Chris + * Date: 8/23/11 + * Time: 5:21 AM + * <p/> + * Test for the CLI Class + */ +public class MoosiqueCLITest { + + public ApplicationContext createApplicationContext(Resource confFile) throws IOException { + ApplicationContextBuilder builder = new DefaultApplicationContextBuilder(); + + List<String> componentKeyPrefixes = new ArrayList<String>(); + componentKeyPrefixes.add("component:"); + componentKeyPrefixes.add(":"); + + //Spring Config Files + List<Resource> springConfigResources = new ArrayList<Resource>(); + + //DL-Learner Configuration Object + IConfiguration configuration = new ConfParserConfiguration(confFile); + //Build The Application Context + + ApplicationContext context = builder.buildApplicationContext(configuration, componentKeyPrefixes, springConfigResources); + return context; + } + + + @Test + public void testMoosiqueConf() throws Exception { + Resource confFile = new FileSystemResource("../examples/sparql/moosique_new.conf"); + ApplicationContext context = createApplicationContext(confFile); + validateContext(context); + } + + + + private void validateContext(ApplicationContext context) { + PosNegLPStandard lp = context.getBean("lp", PosNegLPStandard.class); + Assert.assertTrue(lp.getPositiveExamples().size() == 3); + Assert.assertTrue(lp.getNegativeExamples().size() == 4); + Assert.assertNotNull(lp.getReasoner()); + + CELOE algorithm = context.getBean("alg", CELOE.class); + Assert.assertNotNull(algorithm); + + algorithm.start(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |