From: <jen...@us...> - 2007-09-22 09:30:16
|
Revision: 147 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=147&view=rev Author: jenslehmann Date: 2007-09-22 02:30:01 -0700 (Sat, 22 Sep 2007) Log Message: ----------- intermediate commit for new base structure Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/Component.java trunk/src/dl-learner/org/dllearner/core/ConfigOption.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/ConfigEntry.java trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java trunk/src/dl-learner/org/dllearner/core/InvalidConfigOptionValueException.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java trunk/src/dl-learner/org/dllearner/core/ConfigOptionType.java Modified: trunk/src/dl-learner/org/dllearner/core/Component.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Component.java 2007-09-21 14:21:49 UTC (rev 146) +++ trunk/src/dl-learner/org/dllearner/core/Component.java 2007-09-22 09:30:01 UTC (rev 147) @@ -19,10 +19,29 @@ */ package org.dllearner.core; +import java.util.Collection; + /** * @author Jens Lehmann * */ public interface Component { + /** + * + * @return The name of this component. + */ + public String getName(); + + /** + * Returns all configuration options supported by this component. + */ + public Collection<ConfigOption> getConfigOptions(); + + /** + * Applies a configuration option to this component. + * + * @param entry A configuration entry. + */ + public void applyConfigEntry(ConfigEntry entry); } Copied: trunk/src/dl-learner/org/dllearner/core/ConfigEntry.java (from rev 146, trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigEntry.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/ConfigEntry.java 2007-09-22 09:30:01 UTC (rev 147) @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2007, 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; + +/** + * A config entry is a configuration option and a value for the option. + * + * @author Jens Lehmann + * + */ +public class ConfigEntry { + + public ConfigEntry(ConfigOption option, Object value) throws Exception { + if(!option.isValidValue(value)) { + throw new InvalidConfigOptionValueException(option, value); + } else { + + } + } + +} Modified: trunk/src/dl-learner/org/dllearner/core/ConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigOption.java 2007-09-21 14:21:49 UTC (rev 146) +++ trunk/src/dl-learner/org/dllearner/core/ConfigOption.java 2007-09-22 09:30:01 UTC (rev 147) @@ -20,9 +20,24 @@ package org.dllearner.core; /** + * This class represents a configuration option (without a value for the + * option). + * * @author Jens Lehmann * */ -public class ConfigOption { +public abstract class ConfigOption { + private String name; + + public ConfigOption(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public abstract boolean isValidValue(Object value); + } Deleted: trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java 2007-09-21 14:21:49 UTC (rev 146) +++ trunk/src/dl-learner/org/dllearner/core/ConfigOptionInstance.java 2007-09-22 09:30:01 UTC (rev 147) @@ -1,28 +0,0 @@ -/** - * Copyright (C) 2007, 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; - -/** - * @author Jens Lehmann - * - */ -public class ConfigOptionInstance { - -} Deleted: trunk/src/dl-learner/org/dllearner/core/ConfigOptionType.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigOptionType.java 2007-09-21 14:21:49 UTC (rev 146) +++ trunk/src/dl-learner/org/dllearner/core/ConfigOptionType.java 2007-09-22 09:30:01 UTC (rev 147) @@ -1,36 +0,0 @@ -/** - * Copyright (C) 2007, 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; - -/** - * @author Jens Lehmann - * - */ -public enum ConfigOptionType { - - INT, - - DOUBLE, - - STRING, - - SET_STRING - -} Added: trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java 2007-09-22 09:30:01 UTC (rev 147) @@ -0,0 +1,82 @@ +/** + * Copyright (C) 2007, 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; + +/** + * A configuration option, which allows values of type integer. A minimum and + * maximum value of the argument can optionally be specified. + * + * @author Jens Lehmann + * + */ +public class IntegerConfigOption extends ConfigOption { + + private int lowerLimit = Integer.MIN_VALUE; + private int upperLimit = Integer.MAX_VALUE; + + public IntegerConfigOption(String name) { + super(name); + } + + /* (non-Javadoc) + * @see org.dllearner.core.ConfigOption#isValidValue(java.lang.Object) + */ + @Override + public boolean isValidValue(Object value) { + if(!(value instanceof Integer)) + return false; + + int intValue = (Integer) value; + + if(intValue >= lowerLimit && intValue <= upperLimit) + return true; + else + return false; + } + + /** + * @return the The lowest possible value for this configuration option. + */ + public int getLowerLimit() { + return lowerLimit; + } + + /** + * @param lowerLimit The lowest possible value for this configuration option. + */ + public void setLowerLimit(int lowerLimit) { + this.lowerLimit = lowerLimit; + } + + /** + * @return the The highest possible value for this configuration option. + */ + public int getUpperLimit() { + return upperLimit; + } + + /** + * @param upperLimit The highest possible value for this configuration option. + */ + public void setUpperLimit(int upperLimit) { + this.upperLimit = upperLimit; + } + +} Added: trunk/src/dl-learner/org/dllearner/core/InvalidConfigOptionValueException.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/InvalidConfigOptionValueException.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/InvalidConfigOptionValueException.java 2007-09-22 09:30:01 UTC (rev 147) @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2007, 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; + +/** + * @author Jens Lehmann + * + */ +public class InvalidConfigOptionValueException extends Exception { + + private static final long serialVersionUID = 3286110428258072698L; + + public InvalidConfigOptionValueException(ConfigOption option, Object value) { + super("The value " + value + " is not valid for the configuration option " + option + "."); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-11-11 09:19:21
|
Revision: 278 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=278&view=rev Author: jenslehmann Date: 2007-11-11 01:19:18 -0800 (Sun, 11 Nov 2007) Log Message: ----------- small fixes in component tester and reasoning service Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/ComponentTest.java trunk/src/dl-learner/org/dllearner/core/ReasoningService.java Modified: trunk/src/dl-learner/org/dllearner/core/ComponentTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ComponentTest.java 2007-11-05 13:07:09 UTC (rev 277) +++ trunk/src/dl-learner/org/dllearner/core/ComponentTest.java 2007-11-11 09:19:18 UTC (rev 278) @@ -44,8 +44,6 @@ // get singleton instance of component manager ComponentManager cm = ComponentManager.getInstance(); - cm.writeConfigDocumentation(new File("doc/configOptionsNew.txt")); - // create knowledge source KnowledgeSource source = cm.knowledgeSource(OWLFile.class); String example = "examples/father.owl"; @@ -55,8 +53,8 @@ // create DIG reasoning service with standard settings ReasonerComponent reasoner = cm.reasoner(DIGReasoner.class, source); // ReasoningService rs = cm.reasoningService(DIGReasonerNew.class, source); - ReasoningService rs = cm.reasoningService(reasoner); reasoner.init(); + ReasoningService rs = cm.reasoningService(reasoner); // create a learning problem and set positive and negative examples LearningProblem lp = cm.learningProblem(PosNegDefinitionLP.class, rs); Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2007-11-05 13:07:09 UTC (rev 277) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2007-11-11 09:19:18 UTC (rev 278) @@ -21,6 +21,7 @@ package org.dllearner.core; import java.io.File; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -84,32 +85,19 @@ // private Map<Concept,Set<Concept>> moreSpecialConcepts = new HashMap<Concept,Set<Concept>>(); private Reasoner reasoner; - - // Beachte: wenn Wissensbasis modifiziert wird, muss ein neues - // Reasoner-Objekt - // angelegt werden (da Wissensbasis sofort entsprechend verwendetem - // Reasoning-Typ - // umgewandelt wird) - public ReasoningService(Reasoner reasoner) { - this.reasoner = reasoner; - - resetStatistics(); - } + // note that you must not modify the underlying knowledge base of + // a reasoning service (if you do, you have to create a new reasoning + // service object) public ReasoningService(ReasonerComponent reasoner) { this.reasoner = reasoner; - } - - /* - public void init() { - // temporary ugly hack to keep old version working - ((ReasonerComponent)reasoner).init(); - - // Listenansicht + + // list view atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); - atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); + atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); + + resetStatistics(); } - */ // zurücksetzen aller Statistiken (wenn z.B. vorher ein Satisfiability Check gemacht wird, // der allerdings nicht zum eigentlichen Algorithmus gehört) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |