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. |