From: <sha...@us...> - 2011-08-27 20:51:39
|
Revision: 3143 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3143&view=rev Author: shadowtm Date: 2011-08-27 20:51:32 +0000 (Sat, 27 Aug 2011) Log Message: ----------- Added autowiring support. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java trunk/components-core/src/main/java/org/dllearner/core/AbstractCELA.java trunk/components-core/src/main/java/org/dllearner/core/AbstractLearningProblem.java trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java trunk/examples/family/father_autowired.conf trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java 2011-08-27 20:37:40 UTC (rev 3142) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java 2011-08-27 20:51:32 UTC (rev 3143) @@ -55,6 +55,7 @@ import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.Files; import org.dllearner.utilities.Helper; +import org.springframework.beans.factory.annotation.Autowired; /** * The DL-Learner learning algorithm component for the example @@ -529,6 +530,7 @@ return operator; } + @Autowired public void setOperator(RhoDRDown operator) { this.operator = operator; } @@ -853,6 +855,7 @@ this.terminateOnNoiseReached = terminateOnNoiseReached; } + @Autowired public void setHeuristic(ExampleBasedHeuristic heuristic) { this.heuristic = heuristic; } Modified: trunk/components-core/src/main/java/org/dllearner/core/AbstractCELA.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AbstractCELA.java 2011-08-27 20:37:40 UTC (rev 3142) +++ trunk/components-core/src/main/java/org/dllearner/core/AbstractCELA.java 2011-08-27 20:51:32 UTC (rev 3143) @@ -27,6 +27,7 @@ import org.dllearner.core.owl.Description; import org.dllearner.utilities.datastructures.DescriptionSubsumptionTree; import org.dllearner.utilities.owl.ConceptTransformation; +import org.springframework.beans.factory.annotation.Autowired; /** * Abstract superclass of all class expression learning algorithm implementations. @@ -286,6 +287,7 @@ return learningProblem; } + @Autowired public void setLearningProblem(AbstractLearningProblem learningProblem) { this.learningProblem = learningProblem; } @@ -298,6 +300,7 @@ return reasoner; } + @Autowired public void setReasoner(AbstractReasonerComponent reasoner) { this.reasoner = reasoner; } Modified: trunk/components-core/src/main/java/org/dllearner/core/AbstractLearningProblem.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AbstractLearningProblem.java 2011-08-27 20:37:40 UTC (rev 3142) +++ trunk/components-core/src/main/java/org/dllearner/core/AbstractLearningProblem.java 2011-08-27 20:51:32 UTC (rev 3143) @@ -20,6 +20,7 @@ package org.dllearner.core; import org.dllearner.core.owl.Description; +import org.springframework.beans.factory.annotation.Autowired; /** * Base class for all learning problems. @@ -118,6 +119,7 @@ return reasoner; } + @Autowired public void setReasoner(AbstractReasonerComponent reasoner) { this.reasoner = reasoner; } 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:37:40 UTC (rev 3142) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2011-08-27 20:51:32 UTC (rev 3143) @@ -67,6 +67,7 @@ import org.dllearner.parser.ParseException; import org.dllearner.utilities.Helper; import org.dllearner.utilities.owl.ConceptTransformation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.propertyeditors.StringTrimmerEditor; import sun.beans.editors.BoolEditor; @@ -105,6 +106,7 @@ private TreeSet<Individual> individuals; // private ReasonerComponent rs; + private OWLAPIReasoner rc; // we use sorted sets (map indices) here, because they have only log(n) @@ -1033,6 +1035,7 @@ return rc; } + @Autowired public void setReasonerComponent(OWLAPIReasoner rc) { this.rc = rc; } Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java 2011-08-27 20:37:40 UTC (rev 3142) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java 2011-08-27 20:51:32 UTC (rev 3143) @@ -70,6 +70,7 @@ import org.dllearner.utilities.Helper; import org.dllearner.utilities.owl.ConceptComparator; import org.dllearner.utilities.owl.ConceptTransformation; +import org.springframework.beans.factory.annotation.Autowired; /** * A downward refinement operator, which makes use of domains @@ -1640,6 +1641,7 @@ return reasoner; } + @Autowired public void setReasoner(AbstractReasonerComponent reasoner) { this.reasoner = reasoner; } Modified: trunk/examples/family/father_autowired.conf =================================================================== --- trunk/examples/family/father_autowired.conf 2011-08-27 20:37:40 UTC (rev 3142) +++ trunk/examples/family/father_autowired.conf 2011-08-27 20:51:32 UTC (rev 3143) @@ -17,7 +17,6 @@ // reasoner reasoner.type = "fast instance checker" -reasoner.reasonerComponent = embeddedReasoner embeddedReasoner.type = "OWL API Reasoner" embeddedReasoner.sources = { ks } @@ -27,14 +26,9 @@ lp.positiveExamples = {"kb:stefan","kb:markus","kb:bernd"} lp.negativeExamples = {"kb:heinz","kb:anna","kb:gabi","kb:michelle"} -// plug a reasoner into the learning problem -lp.reasoner = reasoner -//lp.reasoner = reasoner - try to remove the component:part in the parser - // create a refinement operator and configure it op.type = "rho" op.useCardinalityRestrictions = true -op.reasoner = reasoner // create a heuristic and configure it h.type = "multiheuristic" @@ -42,8 +36,4 @@ // create learning algorithm to run alg.type = "ocel" -alg.reasoner = reasoner -alg.operator = op -alg.learningProblem = lp -alg.heuristic = h alg.maxExecutionTimeInSeconds = 15 \ No newline at end of file Modified: trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml =================================================================== --- trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml 2011-08-27 20:37:40 UTC (rev 3142) +++ trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml 2011-08-27 20:51:32 UTC (rev 3143) @@ -1,8 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> + <context:annotation-config/> <bean class="org.dllearner.configuration.spring.ComponentInitializationBeanPostProcessor"/> <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <sha...@us...> - 2011-08-28 05:23:25
|
Revision: 3146 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3146&view=rev Author: shadowtm Date: 2011-08-28 05:23:17 +0000 (Sun, 28 Aug 2011) Log Message: ----------- Updated IConfiguration to get the configured Object versus the String - that way we don't have to write a ton of new PropertyEditors for the different collection types. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/configuration/IConfigurationProperty.java trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java trunk/interfaces/src/main/java/org/dllearner/configuration/spring/ConfigurationBasedBeanDefinitionRegistryPostProcessor.java trunk/interfaces/src/main/java/org/dllearner/configuration/spring/CustomPropertyEditorRegistrar.java trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParser.java trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParserConfiguration.java trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java trunk/interfaces/src/main/java/org/dllearner/confparser3/conf3.jj trunk/interfaces/src/test/java/org/dllearner/configuration/spring/ConfigurationBasedPropertyOverrideConfigurerTest.java trunk/interfaces/src/test/java/org/dllearner/confparser3/ParseTest.java trunk/interfaces/src/test/resources/org/dllearner/configuration/spring/configurationBasedPropertyOverrideConfigurer.conf Modified: trunk/components-core/src/main/java/org/dllearner/configuration/IConfigurationProperty.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/configuration/IConfigurationProperty.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/components-core/src/main/java/org/dllearner/configuration/IConfigurationProperty.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -23,7 +23,7 @@ * * @return The String representation of the value of this property. */ - public String getValue(); + public Object getValue(); /** * Get the type of this value. Modified: trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -46,10 +46,6 @@ private Class<?> propertyType; - // TODO: Do we want to store the actual value as object here or leave it up to - // the corresponding PropertyEditor to create it? - // WARNING: This feature does not work in conjunction with prefix post-processing yet! - @Deprecated private Object valueObject; public ConfFileOption2() { @@ -112,8 +108,8 @@ } @Override - public String getValue() { - return getPropertyValue(); + public Object getValue() { + return getValueObject(); } @Override Modified: trunk/interfaces/src/main/java/org/dllearner/configuration/spring/ConfigurationBasedBeanDefinitionRegistryPostProcessor.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/configuration/spring/ConfigurationBasedBeanDefinitionRegistryPostProcessor.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/main/java/org/dllearner/configuration/spring/ConfigurationBasedBeanDefinitionRegistryPostProcessor.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -73,17 +73,16 @@ Object value = property.getValue(); //Process Single Bean References if (property.isBeanReference()) { - BeanDefinition referencedBean = beanFactory.getBeanDefinition(property.getValue()); + BeanDefinition referencedBean = beanFactory.getBeanDefinition((String)property.getValue()); value = referencedBean; } //Process collections of bean references if(property.isBeanReferenceCollection()){ - StringTokenizer tokenizer = new StringTokenizer(property.getValue(),"{,} ",false); Collection<RuntimeBeanReference> beanReferences = new ManagedSet<RuntimeBeanReference>(); - while(tokenizer.hasMoreTokens()){ - String referencedBeanName = tokenizer.nextToken(); - beanReferences.add(new RuntimeBeanReference(referencedBeanName)); + Collection<String> referencedBeanNames = (Collection<String>)property.getValue(); + for (String referencedBeanName : referencedBeanNames) { + beanReferences.add(new RuntimeBeanReference(referencedBeanName)); } value = beanReferences; } Modified: trunk/interfaces/src/main/java/org/dllearner/configuration/spring/CustomPropertyEditorRegistrar.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/configuration/spring/CustomPropertyEditorRegistrar.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/main/java/org/dllearner/configuration/spring/CustomPropertyEditorRegistrar.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -1,17 +1,8 @@ package org.dllearner.configuration.spring; -import org.dllearner.confparser3.IndividualCollectionEditor; -import org.dllearner.confparser3.MapEditor; -import org.dllearner.confparser3.SetEditor; -import org.dllearner.learningproblems.PosNegLP; -import org.springframework.beans.BeanWrapper; import org.springframework.beans.PropertyEditorRegistrar; import org.springframework.beans.PropertyEditorRegistry; -import java.util.Collection; -import java.util.Map; -import java.util.Set; - /** * Created by IntelliJ IDEA. * User: Chris @@ -25,19 +16,7 @@ @Override public void registerCustomEditors(PropertyEditorRegistry registry) { + //Register any custom editors here. - if (registry instanceof BeanWrapper) { - Object wrappedInstance = ((BeanWrapper) registry).getWrappedInstance(); - if (wrappedInstance instanceof PosNegLP) { - registry.registerCustomEditor(Collection.class, "positiveExamples", new IndividualCollectionEditor()); - registry.registerCustomEditor(Collection.class, "negativeExamples", new IndividualCollectionEditor()); - } - } - - //Wrappers for all beans - registry.registerCustomEditor(Map.class,new MapEditor()); - registry.registerCustomEditor(Set.class,new SetEditor()); - - } } Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParser.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParser.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParser.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -92,7 +92,7 @@ boolean containsSubOption=false; String value="", value1="", value2="", tmp="", tmp2=""; Set<String> values = new HashSet<String>(); - List<StringTuple> tuples = new LinkedList<StringTuple>(); + Map<String,String> tuples = new HashMap<String,String>(); ConfFileOption2 option = new ConfFileOption2(); boolean isBeanRef = false; @@ -207,7 +207,7 @@ jj_consume_token(16); tmp2 = String(); jj_consume_token(21); - tuples.add(new StringTuple(tmp,tmp2)); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + tmp2 + "\u005c"), "; + tuples.put(tmp,tmp2); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + tmp2 + "\u005c"), "; jj_consume_token(16); } jj_consume_token(20); @@ -215,7 +215,7 @@ jj_consume_token(16); tmp2 = String(); jj_consume_token(21); - tuples.add(new StringTuple(tmp,tmp2)); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + tmp2 + "\u005c")"; + tuples.put(tmp,tmp2); propertyValue += "(\u005c""+ tmp + "\u005c",\u005c"" + tmp2 + "\u005c")"; jj_consume_token(19); val = tuples; propertyType = List.class; propertyValue = "["+ propertyValue + "]"; break; Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParserConfiguration.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParserConfiguration.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/ConfParserConfiguration.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -63,7 +63,7 @@ Class<?> result = null; - String value = (String) option.getPropertyValue(); + String value = (String) option.getValue(); // first option: use long name of @ComponentAnn annotation Class<? extends Component> classFromName = AnnComponentManager.getInstance().getComponentsNamed().getKey(value); if(classFromName != null) { @@ -79,7 +79,7 @@ result = Class.forName(value); } catch (ClassNotFoundException e) { // if all methods fail, throw an exception - throw new RuntimeException("Problem getting class type for bean: " + beanName + " - trying to instantiate class: " + option.getPropertyValue()); + throw new RuntimeException("Problem getting class type for bean: " + beanName + " - trying to instantiate class: " + value); } return result; } Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -19,13 +19,9 @@ */ package org.dllearner.confparser3; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; +import java.util.*; import org.dllearner.cli.ConfFileOption2; -import org.dllearner.utilities.Helper; -import org.dllearner.utilities.datastructures.StringTuple; /** * Performs post processing of conf files based on special parsing directives. @@ -50,17 +46,47 @@ // apply prefix directive ConfFileOption2 prefixOption = directives.get("prefixes"); if(prefixOption != null) { - List<StringTuple> prefixes = (List<StringTuple>) prefixOption.getValueObject(); + Map<String,String> prefixes = (Map<String,String>) prefixOption.getValueObject(); // loop through all options and replaces prefixes for(ConfFileOption2 option : confOptions) { - String value = option.getPropertyValue(); - for(StringTuple prefix : prefixes) { - // we only replace the prefix if it occurs directly after a quote - value = value.replaceAll("\"" + prefix.a + ":", "\"" + prefix.b); - } - option.setPropertyValue(value); + Object valueObject = option.getValue(); + + if(valueObject instanceof String){ + for (String prefix : prefixes.keySet()) { + // we only replace the prefix if it occurs directly after a quote + valueObject = ((String) valueObject).replaceAll(prefix + ":", prefixes.get(prefix)); + } + + }else{ + // Check for collections of string + if (valueObject instanceof Collection) { + processStringCollection(prefixes, (Collection) valueObject); + } + } + + option.setValueObject(valueObject); } } } + + private void processStringCollection(Map<String,String> prefixes, Collection valueObject) { + Map<String, String> oldNewStringValues = new HashMap<String, String>(); + Iterator itr = valueObject.iterator(); + while (itr.hasNext()) { + for (String prefix : prefixes.keySet()) { + Object nextObject = itr.next(); + if (nextObject instanceof String) { + String oldValue = (String) nextObject; + String newValue = oldValue.replaceAll( prefix + ":", prefixes.get(prefix)); + oldNewStringValues.put(oldValue, newValue); + } + } + } + + Collection<String> oldValues = oldNewStringValues.keySet(); + Collection<String> newValues = oldNewStringValues.values(); + valueObject.removeAll(oldValues); + valueObject.addAll(newValues); + } } Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/conf3.jj =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/conf3.jj 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/conf3.jj 2011-08-28 05:23:17 UTC (rev 3146) @@ -140,7 +140,7 @@ boolean containsSubOption=false; String value="", value1="", value2="", tmp="", tmp2=""; Set<String> values = new HashSet<String>(); - List<StringTuple> tuples = new LinkedList<StringTuple>(); + Map<String,String> tuples = new HashMap<String,String>(); ConfFileOption2 option = new ConfFileOption2(); boolean isBeanRef = false; @@ -184,9 +184,9 @@ // e.g. [("a","b"),("c","d")] | "[" ( LOOKAHEAD(6) "(" tmp=String() "," tmp2=String() ")" - {tuples.add(new StringTuple(tmp,tmp2)); propertyValue += "(\""+ tmp + "\",\"" + tmp2 + "\"), "; } "," )* + { tuples.put(tmp,tmp2); propertyValue += "(\""+ tmp + "\",\"" + tmp2 + "\"), "; } "," )* "(" tmp=String() "," tmp2=String() ")" - {tuples.add(new StringTuple(tmp,tmp2)); propertyValue += "(\""+ tmp + "\",\"" + tmp2 + "\")";} + { tuples.put(tmp,tmp2); propertyValue += "(\""+ tmp + "\",\"" + tmp2 + "\")";} "]" { val = tuples; propertyType = List.class; propertyValue = "["+ propertyValue + "]";} ) // <CONF_END> Modified: trunk/interfaces/src/test/java/org/dllearner/configuration/spring/ConfigurationBasedPropertyOverrideConfigurerTest.java =================================================================== --- trunk/interfaces/src/test/java/org/dllearner/configuration/spring/ConfigurationBasedPropertyOverrideConfigurerTest.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/test/java/org/dllearner/configuration/spring/ConfigurationBasedPropertyOverrideConfigurerTest.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -66,8 +66,13 @@ validateSecondBean(secondBean); validateThirdBean(secondBean.getComponent()); validateFourthBean(context.getBean("fourthBean", TestBean.class)); + validateFifthBean(context.getBean("fifthBean", TestBean.class)); } + private void validateFifthBean(TestBean fifthBean) { + Assert.assertTrue(fifthBean.getSimpleValue().equals("http://localhost/foo#test")); + } + private void validateThirdBean(TestBean thirdBean) { Assert.assertEquals(thirdBean.getIntValue(), (Integer) 3); TestBean fourthBean = thirdBean.getComponent(); Modified: trunk/interfaces/src/test/java/org/dllearner/confparser3/ParseTest.java =================================================================== --- trunk/interfaces/src/test/java/org/dllearner/confparser3/ParseTest.java 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/test/java/org/dllearner/confparser3/ParseTest.java 2011-08-28 05:23:17 UTC (rev 3146) @@ -37,7 +37,7 @@ public void test() throws FileNotFoundException, ParseException { ConfParser parser = ConfParser.parseFile(new File("../examples/family/father.conf")); for(ConfFileOption2 option : parser.getConfOptions()) { - System.out.print(option.getBeanName() + "." + option.getPropertyName() + " = " + option.getPropertyValue()); + System.out.print(option.getBeanName() + "." + option.getPropertyName() + " = " + option.getValue().toString()); if(option.isBeanRef()) { System.out.println(" (bean reference)"); } else { Modified: trunk/interfaces/src/test/resources/org/dllearner/configuration/spring/configurationBasedPropertyOverrideConfigurer.conf =================================================================== --- trunk/interfaces/src/test/resources/org/dllearner/configuration/spring/configurationBasedPropertyOverrideConfigurer.conf 2011-08-28 00:59:13 UTC (rev 3145) +++ trunk/interfaces/src/test/resources/org/dllearner/configuration/spring/configurationBasedPropertyOverrideConfigurer.conf 2011-08-28 05:23:17 UTC (rev 3146) @@ -2,6 +2,8 @@ * A multi-line comment, which is ignored. */ +prefixes = [ ("kb","http://localhost/foo#") ] + // a single line comment, which is ignored testBean.simpleValue="simple value example" // simple value @@ -31,3 +33,6 @@ fourthBean.simpleValue="Fourth Bean - not specified in xml" fourthBean.type="org.dllearner.configuration.spring.TestBean" +fifthBean.type="org.dllearner.configuration.spring.TestBean" +fifthBean.simpleValue="kb:test" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-28 10:57:45
|
Revision: 3149 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3149&view=rev Author: jenslehmann Date: 2011-08-28 10:57:36 +0000 (Sun, 28 Aug 2011) Log Message: ----------- removed configurator from SparqlKnowledgeSoruce and made related code changes Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/examples/sparql/moosique_new.conf trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java trunk/scripts/src/main/java/org/dllearner/scripts/DumbLPFinder.java trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java Modified: trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -46,11 +46,11 @@ @ComponentAnn(name = "OWL File", shortName = "owlfile", version = 0.9) public class OWLFile extends AbstractKnowledgeSource { - private static Logger logger = Logger - .getLogger(OWLFile.class); + private static Logger logger = Logger.getLogger(OWLFile.class); // TODO: turn this into a config option private URL url; + private String baseDir; // private URL url; // private OWLFileConfigurator configurator ; @@ -119,6 +119,7 @@ // return configurator.getUrl(); return url; } + public void setURL(URL url) { this.url = url; // configurator.setUrl(url); @@ -148,4 +149,12 @@ public void setBaseDir(String baseDir) { this.baseDir = baseDir; } + + public URL getUrl() { + return url; + } + + public void setUrl(URL url) { + this.url = url; + } } Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; +import java.util.Set; import java.util.TreeSet; import javax.swing.ProgressMonitor; @@ -81,21 +82,21 @@ private static final boolean debugExitAfterExtraction = false; // switches - private SparqlKnowledgeSourceConfigurator configurator; +// private SparqlKnowledgeSourceConfigurator configurator; /** * @return the configurator for this Knowledgesource */ - public SparqlKnowledgeSourceConfigurator getConfigurator() { - return configurator; - } +// public SparqlKnowledgeSourceConfigurator getConfigurator() { +// return configurator; +// } public SparqlKnowledgeSource() { - this.configurator = new SparqlKnowledgeSourceConfigurator(this); +// this.configurator = new SparqlKnowledgeSourceConfigurator(this); } - // these are saved for further reference - private URL url; + + private SparqlEndpoint endpoint = null; //private String format = "N-TRIPLES"; @@ -120,7 +121,54 @@ // mainly used for statistic private int nrOfExtractedAxioms = 0; + //// TODO: turn those into config options /// + private URL url; + + private Set<String> instances; + + private int recursionDepth; + private boolean getAllSuperClasses; + + private boolean closeAfterRecursion; + + private boolean propertyInformation; + + private int breakSuperClassRetrievalAfter; + + private boolean dissolveBlankNodes; + + private boolean saveExtractedFragment; + + private String predefinedEndpoint; + + private Collection<String> defaultGraphURIs; + + private Collection<String> namedGraphURIs; + + private boolean useCache; + + private String cacheDir; + + private boolean useCacheDatabase; + + private String predefinedFilter; + + private Set<String> objList; + + private Set<String> predList; + + private boolean useLits; + + private String predefinedManipulator; + + private List<StringTuple> replacePredicate; + + private boolean useImprovedSparqlTupelAquisitor; + + private List<StringTuple> replaceObject; + + public static String getName() { return "SPARQL Endpoint"; } @@ -236,7 +284,7 @@ } logger.trace(getURL()); logger.trace(getSparqlEndpoint()); - logger.trace(configurator.getInstances()); +// logger.trace(configurator.getInstances()); Manager m = new Manager(); m.addProgressMonitor(mon); @@ -246,12 +294,9 @@ TupleAquisitor tupleAquisitor = getTupleAquisitor(); Configuration configuration = new Configuration(tupleAquisitor, - manipulator, configurator.getRecursionDepth(), configurator - .getGetAllSuperClasses(), configurator - .getCloseAfterRecursion(), configurator - .getGetPropertyInformation(), configurator - .getBreakSuperClassRetrievalAfter(), - configurator.getDissolveBlankNodes()); + manipulator, recursionDepth, getAllSuperClasses, + closeAfterRecursion, propertyInformation, breakSuperClassRetrievalAfter, + dissolveBlankNodes); // give everything to the manager m.useConfiguration(configuration); @@ -264,7 +309,7 @@ List<Node> seedNodes=new ArrayList<Node>(); //if(!threaded){ - seedNodes = m.extract(configurator.getInstances()); + seedNodes = m.extract(instances); /*}else{ int maxPoolSize = configurator.getInstances().size(); ThreadPoolExecutor ex = new ThreadPoolExecutor(5,maxPoolSize,1,TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(100)); @@ -291,7 +336,7 @@ extractionTime.stop(); - fragment = m.getOWLAPIOntologyForNodes(seedNodes, configurator.getSaveExtractedFragment()); + fragment = m.getOWLAPIOntologyForNodes(seedNodes, saveExtractedFragment); logger.info("Finished collecting fragment. needed "+extractionTime.getLastValue()+" ms"); @@ -370,16 +415,16 @@ */ public URL getURL() { if(endpoint == null){ - if(url==null){ - if(configurator.getPredefinedEndpoint() == null){ - url = configurator.getUrl(); - return url; + if(getUrl()==null){ + if(predefinedEndpoint == null){ + setUrl(url); + return getUrl(); }else{ return getSparqlEndpoint().getURL(); } }else{ - return url; + return getUrl(); } }else { return endpoint.getURL(); @@ -395,13 +440,12 @@ public SparqlEndpoint getSparqlEndpoint(){ if(endpoint==null) { - if (configurator.getPredefinedEndpoint() == null) { + if (predefinedEndpoint == null) { endpoint = new SparqlEndpoint(getURL(), new LinkedList<String>( - configurator.getDefaultGraphURIs()), - new LinkedList<String>(configurator.getNamedGraphURIs())); + defaultGraphURIs), + new LinkedList<String>(namedGraphURIs)); } else { - endpoint = SparqlEndpoint.getEndpointByName(configurator - .getPredefinedEndpoint()); + endpoint = SparqlEndpoint.getEndpointByName(predefinedEndpoint); // System.out.println(endpoint); } @@ -414,8 +458,8 @@ // get Options for endpoints - if (configurator.getUseCache()){ - return new SPARQLTasks(new Cache(configurator.getCacheDir(), configurator.getUseCacheDatabase()), + if (useCache){ + return new SPARQLTasks(new Cache(cacheDir, useCacheDatabase), getSparqlEndpoint()); }else { return new SPARQLTasks(getSparqlEndpoint()); @@ -424,14 +468,13 @@ public SparqlQueryMaker getSparqlQueryMaker() { // get Options for Filters - if (configurator.getPredefinedFilter() == null) { - return new SparqlQueryMaker("forbid", configurator.getObjList(), - configurator.getPredList(), configurator.getUseLits()); + if (predefinedFilter == null) { + return new SparqlQueryMaker("forbid", objList, + predList, useLits); } else { - return SparqlQueryMaker.getSparqlQueryMakerByName(configurator - .getPredefinedFilter()); + return SparqlQueryMaker.getSparqlQueryMakerByName(predefinedFilter); } } @@ -443,16 +486,15 @@ } // get Options for Filters - if (configurator.getPredefinedManipulator() != null) { - return Manipulator.getManipulatorByName(configurator - .getPredefinedManipulator()); + if (predefinedManipulator != null) { + return Manipulator.getManipulatorByName(predefinedManipulator); } else { Manipulator m = Manipulator.getDefaultManipulator(); - for (StringTuple st : configurator.getReplacePredicate()) { + for (StringTuple st : replacePredicate) { m.addRule(new PredicateReplacementRule(Months.MAY, st.a, st.b)); } - for (StringTuple st : configurator.getReplaceObject()) { + for (StringTuple st : replaceObject) { m.addRule(new ObjectReplacementRule(Months.MAY, st.a, st.b)); } return m; @@ -467,9 +509,9 @@ public TupleAquisitor getTupleAquisitor() { TupleAquisitor ret = null; - if (configurator.getUseImprovedSparqlTupelAquisitor()) { + if (useImprovedSparqlTupelAquisitor) { ret = new SparqlTupleAquisitorImproved(getSparqlQueryMaker(), - getSPARQLTasks(), configurator.getRecursionDepth()); + getSPARQLTasks(), recursionDepth); } else { ret = new SparqlTupleAquisitor(getSparqlQueryMaker(), getSPARQLTasks()); @@ -498,11 +540,11 @@ } public boolean isUseCache() { - return configurator.getUseCache(); + return useCache; } public String getCacheDir() { - return configurator.getCacheDir(); + return cacheDir; } public int getNrOfExtractedAxioms() { @@ -513,6 +555,182 @@ this.mon = mon; } + public void setUrl(URL url) { + this.url = url; + } + + public URL getUrl() { + return url; + } + + public Set<String> getInstances() { + return instances; + } + + public void setInstances(Set<String> instances) { + this.instances = instances; + } + + public int getRecursionDepth() { + return recursionDepth; + } + + public void setRecursionDepth(int recursionDepth) { + this.recursionDepth = recursionDepth; + } + + public boolean isGetAllSuperClasses() { + return getAllSuperClasses; + } + + public void setGetAllSuperClasses(boolean getAllSuperClasses) { + this.getAllSuperClasses = getAllSuperClasses; + } + + public boolean isCloseAfterRecursion() { + return closeAfterRecursion; + } + + public void setCloseAfterRecursion(boolean closeAfterRecursion) { + this.closeAfterRecursion = closeAfterRecursion; + } + + public boolean isPropertyInformation() { + return propertyInformation; + } + + public void setPropertyInformation(boolean propertyInformation) { + this.propertyInformation = propertyInformation; + } + + public int getBreakSuperClassRetrievalAfter() { + return breakSuperClassRetrievalAfter; + } + + public void setBreakSuperClassRetrievalAfter(int breakSuperClassRetrievalAfter) { + this.breakSuperClassRetrievalAfter = breakSuperClassRetrievalAfter; + } + + public boolean isDissolveBlankNodes() { + return dissolveBlankNodes; + } + + public void setDissolveBlankNodes(boolean dissolveBlankNodes) { + this.dissolveBlankNodes = dissolveBlankNodes; + } + + public boolean isSaveExtractedFragment() { + return saveExtractedFragment; + } + + public void setSaveExtractedFragment(boolean saveExtractedFragment) { + this.saveExtractedFragment = saveExtractedFragment; + } + + public String getPredefinedEndpoint() { + return predefinedEndpoint; + } + + public void setPredefinedEndpoint(String predefinedEndpoint) { + this.predefinedEndpoint = predefinedEndpoint; + } + + public Collection<String> getDefaultGraphURIs() { + return defaultGraphURIs; + } + + public void setDefaultGraphURIs(Collection<String> defaultGraphURIs) { + this.defaultGraphURIs = defaultGraphURIs; + } + + public Collection<String> getNamedGraphURIs() { + return namedGraphURIs; + } + + public void setNamedGraphURIs(Collection<String> namedGraphURIs) { + this.namedGraphURIs = namedGraphURIs; + } + + public boolean isUseCacheDatabase() { + return useCacheDatabase; + } + + public void setUseCacheDatabase(boolean useCacheDatabase) { + this.useCacheDatabase = useCacheDatabase; + } + + public String getPredefinedFilter() { + return predefinedFilter; + } + + public void setPredefinedFilter(String predefinedFilter) { + this.predefinedFilter = predefinedFilter; + } + + public Set<String> getObjList() { + return objList; + } + + public void setObjList(Set<String> objList) { + this.objList = objList; + } + + public Set<String> getPredList() { + return predList; + } + + public void setPredList(Set<String> predList) { + this.predList = predList; + } + + public boolean isUseLits() { + return useLits; + } + + public void setUseLits(boolean useLits) { + this.useLits = useLits; + } + + public String getPredefinedManipulator() { + return predefinedManipulator; + } + + public void setPredefinedManipulator(String predefinedManipulator) { + this.predefinedManipulator = predefinedManipulator; + } + + public List<StringTuple> getReplacePredicate() { + return replacePredicate; + } + + public void setReplacePredicate(List<StringTuple> replacePredicate) { + this.replacePredicate = replacePredicate; + } + + public boolean isUseImprovedSparqlTupelAquisitor() { + return useImprovedSparqlTupelAquisitor; + } + + public void setUseImprovedSparqlTupelAquisitor(boolean useImprovedSparqlTupelAquisitor) { + this.useImprovedSparqlTupelAquisitor = useImprovedSparqlTupelAquisitor; + } + + public List<StringTuple> getReplaceObject() { + return replaceObject; + } + + public void setReplaceObject(List<StringTuple> replaceObject) { + this.replaceObject = replaceObject; + } + + public void setUseCache(boolean useCache) { + this.useCache = useCache; + } + + public void setCacheDir(String cacheDir) { + this.cacheDir = cacheDir; + } + } Modified: trunk/examples/sparql/moosique_new.conf =================================================================== --- trunk/examples/sparql/moosique_new.conf 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/examples/sparql/moosique_new.conf 2011-08-28 10:57:36 UTC (rev 3149) @@ -45,7 +45,8 @@ // you can use e.g. Protege to create the taxonomy // (set File >> Preferences >> Renderer to qnames) or a plain text editor jamendoOntology.type = "OWL File" -jamendoOntology.url = "jamendo.owl" +jamendoOntology.url = "file:///home/jl/programmierung/eclipse2/dllearner-parent/examples/sparql/jamendo.owl" +// jamendo.owl" reasoner.type = "fast instance checker" reasoner.sources = {jamendo, jamendoOntology} Modified: trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -118,7 +118,7 @@ } @Override - public Class getType() { + public Class<?> getType() { return getPropertyType(); } Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -331,13 +331,13 @@ ComponentManager cm = ComponentManager.getInstance(); SparqlKnowledgeSource ks2 = cm.knowledgeSource(SparqlKnowledgeSource.class); - ks2.getConfigurator().setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); - ks2.getConfigurator().setUrl(ks.getEndpoint().getURL()); - ks2.getConfigurator().setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs())); - ks2.getConfigurator().setUseLits(false); - ks2.getConfigurator().setUseCacheDatabase(true); - ks2.getConfigurator().setRecursionDepth(2); - ks2.getConfigurator().setCloseAfterRecursion(true); + ks2.setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); + ks2.setUrl(ks.getEndpoint().getURL()); + ks2.setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs())); + ks2.setUseLits(false); + ks2.setUseCacheDatabase(true); + ks2.setRecursionDepth(2); + ks2.setCloseAfterRecursion(true); // ks2.getConfigurator().setSaveExtractedFragment(true); System.out.println("getting fragment ... "); ks2.init(); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/DumbLPFinder.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/DumbLPFinder.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/scripts/src/main/java/org/dllearner/scripts/DumbLPFinder.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -223,10 +223,10 @@ "http://www.blabla.com").toURL(), SetManipulation .indToString(instances)); - ks.getConfigurator().setCloseAfterRecursion(true); - ks.getConfigurator().setRecursionDepth(2); - ks.getConfigurator().setPredefinedEndpoint("LOCALJOSEKIBIBLE"); - ks.getConfigurator().setUseLits(true); + ks.setCloseAfterRecursion(true); + ks.setRecursionDepth(2); + ks.setPredefinedEndpoint("LOCALJOSEKIBIBLE"); + ks.setUseLits(true); Set<AbstractKnowledgeSource> tmp = new HashSet<AbstractKnowledgeSource>(); tmp.add(ks); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -444,25 +444,25 @@ "http://localhost:2020/bible").toURL(), SetManipulation .indToString(instances)); - SparqlKnowledgeSourceConfigurator c = ks.getConfigurator(); +// SparqlKnowledgeSourceConfigurator c = ks.getConfigurator(); - c.setCloseAfterRecursion(true); - c.setRecursionDepth(2); - c.setPredefinedEndpoint("LOCALJOSEKIBIBLE"); - c.setUseLits(true); - c.setGetAllSuperClasses(true); - c.setGetPropertyInformation(true); - c.setVerbosity("warning"); + ks.setCloseAfterRecursion(true); + ks.setRecursionDepth(2); + ks.setPredefinedEndpoint("LOCALJOSEKIBIBLE"); + ks.setUseLits(true); + ks.setGetAllSuperClasses(true); + ks.setPropertyInformation(true); +// ks.setVerbosity("warning"); if(exp.equals(Experiments.SPARQL_10000_CTESTS_SPECIAL_REC2_NOPROP)){ - c.setGetPropertyInformation(false); + ks.setPropertyInformation(false); }else if(exp.equals(Experiments.SPARQL_10000_CTESTS_SPECIAL_REC2_NOCLOSE_NOPROP)){ - c.setCloseAfterRecursion(false); - c.setGetPropertyInformation(false); + ks.setCloseAfterRecursion(false); + ks.setPropertyInformation(false); }else if(exp.equals(Experiments.SPARQL_10000_CTESTS_SPECIAL_REC1)){ - c.setRecursionDepth(1); + ks.setRecursionDepth(1); }else if(exp.equals(Experiments.SPARQL_10000_CTESTS_SPECIAL_REC3)){ - c.setRecursionDepth(3); + ks.setRecursionDepth(3); } Set<AbstractKnowledgeSource> tmp = new HashSet<AbstractKnowledgeSource>(); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -286,21 +286,21 @@ "http://dbpedia.org").toURL(), SetManipulation .indToString(instances)); - SparqlKnowledgeSourceConfigurator c = ks.getConfigurator(); +// SparqlKnowledgeSourceConfigurator c = ks.getConfigurator(); - c.setCloseAfterRecursion(true); - c.setRecursionDepth(1); + ks.setCloseAfterRecursion(true); + ks.setRecursionDepth(1); if(LOCAL){ - c.setPredefinedEndpoint("LOCALDBPEDIA"); + ks.setPredefinedEndpoint("LOCALDBPEDIA"); }else{ - c.setPredefinedEndpoint("DBPEDIA"); + ks.setPredefinedEndpoint("DBPEDIA"); } - c.setUseLits(false); - c.setGetAllSuperClasses(true); - c.setGetPropertyInformation(false); - c.setVerbosity("warning"); - c.setCacheDir(Cache.getPersistantCacheDir()); - c.setPredefinedFilter("YAGOONLY"); + ks.setUseLits(false); + ks.setGetAllSuperClasses(true); + ks.setPropertyInformation(false); +// ks.setVerbosity("warning"); + ks.setCacheDir(Cache.getPersistantCacheDir()); + ks.setPredefinedFilter("YAGOONLY"); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -561,13 +561,13 @@ ComponentManager cm = ComponentManager.getInstance(); SparqlKnowledgeSource ks2 = cm.knowledgeSource(SparqlKnowledgeSource.class); - ks2.getConfigurator().setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); - ks2.getConfigurator().setUrl(ks.getEndpoint().getURL()); - ks2.getConfigurator().setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs())); - ks2.getConfigurator().setUseLits(false); - ks2.getConfigurator().setUseCacheDatabase(true); - ks2.getConfigurator().setRecursionDepth(2); - ks2.getConfigurator().setCloseAfterRecursion(true); + ks2.setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); + ks2.setUrl(ks.getEndpoint().getURL()); + ks2.setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs())); + ks2.setUseLits(false); + ks2.setUseCacheDatabase(true); + ks2.setRecursionDepth(2); + ks2.setCloseAfterRecursion(true); // ks2.getConfigurator().setSaveExtractedFragment(true); System.out.println("getting fragment ... "); ks2.init(); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -125,21 +125,21 @@ ComponentManager cm = ComponentManager.getInstance(); SparqlKnowledgeSource ks = cm.knowledgeSource(SparqlKnowledgeSource.class); - ks.getConfigurator().setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); + ks.setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); //ks.getConfigurator().setPredefinedEndpoint("DBPEDIA"); // TODO: probably the official endpoint is too slow? - ks.getConfigurator().setUrl(new URL(endpointurl)); - ks.getConfigurator().setUseLits(false); - ks.getConfigurator().setUseCacheDatabase(true); - ks.getConfigurator().setRecursionDepth(1); - ks.getConfigurator().setCloseAfterRecursion(true); - ks.getConfigurator().setSaveExtractedFragment(true); - ks.getConfigurator().setPredList(new HashSet<String>(Arrays.asList(new String[]{ + ks.setUrl(new URL(endpointurl)); + ks.setUseLits(false); + ks.setUseCacheDatabase(true); + ks.setRecursionDepth(1); + ks.setCloseAfterRecursion(true); + ks.setSaveExtractedFragment(true); + ks.setPredList(new HashSet<String>(Arrays.asList(new String[]{ "http://dbpedia.org/property/wikiPageUsesTemplate", "http://dbpedia.org/ontology/wikiPageExternalLink", "http://dbpedia.org/property/wordnet_type", "http://www.w3.org/2002/07/owl#sameAs"}))); - ks.getConfigurator().setObjList(new HashSet<String>(Arrays.asList(new String[]{ + ks.setObjList(new HashSet<String>(Arrays.asList(new String[]{ "http://dbpedia.org/class/yago/", "" + "http://dbpedia.org/resource/Category:"}))); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -98,9 +98,9 @@ ComponentManager cm = ComponentManager.getInstance(); SparqlKnowledgeSource ks = cm.knowledgeSource(SparqlKnowledgeSource.class); - ks.getConfigurator().setInstances(instances); - ks.getConfigurator().setPredefinedEndpoint("LOCALGEODATA"); - ks.getConfigurator().setSaveExtractedFragment(true); + ks.setInstances(instances); + ks.setPredefinedEndpoint("LOCALGEODATA"); + ks.setSaveExtractedFragment(true); Manipulator m = Manipulator.getDefaultManipulator(); m.addRule(new StringToResource(Months.DECEMBER,"http://linkedgeodata.org/vocabulary", 0)); ks.setManipulator(m); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java 2011-08-28 05:42:03 UTC (rev 3148) +++ trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java 2011-08-28 10:57:36 UTC (rev 3149) @@ -99,10 +99,10 @@ ComponentManager cm = ComponentManager.getInstance(); SparqlKnowledgeSource ks = cm.knowledgeSource(SparqlKnowledgeSource.class); - ks.getConfigurator().setInstances(instances); - ks.getConfigurator().setPredefinedEndpoint("LOCALGEODATA"); + ks.setInstances(instances); + ks.setPredefinedEndpoint("LOCALGEODATA"); //ks.getConfigurator().setPredefinedEndpoint("LOCALDBPEDIA"); - ks.getConfigurator().setSaveExtractedFragment(true); + ks.setSaveExtractedFragment(true); Manipulator m = Manipulator.getDefaultManipulator(); //m.addRule(new StringToResource(Months.NOVEMBER,"http://linkedgeodata.org/vocabulary", 0)); m.addRule(new AddAllStringsAsClasses(Months.NOVEMBER, "http://linkedgeodata.org/vocabulary")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sha...@us...> - 2011-08-28 12:50:56
|
Revision: 3150 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3150&view=rev Author: shadowtm Date: 2011-08-28 12:50:50 +0000 (Sun, 28 Aug 2011) Log Message: ----------- Added a Converter to convert Map<String,String> to a List of StringTuples Modified Paths: -------------- trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml Added Paths: ----------- trunk/components-core/src/main/java/org/dllearner/core/converter/ trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java Added: trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java (rev 0) +++ trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java 2011-08-28 12:50:50 UTC (rev 3150) @@ -0,0 +1,34 @@ +package org.dllearner.core.converter; + +import org.dllearner.utilities.datastructures.StringTuple; +import org.springframework.core.convert.converter.Converter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Created by IntelliJ IDEA. + * User: Chris + * Date: 8/28/11 + * Time: 6:37 AM + * + * Convert Maps of String to String Tuple List + */ +public class MapToStringTupleListConverter implements Converter<Map<String,String>,List<StringTuple>> { + + @Override + public List<StringTuple> convert(Map<String,String> source) { + List<StringTuple> result = new ArrayList<StringTuple>(); + + Set<String> keys = source.keySet(); + + for (String key : keys) { + String value = source.get(key); + result.add(new StringTuple(key, value)); + } + + return result; + } +} Modified: trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml =================================================================== --- trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml 2011-08-28 10:57:36 UTC (rev 3149) +++ trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml 2011-08-28 12:50:50 UTC (rev 3150) @@ -7,6 +7,7 @@ <context:annotation-config/> <bean class="org.dllearner.configuration.spring.ComponentInitializationBeanPostProcessor"/> + <!--Register Custom Property Editors - for going from Strings to Objects--> <bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"> <property name="propertyEditorRegistrars"> <list> @@ -17,4 +18,14 @@ <bean id="customPropertyEditorRegistrar" class="org.dllearner.configuration.spring.CustomPropertyEditorRegistrar"/> + + <!--Register custom conversion services for converting types to type.--> + <bean id="conversionService" + class="org.springframework.context.support.ConversionServiceFactoryBean"> + <property name="converters"> + <set> + <bean class="org.dllearner.core.converter.MapToStringTupleListConverter"/> + </set> + </property> + </bean> </beans> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-28 18:34:47
|
Revision: 3155 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3155&view=rev Author: jenslehmann Date: 2011-08-28 18:34:39 +0000 (Sun, 28 Aug 2011) Log Message: ----------- a number of further edits towards the new configuration system Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest_noFuzzyTrains.java trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java trunk/interfaces/src/main/java/org/dllearner/gui/TreeWindow.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -31,16 +31,13 @@ import java.util.TreeSet; import org.apache.log4j.Logger; +import org.dllearner.core.AbstractCELA; +import org.dllearner.core.AbstractLearningProblem; +import org.dllearner.core.AbstractReasonerComponent; import org.dllearner.core.ComponentAnn; import org.dllearner.core.ComponentInitException; import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.AbstractCELA; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.config.BooleanEditor; -import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.core.options.BooleanConfigOption; -import org.dllearner.core.options.CommonConfigMappings; import org.dllearner.core.options.CommonConfigOptions; import org.dllearner.core.options.ConfigOption; import org.dllearner.core.options.DoubleConfigOption; @@ -82,7 +79,7 @@ public class CELOE extends AbstractCELA { private static Logger logger = Logger.getLogger(CELOE.class); - private CELOEConfigurator configurator; +// private CELOEConfigurator configurator; private boolean isRunning = false; private boolean stop = false; @@ -145,17 +142,44 @@ private int minHorizExp = 0; private int maxHorizExp = 0; - public CELOEConfigurator getConfigurator() { - return configurator; - } + ConceptComparator cc = new ConceptComparator(); + // TODO: turn those into config options + + Set<NamedClass> allowedConcepts = new TreeSet<NamedClass>(cc); + Set<NamedClass> ignoredConcepts = new TreeSet<NamedClass>(cc); + + private boolean writeSearchTree; + + private String searchTreeFile = "log/searchTree.txt"; + + private int maxNrOfResults; + + private double noisePercentage; + + private boolean filterDescriptionsFollowingFromKB; + + private boolean reuseExistingDescription; + + private boolean replaceSearchTree; + + private int maxClassDescriptionTests; + + private int maxExecutionTimeInSeconds; + + private boolean terminateOnNoiseReached; + +// public CELOEConfigurator getConfigurator() { +// return configurator; +// } + public CELOE() { } public CELOE(AbstractLearningProblem problem, AbstractReasonerComponent reasoner) { super(problem, reasoner); - configurator = new CELOEConfigurator(this); +// configurator = new CELOEConfigurator(this); } public static Collection<Class<? extends AbstractLearningProblem>> supportedLearningProblems() { @@ -206,8 +230,8 @@ // compute used concepts/roles from allowed/ignored // concepts/roles Set<NamedClass> usedConcepts; - Set<NamedClass> allowedConcepts = configurator.getAllowedConcepts()==null ? null : CommonConfigMappings.getAtomicConceptSet(configurator.getAllowedConcepts()); - Set<NamedClass> ignoredConcepts = configurator.getIgnoredConcepts()==null ? null : CommonConfigMappings.getAtomicConceptSet(configurator.getIgnoredConcepts()); +// Set<NamedClass> allowedConcepts = configurator.getAllowedConcepts()==null ? null : CommonConfigMappings.getAtomicConceptSet(configurator.getAllowedConcepts()); +// Set<NamedClass> ignoredConcepts = configurator.getIgnoredConcepts()==null ? null : CommonConfigMappings.getAtomicConceptSet(configurator.getIgnoredConcepts()); if(allowedConcepts != null) { // sanity check to control if no non-existing concepts are in the list Helper.checkConcepts(reasoner, allowedConcepts); @@ -224,36 +248,40 @@ ClassHierarchy classHierarchy = reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts); classHierarchy.thinOutSubsumptionHierarchy(); - heuristic = new OEHeuristicRuntime(configurator); + heuristic = new OEHeuristicRuntime(); minimizer = new DescriptionMinimizer(reasoner); startClass = Thing.instance; - singleSuggestionMode = configurator.getSingleSuggestionMode(); +// singleSuggestionMode = configurator.getSingleSuggestionMode(); // create refinement operator - operator = new RhoDRDown(reasoner, classHierarchy, startClass, configurator); + if(operator == null) { + operator = new RhoDRDown(); + ((RhoDRDown)operator).setStartClass(startClass); + ((RhoDRDown)operator).setSubHierarchy(classHierarchy); + } +// operator = new RhoDRDown(reasoner, classHierarchy, startClass, configurator); baseURI = reasoner.getBaseURI(); prefixes = reasoner.getPrefixes(); - if(configurator.getWriteSearchTree()) { - File f = new File(configurator.getSearchTreeFile()); + if(writeSearchTree) { + File f = new File(searchTreeFile ); // System.out.println(f.getAbsolutePath()); Files.clearFile(f); } - bestEvaluatedDescriptions = new EvaluatedDescriptionSet(configurator.getMaxNrOfResults()); + bestEvaluatedDescriptions = new EvaluatedDescriptionSet(maxNrOfResults); isClassLearningProblem = (learningProblem instanceof ClassLearningProblem); // we put important parameters in class variables - noise = configurator.getNoisePercentage()/100d; + noise = noisePercentage/100d; // System.out.println("noise " + noise); - maxDepth = configurator.getMaxDepth(); +// maxDepth = configurator.getMaxDepth(); // (filterFollowsFromKB is automatically set to false if the problem // is not a class learning problem - filterFollowsFromKB = configurator.getFilterDescriptionsFollowingFromKB() - && isClassLearningProblem; + filterFollowsFromKB = filterDescriptionsFollowingFromKB && isClassLearningProblem; // actions specific to ontology engineering if(isClassLearningProblem) { @@ -268,7 +296,7 @@ // superfluous to add super classes in this case) if(isEquivalenceProblem) { Set<Description> existingDefinitions = reasoner.getAssertedDefinitions(classToDescribe); - if(configurator.getReuseExistingDescription() && (existingDefinitions.size() > 0)) { + if(reuseExistingDescription && (existingDefinitions.size() > 0)) { // the existing definition is reused, which in the simplest case means to // use it as a start class or, if it is already too specific, generalise it @@ -429,7 +457,7 @@ updateMinMaxHorizExp(nextNode); // writing the search tree (if configured) - if (configurator.getWriteSearchTree()) { + if (writeSearchTree) { String treeString = "best node: " + bestEvaluatedDescriptions.getBest() + "\n"; if (refinements.size() > 1) { treeString += "all expanded nodes:\n"; @@ -440,10 +468,10 @@ treeString += startNode.toTreeString(baseURI); treeString += "\n"; - if (configurator.getReplaceSearchTree()) - Files.createFile(new File(configurator.getSearchTreeFile()), treeString); + if (replaceSearchTree) + Files.createFile(new File(searchTreeFile), treeString); else - Files.appendFile(new File(configurator.getSearchTreeFile()), treeString); + Files.appendFile(new File(searchTreeFile), treeString); } // System.out.println(loop); @@ -713,9 +741,9 @@ private boolean terminationCriteriaSatisfied() { return stop || - (configurator.getMaxClassDescriptionTests() != 0 && (expressionTests >= configurator.getMaxClassDescriptionTests())) || - (configurator.getMaxExecutionTimeInSeconds() != 0 && ((System.nanoTime() - nanoStartTime) >= (configurator.getMaxExecutionTimeInSeconds()*1000000000l))) || - (configurator.getTerminateOnNoiseReached() && (100*getCurrentlyBestAccuracy()>=100-configurator.getNoisePercentage())); + (maxClassDescriptionTests != 0 && (expressionTests >= maxClassDescriptionTests)) || + (maxExecutionTimeInSeconds != 0 && ((System.nanoTime() - nanoStartTime) >= (maxExecutionTimeInSeconds*1000000000l))) || + (terminateOnNoiseReached && (100*getCurrentlyBestAccuracy()>=100-noisePercentage)); } private void reset() { @@ -818,6 +846,118 @@ */ public int getClassExpressionTests() { return expressionTests; + } + + public RefinementOperator getOperator() { + return operator; + } + + public void setOperator(RefinementOperator operator) { + this.operator = operator; + } + + public Description getStartClass() { + return startClass; + } + + public void setStartClass(Description startClass) { + this.startClass = startClass; + } + + public Set<NamedClass> getAllowedConcepts() { + return allowedConcepts; + } + + public void setAllowedConcepts(Set<NamedClass> allowedConcepts) { + this.allowedConcepts = allowedConcepts; + } + + public Set<NamedClass> getIgnoredConcepts() { + return ignoredConcepts; + } + + public void setIgnoredConcepts(Set<NamedClass> ignoredConcepts) { + this.ignoredConcepts = ignoredConcepts; + } + + public boolean isWriteSearchTree() { + return writeSearchTree; + } + + public void setWriteSearchTree(boolean writeSearchTree) { + this.writeSearchTree = writeSearchTree; + } + + public String getSearchTreeFile() { + return searchTreeFile; + } + + public void setSearchTreeFile(String searchTreeFile) { + this.searchTreeFile = searchTreeFile; + } + + public int getMaxNrOfResults() { + return maxNrOfResults; + } + + public void setMaxNrOfResults(int maxNrOfResults) { + this.maxNrOfResults = maxNrOfResults; + } + + public double getNoisePercentage() { + return noisePercentage; + } + + public void setNoisePercentage(double noisePercentage) { + this.noisePercentage = noisePercentage; + } + + public boolean isFilterDescriptionsFollowingFromKB() { + return filterDescriptionsFollowingFromKB; + } + + public void setFilterDescriptionsFollowingFromKB(boolean filterDescriptionsFollowingFromKB) { + this.filterDescriptionsFollowingFromKB = filterDescriptionsFollowingFromKB; + } + + public boolean isReplaceSearchTree() { + return replaceSearchTree; + } + + public void setReplaceSearchTree(boolean replaceSearchTree) { + this.replaceSearchTree = replaceSearchTree; + } + + public int getMaxClassDescriptionTests() { + return maxClassDescriptionTests; + } + + public void setMaxClassDescriptionTests(int maxClassDescriptionTests) { + this.maxClassDescriptionTests = maxClassDescriptionTests; + } + + public int getMaxExecutionTimeInSeconds() { + return maxExecutionTimeInSeconds; + } + + public void setMaxExecutionTimeInSeconds(int maxExecutionTimeInSeconds) { + this.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; + } + + public boolean isTerminateOnNoiseReached() { + return terminateOnNoiseReached; + } + + public void setTerminateOnNoiseReached(boolean terminateOnNoiseReached) { + this.terminateOnNoiseReached = terminateOnNoiseReached; + } + + public boolean isReuseExistingDescription() { + return reuseExistingDescription; + } + + public void setReuseExistingDescription(boolean reuseExistingDescription) { + this.reuseExistingDescription = reuseExistingDescription; } } Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -21,6 +21,7 @@ import java.util.Comparator; +import org.dllearner.core.ComponentAnn; import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.utilities.owl.ConceptComparator; @@ -32,6 +33,7 @@ * @author Jens Lehmann * */ +@ComponentAnn(name = "OEHeuristicRuntime", shortName = "OEHeuristicRuntime", version = 0.5) public class OEHeuristicRuntime implements Comparator<OENode>{ // strong penalty for long descriptions @@ -44,8 +46,8 @@ // syntactic comparison as final comparison criterion private ConceptComparator conceptComparator = new ConceptComparator(); - public OEHeuristicRuntime(CELOEConfigurator configurator) { - expansionPenaltyFactor = configurator.getExpansionPenaltyFactor(); + public OEHeuristicRuntime() { + } @Override @@ -83,5 +85,25 @@ public double getExpansionPenaltyFactor() { return expansionPenaltyFactor; + } + + public double getGainBonusFactor() { + return gainBonusFactor; + } + + public void setGainBonusFactor(double gainBonusFactor) { + this.gainBonusFactor = gainBonusFactor; + } + + public double getNodeRefinementPenalty() { + return nodeRefinementPenalty; + } + + public void setNodeRefinementPenalty(double nodeRefinementPenalty) { + this.nodeRefinementPenalty = nodeRefinementPenalty; + } + + public void setExpansionPenaltyFactor(double expansionPenaltyFactor) { + this.expansionPenaltyFactor = expansionPenaltyFactor; } } Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -142,9 +142,9 @@ private String predefinedEndpoint; - private Collection<String> defaultGraphURIs; + private Collection<String> defaultGraphURIs = new LinkedList<String>(); - private Collection<String> namedGraphURIs; + private Collection<String> namedGraphURIs = new LinkedList<String>(); private boolean useCache; @@ -162,11 +162,11 @@ private String predefinedManipulator; - private List<StringTuple> replacePredicate; + private List<StringTuple> replacePredicate = new LinkedList<StringTuple>(); private boolean useImprovedSparqlTupelAquisitor; - private List<StringTuple> replaceObject; + private List<StringTuple> replaceObject = new LinkedList<StringTuple>(); public static String getName() { Modified: trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -50,6 +50,7 @@ public class PosOnlyLP extends AbstractLearningProblem { protected SortedSet<Individual> positiveExamples; + private List<Individual> positiveExamplesShuffled; // protected SortedSet<Individual> pseudoNegatives; private List<Individual> individuals; @@ -329,5 +330,9 @@ private double getAccuracy(double coverage, double protusion) { return 0.5 * (coverage + Math.sqrt(protusion)); + } + + public void setPositiveExamples(SortedSet<Individual> positiveExamples) { + this.positiveExamples = positiveExamples; } } Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -1645,4 +1645,20 @@ public void setReasoner(AbstractReasonerComponent reasoner) { this.reasoner = reasoner; } + + public ClassHierarchy getSubHierarchy() { + return subHierarchy; + } + + public void setSubHierarchy(ClassHierarchy subHierarchy) { + this.subHierarchy = subHierarchy; + } + + public Description getStartClass() { + return startClass; + } + + public void setStartClass(Description startClass) { + this.startClass = startClass; + } } \ No newline at end of file Modified: trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest_noFuzzyTrains.java =================================================================== --- trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest_noFuzzyTrains.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest_noFuzzyTrains.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -54,6 +54,7 @@ import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.reasoning.OWLAPIReasoner; +import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.Helper; /** @@ -130,12 +131,12 @@ // Set<String> aaaaaaaaaa = new TreeSet<String>(); // aaaaaaaaaa.add("Nothing"); // fc.getConfigurator().setIgnoredConcepts(aaaaaaaaaa); - fc.getConfigurator().setMaxClassDescriptionTests(1000); - fc.getConfigurator().setMaxExecutionTimeInSeconds(0); - fc.getConfigurator().setUseDoubleDatatypes(false); - fc.getConfigurator().setUseCardinalityRestrictions(false); - fc.getConfigurator().setWriteSearchTree(true); - fc.getConfigurator().setSearchTreeFile("log/searchTreeNonFuzzy.txt"); + fc.setMaxClassDescriptionTests(1000); + fc.setMaxExecutionTimeInSeconds(0); + ((RhoDRDown)fc.getOperator()).setUseDoubleDatatypes(false); + ((RhoDRDown)fc.getOperator()).setUseCardinalityRestrictions(false); + fc.setWriteSearchTree(true); + fc.setSearchTreeFile("log/searchTreeNonFuzzy.txt"); fc.init(); fc.start(); Modified: trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -32,6 +32,7 @@ import org.dllearner.confparser3.ConfParserConfiguration; import org.dllearner.confparser3.ParseException; import org.dllearner.core.AbstractCELA; +import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.ReasoningMethodUnsupportedException; import org.springframework.context.ApplicationContext; import org.springframework.core.io.FileSystemResource; @@ -101,7 +102,7 @@ // System.out.println(lp.getAccuracy(new NamedClass("http://localhost/foo#male"))); // start algorithm in conf file - OCEL algorithm = context.getBean("alg",OCEL.class); + LearningAlgorithm algorithm = context.getBean("alg",LearningAlgorithm.class); algorithm.start(); } Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -367,9 +367,9 @@ } catch (LearningProblemUnsupportedException e) { e.printStackTrace(); } - CELOEConfigurator cc = la.getConfigurator(); - cc.setMaxExecutionTimeInSeconds(10); - cc.setNoisePercentage(25); +// CELOEConfigurator cc = la.getConfigurator(); + la.setMaxExecutionTimeInSeconds(10); + la.setNoisePercentage(25); la.init(); System.out.print("running CELOE ... "); la.start(); Modified: trunk/interfaces/src/main/java/org/dllearner/gui/TreeWindow.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/gui/TreeWindow.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/interfaces/src/main/java/org/dllearner/gui/TreeWindow.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -77,7 +77,7 @@ } else { CELOE celoe = (CELOE) config.getLearningAlgorithm(); this.rootNode = celoe.getSearchTreeRoot(); - cmp = new SearchTreeNodeCmpWrapper(new OEHeuristicRuntime(celoe.getConfigurator())); + cmp = new SearchTreeNodeCmpWrapper(new OEHeuristicRuntime()); } this.ebNodeModel = new EBNodeTreeModel(rootNode, cmp); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -599,9 +599,9 @@ } catch (LearningProblemUnsupportedException e) { e.printStackTrace(); } - CELOEConfigurator cc = la.getConfigurator(); - cc.setMaxExecutionTimeInSeconds(10); - cc.setNoisePercentage(25); +// CELOEConfigurator cc = la.getConfigurator(); + la.setMaxExecutionTimeInSeconds(10); + la.setNoisePercentage(25); la.init(); System.out.print("running CELOE ... "); la.start(); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -35,6 +35,7 @@ import org.dllearner.learningproblems.EvaluatedDescriptionClass; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; +import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.owl.ConceptComparator; @@ -273,12 +274,13 @@ lp.getConfigurator().setUseApproximations(useApproximations); lp.init(); celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); - cf = celoe.getConfigurator(); - cf.setUseNegation(false); - cf.setValueFrequencyThreshold(3); - cf.setMaxExecutionTimeInSeconds(algorithmRuntimeInSeconds); - cf.setNoisePercentage(noisePercent); - cf.setMaxNrOfResults(10); +// cf = celoe.getConfigurator(); + RhoDRDown op = (RhoDRDown) celoe.getOperator(); + op.setUseNegation(false); + op.setFrequencyThreshold(3); + celoe.setMaxExecutionTimeInSeconds(algorithmRuntimeInSeconds); + celoe.setNoisePercentage(noisePercent); + celoe.setMaxNrOfResults(10); // if(testReuseExistingDescription == ThreeValuedLogic.True){ // cf.setReuseExistingDescription(true); // } else { @@ -384,12 +386,13 @@ lp.getConfigurator().setUseApproximations(useApproximations); lp.init(); celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); - cf = celoe.getConfigurator(); - cf.setUseNegation(false); - cf.setValueFrequencyThreshold(3); - cf.setMaxExecutionTimeInSeconds(algorithmRuntimeInSeconds); - cf.setNoisePercentage(noisePercent); - cf.setMaxNrOfResults(10); + RhoDRDown op = (RhoDRDown) celoe.getOperator(); +// cf = celoe.getConfigurator(); + op.setUseNegation(false); + op.setFrequencyThreshold(3); + celoe.setMaxExecutionTimeInSeconds(algorithmRuntimeInSeconds); + celoe.setNoisePercentage(noisePercent); + celoe.setMaxNrOfResults(10); // if(testReuseExistingDescription == ThreeValuedLogic.True){ // cf.setReuseExistingDescription(true); // } else { @@ -400,8 +403,8 @@ // } else { // cf.setFilterDescriptionsFollowingFromKB(false); // } - cf.setReuseExistingDescription(reuseExistingDescription); - cf.setFilterDescriptionsFollowingFromKB(filterDescriptionsFollowingFromKB); + celoe.setReuseExistingDescription(reuseExistingDescription); + celoe.setFilterDescriptionsFollowingFromKB(filterDescriptionsFollowingFromKB); celoe.init(); celoe.start(); @@ -463,12 +466,13 @@ lp.getConfigurator().setUseApproximations(true); lp.init(); celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); - cf = celoe.getConfigurator(); - cf.setUseNegation(false); - cf.setValueFrequencyThreshold(3); - cf.setMaxExecutionTimeInSeconds(algorithmRuntimeInSeconds); - cf.setNoisePercentage(noisePercent); - cf.setMaxNrOfResults(10); + RhoDRDown op = (RhoDRDown) celoe.getOperator(); +// cf = celoe.getConfigurator(); + op.setUseNegation(false); + op.setFrequencyThreshold(3); + celoe.setMaxExecutionTimeInSeconds(algorithmRuntimeInSeconds); + celoe.setNoisePercentage(noisePercent); + celoe.setMaxNrOfResults(10); // if(testReuseExistingDescription == ThreeValuedLogic.True){ // cf.setReuseExistingDescription(true); // } else { Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -51,6 +51,7 @@ import org.dllearner.learningproblems.EvaluatedDescriptionClass; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; +import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.statistics.Stat; /** @@ -221,12 +222,13 @@ lp.init(); CELOE celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); - CELOEConfigurator cf = celoe.getConfigurator(); - cf.setUseNegation(false); - cf.setValueFrequencyThreshold(3); - cf.setMaxExecutionTimeInSeconds(algorithmRuntimeInSeconds); - cf.setNoisePercentage(noisePercent); - cf.setMaxNrOfResults(10); +// CELOEConfigurator cf = celoe.getConfigurator(); + RhoDRDown op = (RhoDRDown) celoe.getOperator(); + op.setUseNegation(false); + op.setFrequencyThreshold(3); + celoe.setMaxExecutionTimeInSeconds(algorithmRuntimeInSeconds); + celoe.setNoisePercentage(noisePercent); + celoe.setMaxNrOfResults(10); celoe.init(); celoe.start(); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -53,6 +53,7 @@ import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.reasoning.FastInstanceChecker; +import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.Helper; import org.dllearner.utilities.datastructures.Datastructures; import org.dllearner.utilities.datastructures.SetManipulation; @@ -158,15 +159,17 @@ CELOE la = cm.learningAlgorithm(CELOE.class, lp, rc); - CELOEConfigurator cc = la.getConfigurator(); - cc.setMaxExecutionTimeInSeconds(100); +// CELOEConfigurator cc = la.getConfigurator(); + la.setMaxExecutionTimeInSeconds(100); - cc.setUseNegation(false); - cc.setUseAllConstructor(false); - cc.setUseCardinalityRestrictions(false); - cc.setUseHasValueConstructor(true); - cc.setNoisePercentage(20); - cc.setIgnoredConcepts(new HashSet<String>(Arrays.asList(new String[]{classToLearn}))); + RhoDRDown op = (RhoDRDown) la.getOperator(); + + op.setUseNegation(false); + op.setUseAllConstructor(false); + op.setUseCardinalityRestrictions(false); + op.setUseHasValueConstructor(true); + la.setNoisePercentage(20); + la.setIgnoredConcepts(new HashSet<NamedClass>(Arrays.asList(new NamedClass[]{new NamedClass(classToLearn)}))); la.init(); // to write the above configuration in a conf file (optional) Modified: trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -42,6 +42,7 @@ import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.learningproblems.PosOnlyLP; import org.dllearner.reasoning.FastInstanceChecker; +import org.dllearner.refinementoperators.RhoDRDown; /** * Uses learning algorithms to learn class definitions for DBpedia @@ -114,17 +115,18 @@ lp.init(); CELOE celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); + RhoDRDown op = (RhoDRDown) celoe.getOperator(); // ROLComponent2 celoe = cm.learningAlgorithm(ROLComponent2.class, lp, reasoner); - celoe.getConfigurator().setUseAllConstructor(false); + op.setUseAllConstructor(false); // celoe.getConfigurator().setUseExistsConstructor(false); - celoe.getConfigurator().setUseCardinalityRestrictions(false); - celoe.getConfigurator().setUseBooleanDatatypes(false); - celoe.getConfigurator().setUseDoubleDatatypes(false); - celoe.getConfigurator().setUseNegation(false); - celoe.getConfigurator().setUseHasValueConstructor(true); - celoe.getConfigurator().setValueFrequencyThreshold(3); - celoe.getConfigurator().setMaxExecutionTimeInSeconds(100); - celoe.getConfigurator().setNoisePercentage(0.2); + op.setUseCardinalityRestrictions(false); + op.setUseBooleanDatatypes(false); + op.setUseDoubleDatatypes(false); + op.setUseNegation(false); + op.setUseHasValueConstructor(true); + op.setFrequencyThreshold(3); + celoe.setMaxExecutionTimeInSeconds(100); + celoe.setNoisePercentage(0.2); celoe.init(); // debugging Modified: trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java 2011-08-28 13:10:29 UTC (rev 3154) +++ trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java 2011-08-28 18:34:39 UTC (rev 3155) @@ -42,6 +42,7 @@ import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.learningproblems.PosOnlyLP; import org.dllearner.reasoning.FastInstanceChecker; +import org.dllearner.refinementoperators.RhoDRDown; /** * This class produces a fragment for dbpedia and linkedgeodata @@ -117,17 +118,18 @@ lp.init(); CELOE celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); + RhoDRDown op = (RhoDRDown) celoe.getOperator(); // ROLComponent2 celoe = cm.learningAlgorithm(ROLComponent2.class, lp, reasoner); - celoe.getConfigurator().setUseAllConstructor(false); + op.setUseAllConstructor(false); // celoe.getConfigurator().setUseExistsConstructor(false); - celoe.getConfigurator().setUseCardinalityRestrictions(false); - celoe.getConfigurator().setUseBooleanDatatypes(false); - celoe.getConfigurator().setUseDoubleDatatypes(false); - celoe.getConfigurator().setUseNegation(false); - celoe.getConfigurator().setUseHasValueConstructor(true); - celoe.getConfigurator().setValueFrequencyThreshold(3); - celoe.getConfigurator().setMaxExecutionTimeInSeconds(100); - celoe.getConfigurator().setNoisePercentage(0.2); + op.setUseCardinalityRestrictions(false); + op.setUseBooleanDatatypes(false); + op.setUseDoubleDatatypes(false); + op.setUseNegation(false); + op.setUseHasValueConstructor(true); + op.setFrequencyThreshold(3); + celoe.setMaxExecutionTimeInSeconds(100); + celoe.setNoisePercentage(0.2); celoe.init(); // debugging This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-29 08:53:02
|
Revision: 3156 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3156&view=rev Author: jenslehmann Date: 2011-08-29 08:52:56 +0000 (Mon, 29 Aug 2011) Log Message: ----------- removed @Deprecated from valueObject and small improvements in CLI post processor Modified Paths: -------------- trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java Modified: trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java 2011-08-28 18:34:39 UTC (rev 3155) +++ trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java 2011-08-29 08:52:56 UTC (rev 3156) @@ -26,8 +26,6 @@ * Programmatic representation of an option setting in a conf file: * bean.property = value; * - * TODO: Class is not stable yet. - * * @author Jens Lehmann * */ @@ -46,6 +44,8 @@ private Class<?> propertyType; + // the object should be either a primitive, a Collection<String> or a Map<String,String>, + // the actual mapping from Strings to datatypes is later done e.g. by property editors private Object valueObject; public ConfFileOption2() { @@ -84,12 +84,10 @@ this.propertyType = propertyType; } - @Deprecated public Object getValueObject() { return valueObject; } - @Deprecated public void setValueObject(Object valueObject) { this.valueObject = valueObject; } Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java 2011-08-28 18:34:39 UTC (rev 3155) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java 2011-08-29 08:52:56 UTC (rev 3156) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007, Jens Lehmann + * Copyright (C) 2007-2011, Jens Lehmann * * This file is part of DL-Learner. * @@ -19,7 +19,11 @@ */ package org.dllearner.confparser3; -import java.util.*; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import org.dllearner.cli.ConfFileOption2; @@ -58,11 +62,17 @@ valueObject = ((String) valueObject).replaceAll(prefix + ":", prefixes.get(prefix)); } - }else{ + } else if(valueObject instanceof Map) { + throw new Error("Map post processing not implemented yet"); + } else if(valueObject instanceof Collection){ // Check for collections of string if (valueObject instanceof Collection) { - processStringCollection(prefixes, (Collection) valueObject); + processStringCollection(prefixes, (Collection<?>) valueObject); } + } else if(valueObject instanceof Boolean || valueObject instanceof Integer || valueObject instanceof Double) { + // nothing needs to be done for booleans + } else { + throw new Error("Unknown conf option type " + valueObject.getClass()); } option.setValueObject(valueObject); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java 2011-08-28 18:34:39 UTC (rev 3155) +++ trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java 2011-08-29 08:52:56 UTC (rev 3156) @@ -22,10 +22,9 @@ import java.io.File; import java.util.List; import java.util.Map; -import java.util.TreeMap; import java.util.Map.Entry; +import java.util.TreeMap; -import org.dllearner.algorithms.SimpleSubclassLearner; import org.dllearner.core.AnnComponentManager; import org.dllearner.core.Component; import org.dllearner.core.config.ConfigHelper; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-29 14:24:07
|
Revision: 3162 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3162&view=rev Author: jenslehmann Date: 2011-08-29 14:24:00 +0000 (Mon, 29 Aug 2011) Log Message: ----------- resolved some initialisation problems in SPARQL fragment extraction Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java trunk/components-core/src/main/java/org/dllearner/kb/aquisitors/TupleAquisitor.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java trunk/examples/sparql/moosique_new.conf Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-08-29 13:25:30 UTC (rev 3161) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-08-29 14:24:00 UTC (rev 3162) @@ -227,6 +227,8 @@ @Override public void init() throws ComponentInitException { +// System.out.println("inds: " + reasoner.getIndividuals()); + // compute used concepts/roles from allowed/ignored // concepts/roles Set<NamedClass> usedConcepts; @@ -248,7 +250,10 @@ ClassHierarchy classHierarchy = reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts); classHierarchy.thinOutSubsumptionHierarchy(); - heuristic = new OEHeuristicRuntime(); + // if no one injected a heuristic, we use a default one + if(heuristic == null) { + heuristic = new OEHeuristicRuntime(); + } minimizer = new DescriptionMinimizer(reasoner); Modified: trunk/components-core/src/main/java/org/dllearner/kb/aquisitors/TupleAquisitor.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/aquisitors/TupleAquisitor.java 2011-08-29 13:25:30 UTC (rev 3161) +++ trunk/components-core/src/main/java/org/dllearner/kb/aquisitors/TupleAquisitor.java 2011-08-29 14:24:00 UTC (rev 3162) @@ -72,6 +72,7 @@ } }catch(Exception e){ logger.warn("Caught exception in tupleaquisitor, ignoring it: "+e.toString()); + e.printStackTrace(); return new TreeSet<RDFNodeTuple>(); } Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2011-08-29 13:25:30 UTC (rev 3161) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2011-08-29 14:24:00 UTC (rev 3162) @@ -24,6 +24,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collection; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; @@ -126,19 +127,19 @@ private Set<String> instances; - private int recursionDepth; + private int recursionDepth = 1; - private boolean getAllSuperClasses; + private boolean getAllSuperClasses = true; - private boolean closeAfterRecursion; + private boolean closeAfterRecursion = true; private boolean propertyInformation; - private int breakSuperClassRetrievalAfter; + private int breakSuperClassRetrievalAfter = 1000; - private boolean dissolveBlankNodes; + private boolean dissolveBlankNodes = true; - private boolean saveExtractedFragment; + private boolean saveExtractedFragment = false; private String predefinedEndpoint; @@ -146,19 +147,19 @@ private Collection<String> namedGraphURIs = new LinkedList<String>(); - private boolean useCache; + private boolean useCache = true; - private String cacheDir; + private String cacheDir = "cache"; private boolean useCacheDatabase; private String predefinedFilter; - private Set<String> objList; + private Set<String> objList = new TreeSet<String>(); - private Set<String> predList; + private Set<String> predList = new TreeSet<String>() ; - private boolean useLits; + private boolean useLits = true; private String predefinedManipulator; Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlQueryMaker.java 2011-08-29 13:25:30 UTC (rev 3161) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlQueryMaker.java 2011-08-29 14:24:00 UTC (rev 3162) @@ -178,8 +178,6 @@ terms.add(assembleTerms(tmpterms, "&&")); } - - for (String pred : getPredicateFilterList()) { terms.add(not + "regex(str(" + predicateVariable + "), '" + pred + "')"); Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java 2011-08-29 13:25:30 UTC (rev 3161) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/OWLAPIReasoner.java 2011-08-29 14:24:00 UTC (rev 3162) @@ -332,7 +332,7 @@ for (OWLNamedIndividual owlIndividual : owlIndividuals) { individuals.add(new Individual(owlIndividual.toStringID())); } - + // remove top and bottom properties (for backwards compatibility) // atomicRoles.remove(new ObjectProperty("http://www.w3.org/2002/07/owl#bottomObjectProperty")); // atomicRoles.remove(new ObjectProperty("http://www.w3.org/2002/07/owl#topObjectProperty")); Modified: trunk/examples/sparql/moosique_new.conf =================================================================== --- trunk/examples/sparql/moosique_new.conf 2011-08-29 13:25:30 UTC (rev 3161) +++ trunk/examples/sparql/moosique_new.conf 2011-08-29 14:24:00 UTC (rev 3162) @@ -48,7 +48,8 @@ jamendoOntology.fileName = "jamendo.owl" // jamendo.owl" -reasoner.type = "fast instance checker" +// reasoner.type = "fast instance checker" +reasoner.type = "OWL API Reasoner" reasoner.sources = {jamendo, jamendoOntology} // we want to learn from positive examples only This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-29 16:48:56
|
Revision: 3163 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3163&view=rev Author: jenslehmann Date: 2011-08-29 16:48:49 +0000 (Mon, 29 Aug 2011) Log Message: ----------- CELOE working with the new configuration system for the first time - hooray Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStandard.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java trunk/examples/sparql/moosique_new.conf trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-08-29 16:48:49 UTC (rev 3163) @@ -63,6 +63,7 @@ import org.dllearner.utilities.owl.DescriptionMinimizer; import org.dllearner.utilities.owl.EvaluatedDescriptionSet; import org.dllearner.utilities.owl.PropertyContext; +import org.springframework.beans.factory.annotation.Autowired; import com.jamonapi.Monitor; import com.jamonapi.MonitorFactory; @@ -121,9 +122,9 @@ private long nanoStartTime; - // important parameters + // important parameters (non-config options but internal) private double noise; - private double maxDepth; + private boolean filterFollowsFromKB; // less important parameters @@ -142,33 +143,36 @@ private int minHorizExp = 0; private int maxHorizExp = 0; - ConceptComparator cc = new ConceptComparator(); - // TODO: turn those into config options - Set<NamedClass> allowedConcepts = new TreeSet<NamedClass>(cc); - Set<NamedClass> ignoredConcepts = new TreeSet<NamedClass>(cc); + // important: do not initialise those with empty sets + // null = no settings for allowance / ignorance + // empty set = allow / ignore nothing (it is often not desired to allow no class!) + Set<NamedClass> allowedConcepts = null; + Set<NamedClass> ignoredConcepts = null; - private boolean writeSearchTree; + private boolean writeSearchTree = false; private String searchTreeFile = "log/searchTree.txt"; - private int maxNrOfResults; + private int maxNrOfResults = 10; - private double noisePercentage; + private double noisePercentage = 0.0; - private boolean filterDescriptionsFollowingFromKB; + private boolean filterDescriptionsFollowingFromKB = false; - private boolean reuseExistingDescription; + private boolean reuseExistingDescription = false; - private boolean replaceSearchTree; + private boolean replaceSearchTree = false; - private int maxClassDescriptionTests; + private int maxClassDescriptionTests = 0; - private int maxExecutionTimeInSeconds; + private int maxExecutionTimeInSeconds = 100; - private boolean terminateOnNoiseReached; + private boolean terminateOnNoiseReached = false; + private double maxDepth = 7; + // public CELOEConfigurator getConfigurator() { // return configurator; // } @@ -226,9 +230,7 @@ @Override public void init() throws ComponentInitException { - -// System.out.println("inds: " + reasoner.getIndividuals()); - + // compute used concepts/roles from allowed/ignored // concepts/roles Set<NamedClass> usedConcepts; @@ -249,7 +251,7 @@ // ClassHierarchy classHierarchy = reasoner.getClassHierarchy().clone(); ClassHierarchy classHierarchy = reasoner.getClassHierarchy().cloneAndRestrict(usedConcepts); classHierarchy.thinOutSubsumptionHierarchy(); - + // if no one injected a heuristic, we use a default one if(heuristic == null) { heuristic = new OEHeuristicRuntime(); @@ -266,13 +268,14 @@ operator = new RhoDRDown(); ((RhoDRDown)operator).setStartClass(startClass); ((RhoDRDown)operator).setSubHierarchy(classHierarchy); + ((RhoDRDown)operator).setReasoner(reasoner); + ((RhoDRDown)operator).init(); } // operator = new RhoDRDown(reasoner, classHierarchy, startClass, configurator); baseURI = reasoner.getBaseURI(); prefixes = reasoner.getPrefixes(); if(writeSearchTree) { File f = new File(searchTreeFile ); -// System.out.println(f.getAbsolutePath()); Files.clearFile(f); } @@ -288,6 +291,12 @@ // is not a class learning problem filterFollowsFromKB = filterDescriptionsFollowingFromKB && isClassLearningProblem; +// Set<Description> concepts = operator.refine(Thing.instance, 5); +// for(Description concept : concepts) { +// System.out.println(concept); +// } +// System.out.println("refinements of thing: " + concepts.size()); + // actions specific to ontology engineering if(isClassLearningProblem) { ClassLearningProblem problem = (ClassLearningProblem) learningProblem; @@ -434,12 +443,15 @@ // for(Description refinement : refinements) { // System.out.println("refinement: " + refinement); // } +// if(loop > 10) { +// System.exit(0); +// } while(refinements.size() != 0) { // pick element from set Description refinement = refinements.pollFirst(); int length = refinement.getLength(); - + // we ignore all refinements with lower length and too high depth // (this also avoids duplicate node children) if(length > horizExp && refinement.getDepth() <= maxDepth) { @@ -538,7 +550,7 @@ // returns true if node was added and false otherwise private boolean addNode(Description description, OENode parentNode) { -// System.out.println(description); +// System.out.println("d: " + description); // redundancy check (return if redundant) boolean nonRedundant = descriptions.add(description); @@ -857,6 +869,7 @@ return operator; } + @Autowired(required=false) public void setOperator(RefinementOperator operator) { this.operator = operator; } Modified: trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStandard.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStandard.java 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStandard.java 2011-08-29 16:48:49 UTC (rev 3163) @@ -508,8 +508,8 @@ // maybe use this approach: // int maxNotCovered = (int) Math.ceil(noise*positiveExamples.size()+0.0001); - System.out.println("noise: " + noise); - System.out.println("max not covered: " + maxNotCovered); +// System.out.println("noise: " + noise); +// System.out.println("max not covered: " + maxNotCovered); int notCoveredPos = 0; int notCoveredNeg = 0; @@ -518,7 +518,7 @@ if (!getReasoner().hasType(description, example)) { notCoveredPos++; - System.out.println("d:" + description + "; ex:" + example); +// System.out.println("d:" + description + "; ex:" + example); if(notCoveredPos >= maxNotCovered) { return -1; @@ -531,8 +531,8 @@ } } - System.out.println("not covered pos: " + notCoveredPos); - System.out.println("not covered neg: " + notCoveredNeg); +// System.out.println("not covered pos: " + notCoveredPos); +// System.out.println("not covered neg: " + notCoveredNeg); // if(useFMeasure) { // double recall = (positiveExamples.size() - notCoveredPos) / (double) positiveExamples.size(); Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java 2011-08-29 16:48:49 UTC (rev 3163) @@ -279,6 +279,8 @@ // subHierarchy = rs.getClassHierarchy(); public void init() { +// System.out.println("subHierarchy: " + subHierarchy); + // query reasoner for domains and ranges // (because they are used often in the operator) for(ObjectProperty op : reasoner.getObjectProperties()) { Modified: trunk/examples/sparql/moosique_new.conf =================================================================== --- trunk/examples/sparql/moosique_new.conf 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/examples/sparql/moosique_new.conf 2011-08-29 16:48:49 UTC (rev 3163) @@ -48,8 +48,7 @@ jamendoOntology.fileName = "jamendo.owl" // jamendo.owl" -// reasoner.type = "fast instance checker" -reasoner.type = "OWL API Reasoner" +reasoner.type = "fast instance checker" reasoner.sources = {jamendo, jamendoOntology} // we want to learn from positive examples only Modified: trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java 2011-08-29 14:24:00 UTC (rev 3162) +++ trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java 2011-08-29 16:48:49 UTC (rev 3163) @@ -22,9 +22,10 @@ import java.io.File; import java.util.List; import java.util.Map; +import java.util.TreeMap; import java.util.Map.Entry; -import java.util.TreeMap; +import org.dllearner.algorithms.SimpleSubclassLearner; import org.dllearner.core.AnnComponentManager; import org.dllearner.core.Component; import org.dllearner.core.config.ConfigHelper; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-29 17:56:53
|
Revision: 3165 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3165&view=rev Author: jenslehmann Date: 2011-08-29 17:56:47 +0000 (Mon, 29 Aug 2011) Log Message: ----------- further work on OCEL and CLI; created minimal CLI example Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java Added Paths: ----------- trunk/examples/family/father_minimal.conf trunk/test/fuzzydll/ Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java 2011-08-29 17:04:59 UTC (rev 3164) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java 2011-08-29 17:56:47 UTC (rev 3165) @@ -339,7 +339,7 @@ // adjust heuristic - + if(heuristic == null) { if(heuristicStr == "lexicographic") heuristic = new LexicographicHeuristic(); else if(heuristicStr == "flexible") { @@ -348,14 +348,14 @@ } heuristic = new FlexibleHeuristic(((PosNegLP) getLearningProblem()).getNegativeExamples().size(), ((PosNegLP) getLearningProblem()).getPercentPerLengthUnit()); } else { - //The Heuristic is now injected -// if(getLearningProblem() instanceof PosOnlyLP) { -// throw new RuntimeException("does not work with positive examples only yet"); + if(getLearningProblem() instanceof PosOnlyLP) { + throw new RuntimeException("does not work with positive examples only yet"); // heuristic = new MultiHeuristic(((PosOnlyLP) getLearningProblem()).getPositiveExamples().size(),0, negativeWeight, startNodeBonus, expansionPenaltyFactor, negationPenalty); -// } else { -// heuristic = new MultiHeuristic(((PosNegLP) getLearningProblem()).getPositiveExamples().size(),((PosNegLP) getLearningProblem()).getNegativeExamples().size(), negativeWeight, startNodeBonus, expansionPenaltyFactor, negationPenalty); -// } + } else { + heuristic = new MultiHeuristic(((PosNegLP) getLearningProblem()).getPositiveExamples().size(),((PosNegLP) getLearningProblem()).getNegativeExamples().size(), negativeWeight, startNodeBonus, expansionPenaltyFactor, negationPenalty); + } } + } // warn the user if he/she sets any non-standard heuristic, because it will just be ignored if(learningProblem instanceof PosNegLPStandard) { @@ -408,6 +408,7 @@ // create a refinement operator and pass all configuration // variables to it // RhoDRDown + if(operator == null) { operator = new RhoDRDown( reasoner, classHierarchy, @@ -427,7 +428,8 @@ useStringDatatypes, instanceBasedDisjoints ); - + } + // create an algorithm object and pass all configuration // options to it algorithm = new ROLearner2( @@ -530,7 +532,7 @@ return operator; } - @Autowired + @Autowired(required=false) public void setOperator(RhoDRDown operator) { this.operator = operator; } @@ -855,7 +857,7 @@ this.terminateOnNoiseReached = terminateOnNoiseReached; } - @Autowired + @Autowired(required=false) public void setHeuristic(ExampleBasedHeuristic heuristic) { this.heuristic = heuristic; } Added: trunk/examples/family/father_minimal.conf =================================================================== --- trunk/examples/family/father_minimal.conf (rev 0) +++ trunk/examples/family/father_minimal.conf 2011-08-29 17:56:47 UTC (rev 3165) @@ -0,0 +1,19 @@ + +// declare some prefixes to use as abbreviations +prefixes = [ ("ex","http://example.com/father#") ] + +// knowledge source definition +ks.type = "OWL File" +ks.fileName = "father.owl" + +// reasoner +reasoner.type = "fast instance checker" +reasoner.sources = { ks } + +// learning problem +lp.type = "posNegStandard" +lp.positiveExamples = { "ex:stefan", "ex:markus", "ex:martin" } +lp.negativeExamples = { "ex:heinz", "ex:anna", "ex:michelle" } + +// create learning algorithm to run +alg.type = "ocel" Modified: trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java 2011-08-29 17:04:59 UTC (rev 3164) +++ trunk/interfaces/src/main/java/org/dllearner/confparser3/PostProcessor.java 2011-08-29 17:56:47 UTC (rev 3165) @@ -65,10 +65,7 @@ } else if(valueObject instanceof Map) { throw new Error("Map post processing not implemented yet"); } else if(valueObject instanceof Collection){ - // Check for collections of string - if (valueObject instanceof Collection) { - processStringCollection(prefixes, (Collection<?>) valueObject); - } + processStringCollection(prefixes, (Collection<?>) valueObject); } else if(valueObject instanceof Boolean || valueObject instanceof Integer || valueObject instanceof Double) { // nothing needs to be done for booleans } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-30 09:53:58
|
Revision: 3168 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3168&view=rev Author: jenslehmann Date: 2011-08-30 09:53:50 +0000 (Tue, 30 Aug 2011) Log Message: ----------- further tedious changes to weaken the dependency on the generated configurator classes Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/components-core/src/main/java/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/components-core/src/main/java/org/dllearner/utilities/examples/ExampleDataCollector.java trunk/scripts/src/main/java/org/dllearner/examples/KRKModular.java trunk/scripts/src/main/java/org/dllearner/scripts/DumbLPFinder.java trunk/scripts/src/main/java/org/dllearner/scripts/NewSample.java trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java trunk/scripts/src/main/java/org/dllearner/scripts/tiger/TestIterativeLearning.java Removed Paths: ------------- trunk/components-core/src/main/java/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/ComponentFactory.java Modified: trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -47,10 +47,13 @@ String description() default "no description available"; /** - * An implementation of the Property Editor to use + * An implementation of the Property Editor to use. + * + * TODO: This might not be needed in the future. + * * @return */ - Class<? extends PropertyEditor> propertyEditorClass(); + Class<? extends PropertyEditor> propertyEditorClass() default PropertyEditor.class; /** * Returns whether this option is required for initializing the component. Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -1,102 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import org.dllearner.algorithms.BruteForceLearner; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.AbstractReasonerComponent; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public class BruteForceLearnerConfigurator implements Configurator { - -private boolean reinitNecessary = false; -private BruteForceLearner bruteForceLearner; - -/** -* @param bruteForceLearner see BruteForceLearner -**/ -public BruteForceLearnerConfigurator(BruteForceLearner bruteForceLearner){ -this.bruteForceLearner = bruteForceLearner; -} - -/** -* @param reasoningService see reasoningService -* @param learningProblem see learningProblem -* @throws LearningProblemUnsupportedException see -* @return BruteForceLearner -**/ -public static BruteForceLearner getBruteForceLearner(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException{ -BruteForceLearner component = ComponentManager.getInstance().learningAlgorithm(BruteForceLearner.class, learningProblem, reasoningService); -return component; -} - -/** -* maxLength maximum length of generated concepts. -* mandatory: false| reinit necessary: true -* default value: 7 -* @return int -**/ -public int getMaxLength() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(bruteForceLearner, "maxLength") ; -} -/** -* returnType Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type.. -* mandatory: false| reinit necessary: true -* default value: null -* @return String -**/ -public String getReturnType() { -return (String) ComponentManager.getInstance().getConfigOptionValue(bruteForceLearner, "returnType") ; -} - -/** -* @param maxLength maximum length of generated concepts. -* mandatory: false| reinit necessary: true -* default value: 7 -**/ -public void setMaxLength(int maxLength) { -ComponentManager.getInstance().applyConfigEntry(bruteForceLearner, "maxLength", maxLength); -reinitNecessary = true; -} -/** -* @param returnType Specifies the type which the solution has to belong to (if already) known. This means we inform the learning algorithm that the solution is a subclass of this type.. -* mandatory: false| reinit necessary: true -* default value: null -**/ -public void setReturnType(String returnType) { -ComponentManager.getInstance().applyConfigEntry(bruteForceLearner, "returnType", returnType); -reinitNecessary = true; -} - -/** -* true, if this component needs reinitializsation. -* @return boolean -**/ -public boolean isReinitNecessary(){ -return reinitNecessary; -} - - -} Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/ComponentFactory.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/ComponentFactory.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -1,308 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import java.net.URL; -import java.util.Set; -import org.dllearner.algorithms.BruteForceLearner; -import org.dllearner.algorithms.RandomGuesser; -import org.dllearner.algorithms.celoe.CELOE; -import org.dllearner.algorithms.el.ELLearningAlgorithm; -import org.dllearner.algorithms.el.ELLearningAlgorithmDisjunctive; -import org.dllearner.algorithms.fuzzydll.FuzzyCELOE; -import org.dllearner.algorithms.gp.GP; -import org.dllearner.algorithms.isle.ISLE; -import org.dllearner.algorithms.ocel.OCEL; -import org.dllearner.algorithms.refinement.ROLearner; -import org.dllearner.core.AbstractKnowledgeSource; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.kb.KBFile; -import org.dllearner.kb.OWLAPIOntology; -import org.dllearner.kb.OWLFile; -import org.dllearner.kb.SparqlEndpointKS; -import org.dllearner.kb.sparql.SparqlKnowledgeSource; -import org.dllearner.learningproblems.ClassLearningProblem; -import org.dllearner.learningproblems.PosNegLPStandard; -import org.dllearner.learningproblems.PosNegLPStrict; -import org.dllearner.learningproblems.PosOnlyLP; -import org.dllearner.learningproblems.fuzzydll.FuzzyPosNegLPStandard; -import org.dllearner.reasoning.DIGReasoner; -import org.dllearner.reasoning.FastInstanceChecker; -import org.dllearner.reasoning.FastRetrievalReasoner; -import org.dllearner.reasoning.OWLAPIReasoner; -import org.dllearner.reasoning.PelletReasoner; -import org.dllearner.reasoning.ProtegeReasoner; -import org.dllearner.reasoning.fuzzydll.FuzzyOWLAPIReasoner; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public final class ComponentFactory { - -private ComponentFactory(){} - -/** -* @return a component ready for initialization KBFile -**/ -public static KBFile getKBFile() { -return KBFileConfigurator.getKBFile(); -} - -/** -* @return a component ready for initialization OWLAPIOntology -**/ -public static OWLAPIOntology getOWLAPIOntology() { -return OWLAPIOntologyConfigurator.getOWLAPIOntology(); -} - -/** -* @param url URL pointing to the OWL file -* @return a component ready for initialization OWLFile -**/ -public static OWLFile getOWLFile(URL url) { -return OWLFileConfigurator.getOWLFile(url); -} - -/** -* @return a component ready for initialization SparqlEndpointKS -**/ -//public static SparqlEndpointKS getSparqlEndpointKS() { -//return SparqlEndpointKSConfigurator.getSparqlEndpointKS(); -//} - -/** -* @param url URL of SPARQL Endpoint -* @param instances relevant instances e.g. positive and negative examples in a learning problem -* @return a component ready for initialization SparqlKnowledgeSource -**/ -public static SparqlKnowledgeSource getSparqlKnowledgeSource(URL url, Set<String> instances) { -return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(url, instances); -} - -/** -* @param knowledgeSource see KnowledgeSource -* @return a component ready for initialization DIGReasoner -**/ -public static DIGReasoner getDIGReasoner(Set<AbstractKnowledgeSource> knowledgeSource) { -return DIGReasonerConfigurator.getDIGReasoner(knowledgeSource); -} - -/** -* @param knowledgeSource see KnowledgeSource -* @return a component ready for initialization FastInstanceChecker -**/ -public static FastInstanceChecker getFastInstanceChecker(Set<AbstractKnowledgeSource> knowledgeSource) { -return FastInstanceCheckerConfigurator.getFastInstanceChecker(knowledgeSource); -} - -/** -* @param knowledgeSource see KnowledgeSource -* @return a component ready for initialization FastRetrievalReasoner -**/ -public static FastRetrievalReasoner getFastRetrievalReasoner(Set<AbstractKnowledgeSource> knowledgeSource) { -return FastRetrievalReasonerConfigurator.getFastRetrievalReasoner(knowledgeSource); -} - -/** -* @param knowledgeSource see KnowledgeSource -* @return a component ready for initialization OWLAPIReasoner -**/ -public static OWLAPIReasoner getOWLAPIReasoner(Set<AbstractKnowledgeSource> knowledgeSource) { -return OWLAPIReasonerConfigurator.getOWLAPIReasoner(knowledgeSource); -} - -/** -* @param knowledgeSource see KnowledgeSource -* @return a component ready for initialization PelletReasoner -**/ -public static PelletReasoner getPelletReasoner(Set<AbstractKnowledgeSource> knowledgeSource) { -return PelletReasonerConfigurator.getPelletReasoner(knowledgeSource); -} - -/** -* @param knowledgeSource see KnowledgeSource -* @return a component ready for initialization ProtegeReasoner -**/ -public static ProtegeReasoner getProtegeReasoner(Set<AbstractKnowledgeSource> knowledgeSource) { -return ProtegeReasonerConfigurator.getProtegeReasoner(knowledgeSource); -} - -/** -* @param knowledgeSource see KnowledgeSource -* @return a component ready for initialization FuzzyOWLAPIReasoner -**/ -public static FuzzyOWLAPIReasoner getFuzzyOWLAPIReasoner(Set<AbstractKnowledgeSource> knowledgeSource) { -return FuzzyOWLAPIReasonerConfigurator.getFuzzyOWLAPIReasoner(knowledgeSource); -} - -/** -* @param classToDescribe class of which a description should be learned -* @param reasoningService see ReasoningService -* @return a component ready for initialization ClassLearningProblem -**/ -public static ClassLearningProblem getClassLearningProblem(AbstractReasonerComponent reasoningService, URL classToDescribe) { -return ClassLearningProblemConfigurator.getClassLearningProblem(reasoningService, classToDescribe); -} - -/** -* @param positiveExamples positive examples -* @param negativeExamples negative examples -* @param reasoningService see ReasoningService -* @return a component ready for initialization PosNegLPStandard -**/ -public static PosNegLPStandard getPosNegLPStandard(AbstractReasonerComponent reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { -return PosNegLPStandardConfigurator.getPosNegLPStandard(reasoningService, positiveExamples, negativeExamples); -} - -/** -* @param positiveExamples positive examples -* @param negativeExamples negative examples -* @param reasoningService see ReasoningService -* @return a component ready for initialization PosNegLPStrict -**/ -public static PosNegLPStrict getPosNegLPStrict(AbstractReasonerComponent reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { -return PosNegLPStrictConfigurator.getPosNegLPStrict(reasoningService, positiveExamples, negativeExamples); -} - -/** -* @param positiveExamples positive examples -* @param reasoningService see ReasoningService -* @return a component ready for initialization PosOnlyLP -**/ -public static PosOnlyLP getPosOnlyLP(AbstractReasonerComponent reasoningService, Set<String> positiveExamples) { -return PosOnlyLPConfigurator.getPosOnlyLP(reasoningService, positiveExamples); -} - -/** -* @param fuzzyExamples fuzzy examples -* @param positiveExamples positive examples -* @param negativeExamples negative examples -* @param reasoningService see ReasoningService -* @return a component ready for initialization FuzzyPosNegLPStandard -**/ -public static FuzzyPosNegLPStandard getFuzzyPosNegLPStandard(AbstractReasonerComponent reasoningService, Set<Object> fuzzyExamples, Set<String> positiveExamples, Set<String> negativeExamples) { -return FuzzyPosNegLPStandardConfigurator.getFuzzyPosNegLPStandard(reasoningService, fuzzyExamples, positiveExamples, negativeExamples); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization BruteForceLearner -**/ -public static BruteForceLearner getBruteForceLearner(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return BruteForceLearnerConfigurator.getBruteForceLearner(learningProblem, reasoningService); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization RandomGuesser -**/ -public static RandomGuesser getRandomGuesser(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return RandomGuesserConfigurator.getRandomGuesser(learningProblem, reasoningService); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization CELOE -**/ -public static CELOE getCELOE(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return CELOEConfigurator.getCELOE(learningProblem, reasoningService); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization ELLearningAlgorithm -**/ -public static ELLearningAlgorithm getELLearningAlgorithm(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return ELLearningAlgorithmConfigurator.getELLearningAlgorithm(learningProblem, reasoningService); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization ELLearningAlgorithmDisjunctive -**/ -public static ELLearningAlgorithmDisjunctive getELLearningAlgorithmDisjunctive(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return ELLearningAlgorithmDisjunctiveConfigurator.getELLearningAlgorithmDisjunctive(learningProblem, reasoningService); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization FuzzyCELOE -**/ -public static FuzzyCELOE getFuzzyCELOE(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return FuzzyCELOEConfigurator.getFuzzyCELOE(learningProblem, reasoningService); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization GP -**/ -public static GP getGP(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return GPConfigurator.getGP(learningProblem, reasoningService); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization ISLE -**/ -public static ISLE getISLE(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return ISLEConfigurator.getISLE(learningProblem, reasoningService); -} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization OCEL -**/ -//public static OCEL getOCEL(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -//return OCELConfigurator.getOCEL(learningProblem, reasoningService); -//} - -/** -* @param learningProblem see LearningProblem -* @param reasoningService see ReasoningService -* @throws LearningProblemUnsupportedException see -* @return a component ready for initialization ROLearner -**/ -public static ROLearner getROLearner(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException { -return ROLearnerConfigurator.getROLearner(learningProblem, reasoningService); -} - - -} Modified: trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -64,10 +64,13 @@ return "OWL file"; } -// public OWLFile(){ -// configurator = new OWLFileConfigurator(this); -// } + public OWLFile(){ + + } + public OWLFile(URL url) { + this.url = url; + } public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); Modified: trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -96,7 +96,10 @@ // this.configurator = new SparqlKnowledgeSourceConfigurator(this); } - + public SparqlKnowledgeSource(URL url, Set<String> instances) { + this.url = url; + this.instances = instances; + } private SparqlEndpoint endpoint = null; Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/FastRetrievalReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/FastRetrievalReasoner.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/FastRetrievalReasoner.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -25,11 +25,10 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.dllearner.core.ComponentInitException; import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ReasoningMethodUnsupportedException; -import org.dllearner.core.configurators.ComponentFactory; import org.dllearner.core.configurators.FastRetrievalReasonerConfigurator; import org.dllearner.core.options.ConfigEntry; import org.dllearner.core.options.InvalidConfigOptionValueException; @@ -68,7 +67,7 @@ super(sources); this.configurator = new FastRetrievalReasonerConfigurator(this); - rc = ComponentFactory.getOWLAPIReasoner(sources); + rc = new OWLAPIReasoner(sources); try { rc.init(); } catch (ComponentInitException e1) { Modified: trunk/components-core/src/main/java/org/dllearner/utilities/examples/ExampleDataCollector.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/utilities/examples/ExampleDataCollector.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/components-core/src/main/java/org/dllearner/utilities/examples/ExampleDataCollector.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -35,11 +35,11 @@ import org.dllearner.algorithms.ocel.OCEL; import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.ComponentManager; -import org.dllearner.core.configurators.ComponentFactory; import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.Files; +import org.dllearner.utilities.Helper; import org.dllearner.utilities.URLencodeUTF8; /** @@ -80,12 +80,15 @@ urls.add(add); for(URL u: urls){ - OWLFile ks = ComponentFactory.getOWLFile(u); + OWLFile ks = new OWLFile(); + ks.setUrl(u); tmp.add(ks); } - FastInstanceChecker rc = ComponentFactory.getFastInstanceChecker(tmp); - PosNegLPStandard lp = ComponentFactory.getPosNegLPStandard(rc, pos, neg); + FastInstanceChecker rc = new FastInstanceChecker(tmp); + PosNegLPStandard lp = new PosNegLPStandard(rc); + lp.setPositiveExamples(Helper.getIndividualSet(pos)); + lp.setNegativeExamples(Helper.getIndividualSet(neg)); OCEL la = ComponentManager.getInstance().learningAlgorithm(OCEL.class, lp, rc); // la.getConfigurator().setUseNegation(false); // la.getConfigurator().setUseAllConstructor(false); Modified: trunk/scripts/src/main/java/org/dllearner/examples/KRKModular.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/examples/KRKModular.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/scripts/src/main/java/org/dllearner/examples/KRKModular.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -16,11 +16,10 @@ import java.util.TreeSet; import org.dllearner.algorithms.ocel.OCEL; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractCELA; +import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.ComponentFactory; +import org.dllearner.core.ComponentManager; import org.dllearner.core.owl.ClassAssertionAxiom; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; @@ -489,7 +488,7 @@ Set<AbstractKnowledgeSource> ks = new HashSet<AbstractKnowledgeSource>(); ks.add(kbFile); - reasoner = ComponentFactory.getOWLAPIReasoner(ks); + reasoner = new OWLAPIReasoner(ks); ((OWLAPIReasoner)reasoner).setReasonerTypeString("fact"); try{ Modified: trunk/scripts/src/main/java/org/dllearner/scripts/DumbLPFinder.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/DumbLPFinder.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/scripts/src/main/java/org/dllearner/scripts/DumbLPFinder.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -32,10 +32,9 @@ import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; import org.dllearner.algorithms.ocel.OCEL; -import org.dllearner.core.ComponentManager; import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.ComponentFactory; +import org.dllearner.core.ComponentManager; import org.dllearner.core.owl.Individual; import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg; @@ -218,11 +217,9 @@ instances.addAll(posExamples); instances.addAll(negExamples); - SparqlKnowledgeSource ks = ComponentFactory - .getSparqlKnowledgeSource(URI.create( - "http://www.blabla.com").toURL(), SetManipulation - .indToString(instances)); - + SparqlKnowledgeSource ks = new SparqlKnowledgeSource(); + ks.setUrl(URI.create("http://www.blabla.com").toURL()); + ks.setInstances(SetManipulation.indToString(instances)); ks.setCloseAfterRecursion(true); ks.setRecursionDepth(2); ks.setPredefinedEndpoint("LOCALJOSEKIBIBLE"); @@ -231,14 +228,14 @@ Set<AbstractKnowledgeSource> tmp = new HashSet<AbstractKnowledgeSource>(); tmp.add(ks); // reasoner - OWLAPIReasoner f = ComponentFactory - .getOWLAPIReasoner(tmp); + OWLAPIReasoner f = new OWLAPIReasoner(tmp); // learning problem - PosNegLPStandard lp = ComponentFactory.getPosNegLPStandard(f, - SetManipulation.indToString(posExamples), SetManipulation - .indToString(negExamples)); - + PosNegLPStandard lp = new PosNegLPStandard(); + lp.setReasoner(f); + lp.setPositiveExamples(posExamples); + lp.setNegativeExamples(negExamples); + // learning algorithm la = ComponentManager.getInstance().learningAlgorithm(OCEL.class, lp, f);; la.setNoisePercentage(0.0); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/NewSample.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/NewSample.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/scripts/src/main/java/org/dllearner/scripts/NewSample.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -34,17 +34,17 @@ import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; import org.dllearner.algorithms.ocel.OCEL; +import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.configurators.ComponentFactory; import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.Files; +import org.dllearner.utilities.Helper; import com.jamonapi.MonitorFactory; @@ -121,15 +121,16 @@ } catch (MalformedURLException e) { e.printStackTrace(); } - OWLFile ks = ComponentFactory.getOWLFile( fileURL); + OWLFile ks = new OWLFile(); + ks.setUrl(fileURL); Set<AbstractKnowledgeSource> tmp = new HashSet<AbstractKnowledgeSource>(); tmp.add(ks); // reasoner - FastInstanceChecker f = ComponentFactory.getFastInstanceChecker(tmp); + FastInstanceChecker f = new FastInstanceChecker(tmp); // learning problem - PosNegLPStandard lp = ComponentFactory.getPosNegLPStandard( f, posExamples, negExamples); + PosNegLPStandard lp = new PosNegLPStandard( f, Helper.getIndividualSet(posExamples), Helper.getIndividualSet(negExamples)); // learning algorithm OCEL la = ComponentManager.getInstance().learningAlgorithm(OCEL.class, lp, f); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -46,8 +46,6 @@ import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractReasonerComponent; import org.dllearner.core.ComponentManager; -import org.dllearner.core.configurators.ComponentFactory; -import org.dllearner.core.configurators.SparqlKnowledgeSourceConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.gui.Config; @@ -439,8 +437,7 @@ instances.addAll(posExamples); instances.addAll(negExamples); - SparqlKnowledgeSource ks = ComponentFactory - .getSparqlKnowledgeSource(URI.create( + SparqlKnowledgeSource ks = new SparqlKnowledgeSource(URI.create( "http://localhost:2020/bible").toURL(), SetManipulation .indToString(instances)); @@ -468,13 +465,10 @@ Set<AbstractKnowledgeSource> tmp = new HashSet<AbstractKnowledgeSource>(); tmp.add(ks); // reasoner - OWLAPIReasoner f = ComponentFactory - .getOWLAPIReasoner(tmp); + OWLAPIReasoner f = new OWLAPIReasoner(tmp); // learning problem - PosNegLPStandard lp = ComponentFactory.getPosNegLPStandard(f, - SetManipulation.indToString(posExamples), SetManipulation - .indToString(negExamples)); + PosNegLPStandard lp = new PosNegLPStandard(f, posExamples, negExamples); // learning algorithm la = ComponentManager.getInstance().learningAlgorithm(OCEL.class, lp, f); @@ -505,7 +499,7 @@ e.printStackTrace(); flawInExperiment = true; } - OWLFile ks = ComponentFactory.getOWLFile( fileURL); + OWLFile ks = new OWLFile( fileURL); Set<AbstractKnowledgeSource> tmp = new HashSet<AbstractKnowledgeSource>(); tmp.add(ks); @@ -514,18 +508,16 @@ // reasoner if(fic){ - f = ComponentFactory.getFastInstanceChecker(tmp); + f = new FastInstanceChecker(tmp); ((FastInstanceChecker)f).setDefaultNegation(true); }else{ - f = ComponentFactory.getOWLAPIReasoner(tmp); + f = new OWLAPIReasoner(tmp); } // ReasonerComponent rs = ComponentManager.getInstance().reasoningService(f); // learning problem - PosNegLPStandard lp = ComponentFactory.getPosNegLPStandard(f, - SetManipulation.indToString(posExamples), SetManipulation - .indToString(negExamples)); + PosNegLPStandard lp = new PosNegLPStandard(f, posExamples, negExamples); // learning algorithm la = ComponentManager.getInstance().learningAlgorithm(OCEL.class, lp, f); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -37,8 +37,6 @@ import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.configurators.ComponentFactory; -import org.dllearner.core.configurators.SparqlKnowledgeSourceConfigurator; import org.dllearner.core.owl.Individual; import org.dllearner.kb.extraction.ExtractionAlgorithm; import org.dllearner.kb.extraction.Manager; @@ -54,6 +52,7 @@ import org.dllearner.scripts.improveWikipedia.ConceptSelector; import org.dllearner.scripts.improveWikipedia.WikipediaCategoryTasks; import org.dllearner.utilities.Files; +import org.dllearner.utilities.Helper; import org.dllearner.utilities.datastructures.SetManipulation; import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL; import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL; @@ -281,8 +280,7 @@ instances.addAll(SetManipulation.stringToInd(posExamples)); instances.addAll(SetManipulation.stringToInd(negExamples)); - SparqlKnowledgeSource ks = ComponentFactory - .getSparqlKnowledgeSource(URI.create( + SparqlKnowledgeSource ks = new SparqlKnowledgeSource(URI.create( "http://dbpedia.org").toURL(), SetManipulation .indToString(instances)); @@ -307,13 +305,12 @@ Set<AbstractKnowledgeSource> tmp = new HashSet<AbstractKnowledgeSource>(); tmp.add(ks); // reasoner - FastInstanceChecker f = ComponentFactory.getFastInstanceChecker(tmp); + FastInstanceChecker f = new FastInstanceChecker(tmp); f.setDefaultNegation(false); //OWLAPIReasoner f = ComponentFactory.getOWLAPIReasoner(tmp); // learning problem - PosNegLPStandard lp = ComponentFactory.getPosNegLPStandard(f, - posExamples, negExamples); + PosNegLPStandard lp = new PosNegLPStandard(f, Helper.getIndividualSet(posExamples), Helper.getIndividualSet(negExamples)); // learning algorithm la = ComponentManager.getInstance().learningAlgorithm(OCEL.class, lp, f); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/tiger/TestIterativeLearning.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/tiger/TestIterativeLearning.java 2011-08-30 07:47:09 UTC (rev 3167) +++ trunk/scripts/src/main/java/org/dllearner/scripts/tiger/TestIterativeLearning.java 2011-08-30 09:53:50 UTC (rev 3168) @@ -19,14 +19,13 @@ import org.apache.log4j.Logger; import org.dllearner.algorithms.ocel.OCEL; import org.dllearner.algorithms.ocel.ROLearner2; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.ComponentPool; -import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractCELA; +import org.dllearner.core.AbstractKnowledgeSource; import org.dllearner.core.AbstractLearningProblem; import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.ComponentFactory; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.ComponentPool; +import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.NamedClass; import org.dllearner.kb.OWLFile; import org.dllearner.kb.sparql.Cache; @@ -453,7 +452,7 @@ urls.addAll(ExampleDataCollector.convert(sentenceXMLFolder, ex.getNegTrain())); for (URL u : urls) { - OWLFile ks = ComponentFactory.getOWLFile(u); + OWLFile ks = new OWLFile(u); tmp.add(ks); } return tmp; @@ -503,7 +502,7 @@ Set<AbstractKnowledgeSource> tmp = _getOWL(ex); // Set<KnowledgeSource> tmp = _getSPARQL(ex); - FastInstanceChecker rc = ComponentFactory.getFastInstanceChecker(tmp); + FastInstanceChecker rc = new FastInstanceChecker(tmp); for (AbstractKnowledgeSource ks : tmp) { ks.init(); } @@ -519,8 +518,7 @@ try { FastInstanceChecker rc = _getFastInstanceChecker(ex); - PosNegLPStandard lp = ComponentFactory - .getPosNegLPStandard(rc, ex.getPosTrain(), ex.getNegTrain()); + PosNegLPStandard lp = new PosNegLPStandard(rc, Helper.getIndividualSet(ex.getPosTrain()), Helper.getIndividualSet(ex.getNegTrain())); AbstractCELA la = _getROLLearner(lp, rc, config, ex, iteration); lp.init(); la.init(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sha...@us...> - 2011-08-30 12:12:52
|
Revision: 3169 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3169&view=rev Author: shadowtm Date: 2011-08-30 12:12:45 +0000 (Tue, 30 Aug 2011) Log Message: ----------- Used XMLBeans to be able to get the XML representation of our IConfiguration objects. Modified Paths: -------------- trunk/components-core/pom.xml trunk/components-core/src/main/java/org/dllearner/configuration/IConfigurationProperty.java trunk/interfaces/pom.xml trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java trunk/interfaces/src/test/java/org/dllearner/cli/FatherCLITest.java Added Paths: ----------- trunk/interfaces/src/main/java/org/dllearner/configuration/util/ trunk/interfaces/src/main/java/org/dllearner/configuration/util/ConfigurationXMLBeanConverter.java trunk/interfaces/src/main/java/org/dllearner/configuration/util/SpringConfigurationXMLBeanConverter.java trunk/interfaces/src/main/xsd/ trunk/interfaces/src/main/xsd/spring-beans-3.0.xsd Modified: trunk/components-core/pom.xml =================================================================== --- trunk/components-core/pom.xml 2011-08-30 09:53:50 UTC (rev 3168) +++ trunk/components-core/pom.xml 2011-08-30 12:12:45 UTC (rev 3169) @@ -208,10 +208,10 @@ <artifactId>ini4j</artifactId> </dependency> - <dependency> - <groupId>xmlbeans</groupId> - <artifactId>xbean</artifactId> - </dependency> + <dependency> + <groupId>org.apache.xmlbeans</groupId> + <artifactId>xmlbeans</artifactId> + </dependency> <dependency> <groupId>com.google.code.factplusplus</groupId> Modified: trunk/components-core/src/main/java/org/dllearner/configuration/IConfigurationProperty.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/configuration/IConfigurationProperty.java 2011-08-30 09:53:50 UTC (rev 3168) +++ trunk/components-core/src/main/java/org/dllearner/configuration/IConfigurationProperty.java 2011-08-30 12:12:45 UTC (rev 3169) @@ -25,14 +25,7 @@ */ public Object getValue(); - /** - * Get the type of this value. - * - * @return The type of this value. - */ - public Class getType(); - /** * Does this property represent a bean reference? * Modified: trunk/interfaces/pom.xml =================================================================== --- trunk/interfaces/pom.xml 2011-08-30 09:53:50 UTC (rev 3168) +++ trunk/interfaces/pom.xml 2011-08-30 12:12:45 UTC (rev 3169) @@ -126,6 +126,24 @@ <build> <finalName>interfaces</finalName> <plugins> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>xmlbeans-maven-plugin</artifactId> + <version>2.3.3</version> + <executions> + <execution> + <goals> + <goal>xmlbeans</goal> + </goals> + </execution> + </executions> + <inherited>true</inherited> + <configuration> + <schemaDirectory>src/main/xsd</schemaDirectory> + </configuration> + </plugin> + <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> @@ -235,6 +253,10 @@ <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> </dependency> + <dependency> + <groupId>org.apache.xmlbeans</groupId> + <artifactId>xmlbeans</artifactId> + </dependency> </dependencies> Modified: trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java 2011-08-30 09:53:50 UTC (rev 3168) +++ trunk/interfaces/src/main/java/org/dllearner/cli/ConfFileOption2.java 2011-08-30 12:12:45 UTC (rev 3169) @@ -116,11 +116,6 @@ } @Override - public Class<?> getType() { - return getPropertyType(); - } - - @Override public boolean isBeanReferenceCollection() { return isBeanReferenceCollection; } Added: trunk/interfaces/src/main/java/org/dllearner/configuration/util/ConfigurationXMLBeanConverter.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/configuration/util/ConfigurationXMLBeanConverter.java (rev 0) +++ trunk/interfaces/src/main/java/org/dllearner/configuration/util/ConfigurationXMLBeanConverter.java 2011-08-30 12:12:45 UTC (rev 3169) @@ -0,0 +1,23 @@ +package org.dllearner.configuration.util; + +import org.apache.xmlbeans.XmlObject; +import org.dllearner.configuration.IConfiguration; + +/** + * Created by IntelliJ IDEA. + * User: Chris + * Date: 8/30/11 + * Time: 5:20 AM + * + * Interface designed to convert an IConfiguration object into an XML Bean Object. + */ +public interface ConfigurationXMLBeanConverter { + + /** + * Convert configuration to XmlObject. + * + * @param configuration The configuration object to convert + * @return The resulting xml bean object + */ + XmlObject convert(IConfiguration configuration); +} Added: trunk/interfaces/src/main/java/org/dllearner/configuration/util/SpringConfigurationXMLBeanConverter.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/configuration/util/SpringConfigurationXMLBeanConverter.java (rev 0) +++ trunk/interfaces/src/main/java/org/dllearner/configuration/util/SpringConfigurationXMLBeanConverter.java 2011-08-30 12:12:45 UTC (rev 3169) @@ -0,0 +1,99 @@ +package org.dllearner.configuration.util; + +import org.apache.xmlbeans.XmlObject; +import org.apache.xmlbeans.XmlString; +import org.dllearner.configuration.IConfiguration; +import org.dllearner.configuration.IConfigurationProperty; +import org.dllearner.core.Component; +import org.springframework.schema.beans.*; + +import java.util.Collection; +import java.util.Set; + +/** + * Created by IntelliJ IDEA. + * User: Chris + * Date: 8/30/11 + * Time: 5:23 AM + * <p/> + * Implementation responsible for writing the IConfiguration object out to a Spring Beans Schema. + */ +public class SpringConfigurationXMLBeanConverter implements ConfigurationXMLBeanConverter { + + @Override + public XmlObject convert(IConfiguration configuration) { + BeansDocument document = BeansDocument.Factory.newInstance(); + BeansDocument.Beans beans = document.addNewBeans(); + + Collection<String> beanNames = configuration.getBeanNames(); + for (String beanName : beanNames) { + + Collection<IConfigurationProperty> properties = configuration.getConfigurationProperties(beanName); + + BeanDocument.Bean bean = beans.addNewBean(); + Class configurationClass = configuration.getClass(beanName); + bean.setClass1(configurationClass.getName()); + bean.setName(beanName); + + if (isComponentClass(configurationClass)) { + bean.setInitMethod("init"); + } + + + for (IConfigurationProperty property : properties) { + + PropertyType xmlProp = bean.addNewProperty(); + xmlProp.setName(property.getName()); + + Object value = property.getValue(); + if (property.isBeanReference()) { + xmlProp.setRef2((String) value); + } else { + if (value instanceof String) { + xmlProp.setValue2((String) value); + } + + if(value instanceof Set){ + processSet(beanNames, xmlProp, (Set) value); + } + + //TODO For Map + } + + } + + } + return document; + } + + private void processSet(Collection<String> beanNames, PropertyType xmlProp, Set value) { + Set mySet = (Set) value; + SetDocument.Set set = xmlProp.addNewSet(); + for (Object o : mySet) { + + if (beanNames.contains(o)) { + RefDocument.Ref ref = set.addNewRef(); + ref.setBean((String) o); + } else { + ValueDocument.Value setValue = set.addNewValue(); + XmlString s = XmlString.Factory.newInstance(); + s.setStringValue((String) o); + setValue.set(s); + } + } + } + + private boolean isComponentClass(Class configurationClass) { + boolean found = false; + + Class[] interfaces = configurationClass.getInterfaces(); + + int ctr = 0; + while(!found && ctr < interfaces.length) { + found = interfaces[ctr].isAssignableFrom(Component.class); + ctr++; + } + + return found; + } +} Added: trunk/interfaces/src/main/xsd/spring-beans-3.0.xsd =================================================================== --- trunk/interfaces/src/main/xsd/spring-beans-3.0.xsd (rev 0) +++ trunk/interfaces/src/main/xsd/spring-beans-3.0.xsd 2011-08-30 12:12:45 UTC (rev 3169) @@ -0,0 +1,1152 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> + +<xsd:schema xmlns="http://www.springframework.org/schema/beans" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" + targetNamespace="http://www.springframework.org/schema/beans"> + + <xsd:import namespace="http://www.w3.org/XML/1998/namespace"/> + + <xsd:annotation> + <xsd:documentation><![CDATA[ + Spring XML Beans Schema, version 3.0 + Authors: Juergen Hoeller, Rob Harrop, Mark Fisher + + This defines a simple and consistent way of creating a namespace + of JavaBeans objects, managed by a Spring BeanFactory, read by + XmlBeanDefinitionReader (with DefaultBeanDefinitionDocumentReader). + + This document type is used by most Spring functionality, including + web application contexts, which are based on bean factories. + + Each "bean" element in this document defines a JavaBean. + Typically the bean class is specified, along with JavaBean properties + and/or constructor arguments. + + A bean instance can be a "singleton" (shared instance) or a "prototype" + (independent instance). Further scopes can be provided by extended + bean factories, for example in a web environment. + + References among beans are supported, that is, setting a JavaBean property + or a constructor argument to refer to another bean in the same factory + (or an ancestor factory). + + As alternative to bean references, "inner bean definitions" can be used. + Singleton flags of such inner bean definitions are effectively ignored: + inner beans are typically anonymous prototypes. + + There is also support for lists, sets, maps, and java.util.Properties + as bean property types or constructor argument types. + ]]></xsd:documentation> + </xsd:annotation> + + <!-- base types --> + <xsd:complexType name="identifiedType" abstract="true"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The unique identifier for a bean. The scope of the identifier + is the enclosing bean factory. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:attribute name="id" type="xsd:ID"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The unique identifier for a bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- Top-level <beans> tag --> + <xsd:element name="beans"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The top level (typically root) element. Allows the definition + of default values for all nested bean definitions. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="import"/> + <xsd:element ref="alias"/> + <xsd:element ref="bean"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="default-lazy-init" default="false" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'lazy-init' value; see the documentation for the + 'lazy-init' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-merge" default="false" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'merge' value; see the documentation for the + 'merge' attribute of the various collection elements. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-autowire" default="no"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'autowire' value; see the documentation for the + 'autowire' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="no"/> + <xsd:enumeration value="byName"/> + <xsd:enumeration value="byType"/> + <xsd:enumeration value="constructor"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="default-autowire-candidates" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A default bean name pattern for identifying autowire candidates: + e.g. "*Service", "data*", "*Service*", "data*Service". + Also accepts a comma-separated list of patterns: e.g. "*Service,*Dao". + See the documentation for the 'autowire-candidate' attribute of the + '<bean/>' element for the semantic details of autowire candidate beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-init-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'init-method' value; see the documentation for the + 'init-method' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="default-destroy-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The default 'destroy-method' value; see the documentation for the + 'destroy-method' attribute of the '<bean>' element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:anyAttribute namespace="##other" processContents="lax"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="description"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Contains informative text describing the purpose of the enclosing element. + Used primarily for user documentation of XML bean definition documents. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="import"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.core.io.Resource"><![CDATA[ + Specifies an XML bean definition resource to import. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="resource" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The relative resource location of the XML (bean definition) file to import, + for example "myImport.xml" or "includes/myImport.xml" or "../myImport.xml". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="alias"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Defines an alias for a bean (which can reside in a different definition + resource). + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the bean to define an alias for. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="alias" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The alias name to define for the bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:group name="beanElements"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="meta"/> + <xsd:element ref="constructor-arg"/> + <xsd:element ref="property"/> + <xsd:element ref="qualifier"/> + <xsd:element ref="lookup-method"/> + <xsd:element ref="replaced-method"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + </xsd:group> + + <xsd:attributeGroup name="beanAttributes"> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Can be used to create one or more aliases illegal in an (XML) id. + Multiple aliases can be separated by any number of spaces, commas, + or semi-colons (or indeed any mixture of the three). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="class" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The fully qualified name of the bean's class, except if it serves only + as a parent definition for child bean definitions. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="parent" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the parent bean definition. + + Will use the bean class of the parent if none is specified, but can + also override it. In the latter case, the child bean class must be + compatible with the parent, i.e. accept the parent's property values + and constructor argument values, if any. + + A child bean definition will inherit constructor argument values, + property values and method overrides from the parent, with the option + to add new values. If init method, destroy method, factory bean and/or + factory method are specified, they will override the corresponding + parent settings. + + The remaining settings will always be taken from the child definition: + depends on, autowire mode, scope, lazy init. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="scope" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The scope of this bean: typically "singleton" (one shared instance, + which will be returned by all calls to getBean with the given id), or + "prototype" (independent instance resulting from each call to getBean). + + By default, a bean will be a singleton, unless the bean has a parent + bean definition in which case it will inherit the parent's scope. + + Singletons are most commonly used, and are ideal for multi-threaded + service objects. Further scopes, such as "request" or "session", might + be supported by extended bean factories (e.g. in a web environment). + + Inner bean definitions inherit the singleton status of their containing + bean definition, unless explicitly specified: The inner bean will be a + singleton if the containing bean is a singleton, and a prototype if + the containing bean has any other scope. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="abstract" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Is this bean "abstract", that is, not meant to be instantiated itself + but rather just serving as parent for concrete child bean definitions? + The default is "false". Specify "true" to tell the bean factory to not + try to instantiate that particular bean in any case. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per abstract bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="lazy-init" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Indicates whether or not this bean is to be lazily initialized. + If false, it will be instantiated on startup by bean factories + that perform eager initialization of singletons. The default is + "false". + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="autowire" default="default"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Controls whether bean properties are "autowired". + This is an automagical process in which bean references don't need + to be coded explicitly in the XML bean definition file, but rather the + Spring container works out dependencies. + + There are 4 modes: + + 1. "no" + The traditional Spring default. No automagical wiring. Bean references + must be defined in the XML file via the <ref/> element (or "ref" + attribute). We recommend this in most cases as it makes documentation + more explicit. + + Note that this default mode also allows for annotation-driven autowiring, + if activated. "no" refers to externally driven autowiring only, not + affecting any autowiring demands that the bean class itself expresses. + + 2. "byName" + Autowiring by property name. If a bean of class Cat exposes a "dog" + property, Spring will try to set this to the value of the bean "dog" + in the current container. If there is no matching bean by name, nothing + special happens. + + 3. "byType" + Autowiring if there is exactly one bean of the property type in the + container. If there is more than one, a fatal error is raised, and + you cannot use byType autowiring for that bean. If there is none, + nothing special happens. + + 4. "constructor" + Analogous to "byType" for constructor arguments. If there is not exactly + one bean of the constructor argument type in the bean factory, a fatal + error is raised. + + Note that explicit dependencies, i.e. "property" and "constructor-arg" + elements, always override autowiring. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:simpleType> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="default"/> + <xsd:enumeration value="no"/> + <xsd:enumeration value="byName"/> + <xsd:enumeration value="byType"/> + <xsd:enumeration value="constructor"/> + </xsd:restriction> + </xsd:simpleType> + </xsd:attribute> + <xsd:attribute name="depends-on" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The names of the beans that this bean depends on being initialized. + The bean factory will guarantee that these beans get initialized + before this bean. + + Note that dependencies are normally expressed through bean properties + or constructor arguments. This property should just be necessary for + other kinds of dependencies like statics (*ugh*) or database preparation + on startup. + + Note: This attribute will not be inherited by child bean definitions. + Hence, it needs to be specified per concrete bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="autowire-candidate" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Indicates whether or not this bean should be considered when looking + for matching candidates to satisfy another bean's autowiring requirements. + Note that this does not affect explicit references by name, which will get + resolved even if the specified bean is not marked as an autowire candidate. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="primary" type="xsd:boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Specifies that this bean should be given preference when multiple + candidates are qualified to autowire a single-valued dependency. + If exactly one 'primary' bean exists among the candidates, it + will be the autowired value. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="init-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the custom initialization method to invoke after setting + bean properties. The method must have no arguments, but may throw any + exception. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="destroy-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the custom destroy method to invoke on bean factory + shutdown. The method must have no arguments, but may throw any + exception. + + Note: Only invoked on beans whose lifecycle is under the full + control of the factory - which is always the case for singletons, + but not guaranteed for any other scope. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="factory-method" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of a factory method to use to create this object. Use + constructor-arg elements to specify arguments to the factory method, + if it takes arguments. Autowiring does not apply to factory methods. + + If the "class" attribute is present, the factory method will be a static + method on the class specified by the "class" attribute on this bean + definition. Often this will be the same class as that of the constructed + object - for example, when the factory method is used as an alternative + to a constructor. However, it may be on a different class. In that case, + the created object will *not* be of the class specified in the "class" + attribute. This is analogous to FactoryBean behavior. + + If the "factory-bean" attribute is present, the "class" attribute is not + used, and the factory method will be an instance method on the object + returned from a getBean call with the specified bean name. The factory + bean may be defined as a singleton or a prototype. + + The factory method can have any number of arguments. Autowiring is not + supported. Use indexed constructor-arg elements in conjunction with the + factory-method attribute. + + Setter Injection can be used in conjunction with a factory method. + Method Injection cannot, as the factory method returns an instance, + which will be used when the container creates the bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="factory-bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Alternative to class attribute for factory-method usage. + If this is specified, no class attribute should be used. + This must be set to the name of a bean in the current or + ancestor factories that contains the relevant factory method. + This allows the factory itself to be configured using Dependency + Injection, and an instance (rather than static) method to be used. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:anyAttribute namespace="##other" processContents="lax"/> + </xsd:attributeGroup> + + <xsd:element name="meta" type="metaType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Arbitrary metadata attached to a bean definition. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:complexType name="metaType"> + <xsd:attribute name="key" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The key name of the metadata attribute being defined. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The value of the metadata attribute being defined (as a simple String). + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <xsd:element name="bean"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.config.BeanDefinition"><![CDATA[ + Defines a single (usually named) bean. + + A bean definition may contain nested tags for constructor arguments, + property values, lookup methods, and replaced methods. Mixing constructor + injection and setter injection on the same bean is explicitly supported. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="identifiedType"> + <xsd:group ref="beanElements"/> + <xsd:attributeGroup ref="beanAttributes"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="constructor-arg"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.config.ConstructorArgumentValues"> + <![CDATA[ + Bean definitions can specify zero or more constructor arguments. + This is an alternative to "autowire constructor". + Arguments correspond to either a specific index of the constructor + argument list or are supposed to be matched generically by type. + + Note: A single generic argument value will just be used once, rather + than potentially matched multiple times (as of Spring 1.1). + + constructor-arg elements are also used in conjunction with the + factory-method element to construct beans using static or instance + factory methods. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="1"> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="array"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="index" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact index of the argument in the constructor argument list. + Only needed to avoid ambiguities, e.g. in case of 2 arguments of + the exact same type. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact type of the constructor argument. Only needed to avoid + ambiguities, e.g. in case of 2 single argument constructors + that can both be converted from a String. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact name of the argument in the constructor argument list. + Only needed to avoid ambiguities, e.g. in case of 2 arguments of + the exact same type. Note: This requires debug symbols to be + stored in the class file in order to introspect argument names! + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>" element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...<value/>" element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="property" type="propertyType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Bean definitions can have zero or more properties. + Property elements correspond to JavaBean setter methods exposed + by the bean classes. Spring supports primitives, references to other + beans in the same or related factories, lists, maps and properties. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="qualifier"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Bean definitions can provide qualifiers to match against annotations + on a field or parameter for fine-grained autowire candidate resolution. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="attribute" minOccurs="0" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="type" type="xsd:string" default="org.springframework.beans.factory.annotation.Qualifier"/> + <xsd:attribute name="value" type="xsd:string"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="attribute" type="metaType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A qualifier element may contain attribute child elements as key-value + pairs. These will be available for matching against attributes of a + qualifier annotation on an autowired field or parameter if present. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="lookup-method"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A lookup method causes the IoC container to override the given method + and return the bean with the name given in the bean attribute. This is + a form of Method Injection. It is particularly useful as an alternative + to implementing the BeanFactoryAware interface, in order to be able to + make getBean() calls for non-singleton instances at runtime. In this + case, Method Injection is a less invasive alternative. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the lookup method. This method must take no arguments. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the bean in the current or ancestor factories that + the lookup method should resolve to. Often this bean will be a + prototype, in which case the lookup method will return a distinct + instance on every invocation. This is useful for single-threaded objects. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="replaced-method"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Similar to the lookup method mechanism, the replaced-method element + is used to control IoC container method overriding: Method Injection. + This mechanism allows the overriding of a method with arbitrary code. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="arg-type"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the method whose implementation must be replaced by the + IoC container. If this method is not overloaded, there is no need + to use arg-type subelements. If this method is overloaded, arg-type + subelements must be used for all override definitions for the method. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="replacer" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:org.springframework.beans.factory.support.MethodReplacer"><![CDATA[ + Bean name of an implementation of the MethodReplacer interface in the + current or ancestor factories. This may be a singleton or prototype + bean. If it is a prototype, a new instance will be used for each + method replacement. Singleton usage is the norm. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="arg-type"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Identifies an argument for a replaced method in the event of + method overloading. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="match" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Specification of the type of an overloaded method argument as a String. + For convenience, this may be a substring of the FQN. E.g. all the + following would match "java.lang.String": + - java.lang.String + - String + - Str + + As the number of arguments will be checked also, this convenience + can often be used to save typing. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="ref"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Defines a reference to another bean in this factory or an external + factory (parent or included factory). + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="local" type="xsd:IDREF"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. The value must be a bean ID and thus can + be checked by the XML parser. This is therefore the preferred technique + for referencing beans within the same bean factory XML file. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="parent" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean in a parent factory. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="idref"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The id of another bean in this factory or an external factory + (parent or included factory). + While a regular 'value' element could instead be used for the + same effect, using idref in this case allows validation of local + bean ids by the XML parser, and name completion by supporting tools. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:restriction base="xsd:anyType"> + <xsd:attribute name="bean" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="local" type="xsd:IDREF"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the referenced bean. The value must be a bean ID and thus can + be checked by the XML parser. This is therefore the preferred technique + for referencing beans within the same bean factory XML file. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:restriction> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="value"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Contains a string representation of a property value. + The property may be a string, or may be converted to the required + type using the JavaBeans PropertyEditor machinery. This makes it + possible for application developers to write custom PropertyEditor + implementations that can convert strings to arbitrary target objects. + + Note that this is recommended for simple objects only. Configure + more complex objects by populating JavaBean properties with + references to other beans. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The exact type that the value should be converted to. Only needed + if the type of the target property or constructor argument is + too generic: for example, in case of a collection element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:element name="null"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Denotes a Java null value. Necessary because an empty "value" tag + will resolve to an empty String, which will not be resolved to a + null value unless a special PropertyEditor does so. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + </xsd:complexType> + </xsd:element> + + <!-- Collection Elements --> + <xsd:group name="collectionElements"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="array"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict" minOccurs="0" maxOccurs="unbounded"/> + </xsd:choice> + </xsd:sequence> + </xsd:group> + + <xsd:element name="array"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + An array can contain multiple inner bean, ref, collection, or value elements. + This configuration element will always result in an array, even when being + defined e.g. as a value for a map with value type Object. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="listOrSetType"> + <xsd:attribute name="merge" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="list"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A list can contain multiple inner bean, ref, collection, or value elements. + A list can also map to an array type; the necessary conversion is performed + automatically. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="listOrSetType"> + <xsd:attribute name="merge" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="set"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A set can contain multiple inner bean, ref, collection, or value elements. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="listOrSetType"> + <xsd:attribute name="merge" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="map"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A mapping from a key to an object. Maps may be empty. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="mapType"> + <xsd:attribute name="merge" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="entry" type="entryType"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A map entry can be an inner bean, ref, value, or collection. + The key of the entry is given by the "key" attribute or child element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:element> + + <xsd:element name="props"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Props elements differ from map elements in that values must be strings. + Props may be empty. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:complexContent> + <xsd:extension base="propsType"> + <xsd:attribute name="merge" default="default" type="defaultable-boolean"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Enables/disables merging for collections when using parent/child beans. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + </xsd:element> + + <xsd:element name="key"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A key element can contain an inner bean, ref, value, or collection. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:group ref="collectionElements"/> + </xsd:complexType> + </xsd:element> + + <xsd:element name="prop"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The string value of the property. Note that whitespace is trimmed + off to avoid unwanted whitespace caused by typical XML formatting. + ]]></xsd:documentation> + </xsd:annotation> + <xsd:complexType mixed="true"> + <xsd:choice minOccurs="0" maxOccurs="unbounded"/> + <xsd:attribute name="key" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The key of the property entry. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + </xsd:element> + + <xsd:complexType name="propertyType"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="1"> + <xsd:element ref="meta"/> + <xsd:element ref="bean"/> + <xsd:element ref="ref"/> + <xsd:element ref="idref"/> + <xsd:element ref="value"/> + <xsd:element ref="null"/> + <xsd:element ref="array"/> + <xsd:element ref="list"/> + <xsd:element ref="set"/> + <xsd:element ref="map"/> + <xsd:element ref="props"/> + <xsd:any namespace="##other" processContents="strict"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + The name of the property, following JavaBean naming conventions. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...</value>" element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- Collection Types --> + + <!-- base type for collections that have (possibly) typed nested values --> + <xsd:complexType name="collectionType"> + <xsd:attribute name="value-type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The default Java type for nested values. Must be a fully qualified + class name. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- 'list' and 'set' collection type --> + <xsd:complexType name="listOrSetType"> + <xsd:complexContent> + <xsd:extension base="collectionType"> + <xsd:group ref="collectionElements"/> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- 'map' element type --> + <xsd:complexType name="mapType"> + <xsd:complexContent> + <xsd:extension base="collectionType"> + <xsd:sequence> + <xsd:element ref="description" minOccurs="0"/> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="entry"/> + </xsd:choice> + </xsd:sequence> + <xsd:attribute name="key-type" type="xsd:string"> + <xsd:annotation> + <xsd:documentation source="java:java.lang.Class"><![CDATA[ + The default Java type for nested entry keys. Must be a fully qualified + class name. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- 'entry' element type --> + <xsd:complexType name="entryType"> + <xsd:sequence> + <xsd:element ref="key" minOccurs="0"/> + <xsd:group ref="collectionElements"/> + </xsd:sequence> + <xsd:attribute name="key" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + Each map element must specify its key as attribute or as child element. + A key attribute is always a String value. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="key-ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a to a "key" element with a nested + "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<value>...</value>" + element. + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + <xsd:attribute name="value-ref" type="xsd:string"> + <xsd:annotation> + <xsd:documentation><![CDATA[ + A short-cut alternative to a nested "<ref bean='...'/>". + ]]></xsd:documentation> + </xsd:annotation> + </xsd:attribute> + </xsd:complexType> + + <!-- 'props' collection type --> + <xsd:complexType name="propsType"> + <xsd:complexContent> + <xsd:extension base="collectionType"> + <xsd:sequence> + <xsd:choice minOccurs="0" maxOccurs="unbounded"> + <xsd:element ref="prop"/> + </xsd:choice> + </xsd:sequence> + </xsd:extension> + </xsd:complexContent> + </xsd:complexType> + + <!-- simple internal types --> + <xsd:simpleType name="defaultable-boolean"> + <xsd:restriction base="xsd:NMTOKEN"> + <xsd:enumeration value="default"/> + <xsd:enumeration value="true"/> + <xsd:enumeration value="false"/> + </xsd:restriction> + </xsd:simpleType> + +</xsd:schema> Modified: trunk/interfaces/src/test/java/org/dllearner/cli/FatherCLITest.java =================================================================== --- trunk/interfaces/src/test/java/org/dllearner/cli/FatherCLITest.java 2011-08-30 09:53:50 UTC (rev 3168) +++ trunk/interfaces/src/test/java/org/dllearner/cli/FatherCLITest.java 2011-08-30 12:12:45 UTC (rev 3169) @@ -1,13 +1,15 @@ package org.dllearner.cli; import junit.framework.Assert; +import org.apache.xmlbeans.XmlObject; import org.dllearner.algorithms.ocel.OCEL; import org.dllearner.configuration.IConfiguration; import org.dllearner.configuration.spring.ApplicationContextBuilder; import org.dllearner.configuration.spring.DefaultApplicationContextBuilder; +import org.dllearner.configuration.util.ConfigurationXMLBeanConverter; +import org.dllearner.configuration.util.SpringConfigurationXMLBeanConverter; import org.dllearner.confparser3.ConfParserConfiguration; import org.dllearner.learningproblems.PosNegLPStandard; -import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.core.io.FileSystemResource; @@ -35,6 +37,10 @@ //DL-Learner Configuration Object IConfiguration configuration = new ConfParserConfiguration(confFile); + + ConfigurationXMLBeanConverter converter = new SpringConfigurationXMLBeanConverter(); + XmlObject object = converter.convert(configuration); + System.out.println(object.toString()); //Build The Application Context ApplicationContext context = builder.buildApplicationContext(configuration, springConfigResources); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-31 09:24:33
|
Revision: 3181 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3181&view=rev Author: jenslehmann Date: 2011-08-31 09:24:25 +0000 (Wed, 31 Aug 2011) Log Message: ----------- prepared class learning problem for new architecture Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java trunk/components-core/src/test/java/org/dllearner/test/junit/HeuristicTests.java trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java Modified: trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java 2011-08-31 08:52:24 UTC (rev 3180) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java 2011-08-31 09:24:25 UTC (rev 3181) @@ -65,11 +65,13 @@ private long nanoStartTime; private static int maxExecutionTimeInSeconds = 10; + // TODO: config option private NamedClass classToDescribe; + private List<Individual> classInstances; private TreeSet<Individual> classInstancesSet; private boolean equivalence = true; - private ClassLearningProblemConfigurator configurator; +// private ClassLearningProblemConfigurator configurator; // approximation of accuracy private double approxDelta = 0.05; @@ -78,6 +80,9 @@ // factor for higher weight on recall (needed for subclass learning) private double coverageFactor; + private double betaSC = 3.0; + private double betaEq = 1.0; + // instances of super classes excluding instances of the class itself private List<Individual> superClassInstances; // instances of super classes including instances of the class itself @@ -87,13 +92,19 @@ private HeuristicType heuristic = HeuristicType.AMEASURE; - public ClassLearningProblemConfigurator getConfigurator(){ - return configurator; - } + private boolean checkConsistency = true; + public ClassLearningProblem() { + + } + +// public ClassLearningProblemConfigurator getConfigurator(){ +// return configurator; +// } + public ClassLearningProblem(AbstractReasonerComponent reasoner) { super(reasoner); - configurator = new ClassLearningProblemConfigurator(this); +// configurator = new ClassLearningProblemConfigurator(this); } public static Collection<ConfigOption<?>> createConfigOptions() { @@ -127,35 +138,35 @@ @Override public void init() throws ComponentInitException { - classToDescribe = new NamedClass(configurator.getClassToDescribe().toString()); - useApproximations = configurator.getUseApproximations(); +// classToDescribe = new NamedClass(configurator.getClassToDescribe().toString()); +// useApproximations = configurator.getUseApproximations(); - String accM = configurator.getAccuracyMethod(); - if(accM.equals("standard")) { - heuristic = HeuristicType.AMEASURE; - } else if(accM.equals("fmeasure")) { - heuristic = HeuristicType.FMEASURE; - } else if(accM.equals("generalised_fmeasure")) { - heuristic = HeuristicType.GEN_FMEASURE; - } else if(accM.equals("jaccard")) { - heuristic = HeuristicType.JACCARD; - } else if(accM.equals("pred_acc")) { - heuristic = HeuristicType.PRED_ACC; - } +// String accM = configurator.getAccuracyMethod(); +// if(accM.equals("standard")) { +// heuristic = HeuristicType.AMEASURE; +// } else if(accM.equals("fmeasure")) { +// heuristic = HeuristicType.FMEASURE; +// } else if(accM.equals("generalised_fmeasure")) { +// heuristic = HeuristicType.GEN_FMEASURE; +// } else if(accM.equals("jaccard")) { +// heuristic = HeuristicType.JACCARD; +// } else if(accM.equals("pred_acc")) { +// heuristic = HeuristicType.PRED_ACC; +// } if(useApproximations && heuristic.equals(HeuristicType.PRED_ACC)) { System.err.println("Approximating predictive accuracy is an experimental feature. USE IT AT YOUR OWN RISK. If you consider to use it for anything serious, please extend the unit tests at org.dllearner.test.junit.HeuristicTests first to verify that it works."); } if(useApproximations && !(heuristic.equals(HeuristicType.PRED_ACC) || heuristic.equals(HeuristicType.AMEASURE) || heuristic.equals(HeuristicType.FMEASURE))) { - throw new ComponentInitException("Approximations only supported for F-Measure or Standard-Measure. It is unsupported for \"" + accM + ".\""); + throw new ComponentInitException("Approximations only supported for F-Measure or Standard-Measure. It is unsupported for \"" + heuristic + ".\""); } // useFMeasure = configurator.getAccuracyMethod().equals("fmeasure"); - approxDelta = configurator.getApproxAccuracy(); +// approxDelta = configurator.getApproxAccuracy(); if(!getReasoner().getNamedClasses().contains(classToDescribe)) { - throw new ComponentInitException("The class \"" + configurator.getClassToDescribe() + "\" does not exist. Make sure you spelled it correctly."); + throw new ComponentInitException("The class \"" + classToDescribe + "\" does not exist. Make sure you spelled it correctly."); } classInstances = new LinkedList<Individual>(getReasoner().getIndividuals(classToDescribe)); @@ -165,13 +176,13 @@ } classInstancesSet = new TreeSet<Individual>(classInstances); - equivalence = (configurator.getType().equals("equivalence")); - maxExecutionTimeInSeconds = configurator.getMaxExecutionTimeInSeconds(); +// equivalence = (configurator.getType().equals("equivalence")); +// maxExecutionTimeInSeconds = configurator.getMaxExecutionTimeInSeconds(); if(equivalence) { - coverageFactor = configurator.getBetaEq(); + coverageFactor = betaEq; } else { - coverageFactor = configurator.getBetaSC(); + coverageFactor = betaSC; } // we compute the instances of the super class to perform @@ -244,7 +255,7 @@ acc = getAccuracyOrTooWeakExact(description, 1); } - if(configurator.getCheckConsistency()) { + if(checkConsistency) { // we check whether the axiom already follows from the knowledge base // boolean followsFromKB = reasoner.isSuperClassOf(description, classToDescribe); @@ -846,4 +857,68 @@ public boolean followsFromKB(Description description) { return equivalence ? getReasoner().isEquivalentClass(description, classToDescribe) : getReasoner().isSuperClassOf(description, classToDescribe); } + + public static int getMaxExecutionTimeInSeconds() { + return maxExecutionTimeInSeconds; + } + + public static void setMaxExecutionTimeInSeconds(int maxExecutionTimeInSeconds) { + ClassLearningProblem.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; + } + + public boolean isEquivalence() { + return equivalence; + } + + public void setEquivalence(boolean equivalence) { + this.equivalence = equivalence; + } + + public boolean isUseApproximations() { + return useApproximations; + } + + public void setUseApproximations(boolean useApproximations) { + this.useApproximations = useApproximations; + } + + public HeuristicType getHeuristic() { + return heuristic; + } + + public void setHeuristic(HeuristicType heuristic) { + this.heuristic = heuristic; + } + + public double getApproxDelta() { + return approxDelta; + } + + public void setApproxDelta(double approxDelta) { + this.approxDelta = approxDelta; + } + + public double getBetaSC() { + return betaSC; + } + + public void setBetaSC(double betaSC) { + this.betaSC = betaSC; + } + + public double getBetaEq() { + return betaEq; + } + + public void setBetaEq(double betaEq) { + this.betaEq = betaEq; + } + + public boolean isCheckConsistency() { + return checkConsistency; + } + + public void setCheckConsistency(boolean checkConsistency) { + this.checkConsistency = checkConsistency; + } } Modified: trunk/components-core/src/test/java/org/dllearner/test/junit/HeuristicTests.java =================================================================== --- trunk/components-core/src/test/java/org/dllearner/test/junit/HeuristicTests.java 2011-08-31 08:52:24 UTC (rev 3180) +++ trunk/components-core/src/test/java/org/dllearner/test/junit/HeuristicTests.java 2011-08-31 09:24:25 UTC (rev 3181) @@ -40,6 +40,7 @@ import org.dllearner.kb.KBFile; import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.learningproblems.Heuristics; +import org.dllearner.learningproblems.Heuristics.HeuristicType; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.utilities.Helper; @@ -106,21 +107,21 @@ //// equivalent classes, no noise, no approximations //// // evaluate A2 wrt. A1 using Jaccard - HeuristicTests.configureClassLP(problem, nc[0], "jaccard"); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.JACCARD); // the value should be 10 (i10-i19) divided by 30 (i0-i29) assertEqualsClassLP(problem, nc[1], 1/(double)3); assertEqualsClassLP(problem, nc[2], 1/(double)5); - HeuristicTests.configureClassLP(problem, nc[0], "pred_acc"); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.PRED_ACC); // the value should be the sum of 10 (correct positives) and 970 (correct negatives) divided by 1000 assertEqualsClassLP(problem, nc[1], (10+70)/(double)100); assertEqualsClassLP(problem, nc[2], (10+50)/(double)100); - HeuristicTests.configureClassLP(problem, nc[0], "standard"); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.AMEASURE); assertEqualsClassLP(problem, nc[1], 0.5); assertEqualsClassLP(problem, nc[2], 0.375); - HeuristicTests.configureClassLP(problem, nc[0], "fmeasure"); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.FMEASURE); // recall = precision = F1-score = 0.5 assertEqualsClassLP(problem, nc[1], 0.5); // recall = 0.5, precision = 0.25, F1-score = 0.33... @@ -131,20 +132,20 @@ //// super class learning //// // Jaccard - HeuristicTests.configureClassLP(problem, nc[0], "jaccard", false, false, 0.05); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.JACCARD, false, false, 0.05); // the value should be 10 (i10-i19) divided by 30 (i0-i29) assertEqualsClassLP(problem, nc[1], 1/(double)3); assertEqualsClassLP(problem, nc[2], 1/(double)5); - HeuristicTests.configureClassLP(problem, nc[0], "pred_acc", false, false, 0.05); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.PRED_ACC, false, false, 0.05); assertEqualsClassLP(problem, nc[1], 5/(double)7); assertEqualsClassLP(problem, nc[2], 4/(double)7); - HeuristicTests.configureClassLP(problem, nc[0], "standard"); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.AMEASURE); assertEqualsClassLP(problem, nc[1], 0.5); assertEqualsClassLP(problem, nc[2], 0.4375); - HeuristicTests.configureClassLP(problem, nc[0], "fmeasure", false, false, 0.05); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.FMEASURE, false, false, 0.05); // recall = precision = F1-score = 0.5 assertEqualsClassLP(problem, nc[1], 0.5); // recall = 0.5, precision = 0.25, F1-score = 0.33... @@ -154,7 +155,7 @@ //// noise tests //// - HeuristicTests.configureClassLP(problem, nc[0], "fmeasure", false, true, 0.05); + HeuristicTests.configureClassLP(problem, nc[0], HeuristicType.FMEASURE, false, true, 0.05); assertEquals(problem.getAccuracyOrTooWeak(nc[3], 0.5),-1,delta); // TODO: test approximations @@ -269,28 +270,22 @@ } // convencience method to set the learning problem to a desired configuration (approximations disabled) - private static void configureClassLP(ClassLearningProblem problem, NamedClass classToDescribe, String accuracyMethod) throws ComponentInitException { - try { - problem.getConfigurator().setClassToDescribe(new URL(classToDescribe.getName())); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - problem.getConfigurator().setAccuracyMethod(accuracyMethod); - problem.getConfigurator().setUseApproximations(false); - problem.init(); + private static void configureClassLP(ClassLearningProblem problem, NamedClass classToDescribe, HeuristicType accuracyMethod) throws ComponentInitException { + problem.setClassToDescribe(classToDescribe); + problem.setHeuristic(accuracyMethod); + problem.setUseApproximations(false); + problem.init(); + } // convencience method to set the learning problem to a desired configuration - private static void configureClassLP(ClassLearningProblem problem, NamedClass classToDescribe, String accuracyMethod, boolean equivalenceLearning, boolean useApproximations, double approxAccuracy) throws ComponentInitException { - try { - problem.getConfigurator().setClassToDescribe(new URL(classToDescribe.getName())); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - problem.getConfigurator().setType("superClass"); - problem.getConfigurator().setAccuracyMethod(accuracyMethod); - problem.getConfigurator().setUseApproximations(useApproximations); - problem.getConfigurator().setApproxAccuracy(approxAccuracy); + private static void configureClassLP(ClassLearningProblem problem, NamedClass classToDescribe, HeuristicType accuracyMethod, boolean equivalenceLearning, boolean useApproximations, double approxAccuracy) throws ComponentInitException { + problem.setClassToDescribe(classToDescribe); +// problem.getConfigurator().setType("superClass"); + problem.setEquivalence(false); + problem.setHeuristic(accuracyMethod); + problem.setUseApproximations(useApproximations); + problem.setApproxDelta(approxAccuracy); problem.init(); } Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-08-31 08:52:24 UTC (rev 3180) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-08-31 09:24:25 UTC (rev 3181) @@ -99,6 +99,7 @@ import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.kb.sparql.SparqlQuery; import org.dllearner.learningproblems.ClassLearningProblem; +import org.dllearner.learningproblems.Heuristics.HeuristicType; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.SPARQLReasoner; import org.dllearner.utilities.CommonPrefixMap; @@ -350,15 +351,17 @@ ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, rc); // lp.setPositiveExamples(posExamples); // lp.setNegativeExamples(negExamples); - try { - lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } - lp.getConfigurator().setType("equivalence"); - lp.getConfigurator().setAccuracyMethod("fmeasure"); - lp.getConfigurator().setUseApproximations(false); - lp.getConfigurator().setMaxExecutionTimeInSeconds(10); +// try { + lp.setClassToDescribe(nc); +// } catch (MalformedURLException e1) { +// e1.printStackTrace(); +// } +// lp.setType("equivalence"); + lp.setEquivalence(true); +// lp.setAccuracyMethod("fmeasure"); + lp.setHeuristic(HeuristicType.FMEASURE); + lp.setUseApproximations(false); + lp.setMaxExecutionTimeInSeconds(10); lp.init(); CELOE la = null; Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java 2011-08-31 08:52:24 UTC (rev 3180) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java 2011-08-31 09:24:25 UTC (rev 3181) @@ -109,6 +109,7 @@ import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.learningproblems.ClassLearningProblem; +import org.dllearner.learningproblems.Heuristics.HeuristicType; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.SPARQLReasoner; import org.dllearner.utilities.CommonPrefixMap; @@ -598,15 +599,17 @@ ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, rc); // lp.setPositiveExamples(posExamples); // lp.setNegativeExamples(negExamples); - try { - lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); - } catch (MalformedURLException e1) { - e1.printStackTrace(); - } - lp.getConfigurator().setType("equivalence"); - lp.getConfigurator().setAccuracyMethod("fmeasure"); - lp.getConfigurator().setUseApproximations(false); - lp.getConfigurator().setMaxExecutionTimeInSeconds(10); +// try { + lp.setClassToDescribe(nc); +// } catch (MalformedURLException e1) { +// e1.printStackTrace(); +// } +// lp.setType("equivalence"); + lp.setEquivalence(true); +// lp.setAccuracyMethod("fmeasure"); + lp.setHeuristic(HeuristicType.FMEASURE); + lp.setUseApproximations(false); + lp.setMaxExecutionTimeInSeconds(10); lp.init(); CELOE la = null; Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2011-08-31 08:52:24 UTC (rev 3180) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2011-08-31 09:24:25 UTC (rev 3181) @@ -33,6 +33,7 @@ import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.learningproblems.EvaluatedDescriptionClass; +import org.dllearner.learningproblems.Heuristics.HeuristicType; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.refinementoperators.RhoDRDown; @@ -251,27 +252,33 @@ // lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); for (int k = 0; k <= 3; k++) { lp = cm.learningProblem(ClassLearningProblem.class, reasoner); - lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); - lp.getConfigurator().setCheckConsistency(false); - lp.getConfigurator().setType("equivalence"); + lp.setClassToDescribe(nc); + lp.setCheckConsistency(false); + lp.setEquivalence(true); +// lp.setType("equivalence"); System.out.println("Learning equivalentClass expressions"); if (k == 0) { - lp.getConfigurator().setAccuracyMethod("standard"); +// lp.getConfigurator().setAccuracyMethod("standard"); + lp.setHeuristic(HeuristicType.AMEASURE); System.out.println("Using accuracy method: standard"); } else if (k == 1) { - lp.getConfigurator().setAccuracyMethod("fmeasure"); +// lp.getConfigurator().setAccuracyMethod("fmeasure"); + lp.setHeuristic(HeuristicType.AMEASURE); System.out.println("Using accuracy method: F-Measure"); } else if (k == 2) { - lp.getConfigurator().setAccuracyMethod("pred_acc"); +// lp.getConfigurator().setAccuracyMethod("pred_acc"); + lp.setHeuristic(HeuristicType.PRED_ACC); System.out.println("Using accuracy method: Predictive accuracy"); } else if (k == 3) { - lp.getConfigurator().setAccuracyMethod("jaccard"); +// lp.getConfigurator().setAccuracyMethod("jaccard"); + lp.setHeuristic(HeuristicType.JACCARD); System.out.println("Using accuracy method: Jaccard"); } else { - lp.getConfigurator().setAccuracyMethod("generalised_fmeasure"); +// lp.getConfigurator().setAccuracyMethod("generalised_fmeasure"); + lp.setHeuristic(HeuristicType.GEN_FMEASURE); System.out.println("Using accuracy method: Generalised F-Measure"); } - lp.getConfigurator().setUseApproximations(useApproximations); + lp.setUseApproximations(useApproximations); lp.init(); celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); // cf = celoe.getConfigurator(); @@ -377,13 +384,15 @@ System.out.println("\nlearning axioms for class " + nc.toManchesterSyntaxString(baseURI, prefixes)); lp = cm.learningProblem(ClassLearningProblem.class, reasoner); - lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); - lp.getConfigurator().setCheckConsistency(false); - lp.getConfigurator().setType("equivalence"); + lp.setClassToDescribe(nc); + lp.setCheckConsistency(false); +// lp.getConfigurator().setType("equivalence"); + lp.setEquivalence(true); System.out.println("Learning equivalentClass expressions"); - lp.getConfigurator().setAccuracyMethod("generalised_fmeasure"); +// lp.getConfigurator().setAccuracyMethod("generalised_fmeasure"); + lp.setHeuristic(HeuristicType.GEN_FMEASURE); System.out.println("Using accuracy method: Generalised F-Measure"); - lp.getConfigurator().setUseApproximations(useApproximations); + lp.setUseApproximations(useApproximations); lp.init(); celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); RhoDRDown op = (RhoDRDown) celoe.getOperator(); @@ -459,11 +468,13 @@ + " with " + instanceCount + " instances"); lp = cm.learningProblem(ClassLearningProblem.class, reasoner); - lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); - lp.getConfigurator().setCheckConsistency(false); - lp.getConfigurator().setType("equivalence"); + lp.setClassToDescribe(nc); + lp.setCheckConsistency(false); +// lp.getConfigurator().setType("equivalence"); + lp.setEquivalence(true); System.out.println("Learning equivalentClass expressions"); - lp.getConfigurator().setUseApproximations(true); +// lp.getConfigurator().setUseApproximations(true); + lp.setUseApproximations(true); lp.init(); celoe = cm.learningAlgorithm(CELOE.class, lp, reasoner); RhoDRDown op = (RhoDRDown) celoe.getOperator(); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java 2011-08-31 08:52:24 UTC (rev 3180) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java 2011-08-31 09:24:25 UTC (rev 3181) @@ -49,6 +49,7 @@ import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.learningproblems.EvaluatedDescriptionClass; +import org.dllearner.learningproblems.Heuristics.HeuristicType; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.refinementoperators.RhoDRDown; @@ -204,20 +205,23 @@ // learn equivalence axiom ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); - lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); + lp.setClassToDescribe(nc); if (i == 0) { System.out .println("generating suggestions for equivalent class (please wait " + algorithmRuntimeInSeconds + " seconds)"); - lp.getConfigurator().setType("equivalence"); +// lp.getConfigurator().setType("equivalence"); + lp.setEquivalence(true); } else { System.out.println("suggestions for super class (please wait " + algorithmRuntimeInSeconds + " seconds)"); - lp.getConfigurator().setType("superClass"); +// lp.getConfigurator().setType("superClass"); + lp.setEquivalence(false); } - lp.getConfigurator().setUseApproximations(useApproximations); + lp.setUseApproximations(useApproximations); if(useFMeasure) { - lp.getConfigurator().setAccuracyMethod("fmeasure"); +// lp.getConfigurator().setAccuracyMethod("fmeasure"); + lp.setHeuristic(HeuristicType.FMEASURE); } lp.init(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-31 11:15:18
|
Revision: 3182 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3182&view=rev Author: jenslehmann Date: 2011-08-31 11:15:09 +0000 (Wed, 31 Aug 2011) Log Message: ----------- cleanup up OCEL (refinement operator options now separated) and fixed a bug Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java trunk/examples/trains/trains.conf trunk/scripts/src/main/java/org/dllearner/scripts/NewSample.java trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java trunk/scripts/src/main/java/org/dllearner/scripts/tiger/TestIterativeLearning.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java 2011-08-31 09:24:25 UTC (rev 3181) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/ocel/OCEL.java 2011-08-31 11:15:09 UTC (rev 3182) @@ -112,20 +112,20 @@ // these are computed as the result of the previous four settings Set<NamedClass> usedConcepts; Set<ObjectProperty> usedRoles; - private boolean applyAllFilter = true; - private boolean applyExistsFilter = true; +// private boolean applyAllFilter = true; +// private boolean applyExistsFilter = true; private boolean useTooWeakList = true; private boolean useOverlyGeneralList = true; private boolean useShortConceptConstruction = true; private boolean improveSubsumptionHierarchy = true; - private boolean useAllConstructor = CommonConfigOptions.useAllConstructorDefault; - private boolean useExistsConstructor = CommonConfigOptions.useExistsConstructorDefault; - private boolean useHasValueConstructor = CommonConfigOptions.useHasValueConstructorDefault; - private int valueFrequencyThreshold = CommonConfigOptions.valueFrequencyThresholdDefault; - private boolean useCardinalityRestrictions = CommonConfigOptions.useCardinalityRestrictionsDefault; - private boolean useNegation = CommonConfigOptions.useNegationDefault; - private boolean useBooleanDatatypes = CommonConfigOptions.useBooleanDatatypesDefault; - private boolean useDoubleDatatypes = CommonConfigOptions.useDoubleDatatypesDefault; +// private boolean useAllConstructor = CommonConfigOptions.useAllConstructorDefault; +// private boolean useExistsConstructor = CommonConfigOptions.useExistsConstructorDefault; +// private boolean useHasValueConstructor = CommonConfigOptions.useHasValueConstructorDefault; +// private int valueFrequencyThreshold = CommonConfigOptions.valueFrequencyThresholdDefault; +// private boolean useCardinalityRestrictions = CommonConfigOptions.useCardinalityRestrictionsDefault; +// private boolean useNegation = CommonConfigOptions.useNegationDefault; +// private boolean useBooleanDatatypes = CommonConfigOptions.useBooleanDatatypesDefault; +// private boolean useDoubleDatatypes = CommonConfigOptions.useDoubleDatatypesDefault; private static double noisePercentageDefault = 0.0; private double noisePercentage = noisePercentageDefault; private NamedClass startClass = null; @@ -144,10 +144,10 @@ private int guaranteeXgoodDescriptions = CommonConfigOptions.guaranteeXgoodDescriptionsDefault; private int maxClassDescriptionTests = CommonConfigOptions.maxClassDescriptionTestsDefault; - private double negativeWeight; - private double startNodeBonus; - private double expansionPenaltyFactor; - private int negationPenalty; + private double negativeWeight = 1.0; + private double startNodeBonus = 1.0; + private double expansionPenaltyFactor = 0.02; + private int negationPenalty = 0; private boolean terminateOnNoiseReached = true; // Variablen zur Einstellung der Protokollierung @@ -155,9 +155,9 @@ boolean showBenchmarkInformation = false; // boolean createTreeString = false; // String searchTree = new String(); - private int cardinalityLimit; - private boolean useStringDatatypes; - private boolean instanceBasedDisjoints; +// private int cardinalityLimit = 5; +// private boolean useStringDatatypes = false; +// private boolean instanceBasedDisjoints = true; // Konfiguration des Algorithmus // Faktor für horizontale Erweiterung (notwendig für completeness) @@ -266,9 +266,9 @@ } else if(name.equals("ignoredRoles")) { ignoredRoles = CommonConfigMappings.getAtomicRoleSet((Set<String>)entry.getValue()); } else if(name.equals("applyAllFilter")) { - applyAllFilter = (Boolean) entry.getValue(); +// applyAllFilter = (Boolean) entry.getValue(); } else if(name.equals("applyExistsFilter")) { - applyExistsFilter = (Boolean) entry.getValue(); +// applyExistsFilter = (Boolean) entry.getValue(); } else if(name.equals("useTooWeakList")) { useTooWeakList = (Boolean) entry.getValue(); } else if(name.equals("useOverlyGeneralList")) { @@ -278,23 +278,23 @@ } else if(name.equals("improveSubsumptionHierarchy")) { improveSubsumptionHierarchy = (Boolean) entry.getValue(); } else if(name.equals("useAllConstructor")) { - useAllConstructor = (Boolean) entry.getValue(); +// useAllConstructor = (Boolean) entry.getValue(); } else if(name.equals("useExistsConstructor")) { - useExistsConstructor = (Boolean) entry.getValue(); +// useExistsConstructor = (Boolean) entry.getValue(); } else if(name.equals("useHasValueConstructor")) { - useHasValueConstructor = (Boolean) entry.getValue(); +// useHasValueConstructor = (Boolean) entry.getValue(); } else if(name.equals("valueFrequencyThreshold")) { - valueFrequencyThreshold = (Integer) entry.getValue(); +// valueFrequencyThreshold = (Integer) entry.getValue(); } else if(name.equals("useCardinalityRestrictions")) { - useCardinalityRestrictions = (Boolean) entry.getValue(); +// useCardinalityRestrictions = (Boolean) entry.getValue(); } else if(name.equals("useNegation")) { - useNegation = (Boolean) entry.getValue(); +// useNegation = (Boolean) entry.getValue(); } else if(name.equals("noisePercentage")) { noisePercentage = (Double) entry.getValue(); } else if(name.equals("useBooleanDatatypes")) { - useBooleanDatatypes = (Boolean) entry.getValue(); +// useBooleanDatatypes = (Boolean) entry.getValue(); } else if(name.equals("useDoubleDatatypes")) { - useDoubleDatatypes = (Boolean) entry.getValue(); +// useDoubleDatatypes = (Boolean) entry.getValue(); } else if(name.equals("usePropernessChecks")) { usePropernessChecks = (Boolean) entry.getValue(); } else if(name.equals("maxPosOnlyExpansion")) { @@ -409,27 +409,33 @@ // variables to it // RhoDRDown if(operator == null) { - // TODO: switch to default constructor and inject only - // the necessary things (class hierarchy) - operator = new RhoDRDown( - reasoner, - classHierarchy, -// configurator, - applyAllFilter, - applyExistsFilter, - useAllConstructor, - useExistsConstructor, - useHasValueConstructor, - valueFrequencyThreshold, - useCardinalityRestrictions, - useNegation, - useBooleanDatatypes, - useDoubleDatatypes, - startClass, - cardinalityLimit, - useStringDatatypes, - instanceBasedDisjoints - ); + // we use a default operator and inject the class hierarchy for now + operator = new RhoDRDown(); + ((RhoDRDown)operator).setSubHierarchy(classHierarchy); + ((RhoDRDown)operator).setReasoner(reasoner); + ((RhoDRDown)operator).init(); + +// operator = new RhoDRDown( +// reasoner, +// classHierarchy, +//// configurator, +// applyAllFilter, +// applyExistsFilter, +//// useAllConstructor, +// true, +//// useExistsConstructor, +// true, +// useHasValueConstructor, +// valueFrequencyThreshold, +// useCardinalityRestrictions, +// useNegation, +// useBooleanDatatypes, +// useDoubleDatatypes, +// startClass, +// cardinalityLimit, +// useStringDatatypes, +// instanceBasedDisjoints +// ); } else { // we still have to inject the class hierarchy even if the operator is configured operator.setSubHierarchy(classHierarchy); @@ -622,22 +628,6 @@ this.usedRoles = usedRoles; } - public boolean isApplyAllFilter() { - return applyAllFilter; - } - - public void setApplyAllFilter(boolean applyAllFilter) { - this.applyAllFilter = applyAllFilter; - } - - public boolean isApplyExistsFilter() { - return applyExistsFilter; - } - - public void setApplyExistsFilter(boolean applyExistsFilter) { - this.applyExistsFilter = applyExistsFilter; - } - public boolean isUseTooWeakList() { return useTooWeakList; } @@ -670,70 +660,6 @@ this.improveSubsumptionHierarchy = improveSubsumptionHierarchy; } - public boolean isUseAllConstructor() { - return useAllConstructor; - } - - public void setUseAllConstructor(boolean useAllConstructor) { - this.useAllConstructor = useAllConstructor; - } - - public boolean isUseExistsConstructor() { - return useExistsConstructor; - } - - public void setUseExistsConstructor(boolean useExistsConstructor) { - this.useExistsConstructor = useExistsConstructor; - } - - public boolean isUseHasValueConstructor() { - return useHasValueConstructor; - } - - public void setUseHasValueConstructor(boolean useHasValueConstructor) { - this.useHasValueConstructor = useHasValueConstructor; - } - - public int getValueFrequencyThreshold() { - return valueFrequencyThreshold; - } - - public void setValueFrequencyThreshold(int valueFrequencyThreshold) { - this.valueFrequencyThreshold = valueFrequencyThreshold; - } - - public boolean isUseCardinalityRestrictions() { - return useCardinalityRestrictions; - } - - public void setUseCardinalityRestrictions(boolean useCardinalityRestrictions) { - this.useCardinalityRestrictions = useCardinalityRestrictions; - } - - public boolean isUseNegation() { - return useNegation; - } - - public void setUseNegation(boolean useNegation) { - this.useNegation = useNegation; - } - - public boolean isUseBooleanDatatypes() { - return useBooleanDatatypes; - } - - public void setUseBooleanDatatypes(boolean useBooleanDatatypes) { - this.useBooleanDatatypes = useBooleanDatatypes; - } - - public boolean isUseDoubleDatatypes() { - return useDoubleDatatypes; - } - - public void setUseDoubleDatatypes(boolean useDoubleDatatypes) { - this.useDoubleDatatypes = useDoubleDatatypes; - } - public double getNoisePercentage() { return noisePercentage; } Modified: trunk/examples/trains/trains.conf =================================================================== --- trunk/examples/trains/trains.conf 2011-08-31 09:24:25 UTC (rev 3181) +++ trunk/examples/trains/trains.conf 2011-08-31 11:15:09 UTC (rev 3182) @@ -47,4 +47,5 @@ lp.negativeExamples = {"kb:west6", "kb:west7", "kb:west8", "kb:west9", "kb:west10"} alg.type = "ocel" -alg.maxExecutionTimeInSeconds = 10 +alg.maxExecutionTimeInSeconds = 5 + Modified: trunk/scripts/src/main/java/org/dllearner/scripts/NewSample.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/NewSample.java 2011-08-31 09:24:25 UTC (rev 3181) +++ trunk/scripts/src/main/java/org/dllearner/scripts/NewSample.java 2011-08-31 11:15:09 UTC (rev 3182) @@ -43,6 +43,7 @@ import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.reasoning.FastInstanceChecker; +import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.Files; import org.dllearner.utilities.Helper; @@ -134,12 +135,13 @@ // learning algorithm OCEL la = ComponentManager.getInstance().learningAlgorithm(OCEL.class, lp, f); + RhoDRDown op = (RhoDRDown) la.getOperator(); //OPTIONAL PARAMETERS - la.setUseAllConstructor( false); - la.setUseExistsConstructor(true); - la.setUseCardinalityRestrictions(false); - la.setUseExistsConstructor(true); - la.setUseNegation(false); + op.setUseAllConstructor( false); + op.setUseExistsConstructor(true); + op.setUseCardinalityRestrictions(false); + op.setUseExistsConstructor(true); + op.setUseNegation(false); la.setWriteSearchTree(false); // la.setSearchTreeFile("log/searchTree.txt"); la.setReplaceSearchTree(true); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java 2011-08-31 09:24:25 UTC (rev 3181) +++ trunk/scripts/src/main/java/org/dllearner/scripts/SemanticBibleComparison.java 2011-08-31 11:15:09 UTC (rev 3182) @@ -58,6 +58,7 @@ import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.reasoning.ReasonerType; +import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.utilities.Files; import org.dllearner.utilities.JamonMonitorLogger; import org.dllearner.utilities.StringFormatter; @@ -378,14 +379,17 @@ public static OCEL experimentalSetup(Experiments exp,SortedSet<Individual> posExamples, SortedSet<Individual> negExamples ){ OCEL la = null; - if(exp.toString().contains("SPARQL")) + RhoDRDown op = null; + if(exp.toString().contains("SPARQL")) { la = prepareSparqlExperiment(exp, posExamples, negExamples); - else if(exp.toString().contains("NORMAL")){ + op = (RhoDRDown) la.getOperator(); + } else if(exp.toString().contains("NORMAL")){ if(exp.equals(Experiments.NORMAL_10000_CTESTS_FASTINST)){ la = prepareNormalExperiment(true, posExamples, negExamples); - la.setUseAllConstructor(false); - la.setUseNegation(false); - la.setUseCardinalityRestrictions(false); + op = (RhoDRDown) la.getOperator(); + op.setUseAllConstructor(false); + op.setUseNegation(false); + op.setUseCardinalityRestrictions(false); }else{ la = prepareNormalExperiment(false, posExamples, negExamples); } @@ -397,13 +401,13 @@ // OCELConfigurator c = la.getConfigurator(); //defaultSettings: - la.setUseHasValueConstructor(false); - la.setUseBooleanDatatypes(false); - la.setUseDoubleDatatypes(false); + op.setUseHasValueConstructor(false); + op.setUseBooleanDatatypes(false); + op.setUseDoubleDatatypes(false); if(exp.toString().contains("HASVALUE")){ - la.setUseHasValueConstructor(true); + op.setUseHasValueConstructor(true); } Modified: trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java 2011-08-31 09:24:25 UTC (rev 3181) +++ trunk/scripts/src/main/java/org/dllearner/scripts/WikipediaCategoryCleaner.java 2011-08-31 11:15:09 UTC (rev 3182) @@ -48,6 +48,7 @@ import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.reasoning.FastInstanceChecker; +import org.dllearner.refinementoperators.RhoDRDown; import org.dllearner.scripts.improveWikipedia.ConceptSPARQLReEvaluator; import org.dllearner.scripts.improveWikipedia.ConceptSelector; import org.dllearner.scripts.improveWikipedia.WikipediaCategoryTasks; @@ -318,13 +319,14 @@ la.setNoisePercentage(20); la.setGuaranteeXgoodDescriptions(100); la.setMaxExecutionTimeInSeconds(50); + RhoDRDown op = (RhoDRDown) la.getOperator(); - la.setUseAllConstructor(false); - la.setUseBooleanDatatypes(false); - la.setUseCardinalityRestrictions(false); - la.setUseNegation(false); - la.setUseHasValueConstructor(false); - la.setUseDoubleDatatypes(false); + op.setUseAllConstructor(false); + op.setUseBooleanDatatypes(false); + op.setUseCardinalityRestrictions(false); + op.setUseNegation(false); + op.setUseHasValueConstructor(false); + op.setUseDoubleDatatypes(false); la.setWriteSearchTree(true); // la.setSearchTreeFile("log/dbpedia.txt"); la.setReplaceSearchTree(true); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/tiger/TestIterativeLearning.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/tiger/TestIterativeLearning.java 2011-08-31 09:24:25 UTC (rev 3181) +++ trunk/scripts/src/main/java/org/dllearner/scripts/tiger/TestIterativeLearning.java 2011-08-31 11:15:09 UTC (rev 3182) @@ -637,15 +637,16 @@ } OCEL la = ComponentManager.getInstance().learningAlgorithm(OCEL.class, lp, rc); + RhoDRDown op = (RhoDRDown) la.getOperator(); // CELOE la = ComponentFactory.getCELOE(lp, rc); - la.setUseExistsConstructor(true); + op.setUseExistsConstructor(true); - la.setUseAllConstructor(false); - la.setUseCardinalityRestrictions(false); - la.setUseNegation(false); - la.setUseHasValueConstructor(false); - la.setUseDataHasValueConstructor(config.useDataHasValue); - la.setValueFrequencyThreshold(valueFrequencyThreshold); + op.setUseAllConstructor(false); + op.setUseCardinalityRestrictions(false); + op.setUseNegation(false); + op.setUseHasValueConstructor(false); + op.setUseDataHasValueConstructor(config.useDataHasValue); + op.setFrequencyThreshold(valueFrequencyThreshold); // la.getConfigurator().setInstanceBasedDisjoints(true); // la.getConfigurator().setIgnoredConcepts( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-31 16:53:57
|
Revision: 3193 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3193&view=rev Author: jenslehmann Date: 2011-08-31 16:53:51 +0000 (Wed, 31 Aug 2011) Log Message: ----------- removed depdendency on aksw-commons sparql-scala; changed code to firt aksw-commons-0.1 Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java trunk/components-ext/pom.xml trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/Evaluation.java trunk/pom.xml trunk/scripts/pom.xml trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java Modified: trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java 2011-08-31 16:25:26 UTC (rev 3192) +++ trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java 2011-08-31 16:53:51 UTC (rev 3193) @@ -19,20 +19,16 @@ package org.dllearner.core; -import java.lang.annotation.Annotation; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; -import java.util.Map; import org.apache.commons.collections15.BidiMap; import org.apache.commons.collections15.bidimap.DualHashBidiMap; -import org.apache.commons.lang.ClassUtils; /** * Component manager for the new (as of 2011) annotation based configuration @@ -175,7 +171,7 @@ for(Constructor<?> constructor : constructors) { Class<?>[] paraTypes = constructor.getParameterTypes(); for(Class<?> paraType : paraTypes) { - if(ClassUtils.isAssignable(argument, paraType)) { + if(org.springframework.util.ClassUtils.isAssignable(argument, paraType)) { return true; } } @@ -197,9 +193,10 @@ try { Constructor<?>[] constructors = compound.getDeclaredConstructors(); for(Constructor<?> constructor : constructors) { - if(ClassUtils.isAssignable(arguments, constructor.getParameterTypes())) { + // TODO: ClassUtils is no longer in the dependencies +// if(ClassUtils.isAssignable(arguments, constructor.getParameterTypes())) { return true; - } +// } } } catch (SecurityException e) { e.printStackTrace(); Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java 2011-08-31 16:25:26 UTC (rev 3192) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/SPARQLReasoner.java 2011-08-31 16:53:51 UTC (rev 3193) @@ -173,18 +173,20 @@ } private Model loadIncrementally(String query){ - try { +// try { QueryExecutionFactory f = new QueryExecutionFactoryHttp(ks.getEndpoint().getURL().toString(), ks.getEndpoint().getDefaultGraphURIs()); - f = new QueryExecutionFactoryCache(f, new CacheImpl(CacheCoreH2.create("cache", 60 * 24 *5))); +// f = new QueryExecutionFactoryCache(f, new CacheImpl(CacheCoreH2.create("cache", 60 * 24 *5))); + System.out.println("SPARQLReasoner.loadIncrementally needs to be rewritten for aksw-commons 0.1"); + System.exit(0); f = new QueryExecutionFactoryPaginated(f, 1000); Model model = f.createQueryExecution(query).execConstruct(); return model; - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } catch (SQLException e) { - e.printStackTrace(); - } - return null; +// } catch (ClassNotFoundException e) { +// e.printStackTrace(); +// } catch (SQLException e) { +// e.printStackTrace(); +// } +// return null; } @Override Modified: trunk/components-ext/pom.xml =================================================================== --- trunk/components-ext/pom.xml 2011-08-31 16:25:26 UTC (rev 3192) +++ trunk/components-ext/pom.xml 2011-08-31 16:53:51 UTC (rev 3193) @@ -53,10 +53,6 @@ <artifactId>sparql</artifactId> </dependency> <dependency> - <groupId>org.aksw.commons</groupId> - <artifactId>sparql-scala</artifactId> - </dependency> - <dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-core</artifactId> <version>3.3.0</version> Modified: trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/Evaluation.java =================================================================== --- trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/Evaluation.java 2011-08-31 16:25:26 UTC (rev 3192) +++ trunk/components-ext/src/test/java/org/dllearner/algorithm/tbsl/Evaluation.java 2011-08-31 16:53:51 UTC (rev 3193) @@ -7,6 +7,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -25,9 +26,6 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.aksw.commons.sparql.core.SparqlEndpoint; -import org.aksw.commons.sparql.core.decorator.CachingSparqlEndpoint; -import org.aksw.commons.sparql.core.impl.HttpSparqlEndpoint; import org.apache.log4j.FileAppender; import org.apache.log4j.Layout; import org.apache.log4j.Level; @@ -39,14 +37,13 @@ import org.dllearner.algorithm.tbsl.sparql.Slot; import org.dllearner.algorithm.tbsl.sparql.Template; import org.dllearner.algorithm.tbsl.util.LatexWriter; +import org.dllearner.kb.sparql.SparqlEndpoint; import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; -import scala.actors.threadpool.Arrays; - import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.rdf.model.RDFNode; @@ -96,7 +93,8 @@ String endpointURL = props.getProperty("endpointURL", "http://live.dbpedia.org/sparql"); String defaultGraphURI = props.getProperty("defaultGraphURI", "http://live.dbpedia.org"); - this.endpoint = new CachingSparqlEndpoint(new HttpSparqlEndpoint(endpointURL, defaultGraphURI), "cache"); + // TODO: use aksw-commons-sparql instead of sparql-scala +// this.endpoint = new CachingSparqlEndpoint(new HttpSparqlEndpoint(endpointURL, defaultGraphURI), "cache"); try { stbl.setEndpoint(new org.dllearner.kb.sparql.SparqlEndpoint( new URL(endpointURL), Collections.singletonList(defaultGraphURI), Collections.<String>emptyList())); @@ -181,12 +179,13 @@ private Set<String> getResources(String query){ Set<String> resources = new HashSet<String>(); - ResultSet rs = endpoint.executeSelect(query); - QuerySolution qs; - while(rs.hasNext()){ - qs = rs.next(); - resources.add(qs.getResource("uri").getURI()); - } + // TODO: use aksw-commons-sparql instead of sparql-scala +// ResultSet rs = endpoint.executeSelect(query); +// QuerySolution qs; +// while(rs.hasNext()){ +// qs = rs.next(); +// resources.add(qs.getResource("uri").getURI()); +// } return resources; } @@ -195,6 +194,8 @@ logger.debug("Query: " + query); Object answer = null; + // TODO: use aksw-commons-sparql instead of sparql-scala + /* if(query.contains("ASK")){ answer = endpoint.executeAsk(query); } else { @@ -225,10 +226,13 @@ } } logger.debug("Answer: " + answer); + */ return answer; } public void setEndpoint(SparqlEndpoint endpoint){ + // TODO: use aksw-commons-sparql instead of sparql-scala + /* this.endpoint = endpoint; try { stbl.setEndpoint(new org.dllearner.kb.sparql.SparqlEndpoint( @@ -236,6 +240,7 @@ } catch (MalformedURLException e) { e.printStackTrace(); } + */ } public void setUseRemoteValidation(boolean useRemoteValidation){ Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-08-31 16:25:26 UTC (rev 3192) +++ trunk/pom.xml 2011-08-31 16:53:51 UTC (rev 3193) @@ -16,7 +16,7 @@ <gwt.version>2.3.0</gwt.version> <!--Define the AKSW dependency version --> - <aksw.version>0.2-SNAPSHOT</aksw.version> + <aksw.version>0.1</aksw.version> </properties> <modules> @@ -279,11 +279,6 @@ </dependency> <dependency> <groupId>org.aksw.commons</groupId> - <artifactId>sparql-scala</artifactId> - <version>${aksw.version}</version> - </dependency> - <dependency> - <groupId>org.aksw.commons</groupId> <artifactId>model</artifactId> <version>${aksw.version}</version> </dependency> Modified: trunk/scripts/pom.xml =================================================================== --- trunk/scripts/pom.xml 2011-08-31 16:25:26 UTC (rev 3192) +++ trunk/scripts/pom.xml 2011-08-31 16:53:51 UTC (rev 3193) @@ -55,10 +55,6 @@ <groupId>org.aksw.commons</groupId> <artifactId>sparql</artifactId> </dependency> - <dependency> - <groupId>org.aksw.commons</groupId> - <artifactId>sparql-scala</artifactId> - </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> Modified: trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java 2011-08-31 16:25:26 UTC (rev 3192) +++ trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java 2011-08-31 16:53:51 UTC (rev 3193) @@ -30,11 +30,6 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.aksw.commons.sparql.core.ResultSetRenderer; -import org.aksw.commons.sparql.core.SparqlEndpoint; -import org.aksw.commons.sparql.core.SparqlTemplate; -import org.aksw.commons.sparql.core.decorator.CachingSparqlEndpoint; -import org.aksw.commons.sparql.core.impl.HttpSparqlEndpoint; import org.apache.velocity.VelocityContext; import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.AbstractReasonerComponent; @@ -62,7 +57,11 @@ /** * A script, which learns definitions / super classes of classes in the DBpedia ontology. * + * TODO: This script made heavy use of aksw-commons-sparql-scala and needs to be + * rewritten to use aksw-commons-sparql (the new SPARQL API). + * * @author Jens Lehmann + * @author Sebastian Hellmann */ public class DBpediaClassLearnerCELOE { @@ -71,7 +70,7 @@ private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(DBpediaClassLearnerCELOE.class); - SparqlEndpoint sparqlEndpoint = new CachingSparqlEndpoint(new HttpSparqlEndpoint(endpointurl, "http://dbpedia.org"), "cache/"); +// SparqlEndpoint sparqlEndpoint = new CachingSparqlEndpoint(new HttpSparqlEndpoint(endpointurl, "http://dbpedia.org"), "cache/"); public DBpediaClassLearnerCELOE() { // OPTIONAL: if you want to do some case distinctions in the learnClass method, you could add @@ -81,10 +80,10 @@ public static void main(String args[]) throws LearningProblemUnsupportedException, IOException, Exception { DBpediaClassLearnerCELOE dcl = new DBpediaClassLearnerCELOE(); - Set<String> classesToLearn = dcl.getClasses(); - - KB kb = dcl.learnAllClasses(classesToLearn); - kb.export(new File("result.owl"), OntologyFormat.RDF_XML); +// Set<String> classesToLearn = dcl.getClasses(); +// +// KB kb = dcl.learnAllClasses(classesToLearn); +// kb.export(new File("result.owl"), OntologyFormat.RDF_XML); } @@ -109,7 +108,8 @@ } public Description learnClass(String classToLearn) throws Exception { - SortedSet<String> posEx = new TreeSet<String>(getPosEx(classToLearn)); + // TODO: use aksw-commons-sparql instead of sparql-scala + SortedSet<String> posEx = null; // = new TreeSet<String>(getPosEx(classToLearn)); logger.info("Found " + posEx.size() + " positive examples"); if (posEx.isEmpty()) { return null; @@ -182,27 +182,26 @@ return la.getCurrentlyBestDescription(); } - //gets all DBpedia Classes - public Set<String> getClasses() throws Exception { - SparqlTemplate st = SparqlTemplate.getInstance("allClasses.vm"); - st.setLimit(0); - st.addFilter(sparqlEndpoint.like("classes", new HashSet<String>(Arrays.asList(new String[]{"http://dbpedia.org/ontology/"})))); - VelocityContext vc = st.getVelocityContext(); - String query = st.getQuery(); - return new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query))); - } +// public Set<String> getClasses() throws Exception { +// SparqlTemplate st = SparqlTemplate.getInstance("allClasses.vm"); +// st.setLimit(0); +// st.addFilter(sparqlEndpoint.like("classes", new HashSet<String>(Arrays.asList(new String[]{"http://dbpedia.org/ontology/"})))); +// VelocityContext vc = st.getVelocityContext(); +// String query = st.getQuery(); +// return new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query))); +// } +// +// public Set<String> getPosEx(String clazz) throws Exception { +// SparqlTemplate st = SparqlTemplate.getInstance("instancesOfClass.vm"); +// st.setLimit(0); +// VelocityContext vc = st.getVelocityContext(); +// System.out.println(clazz); +// vc.put("class", clazz); +// String query = st.getQuery(); +// return new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query))); +// } - public Set<String> getPosEx(String clazz) throws Exception { - SparqlTemplate st = SparqlTemplate.getInstance("instancesOfClass.vm"); - st.setLimit(0); - VelocityContext vc = st.getVelocityContext(); - System.out.println(clazz); - vc.put("class", clazz); - String query = st.getQuery(); - return new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query))); - } - /** * gets all direct classes of all instances and has a look, what the most common is * @@ -213,7 +212,8 @@ */ public String selectClass(String clazz, Set<String> posEx) throws Exception { Map<String, Integer> m = new HashMap<String, Integer>(); - + // TODO: use aksw-commons-sparql instead of sparql-scala + /* for (String pos : posEx) { SparqlTemplate st = SparqlTemplate.getInstance("directClassesOfInstance.vm"); st.setLimit(0); @@ -230,8 +230,8 @@ m.put(s, m.get(s).intValue() + 1); } } + */ - int max = 0; String maxClass = ""; for (String key : m.keySet()) { @@ -239,6 +239,7 @@ maxClass = key; } } + return maxClass; } @@ -253,6 +254,8 @@ public Set<String> getNegEx(String clazz, Set<String> posEx) throws Exception { Set<String> negEx = new HashSet<String>(); + // TODO: use aksw-commons-sparql instead of sparql-scala + /* String targetClass = getParallelClass(clazz); logger.info("using class for negatives: " + targetClass); if (targetClass != null) { @@ -261,18 +264,19 @@ st.setLimit(0); VelocityContext vc = st.getVelocityContext(); vc.put("class", targetClass); - st.addFilter(sparqlEndpoint.like("class", new HashSet<String>(Arrays.asList(new String[]{"http://dbpedia.org/ontology/"})))); +// st.addFilter(sparqlEndpoint.like("class", new HashSet<String>(Arrays.asList(new String[]{"http://dbpedia.org/ontology/"})))); String query = st.getQuery(); - negEx.addAll(new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query)))); +// negEx.addAll(new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query)))); } else { SparqlTemplate st = SparqlTemplate.getInstance("someInstances.vm"); st.setLimit(posEx.size() + 100); VelocityContext vc = st.getVelocityContext(); String query = st.getQuery(); - negEx.addAll(new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query)))); +// negEx.addAll(new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query)))); } negEx.removeAll(posEx); + */ return negEx; @@ -280,15 +284,16 @@ public String getParallelClass(String clazz) throws Exception { - SparqlTemplate st = SparqlTemplate.getInstance("parallelClass.vm"); - st.setLimit(0); - VelocityContext vc = st.getVelocityContext(); - vc.put("class", clazz); - String query = st.getQuery(); - Set<String> parClasses = new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query))); - for (String s : parClasses) { - return s; - } + // TODO: use aksw-commons-sparql instead of sparql-scala +// SparqlTemplate st = SparqlTemplate.getInstance("parallelClass.vm"); +// st.setLimit(0); +// VelocityContext vc = st.getVelocityContext(); +// vc.put("class", clazz); +// String query = st.getQuery(); +// Set<String> parClasses = new HashSet<String>(ResultSetRenderer.asStringSet(sparqlEndpoint.executeSelect(query))); +// for (String s : parClasses) { +// return s; +// } return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-31 17:23:31
|
Revision: 3195 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3195&view=rev Author: jenslehmann Date: 2011-08-31 17:23:23 +0000 (Wed, 31 Aug 2011) Log Message: ----------- ripped out CELOECOnfigurator Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java Removed Paths: ------------- trunk/components-core/src/main/java/org/dllearner/core/configurators/CELOEConfigurator.java trunk/scripts/src/main/java/org/dllearner/scripts/ConfigJavaGenerator.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java 2011-08-31 17:15:20 UTC (rev 3194) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java 2011-08-31 17:23:23 UTC (rev 3195) @@ -22,7 +22,6 @@ import java.util.Comparator; import org.dllearner.core.ComponentAnn; -import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.utilities.owl.ConceptComparator; /** Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/CELOEConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/CELOEConfigurator.java 2011-08-31 17:15:20 UTC (rev 3194) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/CELOEConfigurator.java 2011-08-31 17:23:23 UTC (rev 3195) @@ -1,539 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import java.util.Set; -import org.dllearner.algorithms.celoe.CELOE; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.RefinementOperatorConfigurator; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -@SuppressWarnings("all") -public class CELOEConfigurator extends RefinementOperatorConfigurator implements Configurator { - -private boolean reinitNecessary = false; -private CELOE cELOE; - -/** -* @param cELOE see CELOE -**/ -public CELOEConfigurator(CELOE cELOE){ -this.cELOE = cELOE; -} - -/** -* @param reasoningService see reasoningService -* @param learningProblem see learningProblem -* @throws LearningProblemUnsupportedException see -* @return CELOE -**/ -public static CELOE getCELOE(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException{ -CELOE component = ComponentManager.getInstance().learningAlgorithm(CELOE.class, learningProblem, reasoningService); -return component; -} - -/** -* useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseAllConstructor() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useAllConstructor") ; -} -/** -* useExistsConstructor specifies whether the existential concept constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseExistsConstructor() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useExistsConstructor") ; -} -/** -* useHasValueConstructor specifies whether the hasValue constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getUseHasValueConstructor() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useHasValueConstructor") ; -} -/** -* useDataHasValueConstructor specifies whether the hasValue constructor is used in the learning algorithm in combination with data properties. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getUseDataHasValueConstructor() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useDataHasValueConstructor") ; -} -/** -* valueFrequencyThreshold specifies how often an object must occur as value in order to be considered for hasValue restrictions. -* mandatory: false| reinit necessary: true -* default value: 3 -* @return int -**/ -public int getValueFrequencyThreshold() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(cELOE, "valueFrequencyThreshold") ; -} -/** -* useCardinalityRestrictions specifies whether CardinalityRestrictions is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseCardinalityRestrictions() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useCardinalityRestrictions") ; -} -/** -* cardinalityLimit Gives the maximum number used in cardinality restrictions.. -* mandatory: false| reinit necessary: true -* default value: 5 -* @return int -**/ -public int getCardinalityLimit() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(cELOE, "cardinalityLimit") ; -} -/** -* useNegation specifies whether negation is used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getUseNegation() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useNegation") ; -} -/** -* useBooleanDatatypes specifies whether boolean datatypes are used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseBooleanDatatypes() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useBooleanDatatypes") ; -} -/** -* useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseDoubleDatatypes() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "useDoubleDatatypes") ; -} -/** -* maxExecutionTimeInSeconds algorithm will stop after specified seconds. -* mandatory: false| reinit necessary: true -* default value: 10 -* @return int -**/ -public int getMaxExecutionTimeInSeconds() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(cELOE, "maxExecutionTimeInSeconds") ; -} -/** -* noisePercentage the (approximated) percentage of noise within the examples. -* mandatory: false| reinit necessary: true -* default value: 0.0 -* @return double -**/ -public double getNoisePercentage() { -return (Double) ComponentManager.getInstance().getConfigOptionValue(cELOE, "noisePercentage") ; -} -/** -* terminateOnNoiseReached specifies whether to terminate when noise criterion is met. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getTerminateOnNoiseReached() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "terminateOnNoiseReached") ; -} -/** -* maxDepth maximum depth of description. -* mandatory: false| reinit necessary: true -* default value: 7 -* @return int -**/ -public int getMaxDepth() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(cELOE, "maxDepth") ; -} -/** -* maxNrOfResults Sets the maximum number of results one is interested in. (Setting this to a lower value may increase performance as the learning algorithm has to store/evaluate/beautify less descriptions).. -* mandatory: false| reinit necessary: true -* default value: 10 -* @return int -**/ -public int getMaxNrOfResults() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(cELOE, "maxNrOfResults") ; -} -/** -* maxClassDescriptionTests The maximum number of candidate hypothesis the algorithm is allowed to test (0 = no limit). The algorithm will stop afterwards. (The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.). -* mandatory: false| reinit necessary: true -* default value: 0 -* @return int -**/ -public int getMaxClassDescriptionTests() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(cELOE, "maxClassDescriptionTests") ; -} -/** -* singleSuggestionMode Use this if you are interested in only one suggestion and your learning problem has many (more than 1000) examples.. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getSingleSuggestionMode() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "singleSuggestionMode") ; -} -/** -* instanceBasedDisjoints Specifies whether to use real disjointness checks or instance based ones (no common instances) in the refinement operator.. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getInstanceBasedDisjoints() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "instanceBasedDisjoints") ; -} -/** -* filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base. Be careful, since this requires a potentially expensive consistency check for candidate solutions.. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getFilterDescriptionsFollowingFromKB() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "filterDescriptionsFollowingFromKB") ; -} -/** -* reuseExistingDescription If true, the algorithm tries to find a good starting point close to an existing definition/super class of the given class in the knowledge base.. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getReuseExistingDescription() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "reuseExistingDescription") ; -} -/** -* writeSearchTree specifies whether to write a search tree. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getWriteSearchTree() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "writeSearchTree") ; -} -/** -* searchTreeFile file to use for the search tree. -* mandatory: false| reinit necessary: true -* default value: log/searchTree.txt -* @return String -**/ -public String getSearchTreeFile() { -return (String) ComponentManager.getInstance().getConfigOptionValue(cELOE, "searchTreeFile") ; -} -/** -* replaceSearchTree specifies whether to replace the search tree in the log file after each run or append the new search tree. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getReplaceSearchTree() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "replaceSearchTree") ; -} -/** -* expansionPenaltyFactor heuristic penalty per syntactic construct used (lower = finds more complex expression, but might miss simple ones). -* mandatory: false| reinit necessary: true -* default value: 0.1 -* @return double -**/ -public double getExpansionPenaltyFactor() { -return (Double) ComponentManager.getInstance().getConfigOptionValue(cELOE, "expansionPenaltyFactor") ; -} -/** -* allowedConcepts concepts the algorithm is allowed to use. -* mandatory: false| reinit necessary: true -* default value: null -* @return Set(String) -**/ -@SuppressWarnings("unchecked") -public Set<String> getAllowedConcepts() { -return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(cELOE, "allowedConcepts") ; -} -/** -* ignoredConcepts concepts the algorithm must ignore. -* mandatory: false| reinit necessary: true -* default value: null -* @return Set(String) -**/ -@SuppressWarnings("unchecked") -public Set<String> getIgnoredConcepts() { -return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(cELOE, "ignoredConcepts") ; -} - -/** -* @param useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setUseAllConstructor(boolean useAllConstructor) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "useAllConstructor", useAllConstructor); -reinitNecessary = true; -} -/** -* @param useExistsConstructor specifies whether the existential concept constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setUseExistsConstructor(boolean useExistsConstructor) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "useExistsConstructor", useExistsConstructor); -reinitNecessary = true; -} -/** -* @param useHasValueConstructor specifies whether the hasValue constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setUseHasValueConstructor(boolean useHasValueConstructor) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "useHasValueConstructor", useHasValueConstructor); -reinitNecessary = true; -} -/** -* @param useDataHasValueConstructor specifies whether the hasValue constructor is used in the learning algorithm in combination with data properties. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setUseDataHasValueConstructor(boolean useDataHasValueConstructor) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "useDataHasValueConstructor", useDataHasValueConstructor); -reinitNecessary = true; -} -/** -* @param valueFrequencyThreshold specifies how often an object must occur as value in order to be considered for hasValue restrictions. -* mandatory: false| reinit necessary: true -* default value: 3 -**/ -public void setValueFrequencyThreshold(int valueFrequencyThreshold) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "valueFrequencyThreshold", valueFrequencyThreshold); -reinitNecessary = true; -} -/** -* @param useCardinalityRestrictions specifies whether CardinalityRestrictions is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setUseCardinalityRestrictions(boolean useCardinalityRestrictions) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "useCardinalityRestrictions", useCardinalityRestrictions); -reinitNecessary = true; -} -/** -* @param cardinalityLimit Gives the maximum number used in cardinality restrictions.. -* mandatory: false| reinit necessary: true -* default value: 5 -**/ -public void setCardinalityLimit(int cardinalityLimit) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "cardinalityLimit", cardinalityLimit); -reinitNecessary = true; -} -/** -* @param useNegation specifies whether negation is used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setUseNegation(boolean useNegation) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "useNegation", useNegation); -reinitNecessary = true; -} -/** -* @param useBooleanDatatypes specifies whether boolean datatypes are used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setUseBooleanDatatypes(boolean useBooleanDatatypes) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "useBooleanDatatypes", useBooleanDatatypes); -reinitNecessary = true; -} -/** -* @param useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setUseDoubleDatatypes(boolean useDoubleDatatypes) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "useDoubleDatatypes", useDoubleDatatypes); -reinitNecessary = true; -} -/** -* @param maxExecutionTimeInSeconds algorithm will stop after specified seconds. -* mandatory: false| reinit necessary: true -* default value: 10 -**/ -public void setMaxExecutionTimeInSeconds(int maxExecutionTimeInSeconds) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds); -reinitNecessary = true; -} -/** -* @param noisePercentage the (approximated) percentage of noise within the examples. -* mandatory: false| reinit necessary: true -* default value: 0.0 -**/ -public void setNoisePercentage(double noisePercentage) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "noisePercentage", noisePercentage); -reinitNecessary = true; -} -/** -* @param terminateOnNoiseReached specifies whether to terminate when noise criterion is met. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setTerminateOnNoiseReached(boolean terminateOnNoiseReached) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "terminateOnNoiseReached", terminateOnNoiseReached); -reinitNecessary = true; -} -/** -* @param maxDepth maximum depth of description. -* mandatory: false| reinit necessary: true -* default value: 7 -**/ -public void setMaxDepth(int maxDepth) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "maxDepth", maxDepth); -reinitNecessary = true; -} -/** -* @param maxNrOfResults Sets the maximum number of results one is interested in. (Setting this to a lower value may increase performance as the learning algorithm has to store/evaluate/beautify less descriptions).. -* mandatory: false| reinit necessary: true -* default value: 10 -**/ -public void setMaxNrOfResults(int maxNrOfResults) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "maxNrOfResults", maxNrOfResults); -reinitNecessary = true; -} -/** -* @param maxClassDescriptionTests The maximum number of candidate hypothesis the algorithm is allowed to test (0 = no limit). The algorithm will stop afterwards. (The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.). -* mandatory: false| reinit necessary: true -* default value: 0 -**/ -public void setMaxClassDescriptionTests(int maxClassDescriptionTests) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "maxClassDescriptionTests", maxClassDescriptionTests); -reinitNecessary = true; -} -/** -* @param singleSuggestionMode Use this if you are interested in only one suggestion and your learning problem has many (more than 1000) examples.. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setSingleSuggestionMode(boolean singleSuggestionMode) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "singleSuggestionMode", singleSuggestionMode); -reinitNecessary = true; -} -/** -* @param instanceBasedDisjoints Specifies whether to use real disjointness checks or instance based ones (no common instances) in the refinement operator.. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setInstanceBasedDisjoints(boolean instanceBasedDisjoints) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "instanceBasedDisjoints", instanceBasedDisjoints); -reinitNecessary = true; -} -/** -* @param filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base. Be careful, since this requires a potentially expensive consistency check for candidate solutions.. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setFilterDescriptionsFollowingFromKB(boolean filterDescriptionsFollowingFromKB) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "filterDescriptionsFollowingFromKB", filterDescriptionsFollowingFromKB); -reinitNecessary = true; -} -/** -* @param reuseExistingDescription If true, the algorithm tries to find a good starting point close to an existing definition/super class of the given class in the knowledge base.. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setReuseExistingDescription(boolean reuseExistingDescription) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "reuseExistingDescription", reuseExistingDescription); -reinitNecessary = true; -} -/** -* @param writeSearchTree specifies whether to write a search tree. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setWriteSearchTree(boolean writeSearchTree) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "writeSearchTree", writeSearchTree); -reinitNecessary = true; -} -/** -* @param searchTreeFile file to use for the search tree. -* mandatory: false| reinit necessary: true -* default value: log/searchTree.txt -**/ -public void setSearchTreeFile(String searchTreeFile) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "searchTreeFile", searchTreeFile); -reinitNecessary = true; -} -/** -* @param replaceSearchTree specifies whether to replace the search tree in the log file after each run or append the new search tree. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setReplaceSearchTree(boolean replaceSearchTree) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "replaceSearchTree", replaceSearchTree); -reinitNecessary = true; -} -/** -* @param expansionPenaltyFactor heuristic penalty per syntactic construct used (lower = finds more complex expression, but might miss simple ones). -* mandatory: false| reinit necessary: true -* default value: 0.1 -**/ -public void setExpansionPenaltyFactor(double expansionPenaltyFactor) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "expansionPenaltyFactor", expansionPenaltyFactor); -reinitNecessary = true; -} -/** -* @param allowedConcepts concepts the algorithm is allowed to use. -* mandatory: false| reinit necessary: true -* default value: null -**/ -public void setAllowedConcepts(Set<String> allowedConcepts) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "allowedConcepts", allowedConcepts); -reinitNecessary = true; -} -/** -* @param ignoredConcepts concepts the algorithm must ignore. -* mandatory: false| reinit necessary: true -* default value: null -**/ -public void setIgnoredConcepts(Set<String> ignoredConcepts) { -ComponentManager.getInstance().applyConfigEntry(cELOE, "ignoredConcepts", ignoredConcepts); -reinitNecessary = true; -} - -/** -* true, if this component needs reinitializsation. -* @return boolean -**/ -public boolean isReinitNecessary(){ -return reinitNecessary; -} - - -} Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-08-31 17:15:20 UTC (rev 3194) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-08-31 17:23:23 UTC (rev 3195) @@ -84,7 +84,6 @@ import org.dllearner.core.Score; import org.dllearner.core.config.ConfigHelper; import org.dllearner.core.config.ConfigOption; -import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.DatatypeProperty; import org.dllearner.core.owl.Entity; @@ -108,7 +107,6 @@ import org.dllearner.utilities.datastructures.Datastructures; import org.dllearner.utilities.datastructures.SetManipulation; import org.dllearner.utilities.datastructures.SortedSetTuple; -import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL; import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL2; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.io.SystemOutDocumentTarget; Deleted: trunk/scripts/src/main/java/org/dllearner/scripts/ConfigJavaGenerator.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/ConfigJavaGenerator.java 2011-08-31 17:15:20 UTC (rev 3194) +++ trunk/scripts/src/main/java/org/dllearner/scripts/ConfigJavaGenerator.java 2011-08-31 17:23:23 UTC (rev 3195) @@ -1,636 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ -package org.dllearner.scripts; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.dllearner.core.AbstractCELA; -import org.dllearner.core.AbstractComponent; -import org.dllearner.core.AbstractKnowledgeSource; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.configurators.CELOEConfigurator; -import org.dllearner.core.configurators.FuzzyCELOEConfigurator; -import org.dllearner.core.configurators.ISLEConfigurator; -import org.dllearner.core.configurators.ROLearnerConfigurator; -import org.dllearner.core.configurators.RefinementOperatorConfigurator; -import org.dllearner.core.options.ConfigOption; -import org.dllearner.kb.OWLAPIOntology; -import org.dllearner.reasoning.FastRetrievalReasoner; -import org.dllearner.utilities.Files; - -/** - * Collects information about all used configuration options and writes them - * into a file. This way the documentation is always in sync with the source - * code. - * - * @author Jens Lehmann - * @author Sebastian Hellmann - * - */ -public final class ConfigJavaGenerator { - - private static final SortedSet<String> DONOTDELETE = - new TreeSet<String>(Arrays.asList(new String[]{ - ".svn", - "RefinementOperatorConfigurator.java", - })); - - // currently it targets the configurators for - private static final SortedSet<String> EXTENDSREFINEMENTOPERATOR = - new TreeSet<String>(Arrays.asList(new String[]{ - ROLearnerConfigurator.class.getSimpleName(), -// OCELConfigurator.class.getSimpleName(), - CELOEConfigurator.class.getSimpleName(), - FuzzyCELOEConfigurator.class.getSimpleName(), - ISLEConfigurator.class.getSimpleName() - })); - - private static final Class<RefinementOperatorConfigurator> EXTENDSREFINEMENTOPERATORCLASS = RefinementOperatorConfigurator.class; - -// private static final boolean INCLUDE_UNUSED = false; - - @SuppressWarnings("unused") - private static final String UNUSED = "@SuppressWarnings(\"unused\")\n"; - private static final String OVERRIDE = "@SuppressWarnings(\"all\")\n"; - - private static final String TARGET_DIR = "../components-core/src/main/java/org/dllearner/core/configurators"; - - private static final String TARGET_PACKAGE = "org.dllearner.core.configurators"; - - private static final String HEADER_FILE = "../interfaces/doc/header.txt"; - - private static final String HEADER = getHeader(); - - private static final String REINITVAR = "reinitNecessary"; - - private static final String REINITGETTER = "/**\n* true, if this component needs reinitializsation.\n" - + "* @return boolean\n**/\n" - + "public boolean is" - + capitalize(REINITVAR) - + "(){\nreturn " - + REINITVAR + ";\n}\n"; - - // private static final String TEMPLATE_DIR = "doc/template/"; - - private static final String CONFIGURATOR = "Configurator"; - - private static final String COMPONENT_FACTORY = "ComponentFactory"; - private static final String CLASS_COMMENT = "* automatically generated, do not edit manually.\n" - + "* run " + ConfigJavaGenerator.class.getCanonicalName()+ " to update\n"; - - private static final SortedSet<String> COMPONENT_FACTORY_IMPORTS = new TreeSet<String>(); - - private static final List<String> COMPONENT_FACTORY_METHODS = new ArrayList<String>(); - - private Class<? extends AbstractComponent> component; - - private String className; - - private String componentType; - - private String extendS = ""; - - //private String implementS = ""; - - private List<String> body = new ArrayList<String>(); - - private List<String> vars = new ArrayList<String>(); - - private List<String> setters = new ArrayList<String>(); - - private List<String> getters = new ArrayList<String>(); - - private SortedSet<String> imports = new TreeSet<String>(); - - private SortedSet<String> getinstanceExceptions = new TreeSet<String>(); - - private Map<String, String> additionalMandatoryVars = new LinkedHashMap<String, String>(); - - private Map<String, String> mandatoryVars = new LinkedHashMap<String, String>(); - - // private Map<String,String> varMap = new LinkedHashMap<String, String>(); - - private List<ConfigOption<?>> mandatoryOptions = new LinkedList<ConfigOption<?>>(); - - /** - * @param args - * none - */ - public static void main(String[] args) { - - Files.backupDirectory(TARGET_DIR); - System.out.println("previous classes were backupped to tmp/+System.currentTimeMillis()"); - String[] files = Files.listDir(TARGET_DIR); - - for (String file : files){ - //System.out.println(DONOTDELETE); - - if(DONOTDELETE.contains(file)){ - continue; - } - //System.out.println(file); - String todelete = TARGET_DIR + File.separator + file; - Files.deleteFile(todelete); - - } - //System.exit(0); - //Files.deleteDir(TARGET_DIR); - - ComponentManager cm = ComponentManager.getInstance(); - COMPONENT_FACTORY_IMPORTS.add(AbstractKnowledgeSource.class.getCanonicalName()); - COMPONENT_FACTORY_IMPORTS - .add(AbstractReasonerComponent.class.getCanonicalName()); - COMPONENT_FACTORY_IMPORTS.add(AbstractLearningProblem.class.getCanonicalName()); - COMPONENT_FACTORY_IMPORTS.add(LearningProblemUnsupportedException.class - .getCanonicalName()); - COMPONENT_FACTORY_METHODS.add("private "+COMPONENT_FACTORY+"(){}\n"); - - for (Class<? extends AbstractKnowledgeSource> component : cm - .getKnowledgeSources()) { - String componentType = "knowledgeSource"; - - COMPONENT_FACTORY_IMPORTS.add(component.getCanonicalName()); - // configuratorImports.add(TARGET_PACKAGE+"."+component.getSimpleName()+CONFIGURATOR); - ConfigJavaGenerator c = new ConfigJavaGenerator(component, - componentType); - c.makeConfigurator(); - - } - for (Class<? extends AbstractReasonerComponent> component : cm - .getReasonerComponents()) { - - COMPONENT_FACTORY_IMPORTS.add(component.getCanonicalName()); - // configuratorImports.add(TARGET_PACKAGE+"."+component.getSimpleName()+CONFIGURATOR); - - ConfigJavaGenerator c = new ConfigJavaGenerator(component, - "reasoner"); - c.imports.add("org.dllearner.core.KnowledgeSource"); - c.imports.add(Set.class.getCanonicalName()); - c.additionalMandatoryVars.put("Set<KnowledgeSource> knowledgeSource", - "knowledgeSource"); - c.makeConfigurator(); - - } - for (Class<? extends AbstractLearningProblem> component : cm - .getLearningProblems()) { - - COMPONENT_FACTORY_IMPORTS.add(component.getCanonicalName()); - // configuratorImports.add(TARGET_PACKAGE + "." + - // component.getSimpleName()+CONFIGURATOR); - - ConfigJavaGenerator c = new ConfigJavaGenerator(component, - "learningProblem"); - c.imports.add("org.dllearner.core.ReasonerComponent"); - c.additionalMandatoryVars.put("ReasonerComponent reasoningService", - "reasoningService"); - c.makeConfigurator(); - - } - - for (Class<? extends AbstractCELA> component : cm - .getLearningAlgorithms()) { - - COMPONENT_FACTORY_IMPORTS.add(component.getCanonicalName()); - // configuratorImports.add(TARGET_PACKAGE+"."+ - // component.getSimpleName()+CONFIGURATOR); - - ConfigJavaGenerator c = new ConfigJavaGenerator(component, - "learningAlgorithm"); - c.imports.add("org.dllearner.core.LearningProblem"); - c.imports.add("org.dllearner.core.ReasonerComponent"); - c.imports.add(LearningProblemUnsupportedException.class - .getCanonicalName()); - - c.additionalMandatoryVars.put("LearningProblem learningProblem", - "learningProblem"); - c.additionalMandatoryVars.put("ReasonerComponent reasoningService", - "reasoningService"); - c.getinstanceExceptions.add("LearningProblemUnsupportedException"); - c.makeConfigurator(); - - } - - makeComponentFactory(); - makeInterface(); - writePackageHTML(); - - System.out.println("Done"); - } - - - - private ConfigJavaGenerator(Class<? extends AbstractComponent> component, - String componentType) { - this.className = component.getSimpleName(); - this.component = component; - this.componentType = componentType; - imports.add(component.getCanonicalName()); - imports.add(ComponentManager.class.getCanonicalName()); - // imports.add(Configurator.class.getCanonicalName()); - // imports.add(ConfigEntry.class.getCanonicalName()); - - vars.add("private " + className + " " + deCapitalize(className) - + ";\n"); - - if(EXTENDSREFINEMENTOPERATOR.contains(this.className+CONFIGURATOR)){ - this.extendS = EXTENDSREFINEMENTOPERATORCLASS.getSimpleName(); - this.imports.add(EXTENDSREFINEMENTOPERATORCLASS.getCanonicalName()); - } - - - } - - private void makeConfigurator() { - - for (ConfigOption<?> option : ComponentManager - .getConfigOptions(component)) { - - String type = option.getValueTypeAsJavaString(); - String optionName = option.getName(); - // String defaultValue = option.getDefaultValueInJava(); - String comment = option.getJavaDocString(); - - if (option.isMandatory()) { - mandatoryVars.put(type + " " + optionName, optionName); - mandatoryOptions.add(option); - COMPONENT_FACTORY_IMPORTS.addAll(option.getJavaImports()); - } - - imports.addAll(option.getJavaImports()); - // vars.add(fillVariableDefTemplate(optionName, type, - // defaultValue)); - setters.add(fillSetterTemplate(className, comment, optionName, - type, option.requiresInit())); - getters - .add(fillGetterTemplate(className, comment, optionName, - type)); - // System.out.println(option); - // componentOptions.get(component)) { - - } - - body.add("private boolean " + REINITVAR + " = false;"); - // suppress warnings if necessary - if(component.equals(FastRetrievalReasoner.class) || component.equals(OWLAPIOntology.class)) { - body.add(UNUSED); - } - body.add(expandCollection(vars, "", "", 0)); - body.add(fillConstructorTemplate(className)); - - body - .add(makeGetInstanceForConfigurators(getAllCommentsForOptionList(mandatoryOptions))); - - // body.add(makeApplyConfigEntryForOptionList(ComponentManager.getConfigOptions(component))); - - body.add(expandCollection(getters, "", "", 0)); - body.add(expandCollection(setters, "", "", 0)); - body.add(REINITGETTER); - String bodytmp = expandCollection(body, "", "\n",0); - String importtmp = expandCollection(imports, "import ", ";\n", 0); - String ret = fillClassTemplate( - TARGET_PACKAGE, - importtmp, - className + CONFIGURATOR, - extendS, - bodytmp , - "", - CONFIGURATOR); - - // configuratorMethods.add((className, componentType, - // mandatoryOptions)); - - Files.createFile(new File(TARGET_DIR + "/" + className + CONFIGURATOR - + ".java"), ret); - - COMPONENT_FACTORY_METHODS - .add(makeComponentFactoryMethods(getAllCommentsForOptionList(mandatoryOptions))); - } - - private static void makeInterface(){ - String ret =""; - ret+= HEADER+"\n"; - ret+= "package "+TARGET_PACKAGE+";\n\n"; - ret+= fillJavaDocComment(CLASS_COMMENT); - ret+="public interface Configurator{\n}\n"; - Files.createFile(new File(TARGET_DIR+File.separator+CONFIGURATOR+".java"), ret); - } - - @SuppressWarnings("unused") - private static String makeApplyConfigEntryForOptionList( - List<ConfigOption<?>> options) { - String ret = "@SuppressWarnings({ \"unchecked\" })\n" - + "public <T> void applyConfigEntry(ConfigEntry<T> entry){\n"; - ret += "String optionName = entry.getOptionName();\n"; - // ret+="ConfigOption<T> option = entry.getOption();\n"; - ret += "if(false){//empty block \n}"; - - for (ConfigOption<?> option : options) { - ret += "else if (optionName.equals(\"" + option.getName() - + "\")){\n"; - ret += "" + option.getName() + " = (" - + rightType(option.getValueTypeAsJavaString()) + ") " - + " entry.getValue();\n}"; - - } - ret += "\n}\n"; - return ret; - } - - private static String getAllCommentsForOptionList( - List<ConfigOption<?>> options) { - String ret = ""; - for (ConfigOption<?> option : options) { - ret += "* @param " + option.getName() + " " - + option.getDescription() + "\n"; - } - - return ret; - } - - private String makeGetInstanceForConfigurators(String comments) { - - Map<String, String> parametersWithType = new LinkedHashMap<String, String>(); - Map<String, String> parametersNoType = new LinkedHashMap<String, String>(); - String applyConf = ""; - // parametersWithType.put("ComponentManager cm", "cm"); - parametersNoType.put(className + ".class", className + ".class"); - for (String s : additionalMandatoryVars.keySet()) { - parametersWithType.put(s, additionalMandatoryVars.get(s)); - parametersNoType.put(s, additionalMandatoryVars.get(s)); - comments ="* @param "+additionalMandatoryVars.get(s)+" see "+additionalMandatoryVars.get(s)+"\n"+comments; - } - for (String s : mandatoryVars.keySet()) { - parametersWithType.put(s, mandatoryVars.get(s)); - applyConf += fillApplyConfigEntry("component", mandatoryVars.get(s)); - } - - String parWithType = expandCollection(parametersWithType.keySet(), "", - ", ", 2); - - String par = expandCollection(parametersNoType.values(), "", ", ", 2); - - String exceptions = ""; - if (!getinstanceExceptions.isEmpty()) { - exceptions += "throws "; - exceptions += expandCollection(getinstanceExceptions, "", ", ", 2); - comments+=expandCollection(getinstanceExceptions, "* @throws ", " see \n", 0); - } - comments = fillJavaDocComment(comments + "* @return " + className - + "\n"); - String ret = comments; - ret += "public static " + className + " get" + className + "(" - + parWithType + ") " + exceptions + "{\n"; - ret += className + " component = ComponentManager.getInstance()." - + componentType + "(" + par + ");\n"; - ret += applyConf; - - ret += "return component;\n}\n"; - - return ret; - } - - - - - private String makeComponentFactoryMethods(String comments) { - - Map<String, String> parametersWithType = new LinkedHashMap<String, String>(); - Map<String, String> parametersNoType = new LinkedHashMap<String, String>(); - String applyConf = ""; - // parametersWithType.put("ComponentManager cm", "cm"); - parametersNoType.put(className + ".class", className + ".class"); - for (String s : additionalMandatoryVars.keySet()) { - parametersWithType.put(s, additionalMandatoryVars.get(s)); - parametersNoType.put(s, additionalMandatoryVars.get(s)); - comments += "* @param " + additionalMandatoryVars.get(s) + " see " - + capitalize(additionalMandatoryVars.get(s)) + "\n"; - } - for (String s : mandatoryVars.keySet()) { - parametersWithType.put(s, mandatoryVars.get(s)); - applyConf += fillApplyConfigEntry("component", mandatoryVars.get(s)) - + ""; - } - - String parWithType = expandCollection(parametersWithType.keySet(), "", - ", ", 2); - - String par = expandCollection(parametersWithType.values(), "", ", ", 2); - - String exceptions = ""; - if (!getinstanceExceptions.isEmpty()) { - exceptions += "throws "; - exceptions += expandCollection(getinstanceExceptions, "", ", ", 2); - comments += expandCollection(getinstanceExceptions, "* @throws ", - " see\n", 0); - } - comments += "* @return a component ready for initialization " - + className + "\n"; - String ret = fillJavaDocComment(comments); - ret += "public static " + className + " get" + className + "(" - + parWithType + ") " + exceptions + " {\n" + "return " - + className + CONFIGURATOR + ".get" + className + "(" + par - + ");\n}\n"; - return ret; - } - - private static void makeComponentFactory() { - String ret = fillClassTemplate(TARGET_PACKAGE, expandCollection( - COMPONENT_FACTORY_IMPORTS, "import ", ";\n", 0), - COMPONENT_FACTORY, "", expandCollection( - COMPONENT_FACTORY_METHODS, "", "\n", 0), "final",""); - - Files.createFile(new File(TARGET_DIR + "/" + COMPONENT_FACTORY - + ".java"), ret); - } - - private static String fillApplyConfigEntry(String className, - String optionName) { - return "ComponentManager.getInstance().applyConfigEntry(" - + deCapitalize(className) + ", \"" + optionName + "\", " - + optionName + ");\n"; - } - - private static String fillConstructorTemplate(String className) { - return fillJavaDocComment("* @param " + deCapitalize(className) - + " see " + className + "\n") - + "public " - + className - + CONFIGURATOR - + "(" - + className - + " " - + deCapitalize(className) - + "){\n" - + "this." - + deCapitalize(className) - + " = " - + deCapitalize(className) - + ";\n" + "}\n"; - } - - @SuppressWarnings("unused") - private static String fillVariableDefTemplate(String optionName, - String type, String defaultValue) { - return "private " + type + " " + optionName + " = " + defaultValue - + ";\n"; - - } - - private static String fillJavaDocComment(String lines) { - return "/**\n" + lines + "**/\n"; - } - - private static String fillGetterTemplate(String className, String comment, - String optionName, String type) { - comment = comment.replaceAll("@param ", ""); - comment += "* @return " + checkstyleAdjust(type) + " \n"; - String ret = fillJavaDocComment(comment); - ret += (type.contains("<String>") || type.contains("<StringTuple>")) ? "@SuppressWarnings(\"unchecked\")\n" - : ""; - ret += "public " + type + " get" + capitalize(optionName) + "() {\n"; - ret += "return (" + rightType(type) - + ") ComponentManager.getInstance()."; - ret += "getConfigOptionValue(" + deCapitalize(className) + ", \"" - + optionName + "\") ;\n"; - ret += "}\n"; - return ret; - } - - private static String fillSetterTemplate(String className, String comment, - String optionName, String type, boolean reinit) { - String ret = fillJavaDocComment(comment); - ret += "public void set" + capitalize(optionName); - ret += "(" + type + " " + optionName + ") {\n"; - ret += fillApplyConfigEntry(className, optionName); - ret += (reinit) ? REINITVAR + " = true;\n" : ""; - ret += "}\n"; - return ret; - } - - - - - private static String fillClassTemplate(String packagE, String imports, - String className, String extendS, String body, String classModifier, String implementS) { - - - String ret = HEADER + "\n"; - ret += "package " + packagE + ";\n\n"; - ret += imports + "\n"; - ret += fillJavaDocComment(CLASS_COMMENT); -// ret += (INCLUDE_UNUSED) ? UNUSED : ""; - ret += (!extendS.isEmpty()) ? OVERRIDE : ""; - ret += "public "+classModifier+" class " + className + " " - + ((extendS.length() > 0) ? " extends " + extendS : "") - + ((implementS.length() > 0) ? " implements " + implementS : "") - + " {\n\n"; - ret += body + "\n"; - ret += "}\n"; - return ret; - - } - - private static void writePackageHTML(){ - String c = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">"+ - "<html>"+ - "<head></head>"+ - "<body bgcolor=\"white\">"+ - "<p>Automatically generated classes, which enable programmatically setting"+ - "and getting configuration options of components.</p>"+ - "</body>"+ - "</html>"; - try{ - Files.createFile(new File(TARGET_DIR+File.separator+"package.html"), c); - }catch (Exception e) { - e.printStackTrace(); - } - } - - - private static String expandCollection(Collection<String> col, - String before, String after, int removeChars) { - if (col.isEmpty()){ - return ""; - } - String ret = ""; - for (String string : col) { - ret += before + string + after; - } - - if (removeChars == 0) { - return ret; - } else { - return ret.substring(0, ret.length() - removeChars); - } - } - - private static String capitalize(String s) { - String tmp = s.substring(0, 1); - return tmp.toUpperCase() + s.substring(1); - } - - private static String deCapitalize(String s) { - String tmp = s.substring(0, 1); - return tmp.toLowerCase() + s.substring(1); - } - - private static String rightType(String type) { - if (type.equals("int")){ - return "Integer"; - }else if (type.equals("boolean")){ - return "Boolean"; - }else if (type.equals("double")){ - return "Double"; - }else{ - return type; - } - - } - - - private static String checkstyleAdjust(String type) { - type = type.replaceAll("<", "("); - type = type.replaceAll(">", ")"); - return type; - } - - private static String getHeader() { - try { - return Files.readFile(new File(HEADER_FILE)); - } catch (Exception e) { - e.printStackTrace(); - } - return ""; - } - -} Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java 2011-08-31 17:15:20 UTC (rev 3194) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EnrichmentEvaluation.java 2011-08-31 17:23:23 UTC (rev 3195) @@ -69,7 +69,6 @@ import org.dllearner.algorithms.properties.DataPropertyDomainAxiomLearner; import org.dllearner.algorithms.properties.DataPropertyRangeAxiomLearner; import org.dllearner.algorithms.properties.DisjointDataPropertyAxiomLearner; -import org.dllearner.algorithms.properties.DisjointObjectPropertyAxiomLearner; import org.dllearner.algorithms.properties.EquivalentDataPropertyAxiomLearner; import org.dllearner.algorithms.properties.EquivalentObjectPropertyAxiomLearner; import org.dllearner.algorithms.properties.FunctionalDataPropertyAxiomLearner; @@ -83,7 +82,6 @@ import org.dllearner.algorithms.properties.SubObjectPropertyOfAxiomLearner; import org.dllearner.algorithms.properties.SymmetricObjectPropertyAxiomLearner; import org.dllearner.algorithms.properties.TransitiveObjectPropertyAxiomLearner; -import org.dllearner.core.AbstractCELA; import org.dllearner.core.AbstractReasonerComponent; import org.dllearner.core.AnnComponentManager; import org.dllearner.core.AxiomLearningAlgorithm; @@ -96,7 +94,6 @@ import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.Score; import org.dllearner.core.config.ConfigHelper; -import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.DatatypeProperty; import org.dllearner.core.owl.EquivalentClassesAxiom; Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2011-08-31 17:15:20 UTC (rev 3194) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2011-08-31 17:23:23 UTC (rev 3195) @@ -19,12 +19,11 @@ import java.util.TreeSet; import org.dllearner.algorithms.celoe.CELOE; +import org.dllearner.core.AbstractReasonerComponent; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.core.owl.Axiom; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.EquivalentClassesAxiom; @@ -227,7 +226,7 @@ ComponentManager cm = ComponentManager.getInstance(); ClassLearningProblem lp = null; CELOE celoe = null; - CELOEConfigurator cf = null; +// CELOEConfigurator cf = null; TreeSet<EvaluatedDescriptionClass> suggestions; for (int i = 0; i <= 1; i++) { if (i == 0) { @@ -298,8 +297,8 @@ // } else { // cf.setFilterDescriptionsFollowingFromKB(false); // } - cf.setReuseExistingDescription(reuseExistingDescription); - cf.setFilterDescriptionsFollowingFromKB(filterDescriptionsFollowingFromKB); + celoe.setReuseExistingDescription(reuseExistingDescription); + celoe.setFilterDescriptionsFollowingFromKB(filterDescriptionsFollowingFromKB); celoe.init(); @@ -362,7 +361,7 @@ ComponentManager cm = ComponentManager.getInstance(); ClassLearningProblem lp = null; CELOE celoe = null; - CELOEConfigurator cf = null; +// CELOEConfigurator cf = null; TreeSet<EvaluatedDescriptionClass> suggestions; for (int i = 0; i <= 1; i++) { if (i == 0) { @@ -456,7 +455,7 @@ // shrinkSet(classes, 20); ClassLearningProblem lp = null; CELOE celoe = null; - CELOEConfigurator cf = null; +// CELOEConfigurator cf = null; for (NamedClass nc : classes) { // check whether the class has sufficient instances int instanceCount = reasoner.getIndividuals(nc).size(); @@ -494,8 +493,8 @@ // } else { // cf.setFilterDescriptionsFollowingFromKB(false); // } - cf.setReuseExistingDescription(reuseExistingDescription); - cf.setFilterDescriptionsFollowingFromKB(filterDescriptionsFollowingFromKB); + celoe.setReuseExistingDescription(reuseExistingDescription); + celoe.setFilterDescriptionsFollowingFromKB(filterDescriptionsFollowingFromKB); celoe.init(); celoe.start(); Modified: trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java 2011-08-31 17:15:20 UTC (rev 3194) +++ trunk/scripts/src/main/java/org/dllearner/scripts/evaluation/OntologyEngineering.java 2011-08-31 17:23:23 UTC (rev 3195) @@ -36,12 +36,11 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.dllearner.algorithms.celoe.CELOE; +import org.dllearner.core.AbstractReasonerComponent; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; Modified: trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java 2011-08-31 17:15:20 UTC (rev 3194) +++ trunk/scripts/src/main/java/org/dllearner/scripts/improveWikipedia/DBpediaClassLearnerCELOE.java 2011-08-31 17:23:23 UTC (rev 3195) @@ -30,13 +30,11 @@ import java.util.SortedSet; import java.util.TreeSet; -import org.apache.velocity.VelocityContext; import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.AbstractReasonerComponent; import org.dllearner.core.ComponentManager; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.OntologyFormat; -import org.dllearner.core.configurators.CELOEConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.EquivalentClassesAxiom; import org.dllearner.core.owl.Individual; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-08-31 18:05:20
|
Revision: 3199 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3199&view=rev Author: jenslehmann Date: 2011-08-31 18:05:10 +0000 (Wed, 31 Aug 2011) Log Message: ----------- finally converted all configurators in DL-Learner Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyOEHeuristicRuntime.java trunk/components-core/src/main/java/org/dllearner/algorithms/gp/GP.java trunk/components-core/src/main/java/org/dllearner/algorithms/isle/ISLE.java trunk/components-core/src/main/java/org/dllearner/algorithms/refinement/ROLearner.java trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java trunk/components-core/src/main/java/org/dllearner/core/AbstractComponent.java trunk/components-core/src/main/java/org/dllearner/kb/OWLAPIOntology.java trunk/components-core/src/main/java/org/dllearner/kb/OWLFile.java trunk/components-core/src/main/java/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java trunk/components-core/src/main/java/org/dllearner/learningproblems/PosNegLPStrict.java trunk/components-core/src/main/java/org/dllearner/learningproblems/PosOnlyLP.java trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLP.java trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLPStandard.java trunk/components-core/src/main/java/org/dllearner/reasoning/DIGReasoner.java trunk/components-core/src/main/java/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/components-core/src/main/java/org/dllearner/reasoning/PelletReasoner.java trunk/components-core/src/main/java/org/dllearner/reasoning/ProtegeReasoner.java trunk/components-core/src/main/java/org/dllearner/reasoning/fuzzydll/FuzzyOWLAPIReasoner.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDRDown.java trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest.java trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest_Trains.java trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest_Trains_noFuzzyIndividuals.java trunk/components-ext/src/main/java/org/dllearner/algorithm/qtl/QTL.java trunk/scripts/src/main/java/org/dllearner/scripts/OWLAPIReasonerIncremental.java trunk/scripts/src/main/java/org/dllearner/scripts/matching/GeneralMatcher.java trunk/scripts/src/main/java/org/dllearner/scripts/matching/LearnOSMClasses.java trunk/scripts/src/main/java/org/dllearner/scripts/matching/Stanley.java Removed Paths: ------------- trunk/components-core/src/main/java/org/dllearner/core/configurators/ClassLearningProblemConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/Configurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/DIGReasonerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/ELLearningAlgorithmConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/ELLearningAlgorithmDisjunctiveConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/FuzzyCELOEConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/FuzzyOWLAPIReasonerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/FuzzyPosNegLPStandardConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/GPConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/ISLEConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/KBFileConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/OWLFileConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/PelletReasonerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStandardConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/PosNegLPStrictConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/PosOnlyLPConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/ProtegeReasonerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/ROLearnerConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/RandomGuesserConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/RefinementOperatorConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/SparqlEndpointKSConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/components-core/src/main/java/org/dllearner/core/configurators/package.html Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -19,22 +19,25 @@ package org.dllearner.algorithms.el; -import java.util.*; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import org.apache.log4j.Logger; -import org.dllearner.core.ComponentInitException; -import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.AbstractCELA; import org.dllearner.core.AbstractLearningProblem; import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.Configurator; -import org.dllearner.core.configurators.ELLearningAlgorithmDisjunctiveConfigurator; +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.options.CommonConfigOptions; import org.dllearner.core.options.ConfigOption; import org.dllearner.core.options.StringConfigOption; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Thing; import org.dllearner.core.owl.Union; import org.dllearner.learningproblems.PosNegLP; @@ -80,7 +83,6 @@ public class ELLearningAlgorithmDisjunctive extends AbstractCELA { private static Logger logger = Logger.getLogger(ELLearningAlgorithmDisjunctive.class); - private ELLearningAlgorithmDisjunctiveConfigurator configurator; String baseURI; Map<String,String> prefixes; @@ -113,11 +115,12 @@ private double bestCurrentScore = 0; private long treeStartTime; // minimum score a tree must have to be part of the solution - private double minimumTreeScore = -1; + private double minimumTreeScore = -1; + + private boolean instanceBasedDisjoints; public ELLearningAlgorithmDisjunctive(PosNegLP problem, AbstractReasonerComponent reasoner) { super(problem, reasoner); - configurator = new ELLearningAlgorithmDisjunctiveConfigurator(this); } public static String getName() { @@ -137,24 +140,18 @@ options.add(new StringConfigOption("startClass", "the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)")); options.add(CommonConfigOptions.getInstanceBasedDisjoints()); return options; - } + } - public Configurator getConfigurator() { - return configurator; - } - @Override public void init() throws ComponentInitException { heuristic = new DisjunctiveHeuristic(); candidates = new TreeSet<SearchTreeNode>(heuristic); trees = new TreeSet<ELDescriptionTree>(new ELDescriptionTreeComparator()); - if(configurator.getStartClass() != null) { - startClass = new NamedClass(configurator.getStartClass()); - } else { + if(startClass == null) { startClass = Thing.instance; } - operator = new ELDown2(reasoner, configurator.getInstanceBasedDisjoints()); + operator = new ELDown2(reasoner, instanceBasedDisjoints); // noise = configurator.getNoisePercentage()/(double)100; @@ -425,6 +422,22 @@ */ public SearchTreeNode getStartNode() { return startNode; + } + + public Description getStartClass() { + return startClass; + } + + public void setStartClass(Description startClass) { + this.startClass = startClass; + } + + public boolean isInstanceBasedDisjoints() { + return instanceBasedDisjoints; + } + + public void setInstanceBasedDisjoints(boolean instanceBasedDisjoints) { + this.instanceBasedDisjoints = instanceBasedDisjoints; } } Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -19,11 +19,7 @@ package org.dllearner.algorithms.fuzzydll; -import java.io.BufferedWriter; import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; import java.text.DecimalFormat; import java.util.Collection; import java.util.Iterator; @@ -35,14 +31,12 @@ import java.util.TreeSet; import org.apache.log4j.Logger; -import org.dllearner.algorithms.celoe.OEHeuristicRuntime; import org.dllearner.core.AbstractCELA; +import org.dllearner.core.AbstractLearningProblem; +import org.dllearner.core.AbstractReasonerComponent; import org.dllearner.core.ComponentInitException; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.FuzzyClassExpressionLearningAlgorithm; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.FuzzyCELOEConfigurator; import org.dllearner.core.options.BooleanConfigOption; import org.dllearner.core.options.CommonConfigOptions; import org.dllearner.core.options.ConfigOption; @@ -61,7 +55,6 @@ import org.dllearner.learningproblems.PosOnlyLP; import org.dllearner.learningproblems.fuzzydll.FuzzyPosNegLP; import org.dllearner.learningproblems.fuzzydll.FuzzyPosNegLPStandard; -import org.dllearner.refinementoperators.FuzzyRhoDRDown; import org.dllearner.refinementoperators.OperatorInverter; import org.dllearner.refinementoperators.RefinementOperator; import org.dllearner.refinementoperators.RhoDRDown; Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyOEHeuristicRuntime.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyOEHeuristicRuntime.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyOEHeuristicRuntime.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -21,7 +21,6 @@ import java.util.Comparator; -import org.dllearner.core.configurators.FuzzyCELOEConfigurator; import org.dllearner.utilities.owl.ConceptComparator; /** Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/gp/GP.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/gp/GP.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/gp/GP.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -24,15 +24,14 @@ import java.util.Collection; import java.util.Comparator; import java.util.LinkedList; +import java.util.Map.Entry; import java.util.Random; import java.util.Set; -import java.util.Map.Entry; import org.dllearner.algorithms.hybridgp.Psi; import org.dllearner.core.AbstractCELA; import org.dllearner.core.AbstractLearningProblem; import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.GPConfigurator; import org.dllearner.core.options.BooleanConfigOption; import org.dllearner.core.options.ConfigEntry; import org.dllearner.core.options.ConfigOption; Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/isle/ISLE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/isle/ISLE.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/isle/ISLE.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -32,12 +32,11 @@ import org.apache.log4j.Logger; import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.algorithms.celoe.OENode; -import org.dllearner.core.ComponentInitException; -import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.AbstractCELA; import org.dllearner.core.AbstractLearningProblem; import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.ISLEConfigurator; +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.options.BooleanConfigOption; import org.dllearner.core.options.CommonConfigOptions; import org.dllearner.core.options.ConfigOption; @@ -74,7 +73,6 @@ public class ISLE extends AbstractCELA { private static Logger logger = Logger.getLogger(CELOE.class); - private ISLEConfigurator configurator; private boolean isRunning = false; private boolean stop = false; @@ -131,14 +129,19 @@ private int expressionTests = 0; private int minHorizExp = 0; private int maxHorizExp = 0; + + private double noisePercentage = 0.0; + + private int maxNrOfResults = 10; + + private boolean filterDescriptionsFollowingFromKB = true; + + private long maxExecutionTimeInSeconds = 10; + + private boolean reuseExistingDescription = false; - public ISLEConfigurator getConfigurator() { - return configurator; - } - public ISLE(AbstractLearningProblem problem, AbstractReasonerComponent reasoner) { super(problem, reasoner); - configurator = new ISLEConfigurator(this); } public static Collection<Class<? extends AbstractLearningProblem>> supportedLearningProblems() { @@ -186,23 +189,31 @@ startClass = Thing.instance; - singleSuggestionMode = configurator.getSingleSuggestionMode(); +// singleSuggestionMode = configurator.getSingleSuggestionMode(); // create refinement operator - operator = new RhoDRDown(reasoner, classHierarchy, startClass, configurator); +// operator = new RhoDRDown(reasoner, classHierarchy, startClass, configurator); + // create refinement operator + if(operator == null) { + operator = new RhoDRDown(); + ((RhoDRDown)operator).setStartClass(startClass); + ((RhoDRDown)operator).setSubHierarchy(classHierarchy); + ((RhoDRDown)operator).setReasoner(reasoner); + ((RhoDRDown)operator).init(); + } baseURI = reasoner.getBaseURI(); prefixes = reasoner.getPrefixes(); - bestEvaluatedDescriptions = new EvaluatedDescriptionSet(configurator.getMaxNrOfResults()); + bestEvaluatedDescriptions = new EvaluatedDescriptionSet(maxNrOfResults); isClassLearningProblem = (learningProblem instanceof ClassLearningProblem); // we put important parameters in class variables - noise = configurator.getNoisePercentage()/100d; - maxDepth = configurator.getMaxDepth(); + noise = noisePercentage/100d; +// maxDepth = configurator.getMaxDepth(); // (filterFollowsFromKB is automatically set to false if the problem // is not a class learning problem - filterFollowsFromKB = configurator.getFilterDescriptionsFollowingFromKB() + filterFollowsFromKB = filterDescriptionsFollowingFromKB && isClassLearningProblem; // actions specific to ontology engineering @@ -218,7 +229,7 @@ // superfluous to add super classes in this case) if(isEquivalenceProblem) { Set<Description> existingDefinitions = reasoner.getAssertedDefinitions(classToDescribe); - if(configurator.getReuseExistingDescription() && (existingDefinitions.size() > 0)) { + if(reuseExistingDescription && (existingDefinitions.size() > 0)) { // the existing definition is reused, which in the simplest case means to // use it as a start class or, if it is already too specific, generalise it @@ -624,7 +635,7 @@ } private boolean terminationCriteriaSatisfied() { - return stop || ((System.nanoTime() - nanoStartTime) >= (configurator.getMaxExecutionTimeInSeconds()*1000000000l)); + return stop || ((System.nanoTime() - nanoStartTime) >= (maxExecutionTimeInSeconds*1000000000l)); } private void reset() { Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/refinement/ROLearner.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/refinement/ROLearner.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -36,7 +36,6 @@ import org.dllearner.core.AbstractCELA; import org.dllearner.core.AbstractLearningProblem; import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.ROLearnerConfigurator; import org.dllearner.core.options.BooleanConfigOption; import org.dllearner.core.options.CommonConfigMappings; import org.dllearner.core.options.CommonConfigOptions; @@ -63,12 +62,6 @@ public class ROLearner extends AbstractCELA { - private ROLearnerConfigurator configurator; - - public ROLearnerConfigurator getConfigurator(){ - return configurator; - } - private static Logger logger = Logger .getLogger(AbstractCELA.class); @@ -213,7 +206,6 @@ public ROLearner(PosNegLP learningProblem, AbstractReasonerComponent reasoningService) { super(learningProblem, reasoningService); this.learningProblem = learningProblem; - this.configurator = new ROLearnerConfigurator(this); baseURI = reasoningService.getBaseURI(); } Modified: trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -28,7 +28,6 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.IntegerEditor; -import org.dllearner.core.configurators.Configurator; import org.dllearner.core.owl.Axiom; import org.dllearner.kb.SparqlEndpointKS; import org.dllearner.kb.sparql.ExtendedQueryEngineHTTP; @@ -38,8 +37,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.hp.hpl.jena.query.Query; -import com.hp.hpl.jena.query.QueryFactory; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.sparql.engine.http.QueryEngineHTTP; @@ -116,11 +113,6 @@ return returnList; } - - public Configurator getConfigurator() { - // TODO Auto-generated method stub - return null; - } protected ResultSet executeSelectQuery(String query) { logger.info("Sending query\n{} ...", query); Modified: trunk/components-core/src/main/java/org/dllearner/core/AbstractComponent.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AbstractComponent.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/AbstractComponent.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -22,7 +22,6 @@ import java.util.Collection; import java.util.LinkedList; -import org.dllearner.core.configurators.Configurator; import org.dllearner.core.options.ConfigEntry; import org.dllearner.core.options.ConfigOption; import org.dllearner.core.options.DoubleConfigOption; Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/ClassLearningProblemConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/ClassLearningProblemConfigurator.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/ClassLearningProblemConfigurator.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -1,226 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import java.net.URL; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.learningproblems.ClassLearningProblem; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public class ClassLearningProblemConfigurator implements Configurator { - -private boolean reinitNecessary = false; -private ClassLearningProblem classLearningProblem; - -/** -* @param classLearningProblem see ClassLearningProblem -**/ -public ClassLearningProblemConfigurator(ClassLearningProblem classLearningProblem){ -this.classLearningProblem = classLearningProblem; -} - -/** -* @param reasoningService see reasoningService -* @param classToDescribe class of which a description should be learned -* @return ClassLearningProblem -**/ -public static ClassLearningProblem getClassLearningProblem(AbstractReasonerComponent reasoningService, URL classToDescribe) { -ClassLearningProblem component = ComponentManager.getInstance().learningProblem(ClassLearningProblem.class, reasoningService); -ComponentManager.getInstance().applyConfigEntry(component, "classToDescribe", classToDescribe); -return component; -} - -/** -* classToDescribe class of which a description should be learned. -* mandatory: true| reinit necessary: false -* default value: null -* @return URL -**/ -public URL getClassToDescribe() { -return (URL) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "classToDescribe") ; -} -/** -* type whether to learn an equivalence class or super class axiom. -* mandatory: false| reinit necessary: true -* default value: equivalence -* @return String -**/ -public String getType() { -return (String) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "type") ; -} -/** -* useApproximations whether to use stochastic approximations for computing accuracy. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseApproximations() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "useApproximations") ; -} -/** -* approxAccuracy accuracy of the approximation (only for expert use). -* mandatory: false| reinit necessary: true -* default value: 0.05 -* @return double -**/ -public double getApproxAccuracy() { -return (Double) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "approxAccuracy") ; -} -/** -* accuracyMethod Specifies, which method/function to use for computing accuracy.. -* mandatory: false| reinit necessary: true -* default value: standard -* @return String -**/ -public String getAccuracyMethod() { -return (String) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "accuracyMethod") ; -} -/** -* checkConsistency Specify whether to check consistency for solution candidates. This is convenient for user interfaces, but can be performance intensive.. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getCheckConsistency() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "checkConsistency") ; -} -/** -* maxExecutionTimeInSeconds algorithm will stop after specified seconds. -* mandatory: false| reinit necessary: true -* default value: 10 -* @return int -**/ -public int getMaxExecutionTimeInSeconds() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "maxExecutionTimeInSeconds") ; -} -/** -* betaSC Higher values of beta rate recall higher than precision or in other words, covering the instances of the class to describe is more important even at the cost of covering additional instances. The actual implementation depends on the selected heuristic. This values is used only for super class learning.. -* mandatory: false| reinit necessary: true -* default value: 3.0 -* @return double -**/ -public double getBetaSC() { -return (Double) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "betaSC") ; -} -/** -* betaEq Higher values of beta rate recall higher than precision or in other words, covering the instances of the class to describe is more important even at the cost of covering additional instances. The actual implementation depends on the selected heuristic. This values is used only for equivalence class learning.. -* mandatory: false| reinit necessary: true -* default value: 1.0 -* @return double -**/ -public double getBetaEq() { -return (Double) ComponentManager.getInstance().getConfigOptionValue(classLearningProblem, "betaEq") ; -} - -/** -* @param classToDescribe class of which a description should be learned. -* mandatory: true| reinit necessary: false -* default value: null -**/ -public void setClassToDescribe(URL classToDescribe) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "classToDescribe", classToDescribe); -} -/** -* @param type whether to learn an equivalence class or super class axiom. -* mandatory: false| reinit necessary: true -* default value: equivalence -**/ -public void setType(String type) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "type", type); -reinitNecessary = true; -} -/** -* @param useApproximations whether to use stochastic approximations for computing accuracy. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setUseApproximations(boolean useApproximations) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "useApproximations", useApproximations); -reinitNecessary = true; -} -/** -* @param approxAccuracy accuracy of the approximation (only for expert use). -* mandatory: false| reinit necessary: true -* default value: 0.05 -**/ -public void setApproxAccuracy(double approxAccuracy) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "approxAccuracy", approxAccuracy); -reinitNecessary = true; -} -/** -* @param accuracyMethod Specifies, which method/function to use for computing accuracy.. -* mandatory: false| reinit necessary: true -* default value: standard -**/ -public void setAccuracyMethod(String accuracyMethod) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "accuracyMethod", accuracyMethod); -reinitNecessary = true; -} -/** -* @param checkConsistency Specify whether to check consistency for solution candidates. This is convenient for user interfaces, but can be performance intensive.. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setCheckConsistency(boolean checkConsistency) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "checkConsistency", checkConsistency); -reinitNecessary = true; -} -/** -* @param maxExecutionTimeInSeconds algorithm will stop after specified seconds. -* mandatory: false| reinit necessary: true -* default value: 10 -**/ -public void setMaxExecutionTimeInSeconds(int maxExecutionTimeInSeconds) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds); -reinitNecessary = true; -} -/** -* @param betaSC Higher values of beta rate recall higher than precision or in other words, covering the instances of the class to describe is more important even at the cost of covering additional instances. The actual implementation depends on the selected heuristic. This values is used only for super class learning.. -* mandatory: false| reinit necessary: true -* default value: 3.0 -**/ -public void setBetaSC(double betaSC) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "betaSC", betaSC); -reinitNecessary = true; -} -/** -* @param betaEq Higher values of beta rate recall higher than precision or in other words, covering the instances of the class to describe is more important even at the cost of covering additional instances. The actual implementation depends on the selected heuristic. This values is used only for equivalence class learning.. -* mandatory: false| reinit necessary: true -* default value: 1.0 -**/ -public void setBetaEq(double betaEq) { -ComponentManager.getInstance().applyConfigEntry(classLearningProblem, "betaEq", betaEq); -reinitNecessary = true; -} - -/** -* true, if this component needs reinitializsation. -* @return boolean -**/ -public boolean isReinitNecessary(){ -return reinitNecessary; -} - - -} Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/Configurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/Configurator.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/Configurator.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -1,27 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public interface Configurator{ -} Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -1,117 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import java.util.Set; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractKnowledgeSource; -import org.dllearner.reasoning.DIGReasoner; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public class DIGReasonerConfigurator implements Configurator { - -private boolean reinitNecessary = false; -private DIGReasoner dIGReasoner; - -/** -* @param dIGReasoner see DIGReasoner -**/ -public DIGReasonerConfigurator(DIGReasoner dIGReasoner){ -this.dIGReasoner = dIGReasoner; -} - -/** -* @param knowledgeSource see knowledgeSource -* @return DIGReasoner -**/ -public static DIGReasoner getDIGReasoner(Set<AbstractKnowledgeSource> knowledgeSource) { -DIGReasoner component = ComponentManager.getInstance().reasoner(DIGReasoner.class, knowledgeSource); -return component; -} - -/** -* reasonerUrl URL of the DIG reasoner. -* mandatory: false| reinit necessary: true -* default value: null -* @return String -**/ -public String getReasonerUrl() { -return (String) ComponentManager.getInstance().getConfigOptionValue(dIGReasoner, "reasonerUrl") ; -} -/** -* writeDIGProtocol specifies whether or not to write a protocoll of send and received DIG requests. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getWriteDIGProtocol() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dIGReasoner, "writeDIGProtocol") ; -} -/** -* digProtocolFile the file to store the DIG protocol. -* mandatory: false| reinit necessary: true -* default value: log/digProtocol.txt -* @return String -**/ -public String getDigProtocolFile() { -return (String) ComponentManager.getInstance().getConfigOptionValue(dIGReasoner, "digProtocolFile") ; -} - -/** -* @param reasonerUrl URL of the DIG reasoner. -* mandatory: false| reinit necessary: true -* default value: null -**/ -public void setReasonerUrl(String reasonerUrl) { -ComponentManager.getInstance().applyConfigEntry(dIGReasoner, "reasonerUrl", reasonerUrl); -reinitNecessary = true; -} -/** -* @param writeDIGProtocol specifies whether or not to write a protocoll of send and received DIG requests. -* mandatory: false| reinit necessary: true -* default value: false -**/ -public void setWriteDIGProtocol(boolean writeDIGProtocol) { -ComponentManager.getInstance().applyConfigEntry(dIGReasoner, "writeDIGProtocol", writeDIGProtocol); -reinitNecessary = true; -} -/** -* @param digProtocolFile the file to store the DIG protocol. -* mandatory: false| reinit necessary: true -* default value: log/digProtocol.txt -**/ -public void setDigProtocolFile(String digProtocolFile) { -ComponentManager.getInstance().applyConfigEntry(dIGReasoner, "digProtocolFile", digProtocolFile); -reinitNecessary = true; -} - -/** -* true, if this component needs reinitializsation. -* @return boolean -**/ -public boolean isReinitNecessary(){ -return reinitNecessary; -} - - -} Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/ELLearningAlgorithmConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/ELLearningAlgorithmConfigurator.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/ELLearningAlgorithmConfigurator.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -1,84 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import org.dllearner.algorithms.el.ELLearningAlgorithm; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.AbstractReasonerComponent; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public class ELLearningAlgorithmConfigurator implements Configurator { - -private boolean reinitNecessary = false; -private ELLearningAlgorithm eLLearningAlgorithm; - -/** -* @param eLLearningAlgorithm see ELLearningAlgorithm -**/ -public ELLearningAlgorithmConfigurator(ELLearningAlgorithm eLLearningAlgorithm){ -this.eLLearningAlgorithm = eLLearningAlgorithm; -} - -/** -* @param reasoningService see reasoningService -* @param learningProblem see learningProblem -* @throws LearningProblemUnsupportedException see -* @return ELLearningAlgorithm -**/ -public static ELLearningAlgorithm getELLearningAlgorithm(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException{ -ELLearningAlgorithm component = ComponentManager.getInstance().learningAlgorithm(ELLearningAlgorithm.class, learningProblem, reasoningService); -return component; -} - -/** -* instanceBasedDisjoints Specifies whether to use real disjointness checks or instance based ones (no common instances) in the refinement operator.. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getInstanceBasedDisjoints() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(eLLearningAlgorithm, "instanceBasedDisjoints") ; -} - -/** -* @param instanceBasedDisjoints Specifies whether to use real disjointness checks or instance based ones (no common instances) in the refinement operator.. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setInstanceBasedDisjoints(boolean instanceBasedDisjoints) { -ComponentManager.getInstance().applyConfigEntry(eLLearningAlgorithm, "instanceBasedDisjoints", instanceBasedDisjoints); -reinitNecessary = true; -} - -/** -* true, if this component needs reinitializsation. -* @return boolean -**/ -public boolean isReinitNecessary(){ -return reinitNecessary; -} - - -} Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/ELLearningAlgorithmDisjunctiveConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/ELLearningAlgorithmDisjunctiveConfigurator.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/ELLearningAlgorithmDisjunctiveConfigurator.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -1,120 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import org.dllearner.algorithms.el.ELLearningAlgorithmDisjunctive; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.AbstractReasonerComponent; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public class ELLearningAlgorithmDisjunctiveConfigurator implements Configurator { - -private boolean reinitNecessary = false; -private ELLearningAlgorithmDisjunctive eLLearningAlgorithmDisjunctive; - -/** -* @param eLLearningAlgorithmDisjunctive see ELLearningAlgorithmDisjunctive -**/ -public ELLearningAlgorithmDisjunctiveConfigurator(ELLearningAlgorithmDisjunctive eLLearningAlgorithmDisjunctive){ -this.eLLearningAlgorithmDisjunctive = eLLearningAlgorithmDisjunctive; -} - -/** -* @param reasoningService see reasoningService -* @param learningProblem see learningProblem -* @throws LearningProblemUnsupportedException see -* @return ELLearningAlgorithmDisjunctive -**/ -public static ELLearningAlgorithmDisjunctive getELLearningAlgorithmDisjunctive(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException{ -ELLearningAlgorithmDisjunctive component = ComponentManager.getInstance().learningAlgorithm(ELLearningAlgorithmDisjunctive.class, learningProblem, reasoningService); -return component; -} - -/** -* noisePercentage the (approximated) percentage of noise within the examples. -* mandatory: false| reinit necessary: true -* default value: 0.0 -* @return double -**/ -public double getNoisePercentage() { -return (Double) ComponentManager.getInstance().getConfigOptionValue(eLLearningAlgorithmDisjunctive, "noisePercentage") ; -} -/** -* startClass the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class). -* mandatory: false| reinit necessary: true -* default value: null -* @return String -**/ -public String getStartClass() { -return (String) ComponentManager.getInstance().getConfigOptionValue(eLLearningAlgorithmDisjunctive, "startClass") ; -} -/** -* instanceBasedDisjoints Specifies whether to use real disjointness checks or instance based ones (no common instances) in the refinement operator.. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getInstanceBasedDisjoints() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(eLLearningAlgorithmDisjunctive, "instanceBasedDisjoints") ; -} - -/** -* @param noisePercentage the (approximated) percentage of noise within the examples. -* mandatory: false| reinit necessary: true -* default value: 0.0 -**/ -public void setNoisePercentage(double noisePercentage) { -ComponentManager.getInstance().applyConfigEntry(eLLearningAlgorithmDisjunctive, "noisePercentage", noisePercentage); -reinitNecessary = true; -} -/** -* @param startClass the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class). -* mandatory: false| reinit necessary: true -* default value: null -**/ -public void setStartClass(String startClass) { -ComponentManager.getInstance().applyConfigEntry(eLLearningAlgorithmDisjunctive, "startClass", startClass); -reinitNecessary = true; -} -/** -* @param instanceBasedDisjoints Specifies whether to use real disjointness checks or instance based ones (no common instances) in the refinement operator.. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setInstanceBasedDisjoints(boolean instanceBasedDisjoints) { -ComponentManager.getInstance().applyConfigEntry(eLLearningAlgorithmDisjunctive, "instanceBasedDisjoints", instanceBasedDisjoints); -reinitNecessary = true; -} - -/** -* true, if this component needs reinitializsation. -* @return boolean -**/ -public boolean isReinitNecessary(){ -return reinitNecessary; -} - - -} Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -1,118 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import java.net.URL; -import java.util.Set; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractKnowledgeSource; -import org.dllearner.reasoning.FastInstanceChecker; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public class FastInstanceCheckerConfigurator implements Configurator { - -private boolean reinitNecessary = false; -private FastInstanceChecker fastInstanceChecker; - -/** -* @param fastInstanceChecker see FastInstanceChecker -**/ -public FastInstanceCheckerConfigurator(FastInstanceChecker fastInstanceChecker){ -this.fastInstanceChecker = fastInstanceChecker; -} - -/** -* @param knowledgeSource see knowledgeSource -* @return FastInstanceChecker -**/ -public static FastInstanceChecker getFastInstanceChecker(Set<AbstractKnowledgeSource> knowledgeSource) { -FastInstanceChecker component = ComponentManager.getInstance().reasoner(FastInstanceChecker.class, knowledgeSource); -return component; -} - -/** -* reasonerType FaCT++, HermiT, OWLlink or Pellet to dematerialize. -* mandatory: false| reinit necessary: true -* default value: pellet -* @return String -**/ -public String getReasonerType() { -return (String) ComponentManager.getInstance().getConfigOptionValue(fastInstanceChecker, "reasonerType") ; -} -/** -* owlLinkURL the URL to the remote OWLlink server. -* mandatory: false| reinit necessary: true -* default value: http://localhost:8080/ -* @return URL -**/ -public URL getOwlLinkURL() { -return (URL) ComponentManager.getInstance().getConfigOptionValue(fastInstanceChecker, "owlLinkURL") ; -} -/** -* defaultNegation Whether to use default negation, i.e. an instance not being in a class means that it is in the negation of the class.. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getDefaultNegation() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fastInstanceChecker, "defaultNegation") ; -} - -/** -* @param reasonerType FaCT++, HermiT, OWLlink or Pellet to dematerialize. -* mandatory: false| reinit necessary: true -* default value: pellet -**/ -public void setReasonerType(String reasonerType) { -ComponentManager.getInstance().applyConfigEntry(fastInstanceChecker, "reasonerType", reasonerType); -reinitNecessary = true; -} -/** -* @param owlLinkURL the URL to the remote OWLlink server. -* mandatory: false| reinit necessary: true -* default value: http://localhost:8080/ -**/ -public void setOwlLinkURL(URL owlLinkURL) { -ComponentManager.getInstance().applyConfigEntry(fastInstanceChecker, "owlLinkURL", owlLinkURL); -reinitNecessary = true; -} -/** -* @param defaultNegation Whether to use default negation, i.e. an instance not being in a class means that it is in the negation of the class.. -* mandatory: false| reinit necessary: true -* default value: true -**/ -public void setDefaultNegation(boolean defaultNegation) { -ComponentManager.getInstance().applyConfigEntry(fastInstanceChecker, "defaultNegation", defaultNegation); -reinitNecessary = true; -} - -/** -* true, if this component needs reinitializsation. -* @return boolean -**/ -public boolean isReinitNecessary(){ -return reinitNecessary; -} - - -} Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -1,65 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import java.util.Set; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractKnowledgeSource; -import org.dllearner.reasoning.FastRetrievalReasoner; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -public class FastRetrievalReasonerConfigurator implements Configurator { - -private boolean reinitNecessary = false; -@SuppressWarnings("unused") - -private FastRetrievalReasoner fastRetrievalReasoner; - -/** -* @param fastRetrievalReasoner see FastRetrievalReasoner -**/ -public FastRetrievalReasonerConfigurator(FastRetrievalReasoner fastRetrievalReasoner){ -this.fastRetrievalReasoner = fastRetrievalReasoner; -} - -/** -* @param knowledgeSource see knowledgeSource -* @return FastRetrievalReasoner -**/ -public static FastRetrievalReasoner getFastRetrievalReasoner(Set<AbstractKnowledgeSource> knowledgeSource) { -FastRetrievalReasoner component = ComponentManager.getInstance().reasoner(FastRetrievalReasoner.class, knowledgeSource); -return component; -} - - - -/** -* true, if this component needs reinitializsation. -* @return boolean -**/ -public boolean isReinitNecessary(){ -return reinitNecessary; -} - - -} Deleted: trunk/components-core/src/main/java/org/dllearner/core/configurators/FuzzyCELOEConfigurator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/configurators/FuzzyCELOEConfigurator.java 2011-08-31 17:55:07 UTC (rev 3198) +++ trunk/components-core/src/main/java/org/dllearner/core/configurators/FuzzyCELOEConfigurator.java 2011-08-31 18:05:10 UTC (rev 3199) @@ -1,500 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.core.configurators; - -import org.dllearner.algorithms.fuzzydll.FuzzyCELOE; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.configurators.RefinementOperatorConfigurator; - -/** -* automatically generated, do not edit manually. -* run org.dllearner.scripts.ConfigJavaGenerator to update -**/ -@SuppressWarnings("all") -public class FuzzyCELOEConfigurator extends RefinementOperatorConfigurator implements Configurator { - -private boolean reinitNecessary = false; -private FuzzyCELOE fuzzyCELOE; - -/** -* @param fuzzyCELOE see FuzzyCELOE -**/ -public FuzzyCELOEConfigurator(FuzzyCELOE fuzzyCELOE){ -this.fuzzyCELOE = fuzzyCELOE; -} - -/** -* @param reasoningService see reasoningService -* @param learningProblem see learningProblem -* @throws LearningProblemUnsupportedException see -* @return FuzzyCELOE -**/ -public static FuzzyCELOE getFuzzyCELOE(AbstractLearningProblem learningProblem, AbstractReasonerComponent reasoningService) throws LearningProblemUnsupportedException{ -FuzzyCELOE component = ComponentManager.getInstance().learningAlgorithm(FuzzyCELOE.class, learningProblem, reasoningService); -return component; -} - -/** -* useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseAllConstructor() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "useAllConstructor") ; -} -/** -* useExistsConstructor specifies whether the existential concept constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseExistsConstructor() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "useExistsConstructor") ; -} -/** -* useHasValueConstructor specifies whether the hasValue constructor is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getUseHasValueConstructor() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "useHasValueConstructor") ; -} -/** -* useDataHasValueConstructor specifies whether the hasValue constructor is used in the learning algorithm in combination with data properties. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getUseDataHasValueConstructor() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "useDataHasValueConstructor") ; -} -/** -* valueFrequencyThreshold specifies how often an object must occur as value in order to be considered for hasValue restrictions. -* mandatory: false| reinit necessary: true -* default value: 3 -* @return int -**/ -public int getValueFrequencyThreshold() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "valueFrequencyThreshold") ; -} -/** -* useCardinalityRestrictions specifies whether CardinalityRestrictions is used in the learning algorithm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseCardinalityRestrictions() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "useCardinalityRestrictions") ; -} -/** -* cardinalityLimit Gives the maximum number used in cardinality restrictions.. -* mandatory: false| reinit necessary: true -* default value: 5 -* @return int -**/ -public int getCardinalityLimit() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "cardinalityLimit") ; -} -/** -* useNegation specifies whether negation is used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getUseNegation() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "useNegation") ; -} -/** -* useBooleanDatatypes specifies whether boolean datatypes are used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseBooleanDatatypes() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "useBooleanDatatypes") ; -} -/** -* useDoubleDatatypes specifies whether double datatypes are used in the learning algorothm. -* mandatory: false| reinit necessary: true -* default value: true -* @return boolean -**/ -public boolean getUseDoubleDatatypes() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "useDoubleDatatypes") ; -} -/** -* maxExecutionTimeInSeconds algorithm will stop after specified seconds. -* mandatory: false| reinit necessary: true -* default value: 10 -* @return int -**/ -public int getMaxExecutionTimeInSeconds() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "maxExecutionTimeInSeconds") ; -} -/** -* noisePercentage the (approximated) percentage of noise within the examples. -* mandatory: false| reinit necessary: true -* default value: 0.0 -* @return double -**/ -public double getNoisePercentage() { -return (Double) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "noisePercentage") ; -} -/** -* terminateOnNoiseReached specifies whether to terminate when noise criterion is met. -* mandatory: false| reinit necessary: true -* default value: false -* @return boolean -**/ -public boolean getTerminateOnNoiseReached() { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "terminateOnNoiseReached") ; -} -/** -* maxDepth maximum depth of description. -* mandatory: false| reinit necessary: true -* default value: 7 -* @return int -**/ -public int getMaxDepth() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "maxDepth") ; -} -/** -* maxNrOfResults Sets the maximum number of results one is interested in. (Setting this to a lower value may increase performance as the learning algorithm has to store/evaluate/beautify less descriptions).. -* mandatory: false| reinit necessary: true -* default value: 10 -* @return int -**/ -public int getMaxNrOfResults() { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(fuzzyCELOE, "maxNrOfResults") ; -} -/** -* maxClassDescriptionTests The maximum number of candidate hypothesis the algorithm is allowed to test (0 = no limit). The algorithm will stop afterwards. (The real number of tests can be slightly higher, because this criterion usually won't be checked after each single test.). -* mandatory: false| reinit necessary: true -* default value: 0 -* @return int -**/ -public int getMaxClassDescr... [truncated message content] |
From: <jen...@us...> - 2011-08-31 18:08:49
|
Revision: 3200 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3200&view=rev Author: jenslehmann Date: 2011-08-31 18:08:40 +0000 (Wed, 31 Aug 2011) Log Message: ----------- some refactoring Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest.java trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest_Trains.java trunk/components-core/src/test/java/org/dllearner/test/FuzzyDLLTest_Trains_noFuzzyIndividuals.java trunk/interfaces/src/main/java/org/dllearner/cli/ConfMapper.java trunk/interfaces/src/main/java/org/dllearner/cli/Start.java Added Paths: ----------- trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLP.java trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLPStandard.java Removed Paths: ------------- trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLP.java trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLPStandard.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java 2011-08-31 18:05:10 UTC (rev 3199) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/fuzzydll/FuzzyCELOE.java 2011-08-31 18:08:40 UTC (rev 3200) @@ -50,11 +50,11 @@ import org.dllearner.core.owl.Restriction; import org.dllearner.core.owl.Thing; import org.dllearner.learningproblems.ClassLearningProblem; +import org.dllearner.learningproblems.FuzzyPosNegLP; +import org.dllearner.learningproblems.FuzzyPosNegLPStandard; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.learningproblems.PosNegLPStandard; import org.dllearner.learningproblems.PosOnlyLP; -import org.dllearner.learningproblems.fuzzydll.FuzzyPosNegLP; -import org.dllearner.learningproblems.fuzzydll.FuzzyPosNegLPStandard; import org.dllearner.refinementoperators.OperatorInverter; import org.dllearner.refinementoperators.RefinementOperator; import org.dllearner.refinementoperators.RhoDRDown; Copied: trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLP.java (from rev 3199, trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLP.java) =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLP.java (rev 0) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLP.java 2011-08-31 18:08:40 UTC (rev 3200) @@ -0,0 +1,193 @@ +/** + * Copyright (C) 2007-2011, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.dllearner.learningproblems; + +import java.util.Collection; +import java.util.LinkedList; +import java.util.Set; +import java.util.SortedSet; + +import org.dllearner.core.AbstractLearningProblem; +import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.options.BooleanConfigOption; +import org.dllearner.core.options.CommonConfigMappings; +import org.dllearner.core.options.CommonConfigOptions; +import org.dllearner.core.options.ConfigEntry; +import org.dllearner.core.options.ConfigOption; +import org.dllearner.core.options.InvalidConfigOptionValueException; +import org.dllearner.core.options.StringConfigOption; +import org.dllearner.core.options.StringSetConfigOption; +import org.dllearner.core.options.fuzzydll.FuzzyExample; +import org.dllearner.core.options.fuzzydll.ObjectSetConfigOption; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.fuzzydll.FuzzyIndividual; +import org.dllearner.utilities.Helper; + +/** + * @author Jens Lehmann + * + */ +public abstract class FuzzyPosNegLP extends AbstractLearningProblem { + + protected SortedSet<Individual> positiveExamples; + protected SortedSet<Individual> negativeExamples; + protected SortedSet<Individual> allExamples; + + protected SortedSet<FuzzyIndividual> fuzzyExamples; + + + protected boolean useRetrievalForClassification = false; + protected UseMultiInstanceChecks useMultiInstanceChecks = UseMultiInstanceChecks.TWOCHECKS; + protected double percentPerLengthUnit = 0.05; + protected double totalTruth = 0; + + /** + * If instance checks are used for testing concepts (e.g. no retrieval), then + * there are several options to do this. The enumeration lists the supported + * options. These options are only important if the reasoning mechanism + * supports sending several reasoning requests at once as it is the case for + * DIG reasoners. + * + * @author Jens Lehmann + * + */ + public enum UseMultiInstanceChecks { + /** + * Perform a separate instance check for each example. + */ + NEVER, + /** + * Perform one instance check for all positive and one instance check + * for all negative examples. + */ + TWOCHECKS, + /** + * Perform all instance checks at once. + */ + ONECHECK + }; + + public FuzzyPosNegLP() { + + } + + public FuzzyPosNegLP(AbstractReasonerComponent reasoningService) { + super(reasoningService); + } + + public static Collection<ConfigOption<?>> createConfigOptions() { + Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); + // changed by Josue + options.add(new ObjectSetConfigOption("fuzzyExamples", + "fuzzy examples",null, true, false)); + // TODO positiveExamples and negativeExamples must desapear here + options.add(new StringSetConfigOption("positiveExamples", + "positive examples",null, true, false)); + options.add(new StringSetConfigOption("negativeExamples", + "negative examples",null, true, false)); + options.add(new BooleanConfigOption("useRetrievalForClassficiation", + "Specifies whether to use retrieval or instance checks for testing a concept. - NO LONGER FULLY SUPPORTED.", false)); + options.add(CommonConfigOptions.getPercentPerLenghtUnitOption(0.05)); + StringConfigOption multiInstanceChecks = new StringConfigOption("useMultiInstanceChecks", "See UseMultiInstanceChecks enum. - NO LONGER FULLY SUPPORTED.","twoChecks"); + multiInstanceChecks.setAllowedValues(new String[] {"never", "twoChecks", "oneCheck"}); + options.add(multiInstanceChecks); + return options; + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) + */ + @Override + @SuppressWarnings( { "unchecked" }) + public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { + String name = entry.getOptionName(); + // added by Josue + if (name.equals("fuzzyExamples")){ + fuzzyExamples = CommonConfigMappings.getFuzzyIndividualSet((Set<FuzzyExample>) entry.getValue()); + for (FuzzyIndividual fuzzyExample : fuzzyExamples) { + totalTruth += fuzzyExample.getTruthDegree(); + } + } + // TODO delete positiveExamples & negativeExamples + else if (name.equals("positiveExamples")) + positiveExamples = CommonConfigMappings + .getIndividualSet((Set<String>) entry.getValue()); // changed by Josue + else if (name.equals("negativeExamples")) + negativeExamples = CommonConfigMappings + .getIndividualSet((Set<String>) entry.getValue()); // changed by Josue + else if (name.equals("useRetrievalForClassficiation")) { + useRetrievalForClassification = (Boolean) entry.getValue(); + } else if (name.equals("percentPerLengthUnit")) + percentPerLengthUnit = (Double) entry.getValue(); + else if (name.equals("useMultiInstanceChecks")) { + String value = (String) entry.getValue(); + if(value.equals("oneCheck")) + useMultiInstanceChecks = UseMultiInstanceChecks.ONECHECK; + else if(value.equals("twoChecks")) + useMultiInstanceChecks = UseMultiInstanceChecks.TWOCHECKS; + else + useMultiInstanceChecks = UseMultiInstanceChecks.NEVER; + } + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.Component#init() + */ + @Override + public void init() { + allExamples = Helper.union(positiveExamples, negativeExamples); + } + + public SortedSet<Individual> getNegativeExamples() { + return negativeExamples; + } + + public SortedSet<Individual> getPositiveExamples() { + return positiveExamples; + } + + public void setNegativeExamples(SortedSet<Individual> set) { + this.negativeExamples=set; + } + + public void setPositiveExamples(SortedSet<Individual> set) { + this.positiveExamples=set; + } + + public abstract int coveredNegativeExamplesOrTooWeak(Description concept); + + public double getPercentPerLengthUnit() { + return percentPerLengthUnit; + } + + public SortedSet<FuzzyIndividual> getFuzzyExamples() { + return fuzzyExamples; + } + + public void setFuzzyExamples(SortedSet<FuzzyIndividual> fuzzyExamples) { + this.fuzzyExamples = fuzzyExamples; + } + +} Copied: trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLPStandard.java (from rev 3199, trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLPStandard.java) =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLPStandard.java (rev 0) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/FuzzyPosNegLPStandard.java 2011-08-31 18:08:40 UTC (rev 3200) @@ -0,0 +1,815 @@ +/** + * Copyright (C) 2007-2011, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.dllearner.learningproblems; + +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.fuzzydll.FuzzyUnsupportedCodeException; +import org.dllearner.core.options.BooleanConfigOption; +import org.dllearner.core.options.ConfigOption; +import org.dllearner.core.options.DoubleConfigOption; +import org.dllearner.core.options.StringConfigOption; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.fuzzydll.FuzzyIndividual; +import org.dllearner.learningproblems.Heuristics.HeuristicType; +import org.dllearner.utilities.Helper; + +/** + * The aim of this learning problem is to learn a concept definition such that + * the positive examples and the negative examples do not follow. It is + * 2-valued, because we only distinguish between covered and non-covered + * examples. (A 3-valued problem distinguishes between covered examples, + * examples covered by the negation of the concept, and all other examples.) The + * 2-valued learning problem is often more useful for Description Logics due to + * (the Open World Assumption and) the fact that negative knowledge, e.g. that a + * person does not have a child, is or cannot be expressed. + * + * @author Jens Lehmann + * + */ +public class FuzzyPosNegLPStandard extends FuzzyPosNegLP { + + // approximation and F-measure + // (taken from class learning => super class instances corresponds to negative examples + // and class instances to positive examples) + private double approxDelta = 0.05; + private boolean useApproximations; +// private boolean useFMeasure; + private boolean useOldDIGOptions = false; + + private HeuristicType heuristic = HeuristicType.PRED_ACC; + + private int errorIndex = 0; + + private String accuracyMethod; + + public FuzzyPosNegLPStandard() { + + } + + public FuzzyPosNegLPStandard(AbstractReasonerComponent reasoningService) { + super(reasoningService); + } + + public FuzzyPosNegLPStandard(AbstractReasonerComponent reasoningService, SortedSet<Individual> positiveExamples, SortedSet<Individual> negativeExamples) { + super(reasoningService); + this.positiveExamples = positiveExamples; + this.negativeExamples = negativeExamples; + } + + @Override + public void init() { + super.init(); +// useApproximations = configurator.getUseApproximations(); +// approxDelta = configurator.getApproxAccuracy(); + + String accM = getAccuracyMethod(); + if(accM.equals("standard")) { + heuristic = HeuristicType.AMEASURE; + } else if(accM.equals("fmeasure")) { + heuristic = HeuristicType.FMEASURE; + } else if(accM.equals("generalised_fmeasure")) { + heuristic = HeuristicType.GEN_FMEASURE; + } else if(accM.equals("jaccard")) { + heuristic = HeuristicType.JACCARD; + } else if(accM.equals("pred_acc")) { + heuristic = HeuristicType.PRED_ACC; + } + +// useFMeasure = configurator.getAccuracyMethod().equals("fmeasure"); + +// if((!useApproximations && useFMeasure) || (useApproximations && !useFMeasure)) { +// System.err.println("Currently F measure can only be used in combination with approximated reasoning."); +// System.exit(0); +// } + + if(useApproximations && heuristic.equals(HeuristicType.PRED_ACC)) { + System.err.println("Approximating predictive accuracy is an experimental feature. USE IT AT YOUR OWN RISK. If you consider to use it for anything serious, please extend the unit tests at org.dllearner.test.junit.HeuristicTests first and verify that it works."); + } + + } + + /* + * (non-Javadoc) + * + * @see org.dllearner.core.Component#getName() + */ + public static String getName() { + return "fuzzy pos neg learning problem"; + } + + public static Collection<ConfigOption<?>> createConfigOptions() { + Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(FuzzyPosNegLP.createConfigOptions()); + BooleanConfigOption approx = new BooleanConfigOption("useApproximations", "whether to use stochastic approximations for computing accuracy", false); + options.add(approx); + DoubleConfigOption approxAccuracy = new DoubleConfigOption("approxAccuracy", "accuracy of the approximation (only for expert use)", 0.05); + options.add(approxAccuracy); + StringConfigOption accMethod = new StringConfigOption("accuracyMethod", "Specifies, which method/function to use for computing accuracy.","predacc"); // or domain/range of a property. + accMethod.setAllowedValues(new String[] {"fmeasure", "predacc"}); + options.add(accMethod); + return options; + } + + /** + * This method computes (using the reasoner) whether a concept is too weak. + * If it is not weak, it returns the number of covered negative examples. It + * can use retrieval or instance checks for classification. + * + * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks + * TODO: Performance could be slightly improved by counting the number of + * covers instead of using sets and counting their size. + * @param concept + * The concept to test. + * @return -1 if concept is too weak and the number of covered negative + * examples otherwise. + */ + @Override + public int coveredNegativeExamplesOrTooWeak(Description concept) { + try { + throw new FuzzyUnsupportedCodeException(); + } catch (FuzzyUnsupportedCodeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + System.exit(0); + } +// if (useRetrievalForClassification) { +// SortedSet<Individual> posClassified = reasoner.getIndividuals(concept); +// SortedSet<Individual> negAsPos = Helper.intersection(negativeExamples, posClassified); +// SortedSet<Individual> posAsNeg = new TreeSet<Individual>(); +// +// // the set is constructed piecewise to avoid expensive set +// // operations +// // on a large number of individuals +// for (Individual posExample : positiveExamples) { +// if (!posClassified.contains(posExample)) +// posAsNeg.add(posExample); +// } +// +// // too weak +// if (posAsNeg.size() > 0) +// return -1; +// // number of covered negatives +// else +// return negAsPos.size(); +// } else { +// if (useMultiInstanceChecks != UseMultiInstanceChecks.NEVER) { +// // two checks +// if (useMultiInstanceChecks == UseMultiInstanceChecks.TWOCHECKS) { +// Set<Individual> s = reasoner.hasTypeFuzzyMembership(concept, positiveExamples); +// // if the concept is too weak, then do not query negative +// // examples +// if (s.size() != positiveExamples.size()) +// return -1; +// else { +// s = reasoner.hasTypeFuzzyMembership(concept, negativeExamples); +// return s.size(); +// } +// // one check +// } else { +// Set<Individual> s = reasoner.hasTypeFuzzyMembership(concept, allExamples); +// // test whether all positive examples are covered +// if (s.containsAll(positiveExamples)) +// return s.size() - positiveExamples.size(); +// else +// return -1; +// } +// } else { +// // SortedSet<Individual> posAsNeg = new TreeSet<Individual>(); +// SortedSet<Individual> negAsPos = new TreeSet<Individual>(); +// +// for (Individual example : positiveExamples) { +// if (!reasoner.hasType(concept, example)) +// return -1; +// // posAsNeg.add(example); +// } +// for (Individual example : negativeExamples) { +// if (reasoner.hasType(concept, example)) +// negAsPos.add(example); +// } +// +// return negAsPos.size(); +// } +// } + return -1; + } + + /** + * Computes score of a given concept using the reasoner. Either retrieval or + * instance check are used. For the latter, this method treats + * <code>UseMultiInstanceChecks.TWO_CHECKS</code> as if it were + * <code>UseMultiInstanceChecks.ONE_CHECKS</code> (it does not make much sense + * to implement TWO_CHECKS in this function, because we have to test all + * examples to create a score object anyway). + * + * NOTE: The options above are no longer supported, because of interface changes (the options + * are more or less only relevant in combination with DIG). + * + * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks + * @param concept + * The concept to test. + * @return Corresponding Score object. + */ + @Override + public ScorePosNeg computeScore(Description concept) { + if(useOldDIGOptions) { + if (useRetrievalForClassification) { + SortedSet<Individual> posClassified = getReasoner().getIndividuals(concept); + Set<Individual> posAsPos = Helper.intersection(positiveExamples, posClassified); + Set<Individual> negAsPos = Helper.intersection(negativeExamples, posClassified); + SortedSet<Individual> posAsNeg = new TreeSet<Individual>(); + + // piecewise set construction + for (Individual posExample : positiveExamples) { + if (!posClassified.contains(posExample)) + posAsNeg.add(posExample); + } + SortedSet<Individual> negAsNeg = new TreeSet<Individual>(); + for (Individual negExample : negativeExamples) { + if (!posClassified.contains(negExample)) + negAsNeg.add(negExample); + } + return new ScoreTwoValued(concept.getLength(), percentPerLengthUnit, posAsPos, posAsNeg, negAsPos, negAsNeg); + // instance checks for classification + } else { + Set<Individual> posAsPos = new TreeSet<Individual>(); + Set<Individual> posAsNeg = new TreeSet<Individual>(); + Set<Individual> negAsPos = new TreeSet<Individual>(); + Set<Individual> negAsNeg = new TreeSet<Individual>(); + + if (useMultiInstanceChecks != UseMultiInstanceChecks.NEVER) { + SortedSet<Individual> posClassified = getReasoner().hasType(concept, allExamples); + SortedSet<Individual> negClassified = Helper.difference(allExamples, posClassified); + posAsPos = Helper.intersection(positiveExamples, posClassified); + posAsNeg = Helper.intersection(positiveExamples, negClassified); + negAsPos = Helper.intersection(negativeExamples, posClassified); + negAsNeg = Helper.intersection(negativeExamples, negClassified); + + // System.out.println("pos classified: " + posClassified); + + return new ScoreTwoValued(concept.getLength(), percentPerLengthUnit, posAsPos, posAsNeg, negAsPos, + negAsNeg); + } else { + + for (Individual example : positiveExamples) { + if (getReasoner().hasType(concept, example)) { + posAsPos.add(example); + } else { + posAsNeg.add(example); + } + } + for (Individual example : negativeExamples) { + if (getReasoner().hasType(concept, example)) + negAsPos.add(example); + else + negAsNeg.add(example); + } + return new ScoreTwoValued(concept.getLength(), percentPerLengthUnit, posAsPos, posAsNeg, negAsPos, + negAsNeg); + } + } + } else { + + SortedSet<Individual> posAsPos = new TreeSet<Individual>(); + SortedSet<Individual> posAsNeg = new TreeSet<Individual>(); + SortedSet<Individual> negAsPos = new TreeSet<Individual>(); + SortedSet<Individual> negAsNeg = new TreeSet<Individual>(); + + for (Individual example : positiveExamples) { + if (getReasoner().hasType(concept, example)) { + posAsPos.add(example); + } else { + posAsNeg.add(example); + } + } + for (Individual example : negativeExamples) { + if (getReasoner().hasType(concept, example)) + negAsPos.add(example); + else + negAsNeg.add(example); + } + + // TODO: this computes accuracy twice - more elegant method should be implemented + double accuracy = getAccuracyOrTooWeakExact(concept,1); + + return new ScoreTwoValued(concept.getLength(), percentPerLengthUnit, posAsPos, posAsNeg, negAsPos, + negAsNeg, accuracy); + } + } + + /* (non-Javadoc) + * @see org.dllearner.core.LearningProblem#getAccuracy(org.dllearner.core.owl.Description) + */ + @Override + public double getAccuracy(Description description) { + // a noise value of 1.0 means that we never return too weak (-1.0) + return getAccuracyOrTooWeak(description, 1.0); + /* + int coveredPos = 0; + int coveredNeg = 0; + + for (Individual example : positiveExamples) { + if (reasoner.hasType(description, example)) { + coveredPos++; + } + } + for (Individual example : negativeExamples) { + if (reasoner.hasType(description, example)) { + coveredNeg++; + } + } + + return coveredPos + negativeExamples.size() - coveredNeg / (double) allExamples.size(); + */ + } + + @Override + public double getAccuracyOrTooWeak(Description description, double noise) { + // delegates to the appropriate methods + return useApproximations ? getAccuracyOrTooWeakApprox(description, noise) : getAccuracyOrTooWeakExact(description, noise); + } + + public double getAccuracyOrTooWeakApprox(Description description, double noise) { + if(heuristic.equals(HeuristicType.PRED_ACC)) { + int maxNotCovered = (int) Math.ceil(noise*positiveExamples.size()); + + int notCoveredPos = 0; +// int notCoveredNeg = 0; + + int posClassifiedAsPos = 0; + int negClassifiedAsNeg = 0; + + int nrOfPosChecks = 0; + int nrOfNegChecks = 0; + + // special case: we test positive and negative examples in turn + Iterator<Individual> itPos = positiveExamples.iterator(); + Iterator<Individual> itNeg = negativeExamples.iterator(); + + do { + // in each loop we pick 0 or 1 positives and 0 or 1 negative + // and classify it + + if(itPos.hasNext()) { + Individual posExample = itPos.next(); +// System.out.println(posExample); + + if(getReasoner().hasType(description, posExample)) { + posClassifiedAsPos++; + } else { + notCoveredPos++; + } + nrOfPosChecks++; + + // take noise into account + if(notCoveredPos > maxNotCovered) { + return -1; + } + } + + if(itNeg.hasNext()) { + Individual negExample = itNeg.next(); + if(!getReasoner().hasType(description, negExample)) { + negClassifiedAsNeg++; + } + nrOfNegChecks++; + } + + // compute how accurate our current approximation is and return if it is sufficiently accurate + double approx[] = Heuristics.getPredAccApproximation(positiveExamples.size(), negativeExamples.size(), 1, nrOfPosChecks, posClassifiedAsPos, nrOfNegChecks, negClassifiedAsNeg); + if(approx[1]<approxDelta) { +// System.out.println(approx[0]); + return approx[0]; + } + + } while(itPos.hasNext() || itNeg.hasNext()); + + double ret = Heuristics.getPredictiveAccuracy(positiveExamples.size(), negativeExamples.size(), posClassifiedAsPos, negClassifiedAsNeg, 1); + return ret; + + } else if(heuristic.equals(HeuristicType.FMEASURE)) { +// System.out.println("Testing " + description); + + // we abort when there are too many uncovered positives + int maxNotCovered = (int) Math.ceil(noise*positiveExamples.size()); + int instancesCovered = 0; + int instancesNotCovered = 0; + + for(Individual ind : positiveExamples) { + if(getReasoner().hasType(description, ind)) { + instancesCovered++; + } else { + instancesNotCovered ++; + if(instancesNotCovered > maxNotCovered) { + return -1; + } + } + } + + double recall = instancesCovered/(double)positiveExamples.size(); + + int testsPerformed = 0; + int instancesDescription = 0; + + for(Individual ind : negativeExamples) { + + if(getReasoner().hasType(description, ind)) { + instancesDescription++; + } + testsPerformed++; + + // check whether approximation is sufficiently accurate + double[] approx = Heuristics.getFScoreApproximation(instancesCovered, recall, 1, negativeExamples.size(), testsPerformed, instancesDescription); + if(approx[1]<approxDelta) { + return approx[0]; + } + + } + + // standard computation (no approximation) + double precision = instancesCovered/(double)(instancesDescription+instancesCovered); +// if(instancesCovered + instancesDescription == 0) { +// precision = 0; +// } + return Heuristics.getFScore(recall, precision, 1); + } else { + throw new Error("Approximation for " + heuristic + " not implemented."); + } + } + + public double getAccuracyOrTooWeakExact(Description description, double noise) { + if(heuristic.equals(HeuristicType.PRED_ACC)) { + return getPredAccuracyOrTooWeakExact(description, noise); + } else if(heuristic.equals(HeuristicType.FMEASURE)) { + return getFMeasureOrTooWeakExact(description, noise); + /* + // computing R(C) restricted to relevant instances + int additionalInstances = 0; + for(Individual ind : negativeExamples) { + if(reasoner.hasType(description, ind)) { + additionalInstances++; + } + } + + // computing R(A) + int coveredInstances = 0; + for(Individual ind : positiveExamples) { + if(reasoner.hasType(description, ind)) { + coveredInstances++; + } + } + + double recall = coveredInstances/(double)positiveExamples.size(); + double precision = (additionalInstances + coveredInstances == 0) ? 0 : coveredInstances / (double) (coveredInstances + additionalInstances); + + return Heuristics.getFScore(recall, precision); + */ + } else { + throw new Error("Heuristic " + heuristic + " not implemented."); + } + } + + /* (non-Javadoc) + * @see org.dllearner.core.LearningProblem#getAccuracyOrTooWeak(org.dllearner.core.owl.Description, double) + */ + public double getPredAccuracyOrTooWeakExact(Description description, double noise) { + + // System.out.println(errorIndex++); + + // double crispAccuracy = crispAccuracy(description, noise); + // if I erase next line, fuzzy reasoning fails +// if (crispAccuracy == -1) { +// System.out.print(description); +// System.out.println(); +// // return -1; +// } + + // BEGIN + // added by Josue + // fuzzy extension +// double posMembership = 0; +// double negMembership = 0; + double descriptionMembership = 0; + // double accumulatedSingleMembership = 0; + double nonAccumulativeDescriptionMembership = 0; + double accumulativeDescriptionMembership = 0; + +// System.out.println("noise = " + noise); + + // int individualCounter = fuzzyExamples.size(); + double individualCounter = totalTruth; + for (FuzzyIndividual fuzzyExample : fuzzyExamples) { + // accumulatedSingleMembership += singleMembership; + nonAccumulativeDescriptionMembership = 1 - Math.abs(fuzzyExample.getTruthDegree() - getReasoner().hasTypeFuzzyMembership(description, fuzzyExample)); + descriptionMembership += nonAccumulativeDescriptionMembership; + individualCounter -= fuzzyExample.getTruthDegree(); + if ((accumulativeDescriptionMembership + (nonAccumulativeDescriptionMembership * fuzzyExample.getTruthDegree()) + individualCounter) < ((1 - noise) * totalTruth)) + return -1; + accumulativeDescriptionMembership += nonAccumulativeDescriptionMembership * fuzzyExample.getTruthDegree(); + + } + + double fuzzyAccuracy = descriptionMembership / (double)fuzzyExamples.size(); + +// System.err.println("crispAccuracy = fuzzyAccuracy"); +// crispAccuracy = fuzzyAccuracy; + +// if (crispAccuracy != fuzzyAccuracy) { +// System.err.println("***********************************************"); +// //System.err.println("* " + (errorIndex++)); +// System.err.println("* (crispAccuracy[" + crispAccuracy + "] != fuzzyAccuracy[" + fuzzyAccuracy + "])"); +// System.err.println("* DESC: " + description); +// System.err.println("***********************************************"); +// Scanner sc = new Scanner(System.in); +// sc.nextLine(); +// } + + return fuzzyAccuracy; + } + + // added by Josue + private double crispAccuracy(Description description, double noise) { + int maxNotCovered = (int) Math.ceil(noise*positiveExamples.size()); + + int notCoveredPos = 0; + int notCoveredNeg = 0; + + for (Individual example : positiveExamples) { + if (!getReasoner().hasType(description, example)) { + notCoveredPos++; + if(notCoveredPos >= maxNotCovered) { + return -1; + } + } + } + for (Individual example : negativeExamples) { + if (!getReasoner().hasType(description, example)) { + notCoveredNeg++; + } + } + return (positiveExamples.size() - notCoveredPos + notCoveredNeg) / (double) allExamples.size(); + } + + // added by Josue + private double crispfMeasure(Description description, double noise) { + // crisp F-measure + int additionalInstances = 0; + for(Individual ind : negativeExamples) { + if(getReasoner().hasType(description, ind)) { + additionalInstances++; + } + } + + int coveredInstances = 0; + for(Individual ind : positiveExamples) { + if(getReasoner().hasType(description, ind)) { + coveredInstances++; + } + } + + double recall = coveredInstances/(double)positiveExamples.size(); + + if(recall < 1 - noise) { + return -1; + } + + double precision = (additionalInstances + coveredInstances == 0) ? 0 : coveredInstances / (double) (coveredInstances + additionalInstances); + + return Heuristics.getFScore(recall, precision); + } + + public double getFMeasureOrTooWeakExact(Description description, double noise) { + + // added by Josue + // fuzzy F-measure + double coveredMembershipDegree = 0; + double totalMembershipDegree = 0; + double invertedCoveredMembershipDegree = 0; + double lastMembershipDegree = 0; + + for (FuzzyIndividual ind: fuzzyExamples) { + lastMembershipDegree = (1 - Math.abs(ind.getTruthDegree() - getReasoner().hasTypeFuzzyMembership(description, ind))); + coveredMembershipDegree += lastMembershipDegree * ind.getTruthDegree(); + totalMembershipDegree += ind.getTruthDegree(); + invertedCoveredMembershipDegree += (1 - ind.getTruthDegree()) * (1 - lastMembershipDegree); + } + double fuzzyRecall = totalMembershipDegree == 0 ? 0 :coveredMembershipDegree/totalMembershipDegree; + + if(fuzzyRecall < 1 - noise) { + return -1; + } + double fuzzyPrecision = (coveredMembershipDegree + invertedCoveredMembershipDegree) == 0 ? 0: coveredMembershipDegree / (coveredMembershipDegree + invertedCoveredMembershipDegree); + double fuzzyFmeasure = Heuristics.getFScore(fuzzyRecall, fuzzyPrecision); + + // double crispFmeasure = crispfMeasure(description, noise); + + // crispFmeasure = fuzzyFmeasure; + +// if (crispFmeasure != fuzzyFmeasure) { +// System.err.println("************************"); +// System.err.println("* crispFmeasuer = " + crispFmeasure); +// System.err.println("* fuzzyFmeasuer = " + fuzzyFmeasure); +// System.err.println("************************"); +// Scanner sc = new Scanner(System.in); +// sc.nextLine(); +// } + + return fuzzyFmeasure; + } + + // instead of using the standard operation, we use optimisation + // and approximation here; + // now deprecated because the Heuristics helper class is used + @Deprecated + public double getFMeasureOrTooWeakApprox(Description description, double noise) { + // we abort when there are too many uncovered positives + int maxNotCovered = (int) Math.ceil(noise*positiveExamples.size()); + int instancesCovered = 0; + int instancesNotCovered = 0; + int total = 0; + boolean estimatedA = false; + + double lowerBorderA = 0; + int lowerEstimateA = 0; + double upperBorderA = 1; + int upperEstimateA = positiveExamples.size(); + + for(Individual ind : positiveExamples) { + if(getReasoner().hasType(description, ind)) { + instancesCovered++; + } else { + instancesNotCovered ++; + if(instancesNotCovered > maxNotCovered) { + return -1; + } + } + + // approximation step (starting after 10 tests) + total = instancesCovered + instancesNotCovered; + if(total > 10) { + // compute confidence interval + double p1 = ClassLearningProblem.p1(instancesCovered, total); + double p2 = ClassLearningProblem.p3(p1, total); + lowerBorderA = Math.max(0, p1 - p2); + upperBorderA = Math.min(1, p1 + p2); + double size = upperBorderA - lowerBorderA; + // if the interval has a size smaller than 10%, we can be confident + if(size < 2 * approxDelta) { + // we have to distinguish the cases that the accuracy limit is + // below, within, or above the limit and that the mean is below + // or above the limit + double mean = instancesCovered/(double)total; + + // if the mean is greater than the required minimum, we can accept; + // we also accept if the interval is small and close to the minimum + // (worst case is to accept a few inaccurate descriptions) + if(mean > 1-noise || (upperBorderA > mean && size < 0.03)) { + instancesCovered = (int) (instancesCovered/(double)total * positiveExamples.size()); + upperEstimateA = (int) (upperBorderA * positiveExamples.size()); + lowerEstimateA = (int) (lowerBorderA * positiveExamples.size()); + estimatedA = true; + break; + } + + // reject only if the upper border is far away (we are very + // certain not to lose a potential solution) + if(upperBorderA + 0.1 < 1-noise) { + return -1; + } + } + } + } + + double recall = instancesCovered/(double)positiveExamples.size(); + +// MonitorFactory.add("estimatedA","count", estimatedA ? 1 : 0); +// MonitorFactory.add("aInstances","count", total); + + // we know that a definition candidate is always subclass of the + // intersection of all super classes, so we test only the relevant instances + // (leads to undesired effects for descriptions not following this rule, + // but improves performance a lot); + // for learning a superclass of a defined class, similar observations apply; + + + int testsPerformed = 0; + int instancesDescription = 0; +// boolean estimatedB = false; + + for(Individual ind : negativeExamples) { + + if(getReasoner().hasType(description, ind)) { + instancesDescription++; + } + + testsPerformed++; + + if(testsPerformed > 10) { + + // compute confidence interval + double p1 = ClassLearningProblem.p1(instancesDescription, testsPerformed); + double p2 = ClassLearningProblem.p3(p1, testsPerformed); + double lowerBorder = Math.max(0, p1 - p2); + double upperBorder = Math.min(1, p1 + p2); + int lowerEstimate = (int) (lowerBorder * negativeExamples.size()); + int upperEstimate = (int) (upperBorder * negativeExamples.size()); + + double size; + if(estimatedA) { + size = getFMeasure(upperBorderA, upperEstimateA/(double)(upperEstimateA+lowerEstimate)) - getFMeasure(lowerBorderA, lowerEstimateA/(double)(lowerEstimateA+upperEstimate)); + } else { + size = getFMeasure(recall, instancesCovered/(double)(instancesCovered+lowerEstimate)) - getFMeasure(recall, instancesCovered/(double)(instancesCovered+upperEstimate)); + } + + if(size < 0.1) { + instancesDescription = (int) (instancesDescription/(double)testsPerformed * negativeExamples.size()); + break; + } + } + } + + double precision = instancesCovered/(double)(instancesDescription+instancesCovered); + if(instancesCovered + instancesDescription == 0) { + precision = 0; + } + +// System.out.println("description: " + description); +// System.out.println("recall: " + recall); +// System.out.println("precision: " + precision); +// System.out.println("F-measure: " + getFMeasure(recall, precision)); +// System.out.println("exact: " + getAccuracyOrTooWeakExact(description, noise)); + + return getFMeasure(recall, precision); + } + + + /* (non-Javadoc) + * @see org.dllearner.core.LearningProblem#evaluate(org.dllearner.core.owl.Description) + */ + @Override + public EvaluatedDescription evaluate(Description description) { + ScorePosNeg score = computeScore(description); + return new EvaluatedDescriptionPosNeg(description, score); + } + + private double getFMeasure(double recall, double precision) { + return 2 * precision * recall / (precision + recall); + } + + public double getApproxDelta() { + return approxDelta; + } + + public void setApproxDelta(double approxDelta) { + this.approxDelta = approxDelta; + } + + public boolean isUseApproximations() { + return useApproximations; + } + + public void setUseApproximations(boolean useApproximations) { + this.useApproximations = useApproximations; + } + + public HeuristicType getHeuristic() { + return heuristic; + } + + public void setHeuristic(HeuristicType heuristic) { + this.heuristic = heuristic; + } + + public String getAccuracyMethod() { + return accuracyMethod; + } + + public void setAccuracyMethod(String accuracyMethod) { + this.accuracyMethod = accuracyMethod; + } + +} Deleted: trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLP.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLP.java 2011-08-31 18:05:10 UTC (rev 3199) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLP.java 2011-08-31 18:08:40 UTC (rev 3200) @@ -1,193 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.learningproblems.fuzzydll; - -import java.util.Collection; -import java.util.LinkedList; -import java.util.Set; -import java.util.SortedSet; - -import org.dllearner.core.AbstractLearningProblem; -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.options.BooleanConfigOption; -import org.dllearner.core.options.CommonConfigMappings; -import org.dllearner.core.options.CommonConfigOptions; -import org.dllearner.core.options.ConfigEntry; -import org.dllearner.core.options.ConfigOption; -import org.dllearner.core.options.InvalidConfigOptionValueException; -import org.dllearner.core.options.StringConfigOption; -import org.dllearner.core.options.StringSetConfigOption; -import org.dllearner.core.options.fuzzydll.FuzzyExample; -import org.dllearner.core.options.fuzzydll.ObjectSetConfigOption; -import org.dllearner.core.owl.Description; -import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.fuzzydll.FuzzyIndividual; -import org.dllearner.utilities.Helper; - -/** - * @author Jens Lehmann - * - */ -public abstract class FuzzyPosNegLP extends AbstractLearningProblem { - - protected SortedSet<Individual> positiveExamples; - protected SortedSet<Individual> negativeExamples; - protected SortedSet<Individual> allExamples; - - protected SortedSet<FuzzyIndividual> fuzzyExamples; - - - protected boolean useRetrievalForClassification = false; - protected UseMultiInstanceChecks useMultiInstanceChecks = UseMultiInstanceChecks.TWOCHECKS; - protected double percentPerLengthUnit = 0.05; - protected double totalTruth = 0; - - /** - * If instance checks are used for testing concepts (e.g. no retrieval), then - * there are several options to do this. The enumeration lists the supported - * options. These options are only important if the reasoning mechanism - * supports sending several reasoning requests at once as it is the case for - * DIG reasoners. - * - * @author Jens Lehmann - * - */ - public enum UseMultiInstanceChecks { - /** - * Perform a separate instance check for each example. - */ - NEVER, - /** - * Perform one instance check for all positive and one instance check - * for all negative examples. - */ - TWOCHECKS, - /** - * Perform all instance checks at once. - */ - ONECHECK - }; - - public FuzzyPosNegLP() { - - } - - public FuzzyPosNegLP(AbstractReasonerComponent reasoningService) { - super(reasoningService); - } - - public static Collection<ConfigOption<?>> createConfigOptions() { - Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - // changed by Josue - options.add(new ObjectSetConfigOption("fuzzyExamples", - "fuzzy examples",null, true, false)); - // TODO positiveExamples and negativeExamples must desapear here - options.add(new StringSetConfigOption("positiveExamples", - "positive examples",null, true, false)); - options.add(new StringSetConfigOption("negativeExamples", - "negative examples",null, true, false)); - options.add(new BooleanConfigOption("useRetrievalForClassficiation", - "Specifies whether to use retrieval or instance checks for testing a concept. - NO LONGER FULLY SUPPORTED.", false)); - options.add(CommonConfigOptions.getPercentPerLenghtUnitOption(0.05)); - StringConfigOption multiInstanceChecks = new StringConfigOption("useMultiInstanceChecks", "See UseMultiInstanceChecks enum. - NO LONGER FULLY SUPPORTED.","twoChecks"); - multiInstanceChecks.setAllowedValues(new String[] {"never", "twoChecks", "oneCheck"}); - options.add(multiInstanceChecks); - return options; - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) - */ - @Override - @SuppressWarnings( { "unchecked" }) - public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { - String name = entry.getOptionName(); - // added by Josue - if (name.equals("fuzzyExamples")){ - fuzzyExamples = CommonConfigMappings.getFuzzyIndividualSet((Set<FuzzyExample>) entry.getValue()); - for (FuzzyIndividual fuzzyExample : fuzzyExamples) { - totalTruth += fuzzyExample.getTruthDegree(); - } - } - // TODO delete positiveExamples & negativeExamples - else if (name.equals("positiveExamples")) - positiveExamples = CommonConfigMappings - .getIndividualSet((Set<String>) entry.getValue()); // changed by Josue - else if (name.equals("negativeExamples")) - negativeExamples = CommonConfigMappings - .getIndividualSet((Set<String>) entry.getValue()); // changed by Josue - else if (name.equals("useRetrievalForClassficiation")) { - useRetrievalForClassification = (Boolean) entry.getValue(); - } else if (name.equals("percentPerLengthUnit")) - percentPerLengthUnit = (Double) entry.getValue(); - else if (name.equals("useMultiInstanceChecks")) { - String value = (String) entry.getValue(); - if(value.equals("oneCheck")) - useMultiInstanceChecks = UseMultiInstanceChecks.ONECHECK; - else if(value.equals("twoChecks")) - useMultiInstanceChecks = UseMultiInstanceChecks.TWOCHECKS; - else - useMultiInstanceChecks = UseMultiInstanceChecks.NEVER; - } - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.Component#init() - */ - @Override - public void init() { - allExamples = Helper.union(positiveExamples, negativeExamples); - } - - public SortedSet<Individual> getNegativeExamples() { - return negativeExamples; - } - - public SortedSet<Individual> getPositiveExamples() { - return positiveExamples; - } - - public void setNegativeExamples(SortedSet<Individual> set) { - this.negativeExamples=set; - } - - public void setPositiveExamples(SortedSet<Individual> set) { - this.positiveExamples=set; - } - - public abstract int coveredNegativeExamplesOrTooWeak(Description concept); - - public double getPercentPerLengthUnit() { - return percentPerLengthUnit; - } - - public SortedSet<FuzzyIndividual> getFuzzyExamples() { - return fuzzyExamples; - } - - public void setFuzzyExamples(SortedSet<FuzzyIndividual> fuzzyExamples) { - this.fuzzyExamples = fuzzyExamples; - } - -} Deleted: 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-08-31 18:05:10 UTC (rev 3199) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/fuzzydll/FuzzyPosNegLPStandard.java 2011-08-31 18:08:40 UTC (rev 3200) @@ -1,820 +0,0 @@ -/** - * Copyright (C) 2007-2011, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.dllearner.learningproblems.fuzzydll; - -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; - -import org.dllearner.core.AbstractReasonerComponent; -import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.fuzzydll.FuzzyUnsupportedCodeException; -import org.dllearner.core.options.BooleanConfigOption; -import org.dllearner.core.options.ConfigOption; -import org.dllearner.core.options.DoubleConfigOption; -import org.dllearner.core.options.StringConfigOption; -import org.dllearner.core.owl.Description; -import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.fuzzydll.FuzzyIndividual; -import org.dllearner.learningproblems.ClassLearningProblem; -import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg; -import org.dllearner.learningproblems.Heuristics; -import org.dllearner.learningproblems.Heuristics.HeuristicType; -import org.dllearner.learningproblems.ScorePosNeg; -import org.dllearner.learningproblems.ScoreTwoValued; -import org.dllearner.utilities.Helper; - -/** - * The aim of this learning problem is to learn a concept definition such that - * the positive examples and the negative examples do not follow. It is - * 2-valued, because we only distinguish between covered and non-covered - * examples. (A 3-valued problem distinguishes between covered examples, - * examples covered by the negation of the concept, and all other examples.) The - * 2-valued learning problem is often more useful for Description Logics due to - * (the Open World Assumption and) the fact that negative knowledge, e.g. that a - * person does not have a child, is or cannot be expressed. - * - * @author Jens Lehmann - * - */ -public class FuzzyPosNegLPStandard extends FuzzyPosNegLP { - - // approximation and F-measure - // (taken from class learning => super class instances corresponds to negative examples - // and class instances to positive examples) - private double approxDelta = 0.05; - private boolean useApproximations; -// private boolean useFMeasure; - private boolean useOldDIGOptions = false; - - private HeuristicType heuristic = HeuristicType.PRED_ACC; - - private int errorIndex = 0; - - private String accuracyMethod; - - public FuzzyPosNegLPStandard() { - - } - - public FuzzyPosNegLPStandard(AbstractReasonerComponent reasoningService) { - super(reasoningService); - } - - public FuzzyPosNegLPStandard(AbstractReasonerComponent reasoningService, SortedSet<Individual> positiveExamples, SortedSet<Individual> negativeExamples) { - super(reasoningService); - this.positiveExamples = positiveExamples; - this.negativeExamples = negativeExamples; - } - - @Override - public void init() { - super.init(); -// useApproximations = configurator.getUseApproximations(); -// approxDelta = configurator.getApproxAccuracy(); - - String accM = getAccuracyMethod(); - if(accM.equals("standard")) { - heuristic = HeuristicType.AMEASURE; - } else if(accM.equals("fmeasure")) { - heuristic = HeuristicType.FMEASURE; - } else if(accM.equals("generalised_fmeasure")) { - heuristic = HeuristicType.GEN_FMEASURE; - } else if(accM.equals("jaccard")) { - heuristic = HeuristicType.JACCARD; - } else if(accM.equals("pred_acc")) { - heuristic = HeuristicType.PRED_ACC; - } - -// useFMeasure = configurator.getAccuracyMethod().equals("fmeasure"); - -// if((!useApproximations && useFMeasure) || (useApproximations && !useFMeasure)) { -// System.err.println("Currently F measure can only be used in combination with approximated reasoning."); -// System.exit(0); -// } - - if(useApproximations && heuristic.equals(HeuristicType.PRED_ACC)) { - System.err.println("Approximating predictive accuracy is an experimental feature. USE IT AT YOUR OWN RISK. If you consider to use it for anything serious, please extend the unit tests at org.dllearner.test.junit.HeuristicTests first and verify that it works."); - } - - } - - /* - * (non-Javadoc) - * - * @see org.dllearner.core.Component#getName() - */ - public static String getName() { - return "fuzzy pos neg learning problem"; - } - - public static Collection<ConfigOption<?>> createConfigOptions() { - Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(FuzzyPosNegLP.createConfigOptions()); - BooleanConfigOption approx = new BooleanConfigOption("useApproximations", "whether to use stochastic approximations for computing accuracy", false); - options.add(approx); - DoubleConfigOption approxAccuracy = new DoubleConfigOption("approxAccuracy", "accuracy of the approximation (only for expert use)", 0.05); - options.add(approxAccuracy); - StringConfigOption accMethod = new StringConfigOption("accuracyMethod", "Specifies, which method/function to use for computing accuracy.","predacc"); // or domain/range of a property. - accMethod.setAllowedValues(new String[] {"fmeasure", "predacc"}); - options.add(accMethod); - return options; - } - - /** - * This method computes (using the reasoner) whether a concept is too weak. - * If it is not weak, it returns the number of covered negative examples. It - * can use retrieval or instance checks for classification. - * - * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks - * TODO: Performance could be slightly improved by counting the number of - * covers instead of using sets and counting their size. - * @param concept - * The concept to test. - * @return -1 if concept is too weak and the number of covered negative - * examples otherwise. - */ - @Override - public int coveredNegativeExamplesOrTooWeak(Description concept) { - try { - throw new FuzzyUnsupportedCodeException(); - } catch (FuzzyUnsupportedCodeException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - System.exit(0); - } -// if (useRetrievalForClassification) { -// SortedSet<Individual> posClassified = reasoner.getIndividuals(concept); -// SortedSet<Individual> negAsPos = Helper.intersection(negativeExamples, posClassified); -// SortedSet<Individual> posAsNeg = new TreeSet<Individual>(); -// -// // the set is constructed piecewise to avoid expensive set -// // operations -// // on a large number of individuals -// for (Individual posExample : positiveExamples) { -// if (!posClassified.contains(posExample)) -// posAsNeg.add(posExample); -// } -// -// // too weak -// if (posAsNeg.size() > 0) -// return -1; -// // number of covered negatives -// else -// return negAsPos.size(); -// } else { -// if (useMultiInstanceChecks != UseMultiInstanceChecks.NEVER) { -// // two checks -// if (useMultiInstanceChecks == UseMultiInstanceChecks.TWOCHECKS) { -// Set<Individual> s = reasoner.hasTypeFuzzyMembership(concept, positiveExamples); -// // if the concept is too weak, then do not query negative -// // examples -// if (s.size() != positiveExamples.size()) -// return -1; -// else { -// s = reasoner.hasTypeFuzzyMembership(concept, negativeExamples); -// return s.size(); -// } -// // one check -// } else { -// Set<Individual> s = reasoner.hasTypeFuzzyMembership(concept, allExamples); -// // test whether all positive examples are covered -// if (s.containsAll(positiveExamples)) -// return s.size() - positiveExamples.size(); -// else -// return -1; -// } -// } else { -// // SortedSet<Individual> posAsNeg = new TreeSet<Individual>(); -// SortedSet<Individual> negAsPos = new TreeSet<Individual>(); -// -// for (Individual example : positiveExamples) { -// if (!reasoner.hasType(concept, example)) -// return -1; -// // posAsNeg.add(example); -// } -// for (Individual example : negativeExamples) { -// if (reasoner.hasType(concept, example)) -// negAsPos.add(example); -// } -// -// return negAsPos.size(); -// } -// } - return -1; - } - - /** - * Computes score of a given concept using the reasoner. Either retrieval or - * instance check are used. For the latter, this method treats - * <code>UseMultiInstanceChecks.TWO_CHECKS</code> as if it were - * <code>UseMultiInstanceChecks.ONE_CHECKS</code> (it does not make much sense - * to implement TWO_CHECKS in this function, because we have to test all - * examples to create a score object anyway). - * - * NOTE: The options above are no longer supported, because of interface changes (the options - * are more or less only relevant in combination with DIG). - * - * @see org.dllearner.learningproblems.PosNegLP.UseMultiInstanceChecks - * @param concept - * The concept to test. - * @return Corresponding Score object. - */ - @Override - public ScorePosNeg computeScore(Description concept) { - if(useOldDIGOptions) { - if (useRetrievalForClassification) { - SortedSet<Individual> posClassified = getReasoner().getIndividuals(concept); - Set<Individual> posAsPos = Helper.intersection(positiveExamples, posClassified); - Set<Individual> negAsPos = Helper.intersection(negativeExamples, posClassified); - SortedSet<Individual> posAsNeg = new TreeSet<Individual>(); - - // piecewise set construction - for (Individual posExample : positiveExamples) { - if (!posClassified.contains(posExample)) - posAsNeg.add(posExample); - } - SortedSet<Individual> negAsNeg = new TreeSet<Individual>(); - for (Individual negExample : negativeExamples) { - if (!posClassified.contains(negExample)) - negAsNeg.add(negExample); - } - return new ScoreTwoValued(concept.getLength(), percentPerLengthUnit, posAsPos, posAsNeg, negAsPos, negAsNeg); - // instance checks for classification - } else { - Set<Individual> posAsPos = new TreeSet<Individual>(); - Set<Individual> posAsNeg = new TreeSet<Individual>(); - Set<Individual> negAsPos = new TreeSet<Individual>(); - Set<Individual> negAsNeg = new TreeSet<Individual>(); - - if (useMultiInstanceChecks != UseMultiInstanceChecks.NEVER) { - SortedSet<Individual> posClassified = getReasoner().hasType(concept, allExamples); - SortedSet<Individual> negClassified = Helper.difference(allExamples, posClassified); - posAsPos = Helper.intersection(positiveExamples, posClassified); - posAsNeg = Helper.intersection(positiveExamples, negClassified); - negAsPos = Helper.intersection(negativeExamples, posClassified); - negAsNeg = Helper.intersection(negativeExamples, negClassified); - - // System.out.println("pos classified: " + posClassified); - - return new ScoreTwoValued(concept.getLength(), percentPerLengthUnit, posAsPos, posAsNeg, negAsPos, - negAsNeg); - } else { - - for (Individual example : positiveExamples) { - if (getReasoner().hasType(concept, example)) { - posAsPos.add(example); - } else { - posAsNeg.add(example); - } - } - for (Individual example : negativeExamples) { - if (getReasoner().hasType(concept, example)) - negAsPos.add(example); - else - negAsNeg.add(example); - } - return new ScoreTwoValued(concept.getLength(), percentPerLengthUnit, posAsPos, posAsNeg, negAsPos, - negAsNeg); - } - } - } else { - - SortedSet<Individual> posAsPos = new TreeSet<Individual>(); - SortedSet<Individual> posAsNeg = new TreeSet<Individual>(); - SortedSet<Individual> negAsPos = new TreeSet<Individual>(); - SortedSet<Individual> negAsNeg = new TreeSet<Individual>(); - - for (Individual example : positiveExamples) { - if (getReasoner().hasType(concept, example)) { - posAsPos.add(example); - } else { - posAsNeg.add(example); - } - } - for (Individual example : negativeExamples) { - if (getReasoner().hasType(concept, example)) - negAsPos.add(example); - else - negAsNeg.add(example); - } - - // TODO: this computes accuracy twice - more elegant method should be implemented - double accuracy = getAccuracyOrTooWeakExact(concept,1); - - return new ScoreTwoValued(concept.getLength(), p... [truncated message content] |
From: <sha...@us...> - 2011-09-01 03:50:16
|
Revision: 3202 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3202&view=rev Author: shadowtm Date: 2011-09-01 03:50:09 +0000 (Thu, 01 Sep 2011) Log Message: ----------- Moved converter to a separate package. Modified Paths: -------------- trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml Added Paths: ----------- trunk/components-core/src/main/java/org/dllearner/utilities/datastructures/MapToStringTupleListConverter.java Removed Paths: ------------- trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java Deleted: trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java 2011-08-31 18:10:17 UTC (rev 3201) +++ trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java 2011-09-01 03:50:09 UTC (rev 3202) @@ -1,34 +0,0 @@ -package org.dllearner.core.converter; - -import org.dllearner.utilities.datastructures.StringTuple; -import org.springframework.core.convert.converter.Converter; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Created by IntelliJ IDEA. - * User: Chris - * Date: 8/28/11 - * Time: 6:37 AM - * - * Convert Maps of String to String Tuple List - */ -public class MapToStringTupleListConverter implements Converter<Map<String,String>,List<StringTuple>> { - - @Override - public List<StringTuple> convert(Map<String,String> source) { - List<StringTuple> result = new ArrayList<StringTuple>(); - - Set<String> keys = source.keySet(); - - for (String key : keys) { - String value = source.get(key); - result.add(new StringTuple(key, value)); - } - - return result; - } -} Copied: trunk/components-core/src/main/java/org/dllearner/utilities/datastructures/MapToStringTupleListConverter.java (from rev 3201, trunk/components-core/src/main/java/org/dllearner/core/converter/MapToStringTupleListConverter.java) =================================================================== --- trunk/components-core/src/main/java/org/dllearner/utilities/datastructures/MapToStringTupleListConverter.java (rev 0) +++ trunk/components-core/src/main/java/org/dllearner/utilities/datastructures/MapToStringTupleListConverter.java 2011-09-01 03:50:09 UTC (rev 3202) @@ -0,0 +1,34 @@ +package org.dllearner.utilities.datastructures; + +import org.dllearner.utilities.datastructures.StringTuple; +import org.springframework.core.convert.converter.Converter; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * Created by IntelliJ IDEA. + * User: Chris + * Date: 8/28/11 + * Time: 6:37 AM + * + * Convert Maps of String to String Tuple List + */ +public class MapToStringTupleListConverter implements Converter<Map<String,String>,List<StringTuple>> { + + @Override + public List<StringTuple> convert(Map<String,String> source) { + List<StringTuple> result = new ArrayList<StringTuple>(); + + Set<String> keys = source.keySet(); + + for (String key : keys) { + String value = source.get(key); + result.add(new StringTuple(key, value)); + } + + return result; + } +} Modified: trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml =================================================================== --- trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml 2011-08-31 18:10:17 UTC (rev 3201) +++ trunk/interfaces/src/main/resources/org/dllearner/configuration/spring/bean-post-processor-configuration.xml 2011-09-01 03:50:09 UTC (rev 3202) @@ -24,7 +24,7 @@ class="org.springframework.context.support.ConversionServiceFactoryBean"> <property name="converters"> <set> - <bean class="org.dllearner.core.converter.MapToStringTupleListConverter"/> + <bean class="org.dllearner.utilities.datastructures.MapToStringTupleListConverter"/> </set> </property> </bean> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-09-02 06:14:17
|
Revision: 3216 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3216&view=rev Author: jenslehmann Date: 2011-09-02 06:14:11 +0000 (Fri, 02 Sep 2011) Log Message: ----------- fixed some problems in enrichment script Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java trunk/components-core/src/main/java/org/dllearner/algorithms/SimpleSubclassLearner.java trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java Removed Paths: ------------- trunk/components-core/src/main/java/org/dllearner/core/converter/ Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java 2011-09-02 00:33:56 UTC (rev 3215) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/DisjointClassesLearner.java 2011-09-02 06:14:11 UTC (rev 3216) @@ -179,6 +179,11 @@ } @Override + public List<EvaluatedAxiom> getCurrentlyBestEvaluatedAxioms() { + return getCurrentlyBestEvaluatedAxioms(currentlyBestEvaluatedDescriptions.size()); + } + + @Override public List<EvaluatedAxiom> getCurrentlyBestEvaluatedAxioms(int nrOfAxioms) { List<EvaluatedAxiom> axioms = new ArrayList<EvaluatedAxiom>(); Set<Description> descriptions; Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/SimpleSubclassLearner.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/SimpleSubclassLearner.java 2011-09-02 00:33:56 UTC (rev 3215) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/SimpleSubclassLearner.java 2011-09-02 06:14:11 UTC (rev 3216) @@ -77,6 +77,11 @@ } @Override + public List<EvaluatedAxiom> getCurrentlyBestEvaluatedAxioms() { + return getCurrentlyBestEvaluatedAxioms(currentlyBestEvaluatedDescriptions.size()); + } + + @Override public List<Description> getCurrentlyBestDescriptions(int nrOfDescriptions) { List<Description> bestDescriptions = new ArrayList<Description>(); for(EvaluatedDescription evDesc : getCurrentlyBestEvaluatedDescriptions(nrOfDescriptions)){ Modified: trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java 2011-09-02 00:33:56 UTC (rev 3215) +++ trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java 2011-09-02 06:14:11 UTC (rev 3216) @@ -44,7 +44,7 @@ * @author Lorenz Bühmann * @author Jens Lehmann */ -public class AbstractAxiomLearningAlgorithm extends AbstractComponent implements AxiomLearningAlgorithm{ +public abstract class AbstractAxiomLearningAlgorithm extends AbstractComponent implements AxiomLearningAlgorithm{ private static final Logger logger = LoggerFactory.getLogger(AbstractAxiomLearningAlgorithm.class); @@ -91,11 +91,6 @@ return bestAxioms; } - @Override - public List<EvaluatedAxiom> getCurrentlyBestEvaluatedAxioms() { - return null; - } - public List<EvaluatedAxiom> getCurrentlyBestEvaluatedAxioms(int nrOfAxioms) { return getCurrentlyBestEvaluatedAxioms(nrOfAxioms, 0.0); } Modified: trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java 2011-09-02 00:33:56 UTC (rev 3215) +++ trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java 2011-09-02 06:14:11 UTC (rev 3216) @@ -53,6 +53,7 @@ * * @return */ + @Deprecated Class<? extends PropertyEditor> propertyEditorClass() default PropertyEditor.class; /** Modified: trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java 2011-09-02 00:33:56 UTC (rev 3215) +++ trunk/components-core/src/main/java/org/dllearner/learningproblems/ClassLearningProblem.java 2011-09-02 06:14:11 UTC (rev 3216) @@ -62,7 +62,7 @@ private static Logger logger = Logger.getLogger(ClassLearningProblem.class); private long nanoStartTime; - private static int maxExecutionTimeInSeconds = 10; + private int maxExecutionTimeInSeconds = 10; // TODO: config option private NamedClass classToDescribe; @@ -857,12 +857,12 @@ return equivalence ? getReasoner().isEquivalentClass(description, classToDescribe) : getReasoner().isSuperClassOf(description, classToDescribe); } - public static int getMaxExecutionTimeInSeconds() { + public int getMaxExecutionTimeInSeconds() { return maxExecutionTimeInSeconds; } - public static void setMaxExecutionTimeInSeconds(int maxExecutionTimeInSeconds) { - ClassLearningProblem.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; + public void setMaxExecutionTimeInSeconds(int maxExecutionTimeInSeconds) { + this.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; } public boolean isEquivalence() { Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2011-09-02 00:33:56 UTC (rev 3215) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2011-09-02 06:14:11 UTC (rev 3216) @@ -20,9 +20,11 @@ package org.dllearner.reasoning; import java.io.File; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Arrays; import java.util.Set; import java.util.SortedSet; import java.util.TreeMap; @@ -145,6 +147,10 @@ super(sources); } + public FastInstanceChecker(AbstractKnowledgeSource... sources) { + super(new HashSet<AbstractKnowledgeSource>(Arrays.asList(sources))); + } + /** * @return The name of this component. */ Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-09-02 00:33:56 UTC (rev 3215) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-09-02 06:14:11 UTC (rev 3216) @@ -351,9 +351,7 @@ System.out.println("done (" + negExStr.size()+ ")"); - ComponentManager cm = ComponentManager.getInstance(); - - SparqlKnowledgeSource ks2 = cm.knowledgeSource(SparqlKnowledgeSource.class); + SparqlKnowledgeSource ks2 = new SparqlKnowledgeSource(); ks2.setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); ks2.setUrl(ks.getEndpoint().getURL()); ks2.setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs())); @@ -366,11 +364,11 @@ ks2.init(); System.out.println("done"); - AbstractReasonerComponent rc = cm.reasoner(FastInstanceChecker.class, ks2); + AbstractReasonerComponent rc = new FastInstanceChecker(ks2); rc.init(); // TODO: super class learning - ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, rc); + ClassLearningProblem lp = new ClassLearningProblem(rc); // lp.setPositiveExamples(posExamples); // lp.setNegativeExamples(negExamples); // try { @@ -386,12 +384,7 @@ lp.setMaxExecutionTimeInSeconds(10); lp.init(); - CELOE la = null; - try { - la = cm.learningAlgorithm(CELOE.class, lp, rc); - } catch (LearningProblemUnsupportedException e) { - e.printStackTrace(); - } + CELOE la = new CELOE(lp, rc); // CELOEConfigurator cc = la.getConfigurator(); la.setMaxExecutionTimeInSeconds(10); la.setNoisePercentage(25); @@ -414,8 +407,7 @@ evaluatedAxioms.add(new EvaluatedAxiom(axiom, score)); } - algorithmRuns.add(new AlgorithmRun(CELOE.class, evaluatedAxioms, ConfigHelper.getConfigOptionValuesString(la))); - cm.freeAllComponents(); + algorithmRuns.add(new AlgorithmRun(CELOE.class, evaluatedAxioms, ConfigHelper.getConfigOptionValuesString(la))); return evaluatedAxioms; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-09-02 07:50:34
|
Revision: 3221 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3221&view=rev Author: jenslehmann Date: 2011-09-02 07:50:27 +0000 (Fri, 02 Sep 2011) Log Message: ----------- fixed bug and improved formatting in enrichment script Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/utilities/CommonPrefixMap.java trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java Modified: trunk/components-core/src/main/java/org/dllearner/utilities/CommonPrefixMap.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/utilities/CommonPrefixMap.java 2011-09-02 07:22:35 UTC (rev 3220) +++ trunk/components-core/src/main/java/org/dllearner/utilities/CommonPrefixMap.java 2011-09-02 07:50:27 UTC (rev 3221) @@ -24,6 +24,8 @@ /** * Can be used as base for a prefix map. * + * TODO: We might implement a version of this class, which is synchronised with prefix.cc. + * * @author Jens Lehmann * */ @@ -32,8 +34,11 @@ private static final long serialVersionUID = 5434065917532534702L; public CommonPrefixMap() { + put("dbpedia","http://dbpedia.org/resource/"); put("dbp","http://dbpedia.org/property/"); put("dbo","http://dbpedia.org/ontology/"); + put("yago","http://dbpedia.org/class/yago/"); + put("gml","http://www.opengis.net/gml/"); } } Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-09-02 07:22:35 UTC (rev 3220) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-09-02 07:50:27 UTC (rev 3221) @@ -77,7 +77,6 @@ import org.dllearner.core.AxiomLearningAlgorithm; import org.dllearner.core.ComponentAnn; import org.dllearner.core.ComponentInitException; -import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedAxiom; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; @@ -128,7 +127,6 @@ import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.ModelFactory; -import com.hp.hpl.jena.rdf.model.Statement; /** * Command Line Interface for Enrichment. @@ -200,6 +198,10 @@ private CommonPrefixMap prefixes = new CommonPrefixMap(); + // cache for SparqKnowledgeSource + SparqlKnowledgeSource ksCached; + AbstractReasonerComponent rcCached; + public Enrichment(SparqlEndpoint se, Entity resource, double threshold, boolean verbose) { this.se = se; this.resource = resource; @@ -303,8 +305,8 @@ // System.out.println("Running algorithms for class " + nc); for (Class<? extends LearningAlgorithm> algorithmClass : classAlgorithms) { if(algorithmClass == CELOE.class) { - applyCELOE(ks, nc, false); - applyCELOE(ks, nc, true); + applyCELOE(ks, nc, false, false); + applyCELOE(ks, nc, true, true); } else { applyLearningAlgorithm((Class<AxiomLearningAlgorithm>)algorithmClass, ks, nc); } @@ -325,73 +327,67 @@ } } - private List<EvaluatedAxiom> applyCELOE(SparqlEndpointKS ks, NamedClass nc, boolean equivalence) throws ComponentInitException { -// SPARQLTasks st = new SPARQLTasks(se); - + private List<EvaluatedAxiom> applyCELOE(SparqlEndpointKS ks, NamedClass nc, boolean equivalence, boolean reuseKnowledgeSource) throws ComponentInitException { + // get instances of class as positive examples SPARQLReasoner sr = new SPARQLReasoner(ks); SortedSet<Individual> posExamples = sr.getIndividuals(nc, 20); SortedSet<String> posExStr = Helper.getStringSet(posExamples); - // get negative examples via various strategies -// AutomaticNegativeExampleFinderSPARQL finder = new AutomaticNegativeExampleFinderSPARQL(posExStr, st, null); -// finder.makeNegativeExamplesFromNearbyClasses(posExStr, 50); -// finder.makeNegativeExamplesFromParallelClasses(posExStr, 50); -// finder.makeNegativeExamplesFromRelatedInstances(posExStr, "http://dbpedia.org/resource/"); -// finder.makeNegativeExamplesFromSuperClasses(resource.getName(), 50); -// finder.makeNegativeExamplesFromRandomInstances(); -// SortedSet<String> negExStr = finder.getNegativeExamples(50, false); // use own implementation of negative example finder + long startTime = System.currentTimeMillis(); System.out.print("finding negatives ... "); AutomaticNegativeExampleFinderSPARQL2 finder = new AutomaticNegativeExampleFinderSPARQL2(ks.getEndpoint()); SortedSet<String> negExStr = finder.getNegativeExamples(nc.getName(), posExStr); negExStr = SetManipulation.fuzzyShrink(negExStr, 20); SortedSet<Individual> negExamples = Helper.getIndividualSet(negExStr); SortedSetTuple<Individual> examples = new SortedSetTuple<Individual>(posExamples, negExamples); + long runTime = System.currentTimeMillis() - startTime; + System.out.println("done (" + negExStr.size()+ " examples fround in " + runTime + " ms)"); - System.out.println("done (" + negExStr.size()+ ")"); - - SparqlKnowledgeSource ks2 = new SparqlKnowledgeSource(); - ks2.setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); - ks2.setUrl(ks.getEndpoint().getURL()); - ks2.setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs())); - ks2.setUseLits(false); - ks2.setUseCacheDatabase(true); - ks2.setRecursionDepth(2); - ks2.setCloseAfterRecursion(true); -// ks2.getConfigurator().setSaveExtractedFragment(true); - System.out.println("getting fragment ... "); - ks2.init(); - System.out.println("done"); + SparqlKnowledgeSource ks2; + AbstractReasonerComponent rc; + if(reuseKnowledgeSource) { + ks2 = ksCached; + rc = rcCached; + System.out.println("re-using previously generated knowledge base fragment"); + } else { + ks2 = new SparqlKnowledgeSource(); + ks2.setInstances(Datastructures.individualSetToStringSet(examples.getCompleteSet())); + ks2.setUrl(ks.getEndpoint().getURL()); + ks2.setDefaultGraphURIs(new TreeSet<String>(ks.getEndpoint().getDefaultGraphURIs())); + ks2.setUseLits(false); + ks2.setUseCacheDatabase(true); + ks2.setRecursionDepth(2); + ks2.setCloseAfterRecursion(true); + startTime = System.currentTimeMillis(); + System.out.print("getting knowledge base fragment ... "); + ks2.init(); + runTime = System.currentTimeMillis() - startTime; + System.out.println("done in " + runTime + " ms"); + rc = new FastInstanceChecker(ks2); + rc.init(); + ksCached = ks2; + rcCached = rc; + } - AbstractReasonerComponent rc = new FastInstanceChecker(ks2); - rc.init(); - - // TODO: super class learning ClassLearningProblem lp = new ClassLearningProblem(rc); -// lp.setPositiveExamples(posExamples); -// lp.setNegativeExamples(negExamples); -// try { - lp.setClassToDescribe(nc); -// } catch (MalformedURLException e1) { -// e1.printStackTrace(); -// } -// lp.setType("equivalence"); - lp.setEquivalence(true); -// lp.setAccuracyMethod("fmeasure"); + lp.setClassToDescribe(nc); + lp.setEquivalence(equivalence); lp.setHeuristic(HeuristicType.FMEASURE); lp.setUseApproximations(false); lp.setMaxExecutionTimeInSeconds(10); lp.init(); CELOE la = new CELOE(lp, rc); -// CELOEConfigurator cc = la.getConfigurator(); la.setMaxExecutionTimeInSeconds(10); la.setNoisePercentage(25); la.init(); - System.out.print("running CELOE (for " + (equivalence ? "EquivalentClasses" : "SubClasses)") + "... "); + startTime = System.currentTimeMillis(); + System.out.print("running CELOE (for " + (equivalence ? "equivalent classes" : "sub classes") + ") ... "); la.start(); - System.out.println("done"); + runTime = System.currentTimeMillis() - startTime; + System.out.println("done in " + runTime + " ms"); // convert the result to axioms (to make it compatible with the other algorithms) List<? extends EvaluatedDescription> learnedDescriptions = la.getCurrentlyBestEvaluatedDescriptions(threshold); @@ -440,7 +436,7 @@ } } long runtime = System.currentTimeMillis() - startTime; - System.out.println("done in " + runtime + "ms"); + System.out.println("done in " + runtime + " ms"); List<EvaluatedAxiom> learnedAxioms = learner .getCurrentlyBestEvaluatedAxioms(nrOfAxiomsToLearn, threshold); System.out.println(prettyPrint(learnedAxioms)); @@ -464,8 +460,8 @@ private String prettyPrint(EvaluatedAxiom axiom) { double acc = axiom.getScore().getAccuracy() * 100; String accs = df.format(acc); - if(acc<10d) { accs = " " + accs; } - if(acc<100d) { accs = " " + accs; } + if(accs.length()==3) { accs = " " + accs; } + if(accs.length()==4) { accs = " " + accs; } String str = accs + "%\t" + axiom.getAxiom().toManchesterSyntaxString(null, prefixes); return str; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-09-02 08:51:47
|
Revision: 3224 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3224&view=rev Author: jenslehmann Date: 2011-09-02 08:51:39 +0000 (Fri, 02 Sep 2011) Log Message: ----------- work on config option documentation Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java trunk/components-core/src/main/java/org/dllearner/core/config/ConfigHelper.java trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/ELDown.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/ELDown2.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/OperatorInverter.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/PsiDown.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/PsiUp.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/RefinementOperator.java trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDown.java trunk/interfaces/doc/configOptions.html trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java Modified: trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/core/AnnComponentManager.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -29,6 +29,7 @@ import org.apache.commons.collections15.BidiMap; import org.apache.commons.collections15.bidimap.DualHashBidiMap; +import org.dllearner.refinementoperators.RefinementOperator; /** * Component manager for the new (as of 2011) annotation based configuration @@ -241,14 +242,20 @@ if(LearningAlgorithm.class.isAssignableFrom(component)) { types.add(LearningAlgorithm.class); } + if(AxiomLearningAlgorithm.class.isAssignableFrom(component)) { + types.add(AxiomLearningAlgorithm.class); + } + if(ClassExpressionLearningAlgorithm.class.isAssignableFrom(component)) { + types.add(ClassExpressionLearningAlgorithm.class); + } if(LearningProblem.class.isAssignableFrom(component)) { types.add(LearningProblem.class); } if(ReasonerComponent.class.isAssignableFrom(component)) { types.add(ReasonerComponent.class); } - if(AxiomLearningAlgorithm.class.isAssignableFrom(component)) { - types.add(AxiomLearningAlgorithm.class); + if(RefinementOperator.class.isAssignableFrom(component)) { + types.add(RefinementOperator.class); } return types; } Modified: trunk/components-core/src/main/java/org/dllearner/core/config/ConfigHelper.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/config/ConfigHelper.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/core/config/ConfigHelper.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -163,6 +163,23 @@ return options; } + /** + * Returns all config options for the given component. + * @param component + * @return + */ + public static Map<ConfigOption,Class<?>> getConfigOptionTypes(Class<? extends Component> component){ + Map<ConfigOption,Class<?>> optionTypes = new HashMap<ConfigOption,Class<?>>(); + Field[] fields = component.getDeclaredFields(); + for(Field f : fields){ + ConfigOption option = f.getAnnotation(ConfigOption.class); + if(option != null){ + optionTypes.put(option, f.getType()); + } + } + return optionTypes; + } + /* * returns the declared fields for the class and its superclass. */ Modified: trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/core/config/ConfigOption.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -20,8 +20,10 @@ package org.dllearner.core.config; import java.beans.PropertyEditor; +import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; /** * @@ -32,6 +34,7 @@ * @author Lorenz Bühmann */ @Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) public @interface ConfigOption { /** @@ -49,7 +52,9 @@ /** * An implementation of the Property Editor to use. * - * TODO: This might not be needed in the future. + * @deprecated We currently do not encourage specifying the + * property editor, because they might not be needed if we find a way + * of auto-detecting appropriate editors. * * @return */ @@ -57,7 +62,9 @@ Class<? extends PropertyEditor> propertyEditorClass() default PropertyEditor.class; /** - * Returns whether this option is required for initializing the component. + * Returns whether this option is required for initializing the component. + * + * Maybe soon deprecated: Please put @Required in the corresponding set method in addition. * @return True if the option is required and false otherwise. */ boolean required() default false; Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/ELDown.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/ELDown.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/ELDown.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -35,6 +35,7 @@ import org.dllearner.algorithms.el.ELDescriptionNode; import org.dllearner.algorithms.el.ELDescriptionTree; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.NamedClass; @@ -293,6 +294,12 @@ return i; } + + @Override + public void init() throws ComponentInitException { + // TODO Auto-generated method stub + + } // private void computeMg(Description index) { // // compute the applicable properties if this has not been done yet Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/ELDown2.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/ELDown2.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/ELDown2.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -42,6 +42,7 @@ import org.dllearner.algorithms.el.TreeAndRoleSet; import org.dllearner.algorithms.el.TreeAndRoleSetComparator; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.NamedClass; @@ -602,5 +603,11 @@ } return false; } + + @Override + public void init() throws ComponentInitException { + // TODO Auto-generated method stub + + } } Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/OperatorInverter.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/OperatorInverter.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/OperatorInverter.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -23,6 +23,7 @@ import java.util.Set; import java.util.TreeSet; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Negation; import org.dllearner.utilities.owl.ConceptComparator; @@ -92,5 +93,11 @@ } return negatedDescription; } + + @Override + public void init() throws ComponentInitException { + // TODO Auto-generated method stub + + } } Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/PsiDown.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/PsiDown.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/PsiDown.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -27,6 +27,7 @@ import java.util.TreeSet; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.owl.ObjectAllRestriction; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Nothing; @@ -262,4 +263,10 @@ throw new RuntimeException(); } + @Override + public void init() throws ComponentInitException { + // TODO Auto-generated method stub + + } + } Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/PsiUp.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/PsiUp.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/PsiUp.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -27,6 +27,7 @@ import java.util.TreeSet; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.owl.ObjectAllRestriction; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Nothing; @@ -238,4 +239,10 @@ throw new RuntimeException(); } + @Override + public void init() throws ComponentInitException { + // TODO Auto-generated method stub + + } + } Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/RefinementOperator.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/RefinementOperator.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/RefinementOperator.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -22,6 +22,7 @@ import java.util.List; import java.util.Set; +import org.dllearner.core.Component; import org.dllearner.core.owl.Description; /** @@ -34,7 +35,7 @@ * @author Jens Lehmann * */ -public interface RefinementOperator { +public interface RefinementOperator extends Component { /** * Standard refinement operation. Modified: trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDown.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDown.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/components-core/src/main/java/org/dllearner/refinementoperators/RhoDown.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -30,6 +30,7 @@ import java.util.TreeSet; import org.dllearner.core.AbstractReasonerComponent; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.owl.BooleanValueRestriction; import org.dllearner.core.owl.DatatypeProperty; import org.dllearner.core.owl.ObjectAllRestriction; @@ -680,4 +681,10 @@ return retSet; } + @Override + public void init() throws ComponentInitException { + // TODO Auto-generated method stub + + } + } Modified: trunk/interfaces/doc/configOptions.html =================================================================== --- trunk/interfaces/doc/configOptions.html 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/interfaces/doc/configOptions.html 2011-09-02 08:51:39 UTC (rev 3224) @@ -17,140 +17,214 @@ </head><body> <h1>DL-Learner Components</h1> <p>Filter components by implemented interfaces:</p> -<ul><a href="#" onClick="showAllCat()">show all</a><li><a href="#" onClick="showOnlyCat('KnowledgeSource')">KnowledgeSource</a></li><li><a href="#" onClick="showOnlyCat('ReasonerComponent')">ReasonerComponent</a></li><li><a href="#" onClick="showOnlyCat('LearningProblem')">LearningProblem</a></li><li><a href="#" onClick="showOnlyCat('LearningAlgorithm')">LearningAlgorithm</a><ul><li><a href="#" onClick="showOnlyCat('AxiomLearningAlgorithm')">AxiomLearningAlgorithm</a></li></ul></li></ul><p>Click on a component to get an overview on its configuration options.</p><ul> -<div class="LearningAlgorithm"><li><a href="#org.dllearner.algorithms.celoe.CELOE">CELOE</a></li></div> +<ul><a href="#" onClick="showAllCat()">show all</a><li><a href="#" onClick="showOnlyCat('KnowledgeSource')">KnowledgeSource</a></li><li><a href="#" onClick="showOnlyCat('ReasonerComponent')">ReasonerComponent</a></li><li><a href="#" onClick="showOnlyCat('LearningProblem')">LearningProblem</a></li><li><a href="#" onClick="showOnlyCat('LearningAlgorithm')">LearningAlgorithm</a><ul><li><a href="#" onClick="showOnlyCat('AxiomLearningAlgorithm')">AxiomLearningAlgorithm</a></li><li><a href="#" onClick="showOnlyCat('ClassExpressionLearningAlgorithm')">ClassExpressionLearningAlgorithm</a></li></ul></li><li><a href="#" onClick="showOnlyCat('RefinementOperator')">RefinementOperator</a></li><li><a href="#" onClick="showOnlyCat('OtherComponent')">other</a></li></ul><p>Click on a component to get an overview on its configuration options.</p><ul> +<div class="LearningAlgorithm ClassExpressionLearningAlgorithm"><li><a href="#org.dllearner.algorithms.BruteForceLearner">Brute Force Learner</a></li></div> +<div class="LearningAlgorithm ClassExpressionLearningAlgorithm"><li><a href="#org.dllearner.algorithms.celoe.CELOE">CELOE</a></li></div> +<div class="LearningProblem"><li><a href="#org.dllearner.learningproblems.ClassLearningProblem">ClassLearningProblem</a></li></div> +<div class="KnowledgeSource"><li><a href="#org.dllearner.kb.KBFile">KB file</a></li></div> +<div class="ReasonerComponent"><li><a href="#org.dllearner.reasoning.OWLAPIReasoner">OWL API Reasoner</a></li></div> +<div class="LearningAlgorithm ClassExpressionLearningAlgorithm"><li><a href="#org.dllearner.algorithms.ocel.OCEL">OWL Class Expression Learner</a></li></div> +<div class="KnowledgeSource"><li><a href="#org.dllearner.kb.OWLFile">OWL File</a></li></div> +<div class="LearningProblem"><li><a href="#org.dllearner.learningproblems.PosNegLPStandard">PosNegLPStandard</a></li></div> +<div class="LearningAlgorithm ClassExpressionLearningAlgorithm"><li><a href="#org.dllearner.algorithms.RandomGuesser">Random Guesser</a></li></div> +<div class="KnowledgeSource"><li><a href="#org.dllearner.kb.SparqlEndpointKS">SPARQL endpoint</a></li></div> +<div class="KnowledgeSource"><li><a href="#org.dllearner.kb.sparql.SparqlKnowledgeSource">SPARQL endpoint fragment</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.SubDataPropertyOfAxiomLearner">data subPropertyOf axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.DataPropertyDomainAxiomLearner">dataproperty domain axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.DataPropertyRangeAxiomLearner">dataproperty range learner</a></li></div> -<div class="LearningAlgorithm"><li><a href="#org.dllearner.algorithms.DisjointClassesLearner">disjoint classes learner</a></li></div> +<div class="LearningAlgorithm AxiomLearningAlgorithm ClassExpressionLearningAlgorithm"><li><a href="#org.dllearner.algorithms.DisjointClassesLearner">disjoint classes learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.DisjointDataPropertyAxiomLearner">disjoint dataproperty axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.DisjointObjectPropertyAxiomLearner">disjoint objectproperty axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.EquivalentDataPropertyAxiomLearner">equivalent dataproperty axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.EquivalentObjectPropertyAxiomLearner">equivalent objectproperty axiom learner</a></li></div> +<div class="ReasonerComponent"><li><a href="#org.dllearner.reasoning.FastInstanceChecker">fast instance checker</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.FunctionalDataPropertyAxiomLearner">functional dataproperty axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.FunctionalObjectPropertyAxiomLearner">functional objectproperty axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.InverseFunctionalObjectPropertyAxiomLearner">inversefunctional objectproperty axiom learner</a></li></div> +<div class="OtherComponent"><li><a href="#org.dllearner.algorithms.ocel.MultiHeuristic">multiple criteria heuristic</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.SubObjectPropertyOfAxiomLearner">object subPropertyOf axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.ObjectPropertyDomainAxiomLearner">objectproperty domain axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.ObjectPropertyRangeAxiomLearner">objectproperty range learner</a></li></div> -<div class="LearningAlgorithm"><li><a href="#org.dllearner.algorithms.SimpleSubclassLearner">simple subclass learner</a></li></div> +<div class="LearningProblem"><li><a href="#org.dllearner.learningproblems.PosOnlyLP">positive only learning problem</a></li></div> +<div class="RefinementOperator"><li><a href="#org.dllearner.refinementoperators.RhoDRDown">rho refinement operator</a></li></div> +<div class="LearningAlgorithm AxiomLearningAlgorithm ClassExpressionLearningAlgorithm"><li><a href="#org.dllearner.algorithms.SimpleSubclassLearner">simple subclass learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.SymmetricObjectPropertyAxiomLearner">symmetric objectproperty axiom learner</a></li></div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><li><a href="#org.dllearner.algorithms.properties.TransitiveObjectPropertyAxiomLearner">transitive objectproperty axiom learner</a></li></div> </ul> -<div class="LearningAlgorithm"><a name="org.dllearner.algorithms.celoe.CELOE"><h2>CELOE</h2></a> -<p>short name: celoe<br />version: 1.0<br />implements: LearningAlgorithm<br />description: CELOE is an adapted and extended version of the OCEL algorithm applied for the ontology engineering use case. See http://jens-lehmann.org/files/2011/celoe.pdf for reference.<br /></p>This component does not have configuration options.</div> +<div class="LearningAlgorithm ClassExpressionLearningAlgorithm"><a name="org.dllearner.algorithms.BruteForceLearner"><h2>Brute Force Learner</h2></a> +<p>short name: bruteForce<br />version: 0.8<br />implements: LearningAlgorithm, ClassExpressionLearningAlgorithm<br /></p>This component does not have configuration options.</div> +<div class="LearningAlgorithm ClassExpressionLearningAlgorithm"><a name="org.dllearner.algorithms.celoe.CELOE"><h2>CELOE</h2></a> +<p>short name: celoe<br />version: 1.0<br />implements: LearningAlgorithm, ClassExpressionLearningAlgorithm<br />description: CELOE is an adapted and extended version of the OCEL algorithm applied for the ontology engineering use case. See http://jens-lehmann.org/files/2011/celoe.pdf for reference.<br /></p>This component does not have configuration options.</div> +<div class="LearningProblem"><a name="org.dllearner.learningproblems.ClassLearningProblem"><h2>ClassLearningProblem</h2></a> +<p>short name: clp<br />version: 0.6<br />implements: LearningProblem<br /></p>This component does not have configuration options.</div> +<div class="KnowledgeSource"><a name="org.dllearner.kb.KBFile"><h2>KB file</h2></a> +<p>short name: kbfile<br />version: 0.8<br />implements: KnowledgeSource<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<tr><td>url</td><td>URL pointer to the KB file</td><td> String</td><td></td><td> false</td></tr> +</tbody></table> +</div> +<div class="ReasonerComponent"><a name="org.dllearner.reasoning.OWLAPIReasoner"><h2>OWL API Reasoner</h2></a> +<p>short name: oar<br />version: 0.8<br />implements: ReasonerComponent<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<tr><td>owlLinkURL</td><td>The URL to the owl server</td><td> String</td><td></td><td> false</td></tr> +<tr><td>reasonerType</td><td>The name of the OWL APIReasoner to use {"fact", "hermit", "owllink", "pellet"}</td><td> String</td><td>pellet</td><td> false</td></tr> +</tbody></table> +</div> +<div class="LearningAlgorithm ClassExpressionLearningAlgorithm"><a name="org.dllearner.algorithms.ocel.OCEL"><h2>OWL Class Expression Learner</h2></a> +<p>short name: ocel<br />version: 1.2<br />implements: LearningAlgorithm, ClassExpressionLearningAlgorithm<br /></p>This component does not have configuration options.</div> +<div class="KnowledgeSource"><a name="org.dllearner.kb.OWLFile"><h2>OWL File</h2></a> +<p>short name: owlfile<br />version: 0.9<br />implements: KnowledgeSource<br /></p>This component does not have configuration options.</div> +<div class="LearningProblem"><a name="org.dllearner.learningproblems.PosNegLPStandard"><h2>PosNegLPStandard</h2></a> +<p>short name: posNegStandard<br />version: 0.8<br />implements: LearningProblem<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<tr><td>accuracyMethod</td><td>Specifies, which method/function to use for computing accuracy.</td><td> String</td><td>predacc</td><td> false</td></tr> +<tr><td>approxDelta</td><td>The Approximate Delta</td><td> double</td><td>0.05</td><td> false</td></tr> +<tr><td>useApproximations</td><td>Use Approximations</td><td> boolean</td><td>false</td><td> false</td></tr> +</tbody></table> +</div> +<div class="LearningAlgorithm ClassExpressionLearningAlgorithm"><a name="org.dllearner.algorithms.RandomGuesser"><h2>Random Guesser</h2></a> +<p>short name: randomGuesser<br />version: 0.8<br />implements: LearningAlgorithm, ClassExpressionLearningAlgorithm<br /></p>This component does not have configuration options.</div> +<div class="KnowledgeSource"><a name="org.dllearner.kb.SparqlEndpointKS"><h2>SPARQL endpoint</h2></a> +<p>short name: sparql<br />version: 0.2<br />implements: KnowledgeSource<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<tr><td>namedGraphs</td><td>no description available</td><td> List</td><td>[]</td><td> false</td></tr> +<tr><td>url</td><td>no description available</td><td> URL</td><td></td><td> true</td></tr> +<tr><td>defaultGraphs</td><td>no description available</td><td> List</td><td>[]</td><td> false</td></tr> +</tbody></table> +</div> +<div class="KnowledgeSource"><a name="org.dllearner.kb.sparql.SparqlKnowledgeSource"><h2>SPARQL endpoint fragment</h2></a> +<p>short name: sparqlfrag<br />version: 0.5<br />implements: KnowledgeSource<br /></p>This component does not have configuration options.</div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.SubDataPropertyOfAxiomLearner"><h2>data subPropertyOf axiom learner</h2></a> <p>short name: dplsubprop<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> -<tr><td>propertyToDescribe</td><td></td><td> DataProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>propertyToDescribe</td><td></td><td> DatatypeProperty</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.DataPropertyDomainAxiomLearner"><h2>dataproperty domain axiom learner</h2></a> <p>short name: dpldomain<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> -<tr><td>propertyToDescribe</td><td></td><td> DataProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>propertyToDescribe</td><td></td><td> DatatypeProperty</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.DataPropertyRangeAxiomLearner"><h2>dataproperty range learner</h2></a> <p>short name: dblrange<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> -<tr><td>propertyToDescribe</td><td></td><td> DataProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>propertyToDescribe</td><td></td><td> DatatypeProperty</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> -<div class="LearningAlgorithm"><a name="org.dllearner.algorithms.DisjointClassesLearner"><h2>disjoint classes learner</h2></a> -<p>short name: cldisjoint<br />version: 0.1<br />implements: LearningAlgorithm<br /></p>This component does not have configuration options.</div> +<div class="LearningAlgorithm AxiomLearningAlgorithm ClassExpressionLearningAlgorithm"><a name="org.dllearner.algorithms.DisjointClassesLearner"><h2>disjoint classes learner</h2></a> +<p>short name: cldisjoint<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm, ClassExpressionLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> +<tr><td>classToDescribe</td><td></td><td> NamedClass</td><td></td><td> false</td></tr> +</tbody></table> +</div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.DisjointDataPropertyAxiomLearner"><h2>disjoint dataproperty axiom learner</h2></a> <p>short name: dpldisjoint<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> -<tr><td>propertyToDescribe</td><td></td><td> DataProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>propertyToDescribe</td><td></td><td> DatatypeProperty</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.DisjointObjectPropertyAxiomLearner"><h2>disjoint objectproperty axiom learner</h2></a> <p>short name: opldisjoint<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.EquivalentDataPropertyAxiomLearner"><h2>equivalent dataproperty axiom learner</h2></a> <p>short name: dplequiv<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> -<tr><td>propertyToDescribe</td><td></td><td> DataProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>propertyToDescribe</td><td></td><td> DatatypeProperty</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.EquivalentObjectPropertyAxiomLearner"><h2>equivalent objectproperty axiom learner</h2></a> <p>short name: oplequiv<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> +<div class="ReasonerComponent"><a name="org.dllearner.reasoning.FastInstanceChecker"><h2>fast instance checker</h2></a> +<p>short name: fic<br />version: 0.9<br />implements: ReasonerComponent<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<tr><td>forAllRetrievalSemantics</td><td>This option controls how to interpret the all quantifier in forall r.C. The standard option isto return all those which do not have an r-filler not in C. The domain semantics is to use thosewhich are in the domain of r and do not have an r-filler not in C. The forallExists semantics is touse those which have at least one r-filler and do not have an r-filler not in C.</td><td> String</td><td>standard</td><td> false</td></tr> +<tr><td>defaultNegation</td><td>Whether to use default negation, i.e. an instance not being in a class means that it is in the negation of the class.</td><td> boolean</td><td>true</td><td> false</td></tr> +</tbody></table> +</div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.FunctionalDataPropertyAxiomLearner"><h2>functional dataproperty axiom learner</h2></a> <p>short name: dplfunc<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> -<tr><td>propertyToDescribe</td><td></td><td> DataProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>propertyToDescribe</td><td></td><td> DatatypeProperty</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.FunctionalObjectPropertyAxiomLearner"><h2>functional objectproperty axiom learner</h2></a> <p>short name: oplfunc<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.InverseFunctionalObjectPropertyAxiomLearner"><h2>inversefunctional objectproperty axiom learner</h2></a> <p>short name: oplinvfunc<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> +<div class="OtherComponent"><a name="org.dllearner.algorithms.ocel.MultiHeuristic"><h2>multiple criteria heuristic</h2></a> +<p>short name: multiheuristic<br />version: 0.7<br />implements: OtherComponent<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<tr><td>negativeWeight</td><td>no description available</td><td> double</td><td>1.0</td><td> false</td></tr> +<tr><td>gainBonusFactor</td><td>no description available</td><td> double</td><td>0.5</td><td> false</td></tr> +<tr><td>startNodeBonus</td><td>no description available</td><td> double</td><td>0.1</td><td> false</td></tr> +<tr><td>negationPenalty</td><td>no description available</td><td> int</td><td>0</td><td> false</td></tr> +<tr><td>nodeChildPenalty</td><td>no description available</td><td> double</td><td>0.0001</td><td> false</td></tr> +<tr><td>expansionPenaltyFactor</td><td>no description available</td><td> double</td><td>0.02</td><td> false</td></tr> +</tbody></table> +</div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.SubObjectPropertyOfAxiomLearner"><h2>object subPropertyOf axiom learner</h2></a> <p>short name: oplsubprop<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.ObjectPropertyDomainAxiomLearner"><h2>objectproperty domain axiom learner</h2></a> <p>short name: opldomain<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.ObjectPropertyRangeAxiomLearner"><h2>objectproperty range learner</h2></a> <p>short name: oplrange<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> -<div class="LearningAlgorithm"><a name="org.dllearner.algorithms.SimpleSubclassLearner"><h2>simple subclass learner</h2></a> -<p>short name: clsub<br />version: 0.1<br />implements: LearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<div class="LearningProblem"><a name="org.dllearner.learningproblems.PosOnlyLP"><h2>positive only learning problem</h2></a> +<p>short name: posonlylp<br />version: 0.6<br />implements: LearningProblem<br /></p>This component does not have configuration options.</div> +<div class="RefinementOperator"><a name="org.dllearner.refinementoperators.RhoDRDown"><h2>rho refinement operator</h2></a> +<p>short name: rho<br />version: 0.8<br />implements: RefinementOperator<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> +<tr><td>instanceBasedDisjoints</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>useAllConstructor</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>disjointChecks</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>applyExistsFilter</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>useHasValueConstructor</td><td>no description available</td><td> boolean</td><td>false</td><td> false</td></tr> +<tr><td>applyAllFilter</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>useStringDatatypes</td><td>no description available</td><td> boolean</td><td>false</td><td> false</td></tr> +<tr><td>useBooleanDatatypes</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>useDoubleDatatypes</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>useExistsConstructor</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>dropDisjuncts</td><td>no description available</td><td> boolean</td><td>false</td><td> false</td></tr> +<tr><td>useNegation</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +<tr><td>useCardinalityRestrictions</td><td>no description available</td><td> boolean</td><td>true</td><td> false</td></tr> +</tbody></table> +</div> +<div class="LearningAlgorithm AxiomLearningAlgorithm ClassExpressionLearningAlgorithm"><a name="org.dllearner.algorithms.SimpleSubclassLearner"><h2>simple subclass learner</h2></a> +<p>short name: clsub<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm, ClassExpressionLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>classToDescribe</td><td></td><td> NamedClass</td><td></td><td> true</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td>10</td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.SymmetricObjectPropertyAxiomLearner"><h2>symmetric objectproperty axiom learner</h2></a> <p>short name: oplsymm<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> <div class="LearningAlgorithm AxiomLearningAlgorithm"><a name="org.dllearner.algorithms.properties.TransitiveObjectPropertyAxiomLearner"><h2>transitive objectproperty axiom learner</h2></a> <p>short name: opltrans<br />version: 0.1<br />implements: LearningAlgorithm, AxiomLearningAlgorithm<br /></p><table id="hor-minimalist-a"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody> <tr><td>propertyToDescribe</td><td></td><td> ObjectProperty</td><td></td><td> false</td></tr> -<tr><td>maxExecutionTimeInSeconds</td><td></td><td> Integer</td><td></td><td> false</td></tr> -<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> Integer</td><td></td><td> false</td></tr> +<tr><td>maxFetchedRows</td><td>The maximum number of rows fetched from the endpoint to approximate the result.</td><td> int</td><td></td><td> false</td></tr> </tbody></table> </div> </body></html> \ No newline at end of file Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -254,8 +254,7 @@ SPARQLTasks st = new SPARQLTasks(se); if(resource == null) { - System.out.println("TEST"); - + // loop over all entities and call appropriate algorithms Set<NamedClass> classes = st.getAllClasses(); int entities = 0; Modified: trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java =================================================================== --- trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java 2011-09-02 08:50:29 UTC (rev 3223) +++ trunk/scripts/src/main/java/org/dllearner/scripts/DocumentationHTMLGenerator.java 2011-09-02 08:51:39 UTC (rev 3224) @@ -70,7 +70,10 @@ sb.append("<li><a href=\"#\" onClick=\"showOnlyCat('ReasonerComponent')\">ReasonerComponent</a></li>"); sb.append("<li><a href=\"#\" onClick=\"showOnlyCat('LearningProblem')\">LearningProblem</a></li>"); sb.append("<li><a href=\"#\" onClick=\"showOnlyCat('LearningAlgorithm')\">LearningAlgorithm</a>"); - sb.append("<ul><li><a href=\"#\" onClick=\"showOnlyCat('AxiomLearningAlgorithm')\">AxiomLearningAlgorithm</a></li></ul></li>"); + sb.append("<ul><li><a href=\"#\" onClick=\"showOnlyCat('AxiomLearningAlgorithm')\">AxiomLearningAlgorithm</a></li>"); + sb.append("<li><a href=\"#\" onClick=\"showOnlyCat('ClassExpressionLearningAlgorithm')\">ClassExpressionLearningAlgorithm</a></li></ul></li>"); + sb.append("<li><a href=\"#\" onClick=\"showOnlyCat('RefinementOperator')\">RefinementOperator</a></li>"); + sb.append("<li><a href=\"#\" onClick=\"showOnlyCat('OtherComponent')\">other</a></li>"); sb.append("</ul>"); // general explanations @@ -100,13 +103,14 @@ sb.append("</p>"); // generate table for configuration options - List<ConfigOption> options = ConfigHelper.getConfigOptions(comp); + Map<ConfigOption,Class<?>> options = ConfigHelper.getConfigOptionTypes(comp); if(options.isEmpty()) { sb.append("This component does not have configuration options."); } else { sb.append("<table id=\"hor-minimalist-a\"><thead><tr><th>option name</th><th>description</th><th>type</th><th>default value</th><th>required?</th></tr></thead><tbody>\n"); - for(ConfigOption option : options) { - sb.append("<tr><td>" + option.name() + "</td><td>" + option.description() + "</td><td> " + getOptionType(option) + "</td><td>" + option.defaultValue() + "</td><td> " + option.required() + "</td></tr>\n"); + for(Entry<ConfigOption,Class<?>> entry : options.entrySet()) { + ConfigOption option = entry.getKey(); + sb.append("<tr><td>" + option.name() + "</td><td>" + option.description() + "</td><td> " + entry.getValue().getSimpleName() + "</td><td>" + option.defaultValue() + "</td><td> " + option.required() + "</td></tr>\n"); } sb.append("</tbody></table>\n"); } @@ -147,10 +151,10 @@ // this is a hack, because we just assume that every PropertyEditor is named // as TypeEditor (e.g. ObjectPropertyEditor); however that hack does not too much harm here - private static String getOptionType(ConfigOption option) { - String name = option.propertyEditorClass().getSimpleName(); - return name.substring(0, name.length()-6); - } +// private static String getOptionType(ConfigOption option) { +// String name = option.propertyEditorClass().getSimpleName(); +// return name.substring(0, name.length()-6); +// } private static String getCoreTypes(Class<? extends Component> comp) { List<Class<? extends Component>> types = AnnComponentManager.getCoreComponentTypes(comp); @@ -158,7 +162,12 @@ for(Class<?extends Component> type : types) { str += " " + type.getSimpleName(); } - return str.substring(1); + // not every component belongs to one of the core types + if(str.length()==0) { + return "OtherComponent"; + } else { + return str.substring(1); + } } public static void main(String[] args) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-09-02 11:30:00
|
Revision: 3229 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3229&view=rev Author: jenslehmann Date: 2011-09-02 11:29:54 +0000 (Fri, 02 Sep 2011) Log Message: ----------- used BeanUtils to enable access to private Java Bean fields; parameter output in Enrichment script now working Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java trunk/components-core/src/main/java/org/dllearner/core/config/ConfigHelper.java trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java Added Paths: ----------- trunk/components-core/src/test/java/org/dllearner/test/junit/ConfigOptionTest.java Modified: trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-09-02 10:53:32 UTC (rev 3228) +++ trunk/components-core/src/main/java/org/dllearner/algorithms/celoe/CELOE.java 2011-09-02 11:29:54 UTC (rev 3229) @@ -167,7 +167,8 @@ private int maxClassDescriptionTests = 0; - private int maxExecutionTimeInSeconds = 100; + @org.dllearner.core.config.ConfigOption(defaultValue = "10", name = "maxExecutionTimeInSeconds", description = "maximum execution of the algorithm in seconds") + private int maxExecutionTimeInSeconds = 10; private boolean terminateOnNoiseReached = false; Modified: trunk/components-core/src/main/java/org/dllearner/core/config/ConfigHelper.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/config/ConfigHelper.java 2011-09-02 10:53:32 UTC (rev 3228) +++ trunk/components-core/src/main/java/org/dllearner/core/config/ConfigHelper.java 2011-09-02 11:29:54 UTC (rev 3229) @@ -31,6 +31,8 @@ import org.dllearner.algorithms.properties.ObjectPropertyDomainAxiomLearner; import org.dllearner.core.Component; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.BeansException; public class ConfigHelper { @@ -97,6 +99,7 @@ * @param component The component to analyse. * @return All config options of the component with their respective value. */ + @Deprecated public static Map<ConfigOption,String> getConfigOptionValuesString(Component component) { Map<ConfigOption,String> optionValues = new HashMap<ConfigOption,String>(); List<Field> fields = getAllFields(component);//getConfigOptions(component).getClass().getDeclaredFields(); @@ -133,11 +136,18 @@ ConfigOption option = field.getAnnotation(ConfigOption.class); if(option != null) { try { - optionValues.put(option, field.get(component)); + // we invoke the public getter instead of accessing a private field (may cause problem with SecurityManagers) + // use Spring BeanUtils TODO: might be unnecessarily slow because we already have the field? + Object value = BeanUtils.getPropertyDescriptor(component.getClass(), field.getName()).getReadMethod().invoke(component); + optionValues.put(option, value); } catch (IllegalArgumentException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); + } catch (BeansException e) { + e.printStackTrace(); + } catch (InvocationTargetException e) { + e.printStackTrace(); } } } Added: trunk/components-core/src/test/java/org/dllearner/test/junit/ConfigOptionTest.java =================================================================== --- trunk/components-core/src/test/java/org/dllearner/test/junit/ConfigOptionTest.java (rev 0) +++ trunk/components-core/src/test/java/org/dllearner/test/junit/ConfigOptionTest.java 2011-09-02 11:29:54 UTC (rev 3229) @@ -0,0 +1,59 @@ +/** + * Copyright (C) 2007-2011, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package org.dllearner.test.junit; + +import static org.junit.Assert.*; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.dllearner.algorithms.celoe.CELOE; +import org.dllearner.core.config.ConfigHelper; +import org.dllearner.core.config.ConfigOption; +import org.junit.Test; + +/** + * + * @author Jens Lehmann + * + */ +public class ConfigOptionTest { + + @Test + public void testConfigOption() { + List<ConfigOption> configOptions = ConfigHelper.getConfigOptions(CELOE.class); + assertFalse(configOptions.isEmpty()); + + CELOE celoe = new CELOE(); + celoe.setMaxExecutionTimeInSeconds(10); + Map<ConfigOption,Object> optionValues = ConfigHelper.getConfigOptionValues(celoe); + boolean found = false; + for(Entry<ConfigOption,Object> entry : optionValues.entrySet()) { + System.out.println(entry.getKey() + " " + entry.getValue()); + if(entry.getKey().name().equals("maxExecutionTimeInSeconds")) { + found = true; + assertTrue(Integer.valueOf(entry.getValue().toString())==10); + } + } + assertTrue(found); + + } + +} Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-09-02 10:53:32 UTC (rev 3228) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2011-09-02 11:29:54 UTC (rev 3229) @@ -143,9 +143,9 @@ // since otherwise we run into memory problems for full enrichment private Class<? extends LearningAlgorithm> algorithm; private List<EvaluatedAxiom> axioms; - private Map<ConfigOption,String> parameters; + private Map<ConfigOption,Object> parameters; - public AlgorithmRun(Class<? extends LearningAlgorithm> algorithm, List<EvaluatedAxiom> axioms, Map<ConfigOption,String> parameters) { + public AlgorithmRun(Class<? extends LearningAlgorithm> algorithm, List<EvaluatedAxiom> axioms, Map<ConfigOption,Object> parameters) { this.algorithm = algorithm; this.axioms = axioms; this.parameters = parameters; @@ -159,7 +159,7 @@ return axioms; } - public Map<ConfigOption, String> getParameters() { + public Map<ConfigOption, Object> getParameters() { return parameters; } } @@ -403,7 +403,7 @@ } System.out.println(prettyPrint(learnedAxioms)); - algorithmRuns.add(new AlgorithmRun(CELOE.class, learnedAxioms, ConfigHelper.getConfigOptionValuesString(la))); + algorithmRuns.add(new AlgorithmRun(CELOE.class, learnedAxioms, ConfigHelper.getConfigOptionValues(la))); return learnedAxioms; } @@ -440,7 +440,7 @@ .getCurrentlyBestEvaluatedAxioms(nrOfAxiomsToLearn, threshold); System.out.println(prettyPrint(learnedAxioms)); - algorithmRuns.add(new AlgorithmRun(learner.getClass(), learnedAxioms, ConfigHelper.getConfigOptionValuesString(learner))); + algorithmRuns.add(new AlgorithmRun(learner.getClass(), learnedAxioms, ConfigHelper.getConfigOptionValues(learner))); return learnedAxioms; } @@ -468,11 +468,11 @@ /* * Generates list of OWL axioms. */ - private List<OWLAxiom> toRDF(List<EvaluatedAxiom> evalAxioms, Class<? extends LearningAlgorithm> algorithm, Map<ConfigOption,String> parameters, SparqlEndpointKS ks){ + private List<OWLAxiom> toRDF(List<EvaluatedAxiom> evalAxioms, Class<? extends LearningAlgorithm> algorithm, Map<ConfigOption,Object> parameters, SparqlEndpointKS ks){ return toRDF(evalAxioms, algorithm, parameters, ks, null); } - private List<OWLAxiom> toRDF(List<EvaluatedAxiom> evalAxioms, Class<? extends LearningAlgorithm> algorithm, Map<ConfigOption,String> parameters, SparqlEndpointKS ks, String defaultNamespace){ + private List<OWLAxiom> toRDF(List<EvaluatedAxiom> evalAxioms, Class<? extends LearningAlgorithm> algorithm, Map<ConfigOption,Object> parameters, SparqlEndpointKS ks, String defaultNamespace){ if(defaultNamespace == null || defaultNamespace.isEmpty()){ defaultNamespace = DEFAULT_NS; } @@ -513,13 +513,13 @@ axioms.add(ax); //add Parameters to algorithm run instance OWLIndividual paramInd; - for(Entry<ConfigOption, String> entry : parameters.entrySet()){ + for(Entry<ConfigOption, Object> entry : parameters.entrySet()){ paramInd = f.getOWLNamedIndividual(IRI.create(generateId())); ax = f.getOWLClassAssertionAxiom(EnrichmentVocabulary.Parameter, paramInd); axioms.add(ax); ax = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.parameterName, paramInd, entry.getKey().name()); axioms.add(ax); - ax = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.parameterValue, paramInd, entry.getValue()); + ax = f.getOWLDataPropertyAssertionAxiom(EnrichmentVocabulary.parameterValue, paramInd, entry.getValue().toString()); axioms.add(ax); } //add used input to algorithm run instance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-09-02 11:54:54
|
Revision: 3230 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3230&view=rev Author: jenslehmann Date: 2011-09-02 11:54:46 +0000 (Fri, 02 Sep 2011) Log Message: ----------- LICENSE, README and INSTALL files Added Paths: ----------- trunk/INSTALL trunk/LICENSE trunk/README Removed Paths: ------------- trunk/TODO.txt Copied: trunk/INSTALL (from rev 3229, tags/premaven/INSTALL) =================================================================== --- trunk/INSTALL (rev 0) +++ trunk/INSTALL 2011-09-02 11:54:46 UTC (rev 3230) @@ -0,0 +1,21 @@ +Requirements +============ +Java 6 is required. (All other libraries are included in the release.) + +Installation +============ +No further installation is necessary. Just download and extract DL-Learner. + +Running Instructions +==================== + +Linux (and other systems) + +Make sure the file "cli" is executable and run it on the command line +followed by the name of the file to process, e.g. +"./cli examples/father.conf". + +Windows: + +Run "cli.bat" followed by the name of the file to process, e.g. +"cli.bat examples/father.conf". Copied: trunk/LICENSE (from rev 3229, tags/premaven/LICENSE) =================================================================== --- trunk/LICENSE (rev 0) +++ trunk/LICENSE 2011-09-02 11:54:46 UTC (rev 3230) @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. Copied: trunk/README (from rev 3229, tags/premaven/README) =================================================================== --- trunk/README (rev 0) +++ trunk/README 2011-09-02 11:54:46 UTC (rev 3230) @@ -0,0 +1,28 @@ +README +====== + +DL-Learner is a tool to learn Description Logic concepts from positive and +negative examples. Equivalently, it can learn OWL classes given objects as +positive and negative instances. + +Homepage: http://dl-learner.org +Sourceforge.net Project Page: http://sourceforge.net/projects/dl-learner/ +Bugs & Feature Requests: http://sourceforge.net/tracker/?group_id=203619 +Mailing Lists: http://sourceforge.net/mail/?group_id=203619 +Latest Release: http://sourceforge.net/projects/dl-learner/files/ + +Documentation for DL-Learner (e.g. various configuration options) can be found +in the "doc" directory and at http://dl-learner.org. We recommend to read +doc/manual.pdf to get started. + +DL-Learner is Open Source and licensed under the GNU General Public License 3. +(Copyright (c) 2007-2011, Jens Lehmann). + +DL-Learner uses several other libraries. An incomplete list is as follows: + * OWL API (licensed under LGPL) + * Pellet (licensed under AGPL 3 , (c) Clark & Parsia LLC) + * FaCT++ (licensed under LGPL, (c) The Victoria University of Manchester) + * HermiT (licensed under LGPL) + * Jena (Jena license, (c) Copyright Hewlett-Packard) + * Protege (licensed under MPL) + \ No newline at end of file Deleted: trunk/TODO.txt =================================================================== --- trunk/TODO.txt 2011-09-02 11:29:54 UTC (rev 3229) +++ trunk/TODO.txt 2011-09-02 11:54:46 UTC (rev 3230) @@ -1,16 +0,0 @@ - -Todos: -- move stuff from core into other package -- fix core pom.xml (remove the weird dependencies, update to lates jena version, etc) -- remove the configurators -- use interfaces for everything (discussion: is it necessary for spring) -- some pom snippets can be found in folder pomsnippets -- there is a cyclic dependency between ore, evalplugin and protege and scripts! -- paths have to be adjusted - -Notes: -- DIG does not work any more -- class JenaBug was deleted -- the components.ini file is not used any more -- i moved the examples folder to projectroot - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2011-09-02 13:53:15
|
Revision: 3237 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3237&view=rev Author: jenslehmann Date: 2011-09-02 13:53:09 +0000 (Fri, 02 Sep 2011) Log Message: ----------- small CLI improvements + converted arch example Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/kb/KBFile.java trunk/examples/arch/arch.conf trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java Modified: trunk/components-core/src/main/java/org/dllearner/kb/KBFile.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/kb/KBFile.java 2011-09-02 13:41:16 UTC (rev 3236) +++ trunk/components-core/src/main/java/org/dllearner/kb/KBFile.java 2011-09-02 13:53:09 UTC (rev 3237) @@ -46,16 +46,18 @@ * @author Jens Lehmann * */ -@ComponentAnn(name = "KB file", shortName = "kbfile", version = 0.8) +@ComponentAnn(name = "KB File", shortName = "kbfile", version = 0.8) public class KBFile extends AbstractKnowledgeSource { private static Logger logger = Logger.getLogger(KBFile.class); private KB kb; - @ConfigOption(name = "url", description = "URL pointer to the KB file", defaultValue = "", required = false, propertyEditorClass = StringTrimmerEditor.class) + @ConfigOption(name = "url", description = "URL pointer to the KB file") private String url; private String baseDir; + @ConfigOption(name = "fileName", description = "relative or absolute path to KB file") + private String fileName; /** * Default constructor (needed for reflection in ComponentManager). @@ -159,4 +161,12 @@ public void setBaseDir(String baseDir) { this.baseDir = baseDir; } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } } Modified: trunk/examples/arch/arch.conf =================================================================== --- trunk/examples/arch/arch.conf 2011-09-02 13:41:16 UTC (rev 3236) +++ trunk/examples/arch/arch.conf 2011-09-02 13:53:09 UTC (rev 3237) @@ -16,17 +16,22 @@ * Copyright (C) 2007, Sebastian Hellmann */ -algorithm = ocel; -reasoner = fastInstanceChecker; -// comment this out if the search should start from construction -// ocel.startClass = "http://localhost/foo#construction"; -// export("arch.owl"); -import("arch.kb"); +// declare some prefixes to use as abbreviations +prefixes = [ ("ex","http://localhost/foo#") ] -/** examples **/ -+c1 -+c4 --c2 --c3 --c5 +// knowledge source definition +ks.type = "KB File" +ks.url = "arch.kb" + +// reasoner +reasoner.type = "fast instance checker" +reasoner.sources = { ks } + +// learning problem +lp.type = "posNegStandard" +lp.positiveExamples = { "ex:c1", "ex:c4" } +lp.negativeExamples = { "ex:c2", "ex:c3", "ex:c5" } + +// create learning algorithm to run +alg.type = "ocel" Modified: trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java 2011-09-02 13:41:16 UTC (rev 3236) +++ trunk/interfaces/src/main/java/org/dllearner/cli/CLI.java 2011-09-02 13:53:09 UTC (rev 3237) @@ -24,10 +24,13 @@ import java.util.ArrayList; import java.util.List; +import org.apache.log4j.ConsoleAppender; +import org.apache.log4j.Layout; +import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.apache.log4j.PatternLayout; import org.apache.xmlbeans.XmlObject; import org.dllearner.Info; -import org.dllearner.algorithms.ocel.OCEL; import org.dllearner.configuration.IConfiguration; import org.dllearner.configuration.spring.ApplicationContextBuilder; import org.dllearner.configuration.spring.DefaultApplicationContextBuilder; @@ -52,6 +55,7 @@ public class CLI { private static Logger logger = Logger.getLogger(CLI.class); + private static Logger rootLogger = Logger.getRootLogger(); private boolean writeSpringConfiguration = false; @@ -80,8 +84,15 @@ */ public static void main(String[] args) throws ParseException, IOException, ReasoningMethodUnsupportedException { - System.out.println("DL-Learner " + Info.build + " [TODO: read pom.version and put it here (make sure that the code for getting the version also works in the release build!)] command line interface"); + Layout layout = new PatternLayout(); + ConsoleAppender consoleAppender = new ConsoleAppender(layout); + rootLogger.removeAllAppenders(); + rootLogger.addAppender(consoleAppender); + rootLogger.setLevel(Level.INFO); +// System.out.println("DL-Learner " + Info.build + " [TODO: read pom.version and put it here (make sure that the code for getting the version also works in the release build!)] command line interface"); + System.out.println("DL-Learner command line interface"); + // currently, CLI has exactly one parameter - the conf file if(args.length == 0) { System.out.println("You need to give a conf file as argument."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |