You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(120) |
Sep
(36) |
Oct
(116) |
Nov
(17) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(143) |
Feb
(192) |
Mar
(74) |
Apr
(84) |
May
(105) |
Jun
(64) |
Jul
(49) |
Aug
(120) |
Sep
(159) |
Oct
(156) |
Nov
(51) |
Dec
(28) |
2009 |
Jan
(17) |
Feb
(55) |
Mar
(33) |
Apr
(57) |
May
(54) |
Jun
(28) |
Jul
(6) |
Aug
(16) |
Sep
(38) |
Oct
(30) |
Nov
(26) |
Dec
(52) |
2010 |
Jan
(7) |
Feb
(91) |
Mar
(65) |
Apr
(2) |
May
(14) |
Jun
(25) |
Jul
(38) |
Aug
(48) |
Sep
(80) |
Oct
(70) |
Nov
(75) |
Dec
(77) |
2011 |
Jan
(68) |
Feb
(53) |
Mar
(51) |
Apr
(35) |
May
(65) |
Jun
(101) |
Jul
(29) |
Aug
(230) |
Sep
(95) |
Oct
(49) |
Nov
(110) |
Dec
(63) |
2012 |
Jan
(41) |
Feb
(42) |
Mar
(25) |
Apr
(46) |
May
(51) |
Jun
(44) |
Jul
(45) |
Aug
(29) |
Sep
(12) |
Oct
(9) |
Nov
(17) |
Dec
(2) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(7) |
Apr
(16) |
May
(54) |
Jun
(27) |
Jul
(11) |
Aug
(5) |
Sep
(85) |
Oct
(27) |
Nov
(37) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(29) |
Mar
(5) |
Apr
(3) |
May
(22) |
Jun
(3) |
Jul
(4) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <jen...@us...> - 2008-09-12 12:35:13
|
Revision: 1200 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1200&view=rev Author: jenslehmann Date: 2008-09-12 12:35:09 +0000 (Fri, 12 Sep 2008) Log Message: ----------- added change methods to components such that underlying components can be replaced Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java trunk/src/dl-learner/org/dllearner/core/LearningProblem.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/InitWorker.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -83,6 +83,7 @@ private Map<Integer,List<Description>> generatedDefinitions = new HashMap<Integer,List<Description>>(); public BruteForceLearner(LearningProblem learningProblem, ReasoningService rs) { + super(learningProblem, rs); this.learningProblem = learningProblem; this.rs = rs; this.configurator = new BruteForceLearnerConfigurator(this); Modified: trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -67,6 +67,7 @@ private static String defaultSearchTreeFile = "log/searchTree.txt"; public DBpediaNavigationSuggestor(LearningProblem learningProblem, ReasoningService rs) { + super(learningProblem, rs); // this.rs=rs; this.configurator = new DBpediaNavigationSuggestorConfigurator(this); try{ @@ -96,10 +97,12 @@ } public DBpediaNavigationSuggestor(PosOnlyDefinitionLP learningProblem, ReasoningService rs) { + super(learningProblem, rs); System.out.println("test1"); } public DBpediaNavigationSuggestor(PosNegDefinitionLP learningProblem, ReasoningService rs) { + super(learningProblem, rs); System.out.println("test2"); } Modified: trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -56,6 +56,7 @@ private static Logger logger = Logger.getLogger(RandomGuesser.class); public RandomGuesser(LearningProblem learningProblem, ReasoningService rs) { + super(learningProblem, rs); this.learningProblem = learningProblem; this.rs = rs; this.configurator = new RandomGuesserConfigurator(this); Modified: trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -56,7 +56,7 @@ private Set<Description> simpleSuggestions; public SimpleSuggestionLearningAlgorithm() { - // this.learningProblem = learningProblem; + super(null, null); this.configurator = new SimpleSuggestionLearningAlgorithmConfigurator(this); } Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -131,12 +131,9 @@ private Score bestScore; private Description bestConcept; - private PosNegLP learningProblem; - // private GeneticRefinementOperator psi; private Psi psi; - private ReasoningService rs; /** * Creates an algorithm object. By default a steady state algorithm with @@ -146,8 +143,7 @@ * */ public GP(PosNegLP learningProblem, ReasoningService rs) { - this.learningProblem = learningProblem; - this.rs = rs; + super(learningProblem, rs); this.configurator = new GPConfigurator(this); } @@ -276,14 +272,14 @@ */ @Override public void init() { - rs.prepareSubsumptionHierarchy(); - rs.prepareRoleHierarchy(); + reasoningService.prepareSubsumptionHierarchy(); + reasoningService.prepareRoleHierarchy(); } @Override public void start() { // falls refinement-Wahrscheinlichkeit größer 0, dann erzeuge psi - psi = new Psi(learningProblem, rs); + psi = new Psi((PosNegLP)learningProblem, reasoningService); System.out.println(); System.out.println("Starting Genetic Programming Learner"); @@ -446,11 +442,11 @@ i++; // mutation } else if(rand >= crossoverBoundary && rand < mutationBoundary) { - newIndividuals[i] = GPUtilities.mutation(learningProblem, rs, individuals[selectedIndividuals[i]]); + newIndividuals[i] = GPUtilities.mutation(learningProblem, reasoningService, individuals[selectedIndividuals[i]]); // hill climbing } else if(rand >= mutationBoundary && rand < hillClimbingBoundary) { // System.out.println("hill climbing"); - newIndividuals[i] = GPUtilities.hillClimbing(learningProblem, rs, individuals[selectedIndividuals[i]]); + newIndividuals[i] = GPUtilities.hillClimbing(learningProblem, reasoningService, individuals[selectedIndividuals[i]]); // refinement operator } else if(rand >= hillClimbingBoundary && rand < refinementBoundary) { newIndividuals[i] = psi.applyOperator(individuals[selectedIndividuals[i]]); @@ -624,9 +620,9 @@ // int depth = rand.nextInt(initMaxDepth-initMinDepth)+initMinDepth; if(grow) - individuals[i] = GPUtilities.createGrowRandomProgram(learningProblem, rs, depth, adc); + individuals[i] = GPUtilities.createGrowRandomProgram(learningProblem, reasoningService, depth, adc); else - individuals[i] = GPUtilities.createFullRandomProgram(learningProblem, rs, depth, adc); + individuals[i] = GPUtilities.createFullRandomProgram(learningProblem, reasoningService, depth, adc); } /* Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -92,11 +92,7 @@ private ExampleBasedROLearner algorithm; private static Logger logger = Logger .getLogger(ExampleBasedROLearner.class); - private String logLevel = CommonConfigOptions.logLevelDefault; - - // learning problem to solve and background knowledge - private ReasoningService rs; - private LearningProblem learningProblem; + private String logLevel = CommonConfigOptions.logLevelDefault; // configuration options private boolean writeSearchTree; @@ -150,15 +146,13 @@ // soll später einen Operator und eine Heuristik entgegennehmen // public ROLearner(LearningProblem learningProblem, LearningProblem learningProblem2) { - public ExampleBasedROLComponent(PosNegLP learningProblem, ReasoningService rs) { - this.learningProblem = learningProblem; - this.rs = rs; + public ExampleBasedROLComponent(PosNegLP learningProblem, ReasoningService reasoningService) { + super(learningProblem, reasoningService); this.configurator = new ExampleBasedROLComponentConfigurator(this); } - public ExampleBasedROLComponent(PosOnlyDefinitionLP learningProblem, ReasoningService rs) { - this.learningProblem = learningProblem; - this.rs = rs; + public ExampleBasedROLComponent(PosOnlyDefinitionLP learningProblem, ReasoningService reasoningService) { + super(learningProblem, reasoningService); this.configurator = new ExampleBasedROLComponentConfigurator(this); } @@ -290,7 +284,7 @@ public void init() throws ComponentInitException { // exit with a ComponentInitException if the reasoner is unsupported for this learning algorithm - if(rs.getReasonerType() == ReasonerType.DIG) { + if(reasoningService.getReasonerType() == ReasonerType.DIG) { throw new ComponentInitException("DIG does not support the inferences needed in the selected learning algorithm component: " + getName()); } @@ -327,38 +321,38 @@ // concepts/roles if(allowedConcepts != null) { // sanity check to control if no non-existing concepts are in the list - Helper.checkConcepts(rs, allowedConcepts); + Helper.checkConcepts(reasoningService, allowedConcepts); usedConcepts = allowedConcepts; } else if(ignoredConcepts != null) { - usedConcepts = Helper.computeConceptsUsingIgnoreList(rs, ignoredConcepts); + usedConcepts = Helper.computeConceptsUsingIgnoreList(reasoningService, ignoredConcepts); } else { - usedConcepts = Helper.computeConcepts(rs); + usedConcepts = Helper.computeConcepts(reasoningService); } if(allowedRoles != null) { - Helper.checkRoles(rs, allowedRoles); + Helper.checkRoles(reasoningService, allowedRoles); usedRoles = allowedRoles; } else if(ignoredRoles != null) { - Helper.checkRoles(rs, ignoredRoles); - usedRoles = Helper.difference(rs.getObjectProperties(), ignoredRoles); + Helper.checkRoles(reasoningService, ignoredRoles); + usedRoles = Helper.difference(reasoningService.getObjectProperties(), ignoredRoles); } else { - usedRoles = rs.getObjectProperties(); + usedRoles = reasoningService.getObjectProperties(); } // prepare subsumption and role hierarchies, because they are needed // during the run of the algorithm - rs.prepareSubsumptionHierarchy(usedConcepts); + reasoningService.prepareSubsumptionHierarchy(usedConcepts); if(improveSubsumptionHierarchy) - rs.getSubsumptionHierarchy().improveSubsumptionHierarchy(); - rs.prepareRoleHierarchy(usedRoles); + reasoningService.getSubsumptionHierarchy().improveSubsumptionHierarchy(); + reasoningService.prepareRoleHierarchy(usedRoles); // prepare datatype hierarchy only if necessary - if(rs.hasDatatypeSupport()) - rs.prepareDatatypePropertyHierarchy(); + if(reasoningService.hasDatatypeSupport()) + reasoningService.prepareDatatypePropertyHierarchy(); // create a refinement operator and pass all configuration // variables to it RhoDRDown operator = new RhoDRDown( - rs, + reasoningService, applyAllFilter, applyExistsFilter, useAllConstructor, @@ -374,7 +368,7 @@ // options to it algorithm = new ExampleBasedROLearner( learningProblem, - rs, + reasoningService, operator, algHeuristic, startClass, Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -103,8 +103,6 @@ private boolean stop = false; private boolean isRunning = false; - private ReasoningService rs; - private Comparator<Node> nodeComparator; private NodeComparatorStable nodeComparatorStable = new NodeComparatorStable(); private ConceptComparator conceptComparator = new ConceptComparator(); @@ -198,21 +196,21 @@ // soll später einen Operator und eine Heuristik entgegennehmen // public ROLearner(LearningProblem learningProblem, LearningProblem learningProblem2) { - public ROLearner(PosNegLP learningProblem, ReasoningService rs) { + public ROLearner(PosNegLP learningProblem, ReasoningService reasoningService) { + super(learningProblem, reasoningService); this.learningProblem = learningProblem; - this.rs = rs; this.configurator = new ROLearnerConfigurator(this); posOnly=false; - baseURI = rs.getBaseURI(); + baseURI = reasoningService.getBaseURI(); } - public ROLearner(PosOnlyDefinitionLP learningProblem, ReasoningService rs) { + public ROLearner(PosOnlyDefinitionLP learningProblem, ReasoningService reasoningService) { + super(learningProblem, reasoningService); this.posOnlyLearningProblem = learningProblem; - this.rs = rs; this.configurator = new ROLearnerConfigurator(this); posOnly=true; - baseURI = rs.getBaseURI(); + baseURI = reasoningService.getBaseURI(); } public static Collection<Class<? extends LearningProblem>> supportedLearningProblems() { @@ -348,7 +346,7 @@ } // this.learningProblem2 = learningProblem2; - operator = new RhoDown(rs, applyAllFilter, applyExistsFilter, useAllConstructor, useExistsConstructor, useNegation, useBooleanDatatypes); + operator = new RhoDown(reasoningService, applyAllFilter, applyExistsFilter, useAllConstructor, useExistsConstructor, useNegation, useBooleanDatatypes); // candidate sets entsprechend der gewählten Heuristik initialisieren candidates = new TreeSet<Node>(nodeComparator); @@ -356,30 +354,30 @@ if(allowedConcepts != null) { // sanity check to control if no non-existing concepts are in the list - Helper.checkConcepts(rs, allowedConcepts); + Helper.checkConcepts(reasoningService, allowedConcepts); usedConcepts = allowedConcepts; } else if(ignoredConcepts != null) { - usedConcepts = Helper.computeConceptsUsingIgnoreList(rs, ignoredConcepts); + usedConcepts = Helper.computeConceptsUsingIgnoreList(reasoningService, ignoredConcepts); } else { - usedConcepts = Helper.computeConcepts(rs); + usedConcepts = Helper.computeConcepts(reasoningService); } if(allowedRoles != null) { - Helper.checkRoles(rs, allowedRoles); + Helper.checkRoles(reasoningService, allowedRoles); usedRoles = allowedRoles; } else if(ignoredRoles != null) { - Helper.checkRoles(rs, ignoredRoles); - usedRoles = Helper.difference(rs.getObjectProperties(), ignoredRoles); + Helper.checkRoles(reasoningService, ignoredRoles); + usedRoles = Helper.difference(reasoningService.getObjectProperties(), ignoredRoles); } else { - usedRoles = rs.getObjectProperties(); + usedRoles = reasoningService.getObjectProperties(); } // prepare subsumption and role hierarchies, because they are needed // during the run of the algorithm - rs.prepareSubsumptionHierarchy(usedConcepts); + reasoningService.prepareSubsumptionHierarchy(usedConcepts); if(improveSubsumptionHierarchy) - rs.getSubsumptionHierarchy().improveSubsumptionHierarchy(); - rs.prepareRoleHierarchy(usedRoles); + reasoningService.getSubsumptionHierarchy().improveSubsumptionHierarchy(); + reasoningService.prepareRoleHierarchy(usedRoles); } public static String getName() { @@ -763,7 +761,7 @@ if(toEvaluateConcepts.size()>0) { // Test aller Konzepte auf properness (mit DIG in nur einer Anfrage) long propCalcReasoningStart = System.nanoTime(); - improperConcepts = rs.subsumes(toEvaluateConcepts, concept); + improperConcepts = reasoningService.subsumes(toEvaluateConcepts, concept); propernessTestsReasoner+=toEvaluateConcepts.size(); // boolean isProper = !learningProblem.getReasoningService().subsumes(refinement, concept); propernessCalcReasoningTimeNs += System.nanoTime() - propCalcReasoningStart; @@ -988,19 +986,19 @@ // System.out.println("properness max recursion depth: " + maxRecDepth); // System.out.println("max. number of one-step refinements: " + maxNrOfRefinements); // System.out.println("max. number of children of a node: " + maxNrOfChildren); - logger.debug("subsumption time: " + Helper.prettyPrintNanoSeconds(rs.getSubsumptionReasoningTimeNs())); - logger.debug("instance check time: " + Helper.prettyPrintNanoSeconds(rs.getInstanceCheckReasoningTimeNs())); + logger.debug("subsumption time: " + Helper.prettyPrintNanoSeconds(reasoningService.getSubsumptionReasoningTimeNs())); + logger.debug("instance check time: " + Helper.prettyPrintNanoSeconds(reasoningService.getInstanceCheckReasoningTimeNs())); } if(showBenchmarkInformation) { - long reasoningTime = rs.getOverallReasoningTimeNs(); + long reasoningTime = reasoningService.getOverallReasoningTimeNs(); double reasoningPercentage = 100 * reasoningTime/(double)algorithmRuntime; long propWithoutReasoning = propernessCalcTimeNs-propernessCalcReasoningTimeNs; double propPercentage = 100 * propWithoutReasoning/(double)algorithmRuntime; double deletionPercentage = 100 * childConceptsDeletionTimeNs/(double)algorithmRuntime; - long subTime = rs.getSubsumptionReasoningTimeNs(); + long subTime = reasoningService.getSubsumptionReasoningTimeNs(); double subPercentage = 100 * subTime/(double)algorithmRuntime; double refinementPercentage = 100 * refinementCalcTimeNs/(double)algorithmRuntime; double redundancyCheckPercentage = 100 * redundancyCheckTimeNs/(double)algorithmRuntime; Modified: trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -45,6 +45,56 @@ public abstract class LearningAlgorithm extends Component { /** + * The learning problem variable, which must be used by + * all learning algorithm implementations. + */ + protected LearningProblem learningProblem; + + /** + * The reasoning service variable, which must be used by + * all learning algorithm implementations. + */ + protected ReasoningService reasoningService; + + /** + * Each learning algorithm gets a learning problem and + * a reasoner as input. + * @param learningProblem The learning problem to solve. + * @param reasoningService The reasoner connecting to the + * underlying knowledge base. + */ + public LearningAlgorithm(LearningProblem learningProblem, ReasoningService reasoningService) { + this.learningProblem = learningProblem; + this.reasoningService = reasoningService; + } + + /** + * Call this when you want to change the learning problem, but + * leave everything else as is. Method can be used to apply + * a configured algorithm to different learning problems. + * Implementations, which do not only use the provided learning + * algorithm variable, must make sure that a call to this method + * indeed changes the learning problem. + * @param learningProblem The new learning problem. + */ + public void changeLearningProblem(LearningProblem learningProblem) { + this.learningProblem = learningProblem; + } + + /** + * Call this when you want to change the reasoning service, but + * leave everything else as is. Method can be used to use + * a configured algorithm with different reasoners. + * Implementations, which do not only use the provided reasoning + * service class variable, must make sure that a call to this method + * indeed changes the reasoning service. + * @param reasoningService The new reasoning service. + */ + public void changeReasoningService(ReasoningService reasoningService) { + this.reasoningService = reasoningService; + } + + /** * This is the maximum number of results, which the learning * algorithms need to keep. (Often algorithms do not need * to store any results except the best one, so this limit Modified: trunk/src/dl-learner/org/dllearner/core/LearningProblem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningProblem.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/core/LearningProblem.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -60,6 +60,18 @@ } /** + * Method to exchange the reasoner underlying the learning + * problem. + * Implementations, which do not only use the provided reasoning + * service class variable, must make sure that a call to this method + * indeed changes the reasoning service. + * @param reasoningService New reasoning service. + */ + public void changeReasoningService(ReasoningService reasoningService) { + this.reasoningService = reasoningService; + } + + /** * Computes the <code>Score</code> of a given class description * with respect to this learning problem. * This can (but does not need to) be used by learning algorithms Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -40,11 +40,38 @@ import org.dllearner.utilities.datastructures.SortedSetTuple; /** + * Component representing a reasoner. + * * @author Jens Lehmann * */ public abstract class ReasonerComponent extends Component implements Reasoner { + protected Set<KnowledgeSource> sources; + + public ReasonerComponent(Set<KnowledgeSource> sources) { + this.sources = sources; + } + + /** + * @return the sources + */ + public Set<KnowledgeSource> getSources() { + return sources; + } + + /** + * Method to exchange the reasoner underlying the learning + * problem. + * Implementations, which do not only use the provided sources + * class variable, must make sure that a call to this method + * indeed changes them. + * @param The new knowledge sources. + */ + public void changeSources(Set<KnowledgeSource> sources) { + this.sources = sources; + } + public abstract boolean hasDatatypeSupport(); public boolean subsumes(Description superConcept, Description subConcept) @@ -258,4 +285,5 @@ public Set<NamedClass> getInconsistentClasses() throws ReasoningMethodUnsupportedException{ throw new ReasoningMethodUnsupportedException(); } + } Modified: trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -1,7 +1,6 @@ package org.dllearner.gui; import java.awt.BorderLayout; -import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.LinkedList; @@ -39,10 +38,6 @@ private JButton clearButton; private JComboBox comboBox = new JComboBox(); - public ComponentPanel(LayoutManager layout) { - super(layout); - } - ComponentPanel(final Config config, StartGUI startGUI, Class<? extends Component> panelClass, Class<? extends Component> defaultComponent) { this(config, startGUI, panelClass, defaultComponent,null); } Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -20,8 +20,10 @@ package org.dllearner.gui; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; +import java.util.Set; import org.apache.log4j.Logger; import org.dllearner.core.Component; @@ -145,17 +147,20 @@ */ public KnowledgeSource changeKnowledgeSource(Class<? extends KnowledgeSource> clazz) { source = cm.knowledgeSource(clazz); + Set<KnowledgeSource> sources = new HashSet<KnowledgeSource>(); + sources.add(source); + reasoner.changeSources(sources); // logger.debug("knowledge source " + clazz + " changed"); // create a new reasoner object using the current class and the selected source - reasoner = cm.reasoner(reasoner.getClass(), source); - rs = cm.reasoningService(reasoner); - lp = cm.learningProblem(lp.getClass(), rs); - try { - la = cm.learningAlgorithm(la.getClass(), lp, rs); - } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } +// reasoner = cm.reasoner(reasoner.getClass(), source); +// rs = cm.reasoningService(reasoner); +// lp = cm.learningProblem(lp.getClass(), rs); +// try { +// la = cm.learningAlgorithm(la.getClass(), lp, rs); +// } catch (LearningProblemUnsupportedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } return source; } @@ -187,13 +192,15 @@ public ReasonerComponent changeReasoner(Class<? extends ReasonerComponent> clazz) { reasoner = cm.reasoner(clazz, source); rs = cm.reasoningService(reasoner); - lp = cm.learningProblem(lp.getClass(), rs); - try { - la = cm.learningAlgorithm(la.getClass(), lp, rs); - } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + lp.changeReasoningService(rs); + la.changeReasoningService(rs); +// lp = cm.learningProblem(lp.getClass(), rs); +// try { +// la = cm.learningAlgorithm(la.getClass(), lp, rs); +// } catch (LearningProblemUnsupportedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } return reasoner; } @@ -240,12 +247,13 @@ public LearningProblem changeLearningProblem(Class<? extends LearningProblem> clazz) { lp = cm.learningProblem(clazz, rs); - try { - la = cm.learningAlgorithm(la.getClass(), lp, rs); - } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + la.changeLearningProblem(lp); +// try { +// la = cm.learningAlgorithm(la.getClass(), lp, rs); +// } catch (LearningProblemUnsupportedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } return lp; } Modified: trunk/src/dl-learner/org/dllearner/gui/InitWorker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/InitWorker.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/gui/InitWorker.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -98,6 +98,14 @@ try { for(Component component : components) { component.init(); + + // when the reasoner has been initialised, we need to update + // the option panel (such that the user can see the existing + // examples, classes etc.) + if(component instanceof ReasonerComponent) { + gui.panels[2].updateOptionPanel(); + gui.panels[3].updateOptionPanel(); + } } } catch (ComponentInitException e) { gui.getStatusPanel().setExceptionMessage(e.getMessage()); @@ -111,14 +119,6 @@ waitFrame.dispose(); } - // when the reasoner has been initialised, we need to update - // the option panel (such that the user can see the existing - // examples, classes etc.) - if(components instanceof ReasonerComponent) { - gui.panels[2].updateOptionPanel(); - gui.panels[3].updateOptionPanel(); - } - return true; } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -85,7 +85,6 @@ URL reasonerURL; - Set<KnowledgeSource> sources; // Variablen für Reasoner DIGHTTPConnector connector; @@ -116,8 +115,8 @@ public DIGReasoner(Set<KnowledgeSource> sources) { + super(sources); this.configurator = new DIGReasonerConfigurator(this); - this.sources = sources; try { reasonerURL = new URL("http://localhost:8081"); } catch (MalformedURLException e) { Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -107,7 +107,6 @@ // private ReasoningService rs; private OWLAPIReasoner rc; - private Set<KnowledgeSource> sources; // we use sorted sets (map indices) here, because they have only log(n) // complexity for checking whether an element is contained in them @@ -127,7 +126,7 @@ private Map<DatatypeProperty, Map<Individual, SortedSet<Integer>>> id = new TreeMap<DatatypeProperty, Map<Individual, SortedSet<Integer>>>(); public FastInstanceChecker(Set<KnowledgeSource> sources) { - this.sources = sources; + super(sources); this.configurator = new FastInstanceCheckerConfigurator(this); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -45,6 +45,7 @@ public FastRetrievalReasoner(Set<KnowledgeSource> sources) { + super(sources); this.configurator = new FastRetrievalReasonerConfigurator(this); rc = ComponentFactory.getDIGReasoner(sources); @@ -68,10 +69,11 @@ } public FastRetrievalReasoner(FlatABox abox) { + super(null); this.configurator = new FastRetrievalReasonerConfigurator(this); this.abox = abox; fastRetrieval = new FastRetrieval(abox); - + // atomare Konzepte und Rollen initialisieren atomicConcepts = new HashSet<NamedClass>(); for(String concept : abox.concepts) { Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-12 10:52:14 UTC (rev 1199) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-12 12:35:09 UTC (rev 1200) @@ -110,7 +110,6 @@ return configurator; } - private Set<KnowledgeSource> sources; private OWLReasoner reasoner; // the data factory is used to generate OWL API objects private OWLDataFactory factory; @@ -141,9 +140,8 @@ private List<OWLOntology> owlAPIOntologies = new LinkedList<OWLOntology>(); public OWLAPIReasoner(Set<KnowledgeSource> sources) { - this.sources = sources; + super(sources); this.configurator = new OWLAPIReasonerConfigurator(this); - } public static String getName() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-12 10:52:19
|
Revision: 1199 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1199&view=rev Author: jenslehmann Date: 2008-09-12 10:52:14 +0000 (Fri, 12 Sep 2008) Log Message: ----------- fixed bug related to URL config option and commandline interface Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/cli/Start.java trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/InitWorker.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/kb/OWLFile.java Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java =================================================================== --- trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -198,7 +198,7 @@ // configuration option "url"), so this may need to be changed in // the // future - cm.applyConfigEntry(ks, "url", entry.getKey().toString()); + cm.applyConfigEntry(ks, "url", entry.getKey()); sources.add(ks); configureComponent(cm, ks, componentPrefixMapping, parser); Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -141,6 +141,8 @@ } /** + * TODO Method should be removed and a mapping table in ConfigJavaGenerator + * created instead. * gets java imports * @return */ Modified: trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -31,6 +31,8 @@ */ public class URLConfigOption extends ConfigOption<URL> { + private boolean refersToFile = false; + public URLConfigOption(String name, String description) { super(name, description); } @@ -44,6 +46,24 @@ super(name, description, defaultValue, mandatory, requiresInit); } + /** + * Returns whether the URI can refer to a file or not, e.g. the + * URL of an OWL knowledge source does refer to a file whereas + * the URL of a SPARQL endpoint cannot refer to a file. The distinction + * can be useful in GUIs (e.g. they may offer to choose a local file). + * @return the refersToFile + */ + public boolean refersToFile() { + return refersToFile; + } + + /** + * @param refersToFile Set whether this option can refer to a file. + */ + public void setRefersToFile(boolean refersToFile) { + this.refersToFile = refersToFile; + } + /* (non-Javadoc) * @see org.dllearner.core.config.ConfigOption#checkType(java.lang.Object) */ Modified: trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -21,8 +21,6 @@ /** * Class displaying a component (and its options). * - * @param <T> The type of the panel (KnowledgeSource, ReasonerComponent, - * LearningProblem, LearningAlgorithm). * @author Jens Lehmann * */ Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -20,6 +20,10 @@ package org.dllearner.gui; +import java.util.LinkedList; +import java.util.List; + +import org.apache.log4j.Logger; import org.dllearner.core.Component; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; @@ -47,7 +51,7 @@ public class Config { private ComponentManager cm = ComponentManager.getInstance(); -// private static Logger logger = Logger.getLogger(Config.class); + private static Logger logger = Logger.getLogger(Config.class); // the components currently active private KnowledgeSource source; @@ -425,9 +429,23 @@ // algorithmRunStopTime = null; // } + + // init the specified component and record which ones where initialised - public void init(int tabIndex) { + public void init(List<Integer> tabIndex) { + List<Component> components = new LinkedList<Component>(); + for(int i : tabIndex) { + switch(i) { + case 0: components.add(source); needsInit[i] = false; break; + case 1: components.add(reasoner); needsInit[i] = false; break; + case 2: components.add(lp); needsInit[i] = false; break; + case 3: components.add(la); needsInit[i] = false; break; + } + } + InitWorker worker = new InitWorker (components, gui); + worker.execute(); + /* // try { if(tabIndex==0) { InitWorker worker = new InitWorker(source, gui); @@ -451,9 +469,14 @@ // // TODO display message in status bar // e.printStackTrace(); // } + */ - needsInit[tabIndex] = false; - System.out.println("component " + tabIndex + " initialised."); + if(tabIndex.size() == 1) { + logger.info("Component " + tabIndex.get(0) + " initialised."); + } else if(tabIndex.size() > 1) { + logger.info("Components " + tabIndex + " initialised."); + } + } // applies a configuration option - used as delegate method, which invalidates components Modified: trunk/src/dl-learner/org/dllearner/gui/InitWorker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/InitWorker.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/gui/InitWorker.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -44,12 +44,12 @@ */ public class InitWorker extends SwingWorker<Boolean, Boolean> { - private Component component; + private List<Component> components; private StartGUI gui; - private boolean timeIntensive = true; + private boolean timeIntensive; - public InitWorker(Component component, StartGUI gui) { - this.component = component; + public InitWorker(List<Component> components, StartGUI gui) { + this.components = components; this.gui = gui; // create a list of components, which do need virtually @@ -59,9 +59,14 @@ nonTimeIntensiveComponents.add(OWLFile.class); nonTimeIntensiveComponents.add(KBFile.class); - if(nonTimeIntensiveComponents.contains(component.getClass())) { - timeIntensive = false; + // we check if any of the components is time-intensive + timeIntensive = false; + for(Component component : components) { + if(!nonTimeIntensiveComponents.contains(component.getClass())) { + timeIntensive = true; + } } + } @Override @@ -91,7 +96,9 @@ } try { - component.init(); + for(Component component : components) { + component.init(); + } } catch (ComponentInitException e) { gui.getStatusPanel().setExceptionMessage(e.getMessage()); e.printStackTrace(); @@ -107,7 +114,7 @@ // when the reasoner has been initialised, we need to update // the option panel (such that the user can see the existing // examples, classes etc.) - if(component instanceof ReasonerComponent) { + if(components instanceof ReasonerComponent) { gui.panels[2].updateOptionPanel(); gui.panels[3].updateOptionPanel(); } Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -179,14 +179,19 @@ int index = tabPane.getSelectedIndex(); // System.out.println(index); + // a list of all components (0 = knowledge source, + // 1 = reasoner etc.) which have to be initialised; + // the user can init several components at once + List<Integer> componentsToInit = new LinkedList<Integer>(); // check whether we need to initialise components if (index != 0 && config.tabNeedsInit(index - 1)) { for (int i = 0; i < index; i++) { if(config.tabNeedsInit(i)) { - config.init(i); + componentsToInit.add(i); } } } + config.init(componentsToInit); updateTabs(); @@ -227,7 +232,7 @@ Logger logger = Logger.getRootLogger(); logger.removeAllAppenders(); logger.addAppender(consoleAppender); - logger.setLevel(Level.DEBUG); + logger.setLevel(Level.TRACE); File file = null; if (args.length > 0) Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -243,8 +243,14 @@ if(individualsSet != null) { LinkedList<Individual> individuals = new LinkedList<Individual>( individualsSet); +// int i = 0; for (Individual ind : individuals) { cBL.add(ind.getName()); +// i++; + // do not display more than 200 examples (freezes GUI) +// if(i == 200) { +// break; +// } } } } Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -33,7 +33,6 @@ import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.config.URLConfigOption; import org.dllearner.core.configurators.KBFileConfigurator; import org.dllearner.core.owl.KB; @@ -63,7 +62,7 @@ .getLogger(KBFile.class); // private File file; - private URL url; +// private URL url; private KB kb; private KBFileConfigurator configurator; @@ -98,8 +97,10 @@ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - options.add(new StringConfigOption("filename", "pointer to the KB file on local file system",null, true, true)); - options.add(new URLConfigOption("url", "URL pointer to the KB file",null, false, true)); +// options.add(new StringConfigOption("filename", "pointer to the KB file on local file system",null, true, true)); + URLConfigOption urlOption = new URLConfigOption("url", "URL pointer to the KB file",null, false, true); + urlOption.setRefersToFile(true); + options.add(urlOption); return options; } @@ -118,25 +119,26 @@ public void init() throws ComponentInitException { //URL url = null; try { - String filename = configurator.getFilename(); - String urlString = configurator.getUrl().toString(); - if(filename!=null){ - url = new File(filename).toURI().toURL(); - }else if(urlString!=null){ - url = new URL(urlString); - } +// String filename = configurator.getFilename(); +// String urlString = configurator.getUrl().toString(); +// if(filename!=null){ +// url = new File(filename).toURI().toURL(); +// }else if(urlString!=null){ +// url = new URL(urlString); +// } +// +// if(url != null) { +// kb = KBParser.parseKBFile(url); +// } + kb = KBParser.parseKBFile(configurator.getUrl()); - if(url != null) { - kb = KBParser.parseKBFile(url); - } - } catch (MalformedURLException e) { logger.error(e.getMessage()); //throw new InvalidConfigOptionValueException(entry.getOption(),entry.getValue()); } catch (IOException e) { - throw new ComponentInitException("KB file " + url + " could not be read.", e); + throw new ComponentInitException("KB file " + configurator.getUrl() + " could not be read.", e); } catch (ParseException e) { - throw new ComponentInitException("KB file " + url + " could not be parsed correctly.", e); + throw new ComponentInitException("KB file " + configurator.getUrl() + " could not be parsed correctly.", e); } } @@ -206,7 +208,7 @@ } public URL getURL() { - return url; + return configurator.getUrl(); } @Override Modified: trunk/src/dl-learner/org/dllearner/kb/OWLFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-12 09:52:17 UTC (rev 1198) +++ trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-12 10:52:14 UTC (rev 1199) @@ -65,7 +65,9 @@ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - options.add(new URLConfigOption("url", "URL pointing to the OWL file", null, true, true)); + URLConfigOption urlOption = new URLConfigOption("url", "URL pointing to the OWL file", null, true, true); + urlOption.setRefersToFile(true); + options.add(urlOption); return options; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-12 09:52:22
|
Revision: 1198 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1198&view=rev Author: jenslehmann Date: 2008-09-12 09:52:17 +0000 (Fri, 12 Sep 2008) Log Message: ----------- simplified GUI code: four panel classes merged into one Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/InitWorker.java trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -1,26 +1,176 @@ package org.dllearner.gui; +import java.awt.BorderLayout; import java.awt.LayoutManager; +import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.util.LinkedList; +import java.util.List; +import javax.swing.JButton; +import javax.swing.JComboBox; import javax.swing.JPanel; import org.dllearner.core.Component; +import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.core.ReasonerComponent; /** * Class displaying a component (and its options). * + * @param <T> The type of the panel (KnowledgeSource, ReasonerComponent, + * LearningProblem, LearningAlgorithm). * @author Jens Lehmann * */ -public abstract class ComponentPanel<T extends Component> extends JPanel implements ActionListener { +public class ComponentPanel extends JPanel implements ActionListener { private static final long serialVersionUID = -7678275020058043937L; + private Config config; +// private StartGUI startGUI; + private List<Class<? extends Component>> selectableComponents; + private OptionPanel optionPanel; +// private Class<? extends Component> panelClass; + private Component currentComponent; + + // GUI elements + private JButton clearButton; + private JComboBox comboBox = new JComboBox(); + public ComponentPanel(LayoutManager layout) { super(layout); } - // called when panel is active - public abstract void panelActivated(); + ComponentPanel(final Config config, StartGUI startGUI, Class<? extends Component> panelClass, Class<? extends Component> defaultComponent) { + this(config, startGUI, panelClass, defaultComponent,null); + } + + ComponentPanel(final Config config, StartGUI startGUI, Class<? extends Component> panelClass, Class<? extends Component> defaultComponent, List<Class<? extends Component>> ignoredComponents) { + super(new BorderLayout()); + + this.config = config; +// this.startGUI = startGUI; +// this.panelClass = panelClass; + + // get all classes of the correct type + selectableComponents = new LinkedList<Class<? extends Component>>(); + if(panelClass == KnowledgeSource.class) { + selectableComponents.addAll(config.getComponentManager().getKnowledgeSources()); + } else if(panelClass == ReasonerComponent.class) { + selectableComponents.addAll(config.getComponentManager().getReasonerComponents()); + } else if(panelClass == LearningProblem.class) { + selectableComponents.addAll(config.getComponentManager().getLearningProblems()); + } else if(panelClass == LearningAlgorithm.class) { + selectableComponents.addAll(config.getComponentManager().getLearningAlgorithms()); + } + + // set default component class (move it to first position) + selectableComponents.remove(defaultComponent); + selectableComponents.add(0, defaultComponent); + + // remove ignored component classes + if(ignoredComponents != null) { + selectableComponents.removeAll(ignoredComponents); + } + + // create combo box + for (int i = 0; i < selectableComponents.size(); i++) { + comboBox.addItem(config.getComponentManager().getComponentName(selectableComponents.get(i))); + } + comboBox.addActionListener(this); + + clearButton = new JButton("Reset to Default Values"); + clearButton.addActionListener(this); + + // create upper panel + JPanel choosePanel = new JPanel(); + choosePanel.add(comboBox); +// choosePanel.add(new JLabel(" ")); + choosePanel.add(clearButton); + + // we create a new default component + currentComponent = newInstance(defaultComponent); + optionPanel = new OptionPanel(config, currentComponent); + + add(choosePanel, BorderLayout.NORTH); + add(optionPanel, BorderLayout.CENTER); + + } + + + + public void actionPerformed(ActionEvent e) { + if(e.getSource() == comboBox) { + // change component and update option panel + Class<? extends Component> c = selectableComponents.get(comboBox.getSelectedIndex()); + currentComponent = changeInstance(c); + updateOptionPanel(); + } else if (e.getSource() == clearButton) { + // clearing everything corresponds to changing to an unconfigured + // component of the same type + currentComponent = changeInstance(currentComponent.getClass()); + updateOptionPanel(); + } + } + + /** + * Updates the option panel. + */ + public void updateOptionPanel() { + optionPanel.rebuild(currentComponent); + } + + /** + * Method performing actions when panel is activated. + */ + public void panelActivated() { + // hook method, which does nothing yet + } + + // creates an instance of the specified component class + @SuppressWarnings("unchecked") + private Component newInstance(Class<? extends Component> clazz) { + Component newComponent = null; + if(KnowledgeSource.class.isAssignableFrom(clazz)) { + newComponent = config.newKnowledgeSource((Class<KnowledgeSource>) clazz); + } else if(ReasonerComponent.class.isAssignableFrom(clazz)) { + newComponent = config.newReasoner((Class<ReasonerComponent>) clazz); + } else if(LearningProblem.class.isAssignableFrom(clazz)) { + newComponent = config.newLearningProblem((Class<LearningProblem>) clazz); + } else if(LearningAlgorithm.class.isAssignableFrom(clazz)) { + try { + newComponent = config.newLearningAlgorithm((Class<LearningAlgorithm>) clazz); + } catch (LearningProblemUnsupportedException e) { + // TODO status message + e.printStackTrace(); + } + } + return newComponent; + } + + // changes current component to an instance of the specified class + @SuppressWarnings("unchecked") + private Component changeInstance(Class<? extends Component> clazz) { + Component newComponent = null; + if(KnowledgeSource.class.isAssignableFrom(clazz)) { + newComponent = config.changeKnowledgeSource((Class<KnowledgeSource>) clazz); + } else if(ReasonerComponent.class.isAssignableFrom(clazz)) { + newComponent = config.changeReasoner((Class<ReasonerComponent>) clazz); + } else if(LearningProblem.class.isAssignableFrom(clazz)) { + newComponent = config.changeLearningProblem((Class<LearningProblem>) clazz); + } else if(LearningAlgorithm.class.isAssignableFrom(clazz)) { + try { + newComponent = config.changeLearningAlgorithm((Class<LearningAlgorithm>) clazz); + } catch (LearningProblemUnsupportedException e) { + // TODO status message + e.printStackTrace(); + } + } + return newComponent; + } + } Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -121,7 +121,7 @@ public KnowledgeSource getKnowledgeSource() { return source; } - + /** * Creates a knowledge source and makes it the active source. * @param clazz @@ -268,13 +268,8 @@ return la; } - public LearningAlgorithm changeLearningAlgorithm(Class<? extends LearningAlgorithm> clazz) { - try { - la = cm.learningAlgorithm(clazz, lp, rs); - } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public LearningAlgorithm changeLearningAlgorithm(Class<? extends LearningAlgorithm> clazz) throws LearningProblemUnsupportedException { + la = cm.learningAlgorithm(clazz, lp, rs); return la; } Modified: trunk/src/dl-learner/org/dllearner/gui/InitWorker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/InitWorker.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/InitWorker.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -108,8 +108,8 @@ // the option panel (such that the user can see the existing // examples, classes etc.) if(component instanceof ReasonerComponent) { - gui.tab2.updateOptionPanel(); - gui.tab3.updateOptionPanel(); + gui.panels[2].updateOptionPanel(); + gui.panels[3].updateOptionPanel(); } return true; Deleted: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -1,141 +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.gui; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JPanel; - -import org.dllearner.core.KnowledgeSource; -import org.dllearner.kb.OWLAPIOntology; -import org.dllearner.kb.OWLFile; - - -/** - * Knowledge source panel, tab 0. Choose source, change mandatory options and finally initialise - * knowledge source. - * - * @author Jens Lehmann - * @author Tilo Hielscher - */ -public class KnowledgeSourcePanel extends ComponentPanel<KnowledgeSource> { - - private static final long serialVersionUID = -7678275020058043937L; - - private Config config; -// private StartGUI startGUI; - private JButton clearButton; - private String[] kbBoxItems = {}; - private JComboBox cb = new JComboBox(kbBoxItems); - private JPanel choosePanel = new JPanel(); - private int choosenClassIndex; - private List<Class<? extends KnowledgeSource>> selectableSources; - private OptionPanel optionPanel; - - KnowledgeSourcePanel(final Config config, StartGUI startGUI) { - super(new BorderLayout()); - - this.config = config; -// this.startGUI = startGUI; - selectableSources = config.getComponentManager().getKnowledgeSources(); - // to set a default source, we move it to the beginning of the list - selectableSources.remove(OWLFile.class); - selectableSources.add(0, OWLFile.class); - // OWL API ontology is only useful programmatically (not in the GUI itself) - selectableSources.remove(OWLAPIOntology.class); - - clearButton = new JButton("Reset to Default Values"); - clearButton.addActionListener(this); - - // add to comboBox - for (int i = 0; i < selectableSources.size(); i++) { - cb.addItem(config.getComponentManager().getComponentName(selectableSources.get(i))); - } - cb.addActionListener(this); - - choosePanel.add(cb); -// choosePanel.add(new JLabel(" ")); - choosePanel.add(clearButton); - choosenClassIndex = cb.getSelectedIndex(); - - // whenever a component is selected, we immediately create an instance (non-initialised) - KnowledgeSource ks = config.newKnowledgeSource(selectableSources.get(cb.getSelectedIndex())); - optionPanel = new OptionPanel(config, ks); - - add(choosePanel, BorderLayout.NORTH); - add(optionPanel, BorderLayout.CENTER); - - choosenClassIndex = cb.getSelectedIndex(); - -// setSource(); -// updateAll(); - } - - public void actionPerformed(ActionEvent e) { - if (choosenClassIndex != cb.getSelectedIndex()) { - choosenClassIndex = cb.getSelectedIndex(); - // create a new knowledge source component - config.changeKnowledgeSource(selectableSources.get(choosenClassIndex)); - updateOptionPanel(); - } - - if (e.getSource() == clearButton) { -// config.setKnowledgeSource(config.getComponentManager().knowledgeSource( -// selectableSources.get(choosenClassIndex))); - updateOptionPanel(); - } - -// if (e.getSource() == initButton) { -// init(); -// } - -// if (e.getSource() == clearButton) { -// config.reInit(); -// } - } - - /** - * after this, you can change widgets - */ -// public void setSource() { -// -// } - - /** - * update OptionPanel with new selection - */ - public void updateOptionPanel() { - optionPanel.update(config.getKnowledgeSource()); - } - - /* (non-Javadoc) - * @see org.dllearner.gui.ComponentPanel#panelActivated() - */ - @Override - public void panelActivated() { - // TODO Auto-generated method stub - - } - -} Deleted: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -1,202 +0,0 @@ -package org.dllearner.gui; - -/** - * 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/>. - * - */ -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.util.List; - -import javax.swing.JComboBox; -import javax.swing.JPanel; - -import org.dllearner.algorithms.DBpediaNavigationSuggestor; -import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; -import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.LearningProblemUnsupportedException; - -/** - * LearningAlgorithmPanel, tab 3. Choose LearningAlgorithm, change Options and - * final initiate LearningAlgorithm. - * - * @author Tilo Hielscher - */ -public class LearningAlgorithmPanel extends ComponentPanel<LearningAlgorithm> { - - private static final long serialVersionUID = 8721490771860452959L; - - private Config config; -// private StartGUI startGUI; - private List<Class<? extends LearningAlgorithm>> selectableAlgorithms; - private JPanel choosePanel = new JPanel(); - private OptionPanel optionPanel; -// private JPanel initPanel = new JPanel(); -// private JButton initButton, autoInitButton; - private String[] cbItems = {}; - private JComboBox cb = new JComboBox(cbItems); - private int choosenClassIndex; - - public LearningAlgorithmPanel(Config config, StartGUI startGUI) { - super(new BorderLayout()); - - this.config = config; -// this.startGUI = startGUI; - selectableAlgorithms = config.getComponentManager().getLearningAlgorithms(); - // to set a default learning algorithm, we move it to the beginning of the list - selectableAlgorithms.remove(ExampleBasedROLComponent.class); - selectableAlgorithms.add(0, ExampleBasedROLComponent.class); - // we also remove the DBpedia Navigation Suggestor (maybe shouldn't be declared as a learning algorithm at all; - // at least it is not doing anything useful at the moment) - selectableAlgorithms.remove(DBpediaNavigationSuggestor.class); - -// initButton = new JButton("Init LearingAlgorithm"); -// initButton.addActionListener(this); - // initPanel.add(initButton); -// initButton.setEnabled(true); -// autoInitButton = new JButton("Set"); -// autoInitButton.addActionListener(this); - - // add into comboBox - for (int i = 0; i < selectableAlgorithms.size(); i++) { - cb.addItem(config.getComponentManager().getComponentName(selectableAlgorithms.get(i))); - } - - choosePanel.add(cb); -// choosePanel.add(autoInitButton); - cb.addActionListener(this); - - LearningAlgorithm la = null; - try { - la = config.newLearningAlgorithm(selectableAlgorithms.get(cb.getSelectedIndex())); - } catch (LearningProblemUnsupportedException e) { - // TODO display message (or avoid selection at all) - e.printStackTrace(); - } - optionPanel = new OptionPanel(config, la); - - add(choosePanel, BorderLayout.PAGE_START); - add(optionPanel, BorderLayout.CENTER); -// add(initPanel, BorderLayout.PAGE_END); - - choosenClassIndex = cb.getSelectedIndex(); -// updateInitButtonColor(); - } - - public void actionPerformed(ActionEvent e) { - // read selected Class - if (choosenClassIndex != cb.getSelectedIndex()) { - choosenClassIndex = cb.getSelectedIndex(); - config.changeLearningAlgorithm(selectableAlgorithms.get(choosenClassIndex)); - updateOptionPanel(); -// config.setInitLearningAlgorithm(false); -// init(); - } - -// if (e.getSource() == autoInitButton) -// setLearningAlgorithm(); - -// if (e.getSource() == initButton) -// init(); - } - - /** - * after this, you can change widgets - */ -// public void setLearningAlgorithm() { -// if (config.getLearningProblem() != null && config.getReasoningService() != null) { -// try { -// config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm( -// selectableAlgorithms.get(choosenClassIndex), config.getLearningProblem(), -// config.getReasoningService())); -// updateOptionPanel(); -// } catch (LearningProblemUnsupportedException e) { -// e.printStackTrace(); -// } -// } -// } - - /** - * after this, next tab can be used - */ - /* - public void init() { - setLearningAlgorithm(); - if (config.getLearningProblem() != null) { - try { - config.getLearningAlgorithm().init(); - } catch (ComponentInitException e) { - e.printStackTrace(); - } - config.setInitLearningAlgorithm(true); - System.out.println("init LearningAlgorithm"); - startGUI.updateTabColors(); - } - }*/ - - /** - * updateAll - */ - /* - public void updateAll() { - updateComboBox(); - updateOptionPanel(); - updateInitButtonColor(); - }*/ - - /** - * set ComboBox to selected class - */ - /* - public void updateComboBox() { - if (config.getLearningAlgorithm() != null) - for (int i = 0; i < selectableAlgorithms.size(); i++) - if (config.getLearningAlgorithm().getClass().equals( - config.getComponentManager().getLearningAlgorithms().get(i))) { - cb.setSelectedIndex(i); - } - this.choosenClassIndex = cb.getSelectedIndex(); - }*/ - - /** - * update OptionPanel with new selection - */ - public void updateOptionPanel() { - optionPanel.update(config.getLearningAlgorithm()); - } - - /** - * make init-button red if you have to click - */ - /* - public void updateInitButtonColor() { - if (!config.needsInitLearningAlgorithm()) { - initButton.setForeground(Color.RED); - } else - initButton.setForeground(Color.BLACK); - }*/ - - /* (non-Javadoc) - * @see org.dllearner.gui.ComponentPanel#panelActivated() - */ - @Override - public void panelActivated() { - // TODO Auto-generated method stub - - } -} Deleted: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -1,181 +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.gui; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.util.List; - -import javax.swing.JComboBox; -import javax.swing.JPanel; - -import org.dllearner.core.LearningProblem; - -/** - * Learning problem panel. - * - * @author Jens Lehmann - * @author Tilo Hielscher - */ -public class LearningProblemPanel extends ComponentPanel<LearningProblem> { - - private static final long serialVersionUID = -3819627680918930203L; - - private Config config; -// private StartGUI startGUI; - private List<Class<? extends LearningProblem>> lpClasses; - private String[] lpBoxItems = {}; - private JComboBox cb = new JComboBox(lpBoxItems); - private JPanel choosePanel = new JPanel(); - private OptionPanel optionPanel; - private JPanel initPanel = new JPanel(); -// private JButton setButton; - private int choosenClassIndex; - - LearningProblemPanel(final Config config, StartGUI startGUI) { - super(new BorderLayout()); - - this.config = config; -// this.startGUI = startGUI; - lpClasses = config.getComponentManager().getLearningProblems(); - -// setButton = new JButton("Set"); -// setButton.addActionListener(this); - choosePanel.add(cb); -// choosePanel.add(setButton); - cb.addActionListener(this); - - // add into comboBox - for (int i = 0; i < lpClasses.size(); i++) { - cb.addItem(config.getComponentManager().getComponentName(lpClasses.get(i))); - } - - // read choosen LearningProblem - choosenClassIndex = cb.getSelectedIndex(); - - LearningProblem lp = config.newLearningProblem(lpClasses.get(choosenClassIndex)); - optionPanel = new OptionPanel(config, lp); - - add(choosePanel, BorderLayout.PAGE_START); - add(optionPanel, BorderLayout.CENTER); - add(initPanel, BorderLayout.PAGE_END); - - choosenClassIndex = cb.getSelectedIndex(); - // setLearningProblem(); -// updateInitButtonColor(); - } - - public void actionPerformed(ActionEvent e) { - // read selected LearningProblemClass - if (choosenClassIndex != cb.getSelectedIndex()) { - this.choosenClassIndex = cb.getSelectedIndex(); - config.changeLearningProblem(lpClasses.get(choosenClassIndex)); - updateOptionPanel(); - } - -// if (e.getSource() == setButton) -// setLearningProblem(); - -// if (e.getSource() == initButton) -// init(); - } - - /** - * after this, you can change widgets - */ -// private void setLearningProblem() { -// if (config.needsInitReasoner()) { -// config.setLearningProblem(config.getComponentManager().learningProblem( -// lpClasses.get(choosenClassIndex), config.getReasoningService())); -// startGUI.updateTabs(); -// updateOptionPanel(); -// } -// } - - /** - * after this, next tab can be used - */ - /* - public void init() { - setLearningProblem(); - if (config.getReasoner() != null && config.getLearningProblem() != null - && config.isSetExample()) { - try { - config.getLearningProblem().init(); - config.setInitLearningProblem(true); - System.out.println("init LearningProblem"); - startGUI.updateTabColors(); - } catch (ComponentInitException e) { - e.printStackTrace(); - } - } - }*/ - - /** - * updateAll - */ - /* - public void updateAll() { - updateComboBox(); - updateOptionPanel(); -// updateInitButtonColor(); - }*/ - - /** - * set ComboBox to selected class - */ - /* - public void updateComboBox() { - if (config.getLearningProblem() != null) - for (int i = 0; i < lpClasses.size(); i++) - if (config.getLearningProblem().getClass().equals( - config.getComponentManager().getLearningProblems().get(i))) { - cb.setSelectedIndex(i); - } - this.choosenClassIndex = cb.getSelectedIndex(); - }*/ - - /** - * update OptionPanel with new selection - */ - public void updateOptionPanel() { - optionPanel.update(config.getLearningProblem()); - } - - /* (non-Javadoc) - * @see org.dllearner.gui.ComponentPanel#panelActivated() - */ - @Override - public void panelActivated() { - // TODO Auto-generated method stub - - } - - /** - * make init-button red if you have to click - */ - /* - public void updateInitButtonColor() { - if (!config.needsInitLearningProblem()) { - initButton.setForeground(Color.RED); - } else - initButton.setForeground(Color.BLACK); - }*/ -} Modified: trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -80,7 +80,7 @@ } /** update this OptionPanel */ - public void update(Component component) { + public void rebuild(Component component) { this.component = component; showWidgets(); } Deleted: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -1,200 +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.gui; - -import java.awt.BorderLayout; -import java.awt.event.ActionEvent; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JPanel; - -import org.dllearner.core.ReasonerComponent; -import org.dllearner.reasoning.FastInstanceChecker; - -/** - * Panel for configuring reasoner. - * - * @author Tilo Hielscher - * @author Jens Lehmann - */ -public class ReasonerPanel extends ComponentPanel<ReasonerComponent> { - - private static final long serialVersionUID = -7678275020058043937L; - - private Config config; -// private StartGUI startGUI; - private List<Class<? extends ReasonerComponent>> selectableReasoners; - private JPanel choosePanel = new JPanel(); - private JPanel initPanel = new JPanel(); - private OptionPanel optionPanel; - private JButton initButton; - private String[] cbItems = {}; - private JComboBox cb = new JComboBox(cbItems); - private int choosenClassIndex; - - ReasonerPanel(final Config config, StartGUI startGUI) { - super(new BorderLayout()); - - this.config = config; -// this.startGUI = startGUI; - selectableReasoners = config.getComponentManager().getReasonerComponents(); - // to set a default reasoner, we move it to the beginning of the list - selectableReasoners.remove(FastInstanceChecker.class); - selectableReasoners.add(0, FastInstanceChecker.class); - - initButton = new JButton("Init Reasoner"); - initButton.addActionListener(this); - // initPanel.add(initButton); - initButton.setEnabled(true); -// setButton = new JButton("Set"); -// setButton.addActionListener(this); - - choosePanel.add(cb); - - // add into comboBox - for (int i = 0; i < selectableReasoners.size(); i++) { - cb.addItem(config.getComponentManager().getComponentName(selectableReasoners.get(i))); - } - - ReasonerComponent rc = config.newReasoner(selectableReasoners.get(cb.getSelectedIndex())); - optionPanel = new OptionPanel(config, rc); - -// choosePanel.add(setButton); - cb.addActionListener(this); - - add(choosePanel, BorderLayout.PAGE_START); - add(optionPanel, BorderLayout.CENTER); - add(initPanel, BorderLayout.PAGE_END); - - choosenClassIndex = cb.getSelectedIndex(); -// setReasoner(); -// updateInitButtonColor(); - } - - public void actionPerformed(ActionEvent e) { - // read selected Class - // choosenClassIndex = cb.getSelectedIndex(); - if (choosenClassIndex != cb.getSelectedIndex()) { - choosenClassIndex = cb.getSelectedIndex(); - // create a new knowledge source component - config.changeReasoner(selectableReasoners.get(choosenClassIndex)); - updateOptionPanel(); - } - -// if (e.getSource() == setButton) { -//// config.setInitReasoner(false); -// setReasoner(); -// } - -// if (e.getSource() == initButton) -// init(); - } - - /** - * after this, you can change widgets - */ -// public void setReasoner() { -// if (config.needsInitKnowledgeSource()) { -// config.setReasoner(config.getComponentManager().reasoner( -// reasoner.get(choosenClassIndex), config.getKnowledgeSource())); -// updateOptionPanel(); -//// startGUI.updateTabColors(); -//// config.setInitReasoner(false); -//// updateInitButtonColor(); -// } -// } - - /** - * after this, next tab can be used - */ - /* - public void init() { - setReasoner(); - if (config.getKnowledgeSource() != null && config.getReasoner() != null) { - try { - config.getReasoner().init(); - System.out.println("init Reasoner"); - // set ReasoningService - config.setReasoningService(config.getComponentManager().reasoningService( - config.getReasoner())); - System.out.println("init ReasoningService"); - config.setInitReasoner(true); - startGUI.updateTabColors(); - } catch (ComponentInitException e) { - e.printStackTrace(); - } - - } - }*/ - - /** - * updateAll - */ - /* - public void updateAll() { - updateComboBox(); - updateOptionPanel(); - updateInitButtonColor(); - } - */ - - /** - * set ComboBox to selected class - */ - /* - public void updateComboBox() { - if (config.getReasoner() != null) - for (int i = 0; i < selectableReasoners.size(); i++) - if (config.getReasoner().getClass().equals( - config.getComponentManager().getReasonerComponents().get(i))) { - cb.setSelectedIndex(i); - } - this.choosenClassIndex = cb.getSelectedIndex(); - }*/ - - /** - * update OptionPanel with new selection - */ - public void updateOptionPanel() { - optionPanel.update(config.getReasoner()); - } - - /* (non-Javadoc) - * @see org.dllearner.gui.ComponentPanel#panelActivated() - */ - @Override - public void panelActivated() { - // TODO Auto-generated method stub - - } - - /** - * make init-button red if you have to click - */ - /* - public void updateInitButtonColor() { - if (!config.needsInitReasoner()) { - initButton.setForeground(Color.RED); - } else - initButton.setForeground(Color.BLACK); - }*/ -} Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-11 17:13:52 UTC (rev 1197) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-12 09:52:17 UTC (rev 1198) @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; +import java.util.LinkedList; +import java.util.List; import javax.swing.JFileChooser; import javax.swing.JFrame; @@ -45,6 +47,16 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; +import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; +import org.dllearner.core.Component; +import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.kb.OWLAPIOntology; +import org.dllearner.kb.OWLFile; +import org.dllearner.learningproblems.PosNegDefinitionLP; +import org.dllearner.reasoning.FastInstanceChecker; /** * This class builds the basic GUI elements and is used to start the DL-Learner @@ -64,11 +76,14 @@ private ConfigLoad configLoad = new ConfigLoad(config, this); private ConfigSave configSave = new ConfigSave(config, this); - protected KnowledgeSourcePanel tab0; - protected ReasonerPanel tab1; - protected LearningProblemPanel tab2; - protected LearningAlgorithmPanel tab3; - protected RunPanel tab4; + // the four component panels + protected ComponentPanel[] panels = new ComponentPanel[4]; + protected RunPanel runPanel; + +// protected KnowledgeSourcePanel tab0; +// protected ReasonerPanel tab1; +// protected LearningProblemPanel tab2; +// protected LearningAlgorithmPanel tab3; private JMenuBar menuBar = new JMenuBar(); private JMenu menuFile = new JMenu("File"); @@ -107,6 +122,23 @@ setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage( this.getClass().getResource("icon.gif"))); + // create panels + List<Class<? extends Component>> ignoredKnowledgeSources = new LinkedList<Class<? extends Component>>(); + ignoredKnowledgeSources.add(OWLAPIOntology.class); + panels[0] = new ComponentPanel(config, this, KnowledgeSource.class, OWLFile.class, ignoredKnowledgeSources); + panels[1] = new ComponentPanel(config, this, ReasonerComponent.class, FastInstanceChecker.class); + panels[2] = new ComponentPanel(config, this, LearningProblem.class, PosNegDefinitionLP.class); + panels[3] = new ComponentPanel(config, this, LearningAlgorithm.class, ExampleBasedROLComponent.class); + runPanel = new RunPanel(config, this); + + // add tabs for panels + tabPane.addTab("Knowledge Source", panels[0]); + tabPane.addTab("Reasoner", panels[1]); + tabPane.addTab("Learning Problem", panels[2]); + tabPane.addTab("Learning Algorithm", panels[3]); + tabPane.addTab("Run", runPanel); + + /* tab0 = new KnowledgeSourcePanel(config, this); tab1 = new ReasonerPanel(config, this); tab2 = new LearningProblemPanel(config, this); @@ -117,6 +149,7 @@ tabPane.addTab("Learning Problem", tab2); tabPane.addTab("Learning Algorithm", tab3); tabPane.addTab("Run", tab4); + */ setJMenuBar(menuBar); menuBar.add(menuFile); @@ -159,10 +192,10 @@ // send signals to panels switch(index) { - case 0: tab0.panelActivated(); break; - case 1: tab1.panelActivated(); break; - case 2: tab2.panelActivated(); break; - case 3: tab3.panelActivated(); break; + case 0: panels[0].panelActivated(); break; + case 1: panels[1].panelActivated(); break; + case 2: panels[2].panelActivated(); break; + case 3: panels[3].panelActivated(); break; } // new tab => ask user to fill in values This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-11 17:13:56
|
Revision: 1197 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1197&view=rev Author: kurzum Date: 2008-09-11 17:13:52 +0000 (Thu, 11 Sep 2008) Log Message: ----------- fxed bug, integrated url option inti sparqlknowledgesource Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/test/TestGetExampleBug.java trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-11 09:32:28 UTC (rev 1196) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-11 17:13:52 UTC (rev 1197) @@ -84,7 +84,7 @@ * @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(String url, Set<String> instances) { +public static SparqlKnowledgeSource getSparqlKnowledgeSource(URL url, Set<String> instances) { return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(url, instances); } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-11 09:32:28 UTC (rev 1196) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-11 17:13:52 UTC (rev 1197) @@ -20,6 +20,7 @@ package org.dllearner.core.configurators; +import java.net.URL; import java.util.List; import java.util.Set; import org.dllearner.core.ComponentManager; @@ -49,7 +50,7 @@ * @param instances relevant instances e.g. positive and negative examples in a learning problem * @return SparqlKnowledgeSource **/ -public static SparqlKnowledgeSource getSparqlKnowledgeSource(String url, Set<String> instances) { +public static SparqlKnowledgeSource getSparqlKnowledgeSource(URL url, Set<String> instances) { SparqlKnowledgeSource component = ComponentManager.getInstance().knowledgeSource(SparqlKnowledgeSource.class); ComponentManager.getInstance().applyConfigEntry(component, "url", url); ComponentManager.getInstance().applyConfigEntry(component, "instances", instances); @@ -60,10 +61,10 @@ * url URL of SPARQL Endpoint. * mandatory: true| reinit necessary: true * default value: null -* @return String +* @return URL **/ -public String getUrl() { -return (String) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "url") ; +public URL getUrl() { +return (URL) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "url") ; } /** * cacheDir dir of cache. @@ -276,7 +277,7 @@ * mandatory: true| reinit necessary: true * default value: null **/ -public void setUrl(String url) { +public void setUrl(URL url) { ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "url", url); reinitNecessary = true; } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-11 09:32:28 UTC (rev 1196) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-11 17:13:52 UTC (rev 1197) @@ -21,7 +21,6 @@ import java.io.File; import java.io.FileWriter; -import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.util.ArrayList; @@ -42,6 +41,7 @@ import org.dllearner.core.config.StringConfigOption; import org.dllearner.core.config.StringSetConfigOption; import org.dllearner.core.config.StringTupleListConfigOption; +import org.dllearner.core.config.URLConfigOption; import org.dllearner.core.configurators.SparqlKnowledgeSourceConfigurator; import org.dllearner.core.owl.KB; import org.dllearner.kb.aquisitors.SparqlTupleAquisitor; @@ -132,7 +132,7 @@ */ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - options.add(new StringConfigOption("url", "URL of SPARQL Endpoint", + options.add(new URLConfigOption("url", "URL of SPARQL Endpoint", null, true, true)); options.add(new StringConfigOption("cacheDir", "dir of cache", "cache", false, true)); @@ -226,14 +226,9 @@ SimpleClock totalTime = new SimpleClock(); SimpleClock extractionTime = new SimpleClock(); - try { - url = new URL(configurator.getUrl()); - } catch (MalformedURLException e) { - logger.error(e.getMessage()); - //throw new InvalidConfigOptionValueException(entry.getOption(), - // entry.getValue(), "malformed URL " + s); - } - + logger.trace(getURL()); + logger.trace(getSparqlEndpoint()); + logger.trace(configurator.getInstances()); Manager m = new Manager(); // get Options for Manipulator @@ -342,12 +337,22 @@ * @return the URL of the used sparql endpoint */ public URL getURL() { - if(url == null && endpoint!=null){ + if(endpoint == null){ + if(url==null){ + if(configurator.getPredefinedEndpoint() == null){ + url = configurator.getUrl(); + return url; + }else{ + return getSparqlEndpoint().getURL(); + } + + }else{ + return url; + } + }else { return endpoint.getURL(); } - else{ - return url; - } + } public String[] getOntArray() { @@ -362,7 +367,7 @@ public SparqlEndpoint getSparqlEndpoint(){ if(endpoint==null) { if (configurator.getPredefinedEndpoint() == null) { - endpoint = new SparqlEndpoint(url, new LinkedList<String>( + endpoint = new SparqlEndpoint(getURL(), new LinkedList<String>( configurator.getDefaultGraphURIs()), new LinkedList<String>(configurator.getNamedGraphURIs())); } else { Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-11 09:32:28 UTC (rev 1196) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-11 17:13:52 UTC (rev 1197) @@ -37,6 +37,7 @@ import javax.jws.WebService; import javax.jws.soap.SOAPBinding; +import org.apache.log4j.Logger; import org.dllearner.Info; import org.dllearner.algorithms.BruteForceLearner; import org.dllearner.algorithms.DBpediaNavigationSuggestor; @@ -86,6 +87,10 @@ @SOAPBinding(style = SOAPBinding.Style.RPC) public class DLLearnerWS { + @SuppressWarnings("unused") + private static Logger logger = Logger + .getLogger(DLLearnerWS.class); + private Map<Integer, ClientState> clients = new TreeMap<Integer,ClientState>(); private Random rand=new Random(); private static ComponentManager cm = ComponentManager.getInstance(); @@ -330,7 +335,11 @@ String json = "{"; int count = 1; for(EvaluatedDescription description : descriptions) { + //FIXME this is not a general method, but specific to dbpedia + // the mehtod name schould mention, that the return String is in JSON + // also it throws errors json += "\"solution" + count + "\" : " + description.asJSON(); + count++; } return json; Modified: trunk/src/dl-learner/org/dllearner/test/TestGetExampleBug.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/TestGetExampleBug.java 2008-09-11 09:32:28 UTC (rev 1196) +++ trunk/src/dl-learner/org/dllearner/test/TestGetExampleBug.java 2008-09-11 17:13:52 UTC (rev 1197) @@ -27,12 +27,18 @@ //Logger.getLogger(SparqlQuery.class).setLevel(Level.DEBUG); try { - String OntowikiUrl="http://localhost/ontowiki-0.8.5/service/sparql"; + String OntowikiUrl="http://localhost/ontowiki/service/sparql"; - String posExamples = "http://3ba.se/conferences/FMILeipzig"; + + SortedSet<String> positiveSet = new TreeSet<String>(); - positiveSet.add(posExamples); - SPARQLTasks st = new SPARQLTasks(new SparqlEndpoint(new URL(OntowikiUrl))); + positiveSet.add("http://3ba.se/conferences/JensLehmann"); + positiveSet.add("http://3ba.se/conferences/MuhammadAhtishamAslam"); + positiveSet.add("http://3ba.se/conferences/SebastianDietzold"); + positiveSet.add("http://3ba.se/conferences/ThomasRiechert"); + //positiveSet.add("http://3ba.se/conferences/FMILeipzig"); + + SPARQLTasks st = new SPARQLTasks(new SparqlEndpoint(new URL(OntowikiUrl))); AutomaticNegativeExampleFinderSPARQL ane = new AutomaticNegativeExampleFinderSPARQL(positiveSet,st); SortedSet<String> negExamples = new TreeSet<String>(); Modified: trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java 2008-09-11 09:32:28 UTC (rev 1196) +++ trunk/src/dl-learner/org/dllearner/utilities/examples/AutomaticNegativeExampleFinderSPARQL.java 2008-09-11 17:13:52 UTC (rev 1197) @@ -185,6 +185,7 @@ try{ classes.addAll(sparqltasks.getClassesForInstance(instance, sparqlResultLimit)); }catch (Exception e) { + e.printStackTrace(); logger.warn("ignoring SPARQLQuery failure, see log/sparql.txt"); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jen...@us...> - 2008-09-11 09:32:32
|
Revision: 1196 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1196&view=rev Author: JensLehmann Date: 2008-09-11 09:32:28 +0000 (Thu, 11 Sep 2008) Log Message: ----------- - uncommented natural language conversion in EvaluatedDescription - it only works for DBpedia!! - added URL option to web service interface Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/server/jaxws/ClientNotKnownExceptionBean.java trunk/src/dl-learner/org/dllearner/server/jaxws/ComponentInitExceptionBean.java trunk/src/dl-learner/org/dllearner/server/jaxws/ConfigOptionTypeExceptionBean.java trunk/src/dl-learner/org/dllearner/server/jaxws/LearningProblemUnsupportedExceptionBean.java trunk/src/dl-learner/org/dllearner/server/jaxws/ParseExceptionBean.java trunk/src/dl-learner/org/dllearner/server/jaxws/SparqlQueryExceptionBean.java trunk/src/dl-learner/org/dllearner/server/jaxws/UnknownComponentExceptionBean.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/server/jaxws/MalformedURLExceptionBean.java Modified: trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -164,7 +164,9 @@ } public String getNaturalDescription(){ - return NaturalLanguageDescriptionConvertVisitor.getNaturalLanguageDescription(description); + // TODO only works for DBpedia !! (no DBpedia SPARQL queries should be made to convert the description) +// return NaturalLanguageDescriptionConvertVisitor.getNaturalLanguageDescription(description); + return ""; } /** Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -19,6 +19,8 @@ */ package org.dllearner.server; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; @@ -217,15 +219,16 @@ * Adds a knowledge source. * * @return An identifier for the component. + * @throws MalformedURLException */ @WebMethod - public int addKnowledgeSource(int id, String component, String url) throws ClientNotKnownException, UnknownComponentException { + public int addKnowledgeSource(int id, String component, String url) throws ClientNotKnownException, UnknownComponentException, MalformedURLException { ClientState state = getState(id); Class<? extends KnowledgeSource> ksClass = knowledgeSourceMapping.get(component); if(ksClass == null) throw new UnknownComponentException(component); KnowledgeSource ks = cm.knowledgeSource(ksClass); - cm.applyConfigEntry(ks, "url", url); + cm.applyConfigEntry(ks, "url", new URL(url)); return state.addKnowledgeSource(ks); } @@ -435,6 +438,13 @@ } @WebMethod + public void applyConfigEntryURL(int sessionID, int componentID, String optionName, String value) throws ClientNotKnownException, UnknownComponentException, MalformedURLException { + // URLs are passed as String and then converted + URL url = new URL(value); + applyConfigEntry(sessionID, componentID,optionName,url); + } + + @WebMethod public void applyConfigEntryStringArray(int sessionID, int componentID, String optionName, String[] value) throws ClientNotKnownException, UnknownComponentException { Set<String> stringSet = new TreeSet<String>(Arrays.asList(value)); applyConfigEntry(sessionID, componentID,optionName,stringSet); @@ -462,6 +472,12 @@ } @WebMethod + public String getConfigOptionValueURL(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { + URL url = getConfigOptionValue(sessionID, componentID, optionName, URL.class); + return url.toString(); + } + + @WebMethod public Double getConfigOptionValueDouble(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { return getConfigOptionValue(sessionID, componentID, optionName, Double.class); } Modified: trunk/src/dl-learner/org/dllearner/server/jaxws/ClientNotKnownExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/ClientNotKnownExceptionBean.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/ClientNotKnownExceptionBean.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -8,9 +8,9 @@ /** - * This class was generated by the JAXWS SI. - * JAX-WS RI 2.0_02-b08-fcs - * Generated source version: 2.0_02 + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 + * Generated source version: 2.1.1 * */ @XmlRootElement(name = "ClientNotKnownException", namespace = "http://server.dllearner.org/") Modified: trunk/src/dl-learner/org/dllearner/server/jaxws/ComponentInitExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/ComponentInitExceptionBean.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/ComponentInitExceptionBean.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -8,9 +8,9 @@ /** - * This class was generated by the JAXWS SI. - * JAX-WS RI 2.0_02-b08-fcs - * Generated source version: 2.0_02 + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 + * Generated source version: 2.1.1 * */ @XmlRootElement(name = "ComponentInitException", namespace = "http://server.dllearner.org/") Modified: trunk/src/dl-learner/org/dllearner/server/jaxws/ConfigOptionTypeExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/ConfigOptionTypeExceptionBean.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/ConfigOptionTypeExceptionBean.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -8,9 +8,9 @@ /** - * This class was generated by the JAXWS SI. - * JAX-WS RI 2.0_02-b08-fcs - * Generated source version: 2.0_02 + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 + * Generated source version: 2.1.1 * */ @XmlRootElement(name = "ConfigOptionTypeException", namespace = "http://server.dllearner.org/") Modified: trunk/src/dl-learner/org/dllearner/server/jaxws/LearningProblemUnsupportedExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/LearningProblemUnsupportedExceptionBean.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/LearningProblemUnsupportedExceptionBean.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -8,9 +8,9 @@ /** - * This class was generated by the JAXWS SI. - * JAX-WS RI 2.0_02-b08-fcs - * Generated source version: 2.0_02 + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 + * Generated source version: 2.1.1 * */ @XmlRootElement(name = "LearningProblemUnsupportedException", namespace = "http://server.dllearner.org/") Added: trunk/src/dl-learner/org/dllearner/server/jaxws/MalformedURLExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/MalformedURLExceptionBean.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/MalformedURLExceptionBean.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -0,0 +1,41 @@ + +package org.dllearner.server.jaxws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 + * Generated source version: 2.1.1 + * + */ +@XmlRootElement(name = "MalformedURLException", namespace = "http://server.dllearner.org/") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "MalformedURLException", namespace = "http://server.dllearner.org/") +public class MalformedURLExceptionBean { + + private String message; + + /** + * + * @return + * returns String + */ + public String getMessage() { + return this.message; + } + + /** + * + * @param message + * the value for the message property + */ + public void setMessage(String message) { + this.message = message; + } + +} Modified: trunk/src/dl-learner/org/dllearner/server/jaxws/ParseExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/ParseExceptionBean.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/ParseExceptionBean.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -8,9 +8,9 @@ /** - * This class was generated by the JAXWS SI. - * JAX-WS RI 2.0_02-b08-fcs - * Generated source version: 2.0_02 + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 + * Generated source version: 2.1.1 * */ @XmlRootElement(name = "ParseException", namespace = "http://server.dllearner.org/") Modified: trunk/src/dl-learner/org/dllearner/server/jaxws/SparqlQueryExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/SparqlQueryExceptionBean.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/SparqlQueryExceptionBean.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -8,9 +8,9 @@ /** - * This class was generated by the JAXWS SI. - * JAX-WS RI 2.0_02-b08-fcs - * Generated source version: 2.0_02 + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 + * Generated source version: 2.1.1 * */ @XmlRootElement(name = "SparqlQueryException", namespace = "http://server.dllearner.org/") Modified: trunk/src/dl-learner/org/dllearner/server/jaxws/UnknownComponentExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/UnknownComponentExceptionBean.java 2008-09-10 13:46:37 UTC (rev 1195) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/UnknownComponentExceptionBean.java 2008-09-11 09:32:28 UTC (rev 1196) @@ -8,9 +8,9 @@ /** - * This class was generated by the JAXWS SI. - * JAX-WS RI 2.0_02-b08-fcs - * Generated source version: 2.0_02 + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.1 + * Generated source version: 2.1.1 * */ @XmlRootElement(name = "UnknownComponentException", namespace = "http://server.dllearner.org/") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-10 13:46:39
|
Revision: 1195 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1195&view=rev Author: jenslehmann Date: 2008-09-10 13:46:37 +0000 (Wed, 10 Sep 2008) Log Message: ----------- small fixes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java Modified: trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java 2008-09-10 13:41:56 UTC (rev 1194) +++ trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java 2008-09-10 13:46:37 UTC (rev 1195) @@ -46,7 +46,7 @@ public AboutWindow() { setTitle("About"); - setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLocationByPlatform(true); setSize(400, 400); Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-10 13:41:56 UTC (rev 1194) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-10 13:46:37 UTC (rev 1195) @@ -266,10 +266,12 @@ dispose(); // tutorial } else if (e.getSource() == tutorialItem) { - new TutorialWindow(); + TutorialWindow window = new TutorialWindow(); + window.setLocationRelativeTo(this); // about } else if (e.getSource() == aboutItem) { - new AboutWindow(); + AboutWindow window = new AboutWindow(); + window.setLocationRelativeTo(this); } } Modified: trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-10 13:41:56 UTC (rev 1194) +++ trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-10 13:46:37 UTC (rev 1195) @@ -36,7 +36,7 @@ public TutorialWindow() { setTitle("Quick Tutorial"); - setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); + setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLocationByPlatform(true); setSize(300, 600); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-10 13:41:59
|
Revision: 1194 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1194&view=rev Author: jenslehmann Date: 2008-09-10 13:41:56 +0000 (Wed, 10 Sep 2008) Log Message: ----------- first partially working GUI version Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Modified: trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java 2008-09-10 12:17:50 UTC (rev 1193) +++ trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java 2008-09-10 13:41:56 UTC (rev 1194) @@ -26,6 +26,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.util.HashSet; @@ -43,15 +44,21 @@ private LinkedList<JCheckBox> list = new LinkedList<JCheckBox>(); private GridBagLayout gridbag = new GridBagLayout(); private GridBagConstraints constraints = new GridBagConstraints(); - private WidgetPanelStringSet panel; + private WidgetPanelStringSet widgetPanel; /** * Make a JPanel with GridBagLayout. */ public CheckBoxList(WidgetPanelStringSet panel) { - this.panel = panel; + this.widgetPanel = panel; checkBoxPanel.setLayout(gridbag); - add(checkBoxPanel, BorderLayout.CENTER); + + JScrollPane scrollPane = new JScrollPane(checkBoxPanel); +// scrollPane.setSize(new Dimension(500,100)); + scrollPane.setPreferredSize(new Dimension(500, 300)); + scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + add(scrollPane, BorderLayout.CENTER); + constraints.anchor = GridBagConstraints.WEST; } @@ -74,7 +81,7 @@ */ public Set<String> getSelections() { Set<String> selectionSet = new HashSet<String>(); - selectionSet.clear(); // remove all +// selectionSet.clear(); // remove all for (int i = 0; i < list.size(); i++) { if (list.get(i).isSelected()) selectionSet.add(list.get(i).getText()); @@ -123,6 +130,9 @@ } public void actionPerformed(ActionEvent e) { - panel.specialSet(); + Set<String> value = getSelections(); + widgetPanel.fireValueChanged(value); + +// widgetPanel.specialSet(); } } \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-10 12:17:50 UTC (rev 1193) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-10 13:41:56 UTC (rev 1194) @@ -20,11 +20,9 @@ * */ import java.awt.BorderLayout; -import java.awt.Color; import java.awt.event.ActionEvent; import java.util.List; -import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JPanel; @@ -48,8 +46,8 @@ private List<Class<? extends LearningAlgorithm>> selectableAlgorithms; private JPanel choosePanel = new JPanel(); private OptionPanel optionPanel; - private JPanel initPanel = new JPanel(); - private JButton initButton, autoInitButton; +// private JPanel initPanel = new JPanel(); +// private JButton initButton, autoInitButton; private String[] cbItems = {}; private JComboBox cb = new JComboBox(cbItems); private int choosenClassIndex; @@ -67,12 +65,12 @@ // at least it is not doing anything useful at the moment) selectableAlgorithms.remove(DBpediaNavigationSuggestor.class); - initButton = new JButton("Init LearingAlgorithm"); - initButton.addActionListener(this); +// initButton = new JButton("Init LearingAlgorithm"); +// initButton.addActionListener(this); // initPanel.add(initButton); - initButton.setEnabled(true); - autoInitButton = new JButton("Set"); - autoInitButton.addActionListener(this); +// initButton.setEnabled(true); +// autoInitButton = new JButton("Set"); +// autoInitButton.addActionListener(this); // add into comboBox for (int i = 0; i < selectableAlgorithms.size(); i++) { @@ -80,7 +78,7 @@ } choosePanel.add(cb); - choosePanel.add(autoInitButton); +// choosePanel.add(autoInitButton); cb.addActionListener(this); LearningAlgorithm la = null; @@ -94,7 +92,7 @@ add(choosePanel, BorderLayout.PAGE_START); add(optionPanel, BorderLayout.CENTER); - add(initPanel, BorderLayout.PAGE_END); +// add(initPanel, BorderLayout.PAGE_END); choosenClassIndex = cb.getSelectedIndex(); // updateInitButtonColor(); @@ -104,6 +102,8 @@ // read selected Class if (choosenClassIndex != cb.getSelectedIndex()) { choosenClassIndex = cb.getSelectedIndex(); + config.changeLearningAlgorithm(selectableAlgorithms.get(choosenClassIndex)); + updateOptionPanel(); // config.setInitLearningAlgorithm(false); // init(); } @@ -152,15 +152,17 @@ /** * updateAll */ + /* public void updateAll() { updateComboBox(); updateOptionPanel(); updateInitButtonColor(); - } + }*/ /** * set ComboBox to selected class */ + /* public void updateComboBox() { if (config.getLearningAlgorithm() != null) for (int i = 0; i < selectableAlgorithms.size(); i++) @@ -169,7 +171,7 @@ cb.setSelectedIndex(i); } this.choosenClassIndex = cb.getSelectedIndex(); - } + }*/ /** * update OptionPanel with new selection @@ -181,12 +183,13 @@ /** * make init-button red if you have to click */ + /* public void updateInitButtonColor() { if (!config.needsInitLearningAlgorithm()) { initButton.setForeground(Color.RED); } else initButton.setForeground(Color.BLACK); - } + }*/ /* (non-Javadoc) * @see org.dllearner.gui.ComponentPanel#panelActivated() Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-10 12:17:50 UTC (rev 1193) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-10 13:41:56 UTC (rev 1194) @@ -28,7 +28,7 @@ import javax.swing.JPanel; import org.dllearner.core.ReasonerComponent; -import org.dllearner.reasoning.OWLAPIReasoner; +import org.dllearner.reasoning.FastInstanceChecker; /** * Panel for configuring reasoner. @@ -58,8 +58,8 @@ // this.startGUI = startGUI; selectableReasoners = config.getComponentManager().getReasonerComponents(); // to set a default reasoner, we move it to the beginning of the list - selectableReasoners.remove(OWLAPIReasoner.class); - selectableReasoners.add(0, OWLAPIReasoner.class); + selectableReasoners.remove(FastInstanceChecker.class); + selectableReasoners.add(0, FastInstanceChecker.class); initButton = new JButton("Init Reasoner"); initButton.addActionListener(this); Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java 2008-09-10 12:17:50 UTC (rev 1193) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java 2008-09-10 13:41:56 UTC (rev 1194) @@ -115,12 +115,13 @@ /** * Use this, to set entry for layout 2. */ + /* public void specialSet() { if (isSpecial()) { this.value = cBL.getSelections(); setEntry(); } - } + }*/ public void setEntry() { StringSetConfigOption specialOption; @@ -239,13 +240,13 @@ // fill lists Set<Individual> individualsSet = config.getReasoningService() .getIndividuals(); - LinkedList<Individual> individuals = new LinkedList<Individual>( - individualsSet); - for (Individual ind : individuals) { - System.out.println(ind.getName()); - cBL.add(ind.getName()); + if(individualsSet != null) { + LinkedList<Individual> individuals = new LinkedList<Individual>( + individualsSet); + for (Individual ind : individuals) { + cBL.add(ind.getName()); + } } -// cBL.add("Test"); } // allowedConcepts or ignoredConcepts if (configOption.getName().equalsIgnoreCase("allowedConcepts") @@ -253,10 +254,12 @@ // fill lists Set<NamedClass> atomicsSet = config.getReasoningService() .getNamedClasses(); - LinkedList<NamedClass> atomicConcepts = new LinkedList<NamedClass>( - atomicsSet); - for (NamedClass ind : atomicConcepts) - cBL.add(ind.getName()); + if(atomicsSet != null) { + LinkedList<NamedClass> atomicConcepts = new LinkedList<NamedClass>( + atomicsSet); + for (NamedClass ind : atomicConcepts) + cBL.add(ind.getName()); + } } // allowedRoles or ignoredRoles if (configOption.getName().equalsIgnoreCase("allowedRoles") @@ -264,10 +267,12 @@ // fill lists Set<ObjectProperty> atomicsSet = config.getReasoningService() .getObjectProperties(); - LinkedList<ObjectProperty> atomicRoles = new LinkedList<ObjectProperty>( - atomicsSet); - for (ObjectProperty ind : atomicRoles) - cBL.add(ind.getName()); + if(atomicsSet != null) { + LinkedList<ObjectProperty> atomicRoles = new LinkedList<ObjectProperty>( + atomicsSet); + for (ObjectProperty ind : atomicRoles) + cBL.add(ind.getName()); + } } // set selections if (value != null) Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-10 12:17:50 UTC (rev 1193) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-10 13:41:56 UTC (rev 1194) @@ -171,6 +171,17 @@ @Override public void init() throws ComponentInitException { + // reset variables (otherwise subsequent initialisation with + // different knowledge sources will merge both) + atomicConcepts = new TreeSet<NamedClass>(conceptComparator); + atomicRoles = new TreeSet<ObjectProperty>(roleComparator); + datatypeProperties = new TreeSet<DatatypeProperty>(); + booleanDatatypeProperties = new TreeSet<DatatypeProperty>(); + doubleDatatypeProperties = new TreeSet<DatatypeProperty>(); + intDatatypeProperties = new TreeSet<DatatypeProperty>(); + individuals = new TreeSet<Individual>(); + + // create OWL API ontology manager OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); // it is a bit cumbersome to obtain all classes, because there This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-10 12:17:53
|
Revision: 1193 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1193&view=rev Author: jenslehmann Date: 2008-09-10 12:17:50 +0000 (Wed, 10 Sep 2008) Log Message: ----------- inits running in separate threads, option panels updated correctly Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/test/ComponentTest.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/InitWorker.java Modified: trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/ComponentPanel.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -1,6 +1,6 @@ package org.dllearner.gui; -import java.awt.event.ActionEvent; +import java.awt.LayoutManager; import java.awt.event.ActionListener; import javax.swing.JPanel; @@ -13,12 +13,14 @@ * @author Jens Lehmann * */ -public class ComponentPanel<T extends Component> extends JPanel implements ActionListener { +public abstract class ComponentPanel<T extends Component> extends JPanel implements ActionListener { private static final long serialVersionUID = -7678275020058043937L; - public void actionPerformed(ActionEvent arg0) { - // TODO Auto-generated method stub + public ComponentPanel(LayoutManager layout) { + super(layout); } - + + // called when panel is active + public abstract void panelActivated(); } Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -20,17 +20,7 @@ package org.dllearner.gui; -import java.awt.BorderLayout; -import java.net.URL; - -import javax.swing.ImageIcon; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.SwingWorker; - -import org.apache.log4j.Logger; import org.dllearner.core.Component; -import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; @@ -57,7 +47,7 @@ public class Config { private ComponentManager cm = ComponentManager.getInstance(); - private static Logger logger = Logger.getLogger(Config.class); +// private static Logger logger = Logger.getLogger(Config.class); // the components currently active private KnowledgeSource source; @@ -154,6 +144,14 @@ // logger.debug("knowledge source " + clazz + " changed"); // create a new reasoner object using the current class and the selected source reasoner = cm.reasoner(reasoner.getClass(), source); + rs = cm.reasoningService(reasoner); + lp = cm.learningProblem(lp.getClass(), rs); + try { + la = cm.learningAlgorithm(la.getClass(), lp, rs); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } return source; } @@ -182,6 +180,19 @@ return reasoner; } + public ReasonerComponent changeReasoner(Class<? extends ReasonerComponent> clazz) { + reasoner = cm.reasoner(clazz, source); + rs = cm.reasoningService(reasoner); + lp = cm.learningProblem(lp.getClass(), rs); + try { + la = cm.learningAlgorithm(la.getClass(), lp, rs); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return reasoner; + } + /** * Set ReasoningService. * @@ -223,6 +234,17 @@ return lp; } + public LearningProblem changeLearningProblem(Class<? extends LearningProblem> clazz) { + lp = cm.learningProblem(clazz, rs); + try { + la = cm.learningAlgorithm(la.getClass(), lp, rs); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return lp; + } + /** * Set LearningAlgorithm. * @@ -246,6 +268,16 @@ return la; } + public LearningAlgorithm changeLearningAlgorithm(Class<? extends LearningAlgorithm> clazz) { + try { + la = cm.learningAlgorithm(clazz, lp, rs); + } catch (LearningProblemUnsupportedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return la; + } + public boolean tabNeedsInit(int tabIndex) { return needsInit[tabIndex]; } @@ -401,114 +433,29 @@ // init the specified component and record which ones where initialised public void init(int tabIndex) { - // a thread class for handling inits (GUI has to remain - // responsive while init process is executed) - class InitThread extends Thread { - private Component component; - public InitThread(Component component) { - this.component = component; - } - @Override - public void run() { - gui.disableTabbedPane(); - try { - component.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - gui.enableTabbedPane(); - } - } - -// final SwingWorker worker = new SwingWorker() { - class InitWorker extends SwingWorker<Boolean,Boolean> { - private Component component; - public InitWorker(Component component) { - this.component = component; - } - - @Override - protected Boolean doInBackground() throws Exception { - gui.getStatusPanel().setStatus("Initialising reasoner ... "); -// gui.getStatusPanel().repaint(); - gui.disableTabbedPane(); - gui.setEnabled(false); - JFrame waitFrame = new JFrame(); - waitFrame.setUndecorated(true); - waitFrame.setSize(200, 200); - URL imgURL = Config.class.getResource("ajaxloader.gif"); - ImageIcon waitIcon = new ImageIcon(imgURL, "wait"); -// waitFrame.add(new JLabel("Wait!"), waitIcon, SwingConstants.RIGHT); -// waitFrame.add(new JLabel("Wait")); - waitFrame.add(new JLabel(waitIcon), BorderLayout.NORTH); - waitFrame.add(new JLabel("Initialising reasoner. Please wait."), BorderLayout.SOUTH); - waitFrame.setLocationRelativeTo(gui); - waitFrame.setVisible(true); - try { - component.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - gui.enableTabbedPane(); - gui.setEnabled(true); - gui.getStatusPanel().extendMessage("done."); - waitFrame.dispose(); - // TODO Auto-generated method stub -// return null; - return true; - } - }; - - - try { +// try { if(tabIndex==0) { - gui.disableTabbedPane(); - gui.getStatusPanel().setStatus("Initialising knowledge source ... "); - source.init(); - gui.getStatusPanel().extendMessage("done."); - gui.enableTabbedPane(); + InitWorker worker = new InitWorker(source, gui); + worker.execute(); } else if(tabIndex==1) { -// gui.disableTabbedPane(); -// gui.getStatusPanel().setStatus("Initialising reasoner ... "); -// gui.repaint(); -// Thread initThread = new InitThread(reasoner); -// initThread.run(); -// SwingWorker worker; -// try { -// SwingUtilities.invokeAndWait(initThread); -// } catch (InterruptedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (InvocationTargetException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - - InitWorker worker = new InitWorker(reasoner); + InitWorker worker = new InitWorker(reasoner, gui); worker.execute(); - -// reasoner.init(); -// gui.getStatusPanel().extendMessage("done."); -// gui.enableTabbedPane(); } else if(tabIndex==2) { - gui.disableTabbedPane(); - gui.getStatusPanel().setStatus("Initialising learning problem ... "); - lp.init(); - gui.getStatusPanel().extendMessage("done."); - gui.enableTabbedPane(); + InitWorker worker = new InitWorker(lp, gui); + worker.execute(); } else if(tabIndex == 3) { - gui.disableTabbedPane(); - gui.getStatusPanel().setStatus("Initialising learning algorithm ... "); - la.init(); - gui.getStatusPanel().extendMessage("done."); - gui.enableTabbedPane(); + InitWorker worker = new InitWorker(la, gui); + worker.execute(); +// gui.disableTabbedPane(); +// gui.getStatusPanel().setStatus("Initialising learning algorithm ... "); +// la.init(); +// gui.getStatusPanel().extendMessage("done."); +// gui.enableTabbedPane(); } - } catch (ComponentInitException e) { - // TODO display message in status bar - e.printStackTrace(); - } +// } catch (ComponentInitException e) { +// // TODO display message in status bar +// e.printStackTrace(); +// } needsInit[tabIndex] = false; System.out.println("component " + tabIndex + " initialised."); Added: trunk/src/dl-learner/org/dllearner/gui/InitWorker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/InitWorker.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/InitWorker.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -0,0 +1,117 @@ +/** + * 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.gui; + +import java.awt.Color; +import java.net.URL; +import java.util.LinkedList; +import java.util.List; + +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.SwingWorker; + +import org.dllearner.core.Component; +import org.dllearner.core.ComponentInitException; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.kb.KBFile; +import org.dllearner.kb.OWLFile; + +/** + * Class, which is responsible for executing the init method of + * a component in a different thread and displaying a "please wait" + * message while the initialisation is in process. + * + * @author Jens Lehmann + * + */ +public class InitWorker extends SwingWorker<Boolean, Boolean> { + + private Component component; + private StartGUI gui; + private boolean timeIntensive = true; + + public InitWorker(Component component, StartGUI gui) { + this.component = component; + this.gui = gui; + + // create a list of components, which do need virtually + // no time to initialise (and where displaying a please + // wait message is an unnecessary overhead) + List<Class<? extends Component>> nonTimeIntensiveComponents = new LinkedList<Class<? extends Component>>(); + nonTimeIntensiveComponents.add(OWLFile.class); + nonTimeIntensiveComponents.add(KBFile.class); + + if(nonTimeIntensiveComponents.contains(component.getClass())) { + timeIntensive = false; + } + } + + @Override + protected Boolean doInBackground() throws Exception { + + JFrame waitFrame = null; + if(timeIntensive) { + // gui.getStatusPanel().setStatus("Initialising reasoner ... "); + gui.disableTabbedPane(); + gui.setEnabled(false); + waitFrame = new JFrame(); + waitFrame.setUndecorated(true); + waitFrame.setSize(160, 100); + waitFrame.getContentPane().setBackground(Color.WHITE); + URL imgURL = Config.class.getResource("ajaxloader.gif"); + // ImageIcon waitIcon = new ImageIcon(imgURL, "wait"); + // waitFrame.add(new JLabel("Wait!"), waitIcon, SwingConstants.RIGHT); + // waitFrame.add(new JLabel("Wait")); + // JLabel iconLabel = new JLabel(waitIcon); + // iconLabel.setOpaque(true); + // iconLabel.setBackground(Color.RED); + // iconLabel.setForeground(Color.RED); + // waitFrame.add(iconLabel, BorderLayout.NORTH); + waitFrame.add(new JLabel("<html><br /><p align=\"center\"><img src=\"" + imgURL + "\" /><br /> Initialising component.<br />Please wait.</p></html>")); + waitFrame.setLocationRelativeTo(gui); + waitFrame.setVisible(true); + } + + try { + component.init(); + } catch (ComponentInitException e) { + gui.getStatusPanel().setExceptionMessage(e.getMessage()); + e.printStackTrace(); + } + + if(timeIntensive) { + gui.enableTabbedPane(); + gui.setEnabled(true); + // gui.getStatusPanel().extendMessage("done."); + waitFrame.dispose(); + } + + // when the reasoner has been initialised, we need to update + // the option panel (such that the user can see the existing + // examples, classes etc.) + if(component instanceof ReasonerComponent) { + gui.tab2.updateOptionPanel(); + gui.tab3.updateOptionPanel(); + } + + return true; + } +} Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -21,7 +21,6 @@ import java.awt.BorderLayout; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.List; import javax.swing.JButton; @@ -40,7 +39,7 @@ * @author Jens Lehmann * @author Tilo Hielscher */ -public class KnowledgeSourcePanel extends JPanel implements ActionListener { +public class KnowledgeSourcePanel extends ComponentPanel<KnowledgeSource> { private static final long serialVersionUID = -7678275020058043937L; @@ -76,6 +75,7 @@ cb.addActionListener(this); choosePanel.add(cb); +// choosePanel.add(new JLabel(" ")); choosePanel.add(clearButton); choosenClassIndex = cb.getSelectedIndex(); @@ -97,12 +97,7 @@ choosenClassIndex = cb.getSelectedIndex(); // create a new knowledge source component config.changeKnowledgeSource(selectableSources.get(choosenClassIndex)); -// updateAll(); updateOptionPanel(); - - System.out.println("update"); -// config.setInitKnowledgeSource(false); -// init(); } if (e.getSource() == clearButton) { @@ -134,4 +129,13 @@ optionPanel.update(config.getKnowledgeSource()); } + /* (non-Javadoc) + * @see org.dllearner.gui.ComponentPanel#panelActivated() + */ + @Override + public void panelActivated() { + // TODO Auto-generated method stub + + } + } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -22,7 +22,6 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.List; import javax.swing.JButton; @@ -40,7 +39,7 @@ * * @author Tilo Hielscher */ -public class LearningAlgorithmPanel extends JPanel implements ActionListener { +public class LearningAlgorithmPanel extends ComponentPanel<LearningAlgorithm> { private static final long serialVersionUID = 8721490771860452959L; @@ -188,4 +187,13 @@ } else initButton.setForeground(Color.BLACK); } + + /* (non-Javadoc) + * @see org.dllearner.gui.ComponentPanel#panelActivated() + */ + @Override + public void panelActivated() { + // TODO Auto-generated method stub + + } } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -1,5 +1,3 @@ -package org.dllearner.gui; - /** * Copyright (C) 2007-2008, Jens Lehmann * @@ -19,25 +17,24 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ +package org.dllearner.gui; import java.awt.BorderLayout; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.List; -import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JPanel; import org.dllearner.core.LearningProblem; /** - * LearningProblemPanel tab 2. Choose LearingProblem, change Options and final - * initiate LearningProblem. + * Learning problem panel. * + * @author Jens Lehmann * @author Tilo Hielscher */ -public class LearningProblemPanel extends JPanel implements ActionListener { +public class LearningProblemPanel extends ComponentPanel<LearningProblem> { private static final long serialVersionUID = -3819627680918930203L; @@ -49,7 +46,7 @@ private JPanel choosePanel = new JPanel(); private OptionPanel optionPanel; private JPanel initPanel = new JPanel(); - private JButton setButton; +// private JButton setButton; private int choosenClassIndex; LearningProblemPanel(final Config config, StartGUI startGUI) { @@ -59,10 +56,10 @@ // this.startGUI = startGUI; lpClasses = config.getComponentManager().getLearningProblems(); - setButton = new JButton("Set"); - setButton.addActionListener(this); +// setButton = new JButton("Set"); +// setButton.addActionListener(this); choosePanel.add(cb); - choosePanel.add(setButton); +// choosePanel.add(setButton); cb.addActionListener(this); // add into comboBox @@ -89,8 +86,8 @@ // read selected LearningProblemClass if (choosenClassIndex != cb.getSelectedIndex()) { this.choosenClassIndex = cb.getSelectedIndex(); -// config.setInitLearningProblem(false); -// init(); + config.changeLearningProblem(lpClasses.get(choosenClassIndex)); + updateOptionPanel(); } // if (e.getSource() == setButton) @@ -134,15 +131,17 @@ /** * updateAll */ + /* public void updateAll() { updateComboBox(); updateOptionPanel(); // updateInitButtonColor(); - } + }*/ /** * set ComboBox to selected class */ + /* public void updateComboBox() { if (config.getLearningProblem() != null) for (int i = 0; i < lpClasses.size(); i++) @@ -151,15 +150,24 @@ cb.setSelectedIndex(i); } this.choosenClassIndex = cb.getSelectedIndex(); - } + }*/ /** * update OptionPanel with new selection */ - private void updateOptionPanel() { + public void updateOptionPanel() { optionPanel.update(config.getLearningProblem()); } + /* (non-Javadoc) + * @see org.dllearner.gui.ComponentPanel#panelActivated() + */ + @Override + public void panelActivated() { + // TODO Auto-generated method stub + + } + /** * make init-button red if you have to click */ Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -1,5 +1,3 @@ -package org.dllearner.gui; - /** * Copyright (C) 2007-2008, Jens Lehmann * @@ -19,11 +17,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ +package org.dllearner.gui; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.List; import javax.swing.JButton; @@ -34,22 +31,22 @@ import org.dllearner.reasoning.OWLAPIReasoner; /** - * ReasonerPanel, tab 1. Choose Resoner, change Options and final initiate - * Reasoner and ReasoningService. + * Panel for configuring reasoner. * * @author Tilo Hielscher + * @author Jens Lehmann */ -public class ReasonerPanel extends JPanel implements ActionListener { +public class ReasonerPanel extends ComponentPanel<ReasonerComponent> { private static final long serialVersionUID = -7678275020058043937L; private Config config; // private StartGUI startGUI; - private List<Class<? extends ReasonerComponent>> reasoner; + private List<Class<? extends ReasonerComponent>> selectableReasoners; private JPanel choosePanel = new JPanel(); private JPanel initPanel = new JPanel(); private OptionPanel optionPanel; - private JButton initButton, setButton; + private JButton initButton; private String[] cbItems = {}; private JComboBox cb = new JComboBox(cbItems); private int choosenClassIndex; @@ -59,29 +56,29 @@ this.config = config; // this.startGUI = startGUI; - reasoner = config.getComponentManager().getReasonerComponents(); + selectableReasoners = config.getComponentManager().getReasonerComponents(); // to set a default reasoner, we move it to the beginning of the list - reasoner.remove(OWLAPIReasoner.class); - reasoner.add(0, OWLAPIReasoner.class); + selectableReasoners.remove(OWLAPIReasoner.class); + selectableReasoners.add(0, OWLAPIReasoner.class); initButton = new JButton("Init Reasoner"); initButton.addActionListener(this); // initPanel.add(initButton); initButton.setEnabled(true); - setButton = new JButton("Set"); - setButton.addActionListener(this); +// setButton = new JButton("Set"); +// setButton.addActionListener(this); choosePanel.add(cb); // add into comboBox - for (int i = 0; i < reasoner.size(); i++) { - cb.addItem(config.getComponentManager().getComponentName(reasoner.get(i))); + for (int i = 0; i < selectableReasoners.size(); i++) { + cb.addItem(config.getComponentManager().getComponentName(selectableReasoners.get(i))); } - ReasonerComponent rc = config.newReasoner(reasoner.get(cb.getSelectedIndex())); + ReasonerComponent rc = config.newReasoner(selectableReasoners.get(cb.getSelectedIndex())); optionPanel = new OptionPanel(config, rc); - choosePanel.add(setButton); +// choosePanel.add(setButton); cb.addActionListener(this); add(choosePanel, BorderLayout.PAGE_START); @@ -90,7 +87,7 @@ choosenClassIndex = cb.getSelectedIndex(); // setReasoner(); - updateInitButtonColor(); +// updateInitButtonColor(); } public void actionPerformed(ActionEvent e) { @@ -98,8 +95,9 @@ // choosenClassIndex = cb.getSelectedIndex(); if (choosenClassIndex != cb.getSelectedIndex()) { choosenClassIndex = cb.getSelectedIndex(); -// config.setInitReasoner(false); -// init(); + // create a new knowledge source component + config.changeReasoner(selectableReasoners.get(choosenClassIndex)); + updateOptionPanel(); } // if (e.getSource() == setButton) { @@ -151,24 +149,27 @@ /** * updateAll */ + /* public void updateAll() { updateComboBox(); updateOptionPanel(); updateInitButtonColor(); } + */ /** * set ComboBox to selected class */ + /* public void updateComboBox() { if (config.getReasoner() != null) - for (int i = 0; i < reasoner.size(); i++) + for (int i = 0; i < selectableReasoners.size(); i++) if (config.getReasoner().getClass().equals( config.getComponentManager().getReasonerComponents().get(i))) { cb.setSelectedIndex(i); } this.choosenClassIndex = cb.getSelectedIndex(); - } + }*/ /** * update OptionPanel with new selection @@ -177,13 +178,23 @@ optionPanel.update(config.getReasoner()); } + /* (non-Javadoc) + * @see org.dllearner.gui.ComponentPanel#panelActivated() + */ + @Override + public void panelActivated() { + // TODO Auto-generated method stub + + } + /** * make init-button red if you have to click */ + /* public void updateInitButtonColor() { if (!config.needsInitReasoner()) { initButton.setForeground(Color.RED); } else initButton.setForeground(Color.BLACK); - } + }*/ } Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -21,6 +21,8 @@ import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Dimension; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -62,11 +64,11 @@ private ConfigLoad configLoad = new ConfigLoad(config, this); private ConfigSave configSave = new ConfigSave(config, this); - private KnowledgeSourcePanel tab0; - private ReasonerPanel tab1; - private LearningProblemPanel tab2; - private LearningAlgorithmPanel tab3; - private RunPanel tab4; + protected KnowledgeSourcePanel tab0; + protected ReasonerPanel tab1; + protected LearningProblemPanel tab2; + protected LearningAlgorithmPanel tab3; + protected RunPanel tab4; private JMenuBar menuBar = new JMenuBar(); private JMenu menuFile = new JMenu("File"); @@ -86,9 +88,20 @@ public StartGUI(File file) { this.setTitle("DL-Learner GUI"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - this.setLocationByPlatform(true); +// this.setLocationByPlatform(true); this.setSize(800, 600); + // center frame + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension size = getSize(); + screenSize.height = screenSize.height/2; + screenSize.width = screenSize.width/2; + size.height = size.height/2; + size.width = size.width/2; + int y = screenSize.height - size.height; + int x = screenSize.width - size.width; + setLocation(x, y); + // set icon if (this.getClass().getResource("icon.gif") != null) setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage( @@ -143,6 +156,14 @@ } updateTabs(); + + // send signals to panels + switch(index) { + case 0: tab0.panelActivated(); break; + case 1: tab1.panelActivated(); break; + case 2: tab2.panelActivated(); break; + case 3: tab3.panelActivated(); break; + } // new tab => ask user to fill in values statusPanel.setTabInitMessage(); Modified: trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -40,6 +40,9 @@ private String oldMessage; + // specifies whether the message is an exception + private boolean isException = false; + public StatusPanel() { super(); add(statusLabel); @@ -53,11 +56,18 @@ } public void setStatus(String message) { - updateMessage(message); + if(!isException) { + updateMessage(message); + } } + public void setExceptionMessage(String message) { + updateMessage(message); + isException = true; + } + public void setTabInitMessage() { -// updateMessage(tabInitText); + updateMessage(tabInitText); } public void extendMessage(String addition) { Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -225,7 +225,7 @@ gridbag.setConstraints(clearButton, constraints); widgetPanel.add(clearButton, constraints); } else { - System.out.println("SPECIAL OPTION " + configOption.getName()); +// System.out.println("SPECIAL OPTION " + configOption.getName()); // SPECIAL LAYOUT // ComboBoxList @@ -245,6 +245,7 @@ System.out.println(ind.getName()); cBL.add(ind.getName()); } +// cBL.add("Test"); } // allowedConcepts or ignoredConcepts if (configOption.getName().equalsIgnoreCase("allowedConcepts") Modified: trunk/src/dl-learner/org/dllearner/test/ComponentTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-09-10 10:34:43 UTC (rev 1192) +++ trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-09-10 12:17:50 UTC (rev 1193) @@ -20,6 +20,7 @@ package org.dllearner.test; import java.io.File; +import java.net.MalformedURLException; import java.util.Set; import java.util.TreeSet; @@ -47,8 +48,9 @@ /** * @param args * @throws ComponentInitException + * @throws MalformedURLException */ - public static void main(String[] args) throws ComponentInitException { + public static void main(String[] args) throws ComponentInitException, MalformedURLException { // get singleton instance of component manager ComponentManager cm = ComponentManager.getInstance(); @@ -56,11 +58,12 @@ // create knowledge source KnowledgeSource source = cm.knowledgeSource(OWLFile.class); String example = "examples/family/uncle.owl"; - cm.applyConfigEntry(source, "url", new File(example).toURI().toString()); + cm.applyConfigEntry(source, "url", new File(example).toURI().toURL()); source.init(); - // create DIG reasoning service with standard settings + // create OWL API reasoning service with standard settings ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, source); + // ReasoningService rs = cm.reasoningService(DIGReasonerNew.class, source); reasoner.init(); ReasoningService rs = cm.reasoningService(reasoner); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-10 10:34:49
|
Revision: 1192 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1192&view=rev Author: kurzum Date: 2008-09-10 10:34:43 +0000 (Wed, 10 Sep 2008) Log Message: ----------- added URL import Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java Modified: trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -20,6 +20,8 @@ package org.dllearner.core.config; import java.net.URL; +import java.util.SortedSet; +import java.util.TreeSet; /** * Option which has an URL as value. @@ -73,6 +75,16 @@ public boolean isValidValue(URL value) { return true; } + + /* (non-Javadoc) + * @see org.dllearner.core.config.ConfigOption#getJavaImports() + */ + @Override + public SortedSet<String> getJavaImports() { + SortedSet<String> ret = new TreeSet<String>(); + ret.add("java.net.URL"); + return ret; + } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; @@ -42,6 +42,7 @@ import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.learningproblems.PosOnlyInclusionLP; +import org.dllearner.learningproblems.RoleLearning; import org.dllearner.reasoning.DIGReasoner; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.FastRetrievalReasoner; @@ -168,6 +169,16 @@ } /** +* @param positiveExamples positive examples +* @param negativeExamples negative examples +* @param reasoningService see ReasoningService +* @return a component ready for initialization RoleLearning +**/ +public static RoleLearning getRoleLearning(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { +return RoleLearningConfigurator.getRoleLearning(reasoningService, positiveExamples, negativeExamples); +} + +/** * @param learningProblem see LearningProblem * @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see Modified: trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,12 +16,11 @@ * 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.kb.KBFile; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,12 +16,11 @@ * 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.kb.OWLFile; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-10 10:25:17 UTC (rev 1191) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-10 10:34:43 UTC (rev 1192) @@ -16,7 +16,7 @@ * 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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-10 10:25:20
|
Revision: 1191 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1191&view=rev Author: jenslehmann Date: 2008-09-10 10:25:17 +0000 (Wed, 10 Sep 2008) Log Message: ----------- new URL config option type Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java trunk/src/dl-learner/org/dllearner/gui/ajaxloader.gif trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java Added: trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/config/URLConfigOption.java 2008-09-10 10:25:17 UTC (rev 1191) @@ -0,0 +1,79 @@ +/** + * 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.core.config; + +import java.net.URL; + +/** + * Option which has an URL as value. + * + * @author Jens Lehmann + * + */ +public class URLConfigOption extends ConfigOption<URL> { + + public URLConfigOption(String name, String description) { + super(name, description); + } + + public URLConfigOption(String name, String description, URL defaultValue) { + super(name, description, defaultValue); + } + + public URLConfigOption(String name, String description, URL defaultValue, boolean mandatory, + boolean requiresInit) { + super(name, description, defaultValue, mandatory, requiresInit); + } + + /* (non-Javadoc) + * @see org.dllearner.core.config.ConfigOption#checkType(java.lang.Object) + */ + @Override + public boolean checkType(Object object) { + return (object instanceof URL); + } + + /* (non-Javadoc) + * @see org.dllearner.core.config.ConfigOption#getValueFormatting(java.lang.Object, java.lang.Integer) + */ + @Override + public String getValueFormatting(URL value) { + return value.toString(); + } + + /* (non-Javadoc) + * @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString() + */ + @Override + public String getValueTypeAsJavaString() { + return "URL"; + } + + /* (non-Javadoc) + * @see org.dllearner.core.config.ConfigOption#isValidValue(java.lang.Object) + */ + @Override + public boolean isValidValue(URL value) { + return true; + } + + + +} Property changes on: trunk/src/dl-learner/org/dllearner/gui/ajaxloader.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java 2008-09-10 10:25:17 UTC (rev 1191) @@ -0,0 +1,126 @@ +/** + * 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.gui.widgets; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.MalformedURLException; +import java.net.URL; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JTextField; + +import org.dllearner.core.Component; +import org.dllearner.core.config.URLConfigOption; +import org.dllearner.gui.Config; +import org.dllearner.gui.ExampleFileChooser; +import org.dllearner.kb.OWLFile; + +/** + * Widget panel for URLs. + * + * @author Jens Lehmann + * + */ +public class WidgetPanelURL extends AbstractWidgetPanel<URL> implements ActionListener { + + private static final long serialVersionUID = -2169739820989891226L; + + private JButton setButton; + private JButton chooseLocalButton; + + private URL value; + private JTextField stringField; + + public WidgetPanelURL(Config config, Component component, URLConfigOption configOption) { + super(config, component, configOption); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == chooseLocalButton) { +// String stringValue; + JFileChooser fc; + if(component instanceof OWLFile) { + fc = new ExampleFileChooser("owl"); + } else { + fc = new ExampleFileChooser("kb"); + } + + int returnVal = fc.showOpenDialog(this); + if (returnVal == JFileChooser.APPROVE_OPTION) { +// stringValue = fc.getSelectedFile().toString(); +// stringField.setText(stringValue); + try { + // get file URI, add it into text field and fire a + // value changed event + value = fc.getSelectedFile().toURI().toURL(); + stringField.setText(value.toString()); + fireValueChanged(value); + } catch (MalformedURLException e1) { + // should never happen, because an actual file was selected + e1.printStackTrace(); + } + } + } else if(e.getSource() == setButton) { + String stringValue = stringField.getText(); + try { + value = new URL(stringValue); + } catch (MalformedURLException e1) { + // TODO add error handling + e1.printStackTrace(); + } + fireValueChanged(value); + } + } + + @Override + public void buildWidgetPanel() { + add(getLabel()); + + // get current value of this option for the given component + value = config.getConfigOptionValue(component, configOption); + // default values can be null, so we interpret this as empty string +// if (value == null) { +// value = ""; +// } + + // text field for strings + stringField = new JTextField(35); + if(value != null) + stringField.setText(value.toString()); + stringField.setToolTipText(configOption.getAllowedValuesDescription()); + + // set button (value is only updated when this button is pressed => would better without set) + setButton = new JButton("Set"); + setButton.addActionListener(this); + + chooseLocalButton = new JButton("Choose Local File"); + chooseLocalButton.addActionListener(this); + + add(stringField); + add(setButton); + add(new JLabel(" or ")); + add(chooseLocalButton); + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-10 10:23:07
|
Revision: 1190 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1190&view=rev Author: jenslehmann Date: 2008-09-10 10:23:02 +0000 (Wed, 10 Sep 2008) Log Message: ----------- GUI intermediate commit Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/ConfigEntry.java trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/kb/OWLFile.java trunk/src/dl-learner/org/dllearner/scripts/NewSample.java Added Paths: ----------- trunk/doc/header.txt Added: trunk/doc/header.txt =================================================================== --- trunk/doc/header.txt (rev 0) +++ trunk/doc/header.txt 2008-09-10 10:23:02 UTC (rev 1190) @@ -0,0 +1,19 @@ +/** + * 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/>. + * + */ Modified: trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -77,7 +77,7 @@ * @see org.dllearner.core.config.ConfigOption#getValueFormatting(java.lang.Object) */ @Override - public String getValueFormatting(Boolean value, Integer special) { + public String getValueFormatting(Boolean value) { if (value != null) { if (value) return "true;"; Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigEntry.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/ConfigEntry.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/config/ConfigEntry.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -58,11 +58,16 @@ */ public String toConfString(String componentName) { if (option.getName().equalsIgnoreCase("positiveExamples")) { - return option.getValueFormatting(value, 1); + return option.getValueFormatting(value); } else if (option.getName().equalsIgnoreCase("negativeExamples")) { - return option.getValueFormatting(value, 2); + return option.getValueFormatting(value); } return componentName.toString() + "." + option.getName() + " = " - + option.getValueFormatting(value, 0); + + option.getValueFormatting(value); } + + @Override + public String toString() { + return option.name + " = " + value; + } } Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -205,14 +205,10 @@ /** * Get a formatted value to put into configuration file. * - * @param value - * @param special - * 0 for normal output. - * 1 for positiveExamples. - * 2 for negativeExamples. + * @param value Option value. * - * @return a string to put into a file + * @return A string to put into a conf file. */ - public abstract String getValueFormatting(T value, Integer special); + public abstract String getValueFormatting(T value); } Modified: trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/config/DoubleConfigOption.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -119,7 +119,7 @@ * @see org.dllearner.core.config.ConfigOption#getValueFormatting(java.lang.Object) */ @Override - public String getValueFormatting(Double value, Integer special) { + public String getValueFormatting(Double value) { if (value != null) return value.toString() + ";"; else Modified: trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -126,7 +126,7 @@ * @see org.dllearner.core.config.ConfigOption#getValueFormatting(java.lang.Object) */ @Override - public String getValueFormatting(Integer value, Integer special) { + public String getValueFormatting(Integer value) { if (value != null) return value.toString() + ";"; else Modified: trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/config/StringConfigOption.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -36,12 +36,10 @@ public StringConfigOption(String name, String description) { super(name, description); - } public StringConfigOption(String name, String description, String defaultValue) { super(name, description, defaultValue); - } public StringConfigOption(String name, String description, String defaultValue, boolean mandatory, boolean requiresInit) { @@ -112,7 +110,7 @@ * @see org.dllearner.core.config.ConfigOption#getValueFormatting(java.lang.Object) */ @Override - public String getValueFormatting(String value, Integer special) { + public String getValueFormatting(String value) { if (value != null) return value.toString() + ";"; else Modified: trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/config/StringSetConfigOption.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -99,9 +99,9 @@ * @see org.dllearner.core.config.ConfigOption#getValueFormatting(java.lang.Object) */ @Override - public String getValueFormatting(Set<String> value, Integer special) { + public String getValueFormatting(Set<String> value) { String back = ""; - if (value != null && special == 0) { + if (value != null && !name.equals("positiveExamples") && !name.equals("negativeExamples")) { Integer count = 0; back = "{"; for (String i : value) { @@ -114,14 +114,14 @@ return back; } // positive examples - if (value != null && special == 1) { + if (value != null && name.equals("positiveExamples")) { for (String i : value) { back += "\n+\"" + i + "\""; } return back + "\n"; } // negative examples - if (value != null && special == 2) { + if (value != null && name.equals("negativeExamples")) { Integer count = 0; for (String i : value) { count++; Modified: trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -103,7 +103,7 @@ * @see org.dllearner.core.config.ConfigOption#getValueFormatting(java.lang.Object) */ @Override - public String getValueFormatting(List<StringTuple> value, Integer special) { + public String getValueFormatting(List<StringTuple> value) { Integer count = 0; if (value != null) { String back = "["; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,10 +16,11 @@ * 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.DBpediaNavigationSuggestor; @@ -41,7 +42,6 @@ import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.learningproblems.PosOnlyInclusionLP; -import org.dllearner.learningproblems.RoleLearning; import org.dllearner.reasoning.DIGReasoner; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.FastRetrievalReasoner; @@ -74,7 +74,7 @@ * @param url URL pointing to the OWL file * @return a component ready for initialization OWLFile **/ -public static OWLFile getOWLFile(String url) { +public static OWLFile getOWLFile(URL url) { return OWLFileConfigurator.getOWLFile(url); } @@ -168,16 +168,6 @@ } /** -* @param positiveExamples positive examples -* @param negativeExamples negative examples -* @param reasoningService see ReasoningService -* @return a component ready for initialization RoleLearning -**/ -public static RoleLearning getRoleLearning(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { -return RoleLearningConfigurator.getRoleLearning(reasoningService, positiveExamples, negativeExamples); -} - -/** * @param learningProblem see LearningProblem * @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see Modified: trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,10 +16,12 @@ * 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.kb.KBFile; @@ -64,10 +66,10 @@ * url URL pointer to the KB file. * mandatory: false| reinit necessary: true * default value: null -* @return String +* @return URL **/ -public String getUrl() { -return (String) ComponentManager.getInstance().getConfigOptionValue(kBFile, "url") ; +public URL getUrl() { +return (URL) ComponentManager.getInstance().getConfigOptionValue(kBFile, "url") ; } /** @@ -84,7 +86,7 @@ * mandatory: false| reinit necessary: true * default value: null **/ -public void setUrl(String url) { +public void setUrl(URL url) { ComponentManager.getInstance().applyConfigEntry(kBFile, "url", url); reinitNecessary = true; } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,10 +16,12 @@ * 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.kb.OWLFile; @@ -45,7 +47,7 @@ * @param url URL pointing to the OWL file * @return OWLFile **/ -public static OWLFile getOWLFile(String url) { +public static OWLFile getOWLFile(URL url) { OWLFile component = ComponentManager.getInstance().knowledgeSource(OWLFile.class); ComponentManager.getInstance().applyConfigEntry(component, "url", url); return component; @@ -55,10 +57,10 @@ * url URL pointing to the OWL file. * mandatory: true| reinit necessary: true * default value: null -* @return String +* @return URL **/ -public String getUrl() { -return (String) ComponentManager.getInstance().getConfigOptionValue(oWLFile, "url") ; +public URL getUrl() { +return (URL) ComponentManager.getInstance().getConfigOptionValue(oWLFile, "url") ; } /** @@ -66,7 +68,7 @@ * mandatory: true| reinit necessary: true * default value: null **/ -public void setUrl(String url) { +public void setUrl(URL url) { ComponentManager.getInstance().applyConfigEntry(oWLFile, "url", url); reinitNecessary = true; } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -16,7 +16,7 @@ * 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; Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -20,6 +20,15 @@ package org.dllearner.gui; +import java.awt.BorderLayout; +import java.net.URL; + +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.SwingWorker; + +import org.apache.log4j.Logger; import org.dllearner.core.Component; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; @@ -33,6 +42,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.kb.KBFile; import org.dllearner.kb.OWLFile; +import org.dllearner.learningproblems.PosNegLP; // import org.dllearner.core.Component; @@ -47,6 +57,7 @@ public class Config { private ComponentManager cm = ComponentManager.getInstance(); + private static Logger logger = Logger.getLogger(Config.class); // the components currently active private KnowledgeSource source; @@ -108,9 +119,9 @@ * * @param knowledgeSource */ - public void setKnowledgeSource(KnowledgeSource knowledgeSource) { - source = knowledgeSource; - } +// public void setKnowledgeSource(KnowledgeSource knowledgeSource) { +// source = knowledgeSource; +// } /** * Get KnowledgeSource. @@ -128,17 +139,32 @@ */ public KnowledgeSource newKnowledgeSource(Class<? extends KnowledgeSource> clazz) { source = cm.knowledgeSource(clazz); +// logger.debug("new knowledge source " + clazz + " created"); return source; } /** + * Changes active knowledge source. This method does not not only + * create a knowledge source, but also updates the active reasoner + * to use the new knowledge source. + * @param clazz + */ + public KnowledgeSource changeKnowledgeSource(Class<? extends KnowledgeSource> clazz) { + source = cm.knowledgeSource(clazz); +// logger.debug("knowledge source " + clazz + " changed"); + // create a new reasoner object using the current class and the selected source + reasoner = cm.reasoner(reasoner.getClass(), source); + return source; + } + + /** * Set Reasoner. * * @param reasoner */ - public void setReasoner(ReasonerComponent reasoner) { - this.reasoner = reasoner; - } +// public void setReasoner(ReasonerComponent reasoner) { +// this.reasoner = reasoner; +// } /** * Get Reasoner. @@ -161,9 +187,9 @@ * * @param reasoningService */ - public void setReasoningService(ReasoningService reasoningService) { - this.rs = reasoningService; - } +// public void setReasoningService(ReasoningService reasoningService) { +// this.rs = reasoningService; +// } /** * Get ReasoningService. @@ -179,9 +205,9 @@ * * @param learningProblem */ - public void setLearningProblem(LearningProblem learningProblem) { - this.lp = learningProblem; - } +// public void setLearningProblem(LearningProblem learningProblem) { +// this.lp = learningProblem; +// } /** * Get LearningProblem. @@ -202,9 +228,9 @@ * * @param learningAlgorithm */ - public void setLearningAlgorithm(LearningAlgorithm learningAlgorithm) { - this.la = learningAlgorithm; - } +// public void setLearningAlgorithm(LearningAlgorithm learningAlgorithm) { +// this.la = learningAlgorithm; +// } /** * Get LearningAlgorithm. @@ -374,15 +400,110 @@ // init the specified component and record which ones where initialised public void init(int tabIndex) { + + // a thread class for handling inits (GUI has to remain + // responsive while init process is executed) + class InitThread extends Thread { + private Component component; + public InitThread(Component component) { + this.component = component; + } + @Override + public void run() { + gui.disableTabbedPane(); + try { + component.init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + gui.enableTabbedPane(); + } + } + +// final SwingWorker worker = new SwingWorker() { + class InitWorker extends SwingWorker<Boolean,Boolean> { + private Component component; + public InitWorker(Component component) { + this.component = component; + } + + @Override + protected Boolean doInBackground() throws Exception { + gui.getStatusPanel().setStatus("Initialising reasoner ... "); +// gui.getStatusPanel().repaint(); + gui.disableTabbedPane(); + gui.setEnabled(false); + JFrame waitFrame = new JFrame(); + waitFrame.setUndecorated(true); + waitFrame.setSize(200, 200); + URL imgURL = Config.class.getResource("ajaxloader.gif"); + ImageIcon waitIcon = new ImageIcon(imgURL, "wait"); +// waitFrame.add(new JLabel("Wait!"), waitIcon, SwingConstants.RIGHT); +// waitFrame.add(new JLabel("Wait")); + waitFrame.add(new JLabel(waitIcon), BorderLayout.NORTH); + waitFrame.add(new JLabel("Initialising reasoner. Please wait."), BorderLayout.SOUTH); + waitFrame.setLocationRelativeTo(gui); + waitFrame.setVisible(true); + try { + component.init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + gui.enableTabbedPane(); + gui.setEnabled(true); + gui.getStatusPanel().extendMessage("done."); + waitFrame.dispose(); + // TODO Auto-generated method stub +// return null; + return true; + } + }; + + try { if(tabIndex==0) { + gui.disableTabbedPane(); + gui.getStatusPanel().setStatus("Initialising knowledge source ... "); source.init(); + gui.getStatusPanel().extendMessage("done."); + gui.enableTabbedPane(); } else if(tabIndex==1) { - reasoner.init(); +// gui.disableTabbedPane(); +// gui.getStatusPanel().setStatus("Initialising reasoner ... "); +// gui.repaint(); +// Thread initThread = new InitThread(reasoner); +// initThread.run(); +// SwingWorker worker; +// try { +// SwingUtilities.invokeAndWait(initThread); +// } catch (InterruptedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } catch (InvocationTargetException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } + + InitWorker worker = new InitWorker(reasoner); + worker.execute(); + +// reasoner.init(); +// gui.getStatusPanel().extendMessage("done."); +// gui.enableTabbedPane(); } else if(tabIndex==2) { + gui.disableTabbedPane(); + gui.getStatusPanel().setStatus("Initialising learning problem ... "); lp.init(); + gui.getStatusPanel().extendMessage("done."); + gui.enableTabbedPane(); } else if(tabIndex == 3) { + gui.disableTabbedPane(); + gui.getStatusPanel().setStatus("Initialising learning algorithm ... "); la.init(); + gui.getStatusPanel().extendMessage("done."); + gui.enableTabbedPane(); } } catch (ComponentInitException e) { // TODO display message in status bar @@ -395,6 +516,8 @@ // applies a configuration option - used as delegate method, which invalidates components public <T> void applyConfigEntry(Component component, ConfigEntry<T> entry) { + System.out.println("Applying " + entry + " to " + component.getClass().getName() + "."); + cm.applyConfigEntry(component, entry); // enable tabs if setting the value completed mandatory settings enableTabsIfPossible(); @@ -433,27 +556,35 @@ private void enableTabsIfPossible() { if(mandatoryOptionsSpecified(source)) { isEnabled[0] = true; - } else if(mandatoryOptionsSpecified(reasoner)) { + } + if(mandatoryOptionsSpecified(reasoner) && isEnabled[0]) { isEnabled[1] = true; - } else if(mandatoryOptionsSpecified(lp)) { + } + if(mandatoryOptionsSpecified(lp) && isEnabled[1]) { isEnabled[2] = true; - } else if(mandatoryOptionsSpecified(la)) { + } + if(mandatoryOptionsSpecified(la) && isEnabled[1] && isEnabled[2]) { isEnabled[3] = true; } } // TODO use specification of mandatory variables private boolean mandatoryOptionsSpecified(Component component) { +// System.out.println("check mandatory options for " + component.getClass().getName()); if(component instanceof OWLFile) { - if(cm.getConfigOptionValue(source, "url") != null) { - return true; + if(cm.getConfigOptionValue(source, "url") == null) { + return false; } } else if(component instanceof KBFile) { - if(cm.getConfigOptionValue(source, "url") != null | cm.getConfigOptionValue(source, "filename") != null) { - return true; + if(cm.getConfigOptionValue(source, "url") == null && cm.getConfigOptionValue(source, "filename") == null) { + return false; } + } else if(component instanceof PosNegLP) { + if(cm.getConfigOptionValue(component, "positiveExamples")==null || cm.getConfigOptionValue(component, "negativeExamples") == null) { + return false; + } } - return false; + return true; } // delegate method for getting config option values Modified: trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -24,14 +24,14 @@ import java.net.URL; import java.util.Map; import java.util.SortedSet; + +import org.dllearner.cli.ConfFileOption; +import org.dllearner.cli.Start; +import org.dllearner.core.Component; import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; -import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.parser.ConfParser; -import org.dllearner.core.Component; -import org.dllearner.cli.ConfFileOption; -import org.dllearner.cli.Start; /** * Open a config file. @@ -85,13 +85,13 @@ Map<URL, Class<? extends KnowledgeSource>> importedFiles = Start.getImportedFiles( parser, file.getParentFile().getPath()); for (Map.Entry<URL, Class<? extends KnowledgeSource>> entry : importedFiles.entrySet()) { - config.setKnowledgeSource(config.getComponentManager().knowledgeSource( - entry.getValue())); +// config.setKnowledgeSource(config.getComponentManager().knowledgeSource( +// entry.getValue())); config.getComponentManager().applyConfigEntry(config.getKnowledgeSource(), "url", entry.getKey().toString()); // sources.add(ks); // TODO more then 1 KnowledgeSource - config.setKnowledgeSource(config.getKnowledgeSource()); +// config.setKnowledgeSource(config.getKnowledgeSource()); Start.configureComponent(config.getComponentManager(), config.getKnowledgeSource(), componentPrefixMapping, parser); startGUI.updateTabs(); @@ -109,8 +109,8 @@ // REASONER ConfFileOption reasonerOption = parser.getConfOptionsByName("reasoner"); - config.setReasoner(config.getComponentManager().reasoner( - Start.getReasonerClass(reasonerOption), config.getKnowledgeSource())); +// config.setReasoner(config.getComponentManager().reasoner( +// Start.getReasonerClass(reasonerOption), config.getKnowledgeSource())); Start.configureComponent(config.getComponentManager(), config.getReasoner(), componentPrefixMapping, parser); if (config.getKnowledgeSource() != null && config.getReasoner() != null) { @@ -118,8 +118,8 @@ config.getReasoner().init(); System.out.println("init Reasoner"); // set ReasoningService - config.setReasoningService(config.getComponentManager().reasoningService( - config.getReasoner())); +// config.setReasoningService(config.getComponentManager().reasoningService( +// config.getReasoner())); System.out.println("init ReasoningService"); // config.setInitReasoner(true); startGUI.updateTabs(); @@ -130,8 +130,8 @@ // LEARNING PROBLEM ConfFileOption problemOption = parser.getConfOptionsByName("problem"); - config.setLearningProblem(config.getComponentManager().learningProblem( - Start.getLearningProblemClass(problemOption), config.getReasoningService())); +// config.setLearningProblem(config.getComponentManager().learningProblem( +// Start.getLearningProblemClass(problemOption), config.getReasoningService())); SortedSet<String> posExamples = parser.getPositiveExamples(); SortedSet<String> negExamples = parser.getNegativeExamples(); config.getComponentManager().applyConfigEntry(config.getLearningProblem(), @@ -155,13 +155,13 @@ // LEARNING ALGORITHM ConfFileOption algorithmOption = parser.getConfOptionsByName("algorithm"); if (config.getLearningProblem() != null && config.getReasoningService() != null) { - try { - config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm( - Start.getLearningAlgorithm(algorithmOption), - config.getLearningProblem(), config.getReasoningService())); - } catch (LearningProblemUnsupportedException e) { - e.printStackTrace(); - } +// try { +// config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm( +// Start.getLearningAlgorithm(algorithmOption), +// config.getLearningProblem(), config.getReasoningService())); +// } catch (LearningProblemUnsupportedException e) { +// e.printStackTrace(); +// } } Start.configureComponent(config.getComponentManager(), config.getLearningAlgorithm(), componentPrefixMapping, parser); Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -96,7 +96,7 @@ if (choosenClassIndex != cb.getSelectedIndex()) { choosenClassIndex = cb.getSelectedIndex(); // create a new knowledge source component - config.newKnowledgeSource(selectableSources.get(choosenClassIndex)); + config.changeKnowledgeSource(selectableSources.get(choosenClassIndex)); // updateAll(); updateOptionPanel(); @@ -106,8 +106,8 @@ } if (e.getSource() == clearButton) { - config.setKnowledgeSource(config.getComponentManager().knowledgeSource( - selectableSources.get(choosenClassIndex))); +// config.setKnowledgeSource(config.getComponentManager().knowledgeSource( +// selectableSources.get(choosenClassIndex))); updateOptionPanel(); } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -109,8 +109,8 @@ // init(); } - if (e.getSource() == autoInitButton) - setLearningAlgorithm(); +// if (e.getSource() == autoInitButton) +// setLearningAlgorithm(); // if (e.getSource() == initButton) // init(); @@ -119,18 +119,18 @@ /** * after this, you can change widgets */ - public void setLearningAlgorithm() { - if (config.getLearningProblem() != null && config.getReasoningService() != null) { - try { - config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm( - selectableAlgorithms.get(choosenClassIndex), config.getLearningProblem(), - config.getReasoningService())); - updateOptionPanel(); - } catch (LearningProblemUnsupportedException e) { - e.printStackTrace(); - } - } - } +// public void setLearningAlgorithm() { +// if (config.getLearningProblem() != null && config.getReasoningService() != null) { +// try { +// config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm( +// selectableAlgorithms.get(choosenClassIndex), config.getLearningProblem(), +// config.getReasoningService())); +// updateOptionPanel(); +// } catch (LearningProblemUnsupportedException e) { +// e.printStackTrace(); +// } +// } +// } /** * after this, next tab can be used Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -42,7 +42,7 @@ private static final long serialVersionUID = -3819627680918930203L; private Config config; - private StartGUI startGUI; +// private StartGUI startGUI; private List<Class<? extends LearningProblem>> lpClasses; private String[] lpBoxItems = {}; private JComboBox cb = new JComboBox(lpBoxItems); @@ -56,7 +56,7 @@ super(new BorderLayout()); this.config = config; - this.startGUI = startGUI; +// this.startGUI = startGUI; lpClasses = config.getComponentManager().getLearningProblems(); setButton = new JButton("Set"); @@ -93,8 +93,8 @@ // init(); } - if (e.getSource() == setButton) - setLearningProblem(); +// if (e.getSource() == setButton) +// setLearningProblem(); // if (e.getSource() == initButton) // init(); @@ -103,14 +103,14 @@ /** * after this, you can change widgets */ - private void setLearningProblem() { - if (config.needsInitReasoner()) { - config.setLearningProblem(config.getComponentManager().learningProblem( - lpClasses.get(choosenClassIndex), config.getReasoningService())); - startGUI.updateTabs(); - updateOptionPanel(); - } - } +// private void setLearningProblem() { +// if (config.needsInitReasoner()) { +// config.setLearningProblem(config.getComponentManager().learningProblem( +// lpClasses.get(choosenClassIndex), config.getReasoningService())); +// startGUI.updateTabs(); +// updateOptionPanel(); +// } +// } /** * after this, next tab can be used Modified: trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -39,6 +39,7 @@ import org.dllearner.gui.widgets.WidgetPanelString; import org.dllearner.gui.widgets.WidgetPanelStringSet; import org.dllearner.gui.widgets.WidgetPanelStringTupleList; +import org.dllearner.gui.widgets.WidgetPanelURL; /** * OptionPanel reads all possible options and use all widgets. Definition map is @@ -107,6 +108,8 @@ widgetPanel = new WidgetPanelDouble(config, component, (DoubleConfigOption) option); } else if (option instanceof StringConfigOption) { widgetPanel = new WidgetPanelString(config, component, (StringConfigOption) option); + } else if (option instanceof URLConfigOption) { + widgetPanel = new WidgetPanelURL(config, component, (URLConfigOption) option); } else if (option instanceof StringSetConfigOption) { widgetPanel = new WidgetPanelStringSet(config, component, (StringSetConfigOption) option); } else if (option instanceof StringTupleListConfigOption) { Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -89,7 +89,7 @@ add(initPanel, BorderLayout.PAGE_END); choosenClassIndex = cb.getSelectedIndex(); - setReasoner(); +// setReasoner(); updateInitButtonColor(); } @@ -102,10 +102,10 @@ // init(); } - if (e.getSource() == setButton) { -// config.setInitReasoner(false); - setReasoner(); - } +// if (e.getSource() == setButton) { +//// config.setInitReasoner(false); +// setReasoner(); +// } // if (e.getSource() == initButton) // init(); @@ -114,16 +114,16 @@ /** * after this, you can change widgets */ - public void setReasoner() { - if (config.needsInitKnowledgeSource()) { - config.setReasoner(config.getComponentManager().reasoner( - reasoner.get(choosenClassIndex), config.getKnowledgeSource())); - updateOptionPanel(); -// startGUI.updateTabColors(); -// config.setInitReasoner(false); -// updateInitButtonColor(); - } - } +// public void setReasoner() { +// if (config.needsInitKnowledgeSource()) { +// config.setReasoner(config.getComponentManager().reasoner( +// reasoner.get(choosenClassIndex), config.getKnowledgeSource())); +// updateOptionPanel(); +//// startGUI.updateTabColors(); +//// config.setInitReasoner(false); +//// updateInitButtonColor(); +// } +// } /** * after this, next tab can be used Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -136,7 +136,9 @@ // check whether we need to initialise components if (index != 0 && config.tabNeedsInit(index - 1)) { for (int i = 0; i < index; i++) { - config.init(i); + if(config.tabNeedsInit(i)) { + config.init(i); + } } } @@ -171,7 +173,7 @@ Logger logger = Logger.getRootLogger(); logger.removeAllAppenders(); logger.addAppender(consoleAppender); - logger.setLevel(Level.INFO); + logger.setLevel(Level.DEBUG); File file = null; if (args.length > 0) @@ -301,7 +303,23 @@ } + // freeze tab + public void disableTabbedPane() { + tabPane.setEnabled(false); + } + + public void enableTabbedPane() { + tabPane.setEnabled(true); + } + public void setStatusMessage(String message) { statusPanel.setStatus(message); } + + /** + * @return the statusPanel + */ + public StatusPanel getStatusPanel() { + return statusPanel; + } } Modified: trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -36,17 +36,36 @@ private JLabel statusLabel = new JLabel(tabInitText); + private String message = tabInitText; + + private String oldMessage; + public StatusPanel() { super(); add(statusLabel); } - public void setStatus(String message) { + private void updateMessage(String message) { + oldMessage = this.message; + this.message = message; statusLabel.setText(message); +// repaint(); } + public void setStatus(String message) { + updateMessage(message); + } + public void setTabInitMessage() { - statusLabel.setText(tabInitText); +// updateMessage(tabInitText); } + public void extendMessage(String addition) { + message += addition; + statusLabel.setText(message); + } + + public void revertToPreviousMessage() { + updateMessage(oldMessage); + } } Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -56,7 +56,7 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == setButton) { - if (configOption.getName().equals("filename")) { + if (configOption.getName().equals("filename") || configOption.getName().equals("url")) { JFileChooser fc; if(component instanceof OWLFile) { fc = new ExampleFileChooser("owl"); Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -34,6 +34,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.config.URLConfigOption; import org.dllearner.core.configurators.KBFileConfigurator; import org.dllearner.core.owl.KB; import org.dllearner.parser.KBParser; @@ -98,7 +99,7 @@ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); options.add(new StringConfigOption("filename", "pointer to the KB file on local file system",null, true, true)); - options.add(new StringConfigOption("url", "URL pointer to the KB file",null, false, true)); + options.add(new URLConfigOption("url", "URL pointer to the KB file",null, false, true)); return options; } @@ -118,7 +119,7 @@ //URL url = null; try { String filename = configurator.getFilename(); - String urlString = configurator.getUrl(); + String urlString = configurator.getUrl().toString(); if(filename!=null){ url = new File(filename).toURI().toURL(); }else if(urlString!=null){ Modified: trunk/src/dl-learner/org/dllearner/kb/OWLFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -20,20 +20,20 @@ package org.dllearner.kb; import java.io.File; -import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.util.Collection; import java.util.LinkedList; import org.apache.log4j.Logger; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.OntologyFormat; import org.dllearner.core.OntologyFormatUnsupportedException; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.config.URLConfigOption; import org.dllearner.core.configurators.OWLFileConfigurator; import org.dllearner.core.owl.KB; import org.dllearner.reasoning.OWLAPIDIGConverter; @@ -47,7 +47,7 @@ private static Logger logger = Logger .getLogger(OWLFile.class); - private URL url; +// private URL url; private OWLFileConfigurator configurator ; @Override public OWLFileConfigurator getConfigurator(){ @@ -65,7 +65,7 @@ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - options.add(new StringConfigOption("url", "URL pointing to the OWL file", null, true, true)); + options.add(new URLConfigOption("url", "URL pointing to the OWL file", null, true, true)); return options; } @@ -81,16 +81,20 @@ * @see org.dllearner.core.Component#init() */ @Override - public void init() { + public void init() throws ComponentInitException { + if(configurator.getUrl() == null) { + logger.error("Cannot initialise OWL file with empty URL"); + } + /* try { url = new URL(configurator.getUrl()); } catch (MalformedURLException e) { logger.error(e.getMessage()); //throw new InvalidConfigOptionValueException(entry.getOption(), entry.getValue(),"malformed URL " + configurator.getUrl()); } + */ - } /* @@ -101,14 +105,15 @@ @Override public String toDIG(URI kbURI) { // TODO: need some handling for cases where the URL was not set - return OWLAPIDIGConverter.getTellsString(url, OntologyFormat.RDF_XML, kbURI); + return OWLAPIDIGConverter.getTellsString(configurator.getUrl(), OntologyFormat.RDF_XML, kbURI); } public URL getURL() { - return url; + return configurator.getUrl(); } public void setURL(URL url) { - this.url = url; +// this.url = url; + configurator.setUrl(url); } /* (non-Javadoc) Modified: trunk/src/dl-learner/org/dllearner/scripts/NewSample.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-10 05:48:08 UTC (rev 1189) +++ trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-10 10:23:02 UTC (rev 1190) @@ -19,6 +19,8 @@ import java.io.File; import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; import java.text.DecimalFormat; import java.util.HashSet; import java.util.List; @@ -119,7 +121,13 @@ // knowledge source //KnowledgeSource ks = cm.knowledgeSource(OWLFile.class); - String fileURL = new File(owlFile).toURI().toString(); + URL fileURL = null; + try { + fileURL = new File(owlFile).toURI().toURL(); + } catch (MalformedURLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } OWLFile ks = ComponentFactory.getOWLFile( fileURL); Set<KnowledgeSource> tmp = new HashSet<KnowledgeSource>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-10 05:48:12
|
Revision: 1189 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1189&view=rev Author: jenslehmann Date: 2008-09-10 05:48:08 +0000 (Wed, 10 Sep 2008) Log Message: ----------- fixed all Eclipse warnings in project Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-09 14:27:41 UTC (rev 1188) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-10 05:48:08 UTC (rev 1189) @@ -21,7 +21,6 @@ import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; Modified: trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-09-09 14:27:41 UTC (rev 1188) +++ trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-09-10 05:48:08 UTC (rev 1189) @@ -31,6 +31,7 @@ import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; import org.dllearner.core.owl.Individual; import org.dllearner.reasoning.FastInstanceChecker; @@ -54,7 +55,7 @@ public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl"; //private static Class usedReasoner = FastInstanceChecker.class; - private static Class usedReasoner = OWLAPIReasoner.class; + private static Class<? extends ReasonerComponent> usedReasoner = OWLAPIReasoner.class; private static boolean allOrExists = true; private static boolean tenORthirty = true; @@ -285,7 +286,7 @@ } - Class tmp = FastInstanceChecker.class; + Class<? extends ReasonerComponent> tmp = FastInstanceChecker.class; if(usedReasoner.equals(tmp)){ lc.maxExecutionTimeInSeconds = 30; }else{ Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-09-09 14:27:41 UTC (rev 1188) +++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2008-09-10 05:48:08 UTC (rev 1189) @@ -34,6 +34,7 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; @@ -75,7 +76,7 @@ public static String ontologyPath = "examples/semantic_bible/NTNcombined.owl"; - private static Class usedReasoner = FastInstanceChecker.class; + private static Class<? extends ReasonerComponent> usedReasoner = FastInstanceChecker.class; /** * @param args Modified: trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java 2008-09-09 14:27:41 UTC (rev 1188) +++ trunk/src/dl-learner/org/dllearner/scripts/WikipediaCategoryCleaner.java 2008-09-10 05:48:08 UTC (rev 1189) @@ -269,9 +269,9 @@ private static void printIntermediateResults( - SortedSet fullSet, - SortedSet correctIndividuals, - SortedSet wrongIndividuals, + SortedSet<String> fullSet, + SortedSet<String> correctIndividuals, + SortedSet<String> wrongIndividuals, int numberOfConcepts) { SetManipulation.printSet("full Individual set: ", fullSet, logger); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-09-09 14:27:41 UTC (rev 1188) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-09-10 05:48:08 UTC (rev 1189) @@ -197,6 +197,7 @@ * returns the edited Components. * @return Set of OWLDescriptions */ + @Override public Set<OWLDescription> getEditedObjects() { if (tabbedPane.getSelectedComponent() == classSelectorPanel) { return new HashSet<OWLDescription>(classSelectorPanel @@ -630,6 +631,7 @@ splitPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); List<RestrictionCreator> types = new ArrayList<RestrictionCreator>(); types.add(new RestrictionCreator("Some (existential)") { + @Override public void createRestrictions( Set<OWLObjectProperty> properties, Set<OWLDescription> fillers, Set<OWLDescription> result) { @@ -642,6 +644,7 @@ } }); types.add(new RestrictionCreator("Only (universal)") { + @Override public void createRestrictions( Set<OWLObjectProperty> properties, Set<OWLDescription> fillers, Set<OWLDescription> result) { @@ -663,6 +666,7 @@ }); types.add(new CardinalityRestrictionCreator( "Min (min cardinality)", cardinalitySpinner) { + @Override public OWLDescription createRestriction(OWLObjectProperty prop, OWLDescription filler, int card) { return getDataFactory() @@ -672,6 +676,7 @@ }); types.add(new CardinalityRestrictionCreator( "Exactly (exact cardinality)", cardinalitySpinner) { + @Override public OWLDescription createRestriction(OWLObjectProperty prop, OWLDescription filler, int card) { return getDataFactory() @@ -681,6 +686,7 @@ }); types.add(new CardinalityRestrictionCreator( "Max (max cardinality)", cardinalitySpinner) { + @Override public OWLDescription createRestriction(OWLObjectProperty prop, OWLDescription filler, int card) { return getDataFactory() @@ -744,6 +750,7 @@ this.name = name; } + @Override public String toString() { return name; } @@ -767,6 +774,7 @@ this.cardinalitySpinner = cardinalitySpinner; } + @Override public void createRestrictions(Set<OWLObjectProperty> properties, Set<OWLDescription> fillers, Set<OWLDescription> result) { for (OWLObjectProperty prop : properties) { Modified: trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java 2008-09-09 14:27:41 UTC (rev 1188) +++ trunk/src/dl-learner/org/dllearner/utilities/datastructures/SetManipulation.java 2008-09-10 05:48:08 UTC (rev 1189) @@ -129,7 +129,7 @@ * @param nrElements * @return returns the list shrunken to size. */ - public static List getFirst(List list, int nrElements) { + public static <T> List<T> getFirst(List<T> list, int nrElements) { int size; while ((size = list.size()) > nrElements) { list.remove(size - 1); @@ -153,7 +153,7 @@ return ret; } - public static void printSet(String s, SortedSet set, Logger logger) { + public static void printSet(String s, SortedSet<String> set, Logger logger) { if(logger.getLevel().equals(Level.DEBUG)){ logger.info(s +" ["+ set.size()+"]: "+set); }else{ @@ -162,7 +162,7 @@ } - public static void printSet(String s, SortedSet set) { + public static <T> void printSet(String s, SortedSet<T> set) { System.out.println(s +" ["+ set.size()+"]: "+set); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jen...@us...> - 2008-09-09 14:27:43
|
Revision: 1188 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1188&view=rev Author: JensLehmann Date: 2008-09-09 14:27:41 +0000 (Tue, 09 Sep 2008) Log Message: ----------- more cleanup, added some status messages Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-09 13:48:15 UTC (rev 1187) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-09 14:27:41 UTC (rev 1188) @@ -31,6 +31,8 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; +import org.dllearner.kb.KBFile; +import org.dllearner.kb.OWLFile; // import org.dllearner.core.Component; @@ -357,18 +359,18 @@ return false; } - public void reInit() { - cm = ComponentManager.getInstance(); - source = null; - reasoner = null; - rs = null; - lp = null; - la = null; - needsInit = new boolean[4]; - threadIsRunning = false; - algorithmRunStartTime = null; - algorithmRunStopTime = null; - } +// public void reInit() { +// cm = ComponentManager.getInstance(); +// source = null; +// reasoner = null; +// rs = null; +// lp = null; +// la = null; +// needsInit = new boolean[4]; +// threadIsRunning = false; +// algorithmRunStartTime = null; +// algorithmRunStopTime = null; +// } // init the specified component and record which ones where initialised public void init(int tabIndex) { @@ -394,29 +396,63 @@ // applies a configuration option - used as delegate method, which invalidates components public <T> void applyConfigEntry(Component component, ConfigEntry<T> entry) { cm.applyConfigEntry(component, entry); + // enable tabs if setting the value completed mandatory settings + enableTabsIfPossible(); // invalidate components if(component instanceof KnowledgeSource) { needsInit[0] = true; needsInit[1] = true; needsInit[2] = true; needsInit[3] = true; - if(mandatoryOptionsSpecified(component)) { - isEnabled[1] = true; + if(isEnabled[0]) { + gui.setStatusMessage("All mandatory options filled in. You can continue to the reasoner tab."); } } else if(component instanceof ReasonerComponent) { needsInit[1] = true; needsInit[2] = true; needsInit[3] = true; + if(isEnabled[1]) { + gui.setStatusMessage("All mandatory options filled in. You can continue to the learning problem tab."); + } } else if(component instanceof LearningProblem) { needsInit[2] = true; needsInit[3] = true; + if(isEnabled[2]) { + gui.setStatusMessage("All mandatory options filled in. You can continue to the learning algorithm tab."); + } } else if(component instanceof LearningAlgorithm) { needsInit[3] = true; + if(isEnabled[3]) { + gui.setStatusMessage("All mandatory options filled in. You can now run the algorithm."); + } } - gui.updateTabColors(); + + gui.updateTabs(); } + private void enableTabsIfPossible() { + if(mandatoryOptionsSpecified(source)) { + isEnabled[0] = true; + } else if(mandatoryOptionsSpecified(reasoner)) { + isEnabled[1] = true; + } else if(mandatoryOptionsSpecified(lp)) { + isEnabled[2] = true; + } else if(mandatoryOptionsSpecified(la)) { + isEnabled[3] = true; + } + } + + // TODO use specification of mandatory variables private boolean mandatoryOptionsSpecified(Component component) { + if(component instanceof OWLFile) { + if(cm.getConfigOptionValue(source, "url") != null) { + return true; + } + } else if(component instanceof KBFile) { + if(cm.getConfigOptionValue(source, "url") != null | cm.getConfigOptionValue(source, "filename") != null) { + return true; + } + } return false; } Modified: trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java 2008-09-09 13:48:15 UTC (rev 1187) +++ trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java 2008-09-09 14:27:41 UTC (rev 1188) @@ -74,7 +74,7 @@ * parse file */ public void startParser() { - config.reInit(); // new ComponentManager +// config.reInit(); // new ComponentManager if (this.file.exists()) { ConfParser parser = ConfParser.parseFile(file); // create a mapping between components and prefixes in the conf file @@ -94,7 +94,7 @@ config.setKnowledgeSource(config.getKnowledgeSource()); Start.configureComponent(config.getComponentManager(), config.getKnowledgeSource(), componentPrefixMapping, parser); - startGUI.updateTabColors(); + startGUI.updateTabs(); // init if (config.getKnowledgeSource() != null && config.isSetURL()) { try { @@ -122,7 +122,7 @@ config.getReasoner())); System.out.println("init ReasoningService"); // config.setInitReasoner(true); - startGUI.updateTabColors(); + startGUI.updateTabs(); } catch (ComponentInitException e) { e.printStackTrace(); } @@ -146,7 +146,7 @@ config.getLearningProblem().init(); // config.setInitLearningProblem(true); System.out.println("init LearningProblem"); - startGUI.updateTabColors(); + startGUI.updateTabs(); } catch (ComponentInitException e) { e.printStackTrace(); } @@ -170,14 +170,14 @@ config.getLearningAlgorithm().init(); // config.setInitLearningAlgorithm(true); System.out.println("init LearningAlgorithm"); - startGUI.updateTabColors(); + startGUI.updateTabs(); } catch (ComponentInitException e) { e.printStackTrace(); } } // update graphic - startGUI.updateTabColors(); + startGUI.updateTabs(); } } Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-09 13:48:15 UTC (rev 1187) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-09 14:27:41 UTC (rev 1188) @@ -46,13 +46,10 @@ private Config config; // private StartGUI startGUI; -// private JButton initButton; - private JButton setButton; private JButton clearButton; private String[] kbBoxItems = {}; private JComboBox cb = new JComboBox(kbBoxItems); private JPanel choosePanel = new JPanel(); -// private JPanel initPanel = new JPanel(); private int choosenClassIndex; private List<Class<? extends KnowledgeSource>> selectableSources; private OptionPanel optionPanel; @@ -69,13 +66,8 @@ // OWL API ontology is only useful programmatically (not in the GUI itself) selectableSources.remove(OWLAPIOntology.class); - setButton = new JButton("Set"); - setButton.addActionListener(this); - setButton = new JButton("Clear All"); - setButton.addActionListener(this); -// initButton = new JButton("Init KnowledgeSource"); -// initButton.addActionListener(this); -// initButton.setEnabled(true); + clearButton = new JButton("Reset to Default Values"); + clearButton.addActionListener(this); // add to comboBox for (int i = 0; i < selectableSources.size(); i++) { @@ -84,19 +76,15 @@ cb.addActionListener(this); choosePanel.add(cb); - choosePanel.add(setButton); + choosePanel.add(clearButton); choosenClassIndex = cb.getSelectedIndex(); // whenever a component is selected, we immediately create an instance (non-initialised) KnowledgeSource ks = config.newKnowledgeSource(selectableSources.get(cb.getSelectedIndex())); optionPanel = new OptionPanel(config, ks); - -// optionPanel = new OptionPanel(config, config.getKnowledgeSource(), sources.get(choosenClassIndex)); - // initPanel.add(initButton); - add(choosePanel, BorderLayout.PAGE_START); + add(choosePanel, BorderLayout.NORTH); add(optionPanel, BorderLayout.CENTER); -// add(initPanel, BorderLayout.PAGE_END); choosenClassIndex = cb.getSelectedIndex(); @@ -117,88 +105,33 @@ // init(); } - if (e.getSource() == setButton) { - setSource(); + if (e.getSource() == clearButton) { + config.setKnowledgeSource(config.getComponentManager().knowledgeSource( + selectableSources.get(choosenClassIndex))); + updateOptionPanel(); } // if (e.getSource() == initButton) { // init(); // } - if (e.getSource() == clearButton) { - config.reInit(); - } +// if (e.getSource() == clearButton) { +// config.reInit(); +// } } /** * after this, you can change widgets */ - public void setSource() { - config.setKnowledgeSource(config.getComponentManager().knowledgeSource( - selectableSources.get(choosenClassIndex))); -// config.setInitKnowledgeSource(false); - updateAll(); - } +// public void setSource() { +// +// } /** - * after this, next tab can be used - */ - /* - public void init() { - setSource(); - if (config.getKnowledgeSource() != null && config.isSetURL()) { - try { - config.getKnowledgeSource().init(); -// config.setInitKnowledgeSource(true); - System.out.println("init KnowledgeSource"); - startGUI.updateTabColors(); - } catch (ComponentInitException e) { - e.printStackTrace(); - } - } - } - */ - - /** - * updateAll - */ - public void updateAll() { -// updateComboBox(); - updateOptionPanel(); -// updateInitButtonColor(); - } - - /** - * set ComboBox to selected class - */ - /* - public void updateComboBox() { - if (config.getKnowledgeSource() != null) - for (int i = 0; i < selectableSources.size(); i++) - if (config.getKnowledgeSource().getClass().equals( - config.getComponentManager().getKnowledgeSources().get(i))) { - cb.setSelectedIndex(i); - } - this.choosenClassIndex = cb.getSelectedIndex(); - }*/ - - /** * update OptionPanel with new selection */ public void updateOptionPanel() { optionPanel.update(config.getKnowledgeSource()); } - /** - * make init-button red if you have to click - */ - /* - public void updateInitButtonColor() { - if (!config.needsInitKnowledgeSource()) { - initButton.setForeground(Color.RED); - } else - initButton.setForeground(Color.BLACK); - } - */ - } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-09 13:48:15 UTC (rev 1187) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-09 14:27:41 UTC (rev 1188) @@ -107,7 +107,7 @@ if (config.needsInitReasoner()) { config.setLearningProblem(config.getComponentManager().learningProblem( lpClasses.get(choosenClassIndex), config.getReasoningService())); - startGUI.updateTabColors(); + startGUI.updateTabs(); updateOptionPanel(); } } Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-09 13:48:15 UTC (rev 1187) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-09 14:27:41 UTC (rev 1188) @@ -123,7 +123,7 @@ add(tabPane, BorderLayout.CENTER); add(statusPanel, BorderLayout.SOUTH); setVisible(true); - updateTabColors(); + updateTabs(); // Register a change listener tabPane.addChangeListener(new ChangeListener() { @@ -141,18 +141,12 @@ } } - updateTabColors(); + updateTabs(); - // TODO: handle init code here => whenever a tab - // is selected, we have to determine whether it - // and the tabs before need to be initialised - - Component c = tabPane.getSelectedComponent(); - if (c == tab0) { - // System.out.println(tab0); - } + // new tab => ask user to fill in values + statusPanel.setTabInitMessage(); + } - // init(); } }); @@ -260,7 +254,7 @@ /** * Update colors of tabulators; red should be clicked, black for OK. */ - public void updateTabColors() { + public void updateTabs() { for(int i=0; i<4; i++) { // red = needs init, black = initialised if(config.needsInit(i)) { Modified: trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java 2008-09-09 13:48:15 UTC (rev 1187) +++ trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java 2008-09-09 14:27:41 UTC (rev 1188) @@ -32,9 +32,9 @@ private static final long serialVersionUID = 2426470148153461670L; - private String initText = "Please fill in the mandatory config options and proceed to the next tab."; + private String tabInitText = "Please fill in the mandatory config options and proceed to the next tab."; - private JLabel statusLabel = new JLabel(initText); + private JLabel statusLabel = new JLabel(tabInitText); public StatusPanel() { super(); @@ -44,5 +44,9 @@ public void setStatus(String message) { statusLabel.setText(message); } + + public void setTabInitMessage() { + statusLabel.setText(tabInitText); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jen...@us...> - 2008-09-09 13:48:21
|
Revision: 1187 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1187&view=rev Author: JensLehmann Date: 2008-09-09 13:48:15 +0000 (Tue, 09 Sep 2008) Log Message: ----------- refactoring: widgets moved to separate package Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/widgets/ trunk/src/dl-learner/org/dllearner/gui/widgets/AbstractWidgetPanel.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDefault.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDouble.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelInteger.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelStringTupleList.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDefault.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringTupleList.java Deleted: trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -1,85 +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.gui; - -import javax.swing.JLabel; -import javax.swing.JPanel; - -import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.ConfigOption; -import org.dllearner.core.config.InvalidConfigOptionValueException; - -/** - * Abstract superclass of all widgets. Each widget has an associated component and configuration option, - * for which it allows modification by the user. - * - * @author Jens Lehmann - */ -public abstract class AbstractWidgetPanel<T> extends JPanel { - - protected ConfigOption<T> configOption; - protected Config config; - protected Component component; - - /** - * Constructs a widget. - * @param config The status of all components and options (which may be updated by this widget). - * @param component The component potentially changed by this widget. - * @param optionOption The config option of the specified component, which is potentially changed by this widget. - */ - public AbstractWidgetPanel(Config config, Component component, ConfigOption<T> optionOption) { - this.config = config; - this.component = component; - this.configOption = optionOption; - - if(configOption == null || component == null || config == null) { - System.out.println("| " + component + ", " + configOption + ", " + config + " |"); - throw new Error("Parameters must not be null."); - } - - buildWidgetPanel(); - } - - // convenience method - protected JLabel getLabel() { - JLabel nameLabel = new JLabel(configOption.getName()); - nameLabel.setToolTipText(configOption.getDescription()); - return nameLabel; - } - - // subclasses should call this method if a configuration option has changed - public void fireValueChanged(T value) { - ConfigEntry<T> entry = null; - try { - entry = new ConfigEntry<T>(configOption, value); - } catch (InvalidConfigOptionValueException e) { - // TODO display a message on the status bar (where the init - // has been before) - e.printStackTrace(); - } - // notify config that a value has changed -> it decides what to do - config.applyConfigEntry(component, entry); - } - - // subclasses should use this method to build the graphical representation of the widgets - public abstract void buildWidgetPanel(); - -} Modified: trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/CheckBoxList.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -20,6 +20,9 @@ package org.dllearner.gui; import javax.swing.*; + +import org.dllearner.gui.widgets.WidgetPanelStringSet; + import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.BorderLayout; Modified: trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/OptionPanel.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -32,6 +32,13 @@ import org.dllearner.core.Component; import org.dllearner.core.ComponentManager; import org.dllearner.core.config.*; +import org.dllearner.gui.widgets.WidgetPanelBoolean; +import org.dllearner.gui.widgets.WidgetPanelDefault; +import org.dllearner.gui.widgets.WidgetPanelDouble; +import org.dllearner.gui.widgets.WidgetPanelInteger; +import org.dllearner.gui.widgets.WidgetPanelString; +import org.dllearner.gui.widgets.WidgetPanelStringSet; +import org.dllearner.gui.widgets.WidgetPanelStringTupleList; /** * OptionPanel reads all possible options and use all widgets. Definition map is Deleted: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -1,114 +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.gui; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JComboBox; - -import org.dllearner.core.Component; -import org.dllearner.core.config.BooleanConfigOption; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.InvalidConfigOptionValueException; - -/** - * Panel for option Boolean, defined in - * org.dllearner.core.config.BooleanConfigOption. - * - * @author Jens Lehmann - * @author Tilo Hielscher - */ -public class WidgetPanelBoolean extends AbstractWidgetPanel<Boolean> implements ActionListener { - - private static final long serialVersionUID = -4800583253223939928L; - - private Boolean value; -// private String[] kbBoxItems; // = { "false", "true" }; - private JComboBox cb; // = new JComboBox(kbBoxItems); - - public WidgetPanelBoolean(Config config, Component component, BooleanConfigOption configOption) { - super(config, component, configOption); - } - - public void actionPerformed(ActionEvent e) { - if (cb.getSelectedIndex() == 0) - value = false; - else - value = true; - - BooleanConfigOption specialOption; - specialOption = (BooleanConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Boolean> specialEntry = new ConfigEntry<Boolean>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set Boolean: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("Boolean: not valid value"); - } - - public void setEntry() { - BooleanConfigOption specialOption; - specialOption = (BooleanConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Boolean> specialEntry = new ConfigEntry<Boolean>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set Boolean: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("Boolean: not valid value"); - } - - @Override - public void buildWidgetPanel() { - add(getLabel()); - - value = config.getConfigOptionValue(component, configOption); - - if (value == null) - value = false; - else - setEntry(); - - // set cb-index - String[] kbBoxItems = { "false", "true" }; - cb = new JComboBox(kbBoxItems); - if (!value) - cb.setSelectedIndex(0); - else - cb.setSelectedIndex(1); - - cb.addActionListener(this); - add(cb); - - } - -} Deleted: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDefault.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDefault.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDefault.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -1,51 +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.gui; - -import java.awt.Color; - -import javax.swing.JLabel; - -import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigOption; - -/** - * Panel for not defined options. - * - * @author Tilo Hielscher - * - */ -public class WidgetPanelDefault extends AbstractWidgetPanel<Object> { - - private static final long serialVersionUID = 4059515858894036769L; - - public WidgetPanelDefault(Config config, Component component, ConfigOption<Object> configOption) { - super(config, component, configOption); - } - - @Override - public void buildWidgetPanel() { - JLabel notImplementedLabel = new JLabel(configOption.getClass().getSimpleName() - + " not implemented"); - notImplementedLabel.setForeground(Color.RED); - add(notImplementedLabel); - } - -} Deleted: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -1,102 +0,0 @@ -package org.dllearner.gui; - -/** - * 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/>. - * - */ - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JButton; -import javax.swing.JTextField; - -import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.DoubleConfigOption; -import org.dllearner.core.config.InvalidConfigOptionValueException; - -/** - * Panel for option Double, defined in - * {@link org.dllearner.core.config.DoubleConfigOption}. - * - * @author Tilo Hielscher - * - */ -public class WidgetPanelDouble extends AbstractWidgetPanel<Double> implements ActionListener { - - private static final long serialVersionUID = 5238903690721116289L; - - private JButton setButton = new JButton("Set"); - -// private Class<? extends Component> componentOption; - - private Double value; - private JTextField doubleField = new JTextField(5); - - public WidgetPanelDouble(Config config, Component component, DoubleConfigOption configOption) { - super(config, component, configOption); - } - - public void actionPerformed(ActionEvent e) { - if (e.getSource() == setButton) { - setEntry(); - } - } - - public void setEntry() { - DoubleConfigOption specialOption; - value = Double.parseDouble(doubleField.getText()); // get from input - specialOption = (DoubleConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Double> specialEntry = new ConfigEntry<Double>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set Double: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("Double: not valid value"); - } - - @Override - public void buildWidgetPanel() { - add(getLabel()); - - value = config.getConfigOptionValue(component, configOption); - - setButton = new JButton("Set"); - doubleField = new JTextField(5); - if (value == null) - value = 0.0; - else { - doubleField.setText(value.toString()); - setEntry(); - } - - doubleField.setText(value.toString()); - doubleField.setToolTipText(configOption.getAllowedValuesDescription()); - setButton.addActionListener(this); - add(doubleField); - add(setButton); - - } -} Deleted: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -1,99 +0,0 @@ -package org.dllearner.gui; - -/** - * 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/>. - * - */ - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JButton; -import javax.swing.JTextField; - -import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.IntegerConfigOption; -import org.dllearner.core.config.InvalidConfigOptionValueException; - -/** - * Panel for option Integer, defined in - * org.dllearner.core.config.IntegerConfigOption. - * - * @author Tilo Hielscher - * - */ -public class WidgetPanelInteger extends AbstractWidgetPanel<Integer> implements ActionListener { - - private static final long serialVersionUID = -1802111225835164644L; - - private JButton setButton = new JButton("Set"); - - private Integer value; - private JTextField integerField = new JTextField(3); - - public WidgetPanelInteger(Config config, Component component, IntegerConfigOption configOption) { - super(config, component, configOption); - } - - public void actionPerformed(ActionEvent e) { - if (e.getSource() == setButton) { - setEntry(); - } - } - - public void setEntry() { - IntegerConfigOption specialOption; - value = Integer.parseInt(integerField.getText()); // get from input - specialOption = (IntegerConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Integer> specialEntry = new ConfigEntry<Integer>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set Integer: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("Integer: not valid value"); - } - - @Override - public void buildWidgetPanel() { - add(getLabel()); - - value = config.getConfigOptionValue(component, configOption); - - setButton = new JButton("Set"); - integerField = new JTextField(3); - if (value == null) - value = 0; - else { - integerField.setText(value.toString()); - setEntry(); - } - - integerField.setText(value.toString()); - integerField.setToolTipText(configOption.getAllowedValuesDescription()); - setButton.addActionListener(this); - add(integerField); - add(setButton); - } -} Deleted: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -1,129 +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.gui; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JButton; -import javax.swing.JFileChooser; -import javax.swing.JTextField; - -import org.dllearner.core.Component; -import org.dllearner.core.config.StringConfigOption; -import org.dllearner.kb.OWLFile; - -/** - * Panel for option String, defined in - * {@link org.dllearner.core.config.StringConfigOption}. - * - * @author Jens Lehmann - * @author Tilo Hielscher - * - */ -public class WidgetPanelString extends AbstractWidgetPanel<String> implements ActionListener { - - private static final long serialVersionUID = -2169739820989891226L; - -// private JPanel widgetPanel = new JPanel(); - private JButton setButton; // = new JButton("Set"); - - private String value; - private JTextField stringField; // = new JTextField(35); - - public WidgetPanelString(Config config, Component component, StringConfigOption configOption) { - super(config, component, configOption); - } - - public void actionPerformed(ActionEvent e) { - if (e.getSource() == setButton) { - if (configOption.getName().equals("filename")) { - JFileChooser fc; - if(component instanceof OWLFile) { - fc = new ExampleFileChooser("owl"); - } else { - fc = new ExampleFileChooser("kb"); - } - - int returnVal = fc.showOpenDialog(this); - if (returnVal == JFileChooser.APPROVE_OPTION) { - value = fc.getSelectedFile().toString(); - stringField.setText(value); - } - } - value = stringField.getText(); - fireValueChanged(value); -// setEntry(); - // if url and value not "" - // necessary for init knowledge source - if (configOption.getName().equalsIgnoreCase("url") && !value.equalsIgnoreCase("")) { - } - } - } - - /* - public void setEntry() { - StringConfigOption specialOption; - value = stringField.getText(); // get from input - specialOption = (StringConfigOption) config.getComponentManager().getConfigOption( - componentOption, configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<String> specialEntry = new ConfigEntry<String>(specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set String: " + configOption.getName() + - // " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("String: not valid value"); - }*/ - - @Override - public void buildWidgetPanel() { - add(getLabel()); - - // get current value of this option for the given component - value = config.getConfigOptionValue(component, configOption); - // default values can be null, so we interpret this as empty string - if (value == null) { - value = ""; - } - - // text field for strings - stringField = new JTextField(35); - stringField.setText(value); - stringField.setToolTipText(configOption.getAllowedValuesDescription()); - - // set button (value is only updated when this button is pressed => would better without set) - setButton = new JButton("Set"); - setButton.addActionListener(this); - - add(stringField); - add(setButton); - - // special handling for filename option - if (configOption.getName().equals("filename")) - setButton.setText("choose local file"); - - } - -} Deleted: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -1,283 +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.gui; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Set; - -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; - -import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.config.StringSetConfigOption; -import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.NamedClass; -import org.dllearner.core.owl.ObjectProperty; - -/** - * Panel for option StringSet, defined in - * org.dllearner.core.config.StringSetConfigOption. - * - * There are 2 layouts defined. First for normal option and a second for special - * options. Second layout shows a list of JCheckBox's. - * - * @author Tilo Hielscher - * - */ -public class WidgetPanelStringSet extends AbstractWidgetPanel<Set<String>> implements ActionListener { - - private static final long serialVersionUID = 7832726987046601916L; - - private GridBagLayout gridbag = new GridBagLayout(); - private GridBagConstraints constraints = new GridBagConstraints(); - - private JPanel widgetPanel = new JPanel(); - private JButton addButton = new JButton("add"); - private JButton removeButton = new JButton("remove"); - private JButton clearButton = new JButton("clear"); - private JTextField stringField = new JTextField(30); - - private Set<String> value = new HashSet<String>(); - private JList stringList = new JList(); - private DefaultListModel listModel = new DefaultListModel(); - - private CheckBoxList cBL = new CheckBoxList(this); - - public WidgetPanelStringSet(Config config, Component component, StringSetConfigOption configOption) { - super(config, component, configOption); - } - - public void actionPerformed(ActionEvent e) { - if (!isSpecial()) { - // NORMAL LAYOUT - Set<String> exampleSet = new HashSet<String>(); - // add to list - if (e.getSource() == addButton && !listModel.contains(stringField.getText())) { - listModel.addElement(stringField.getText()); - } - // remove selection - if (e.getSource() == removeButton) { - int[] selectedIndices = stringList.getSelectedIndices(); - int count = 0; - // remove i.e. 2 and 4: after delete 2: 4 is now 3 - for (int i : selectedIndices) - listModel.remove(i - count++); - } - // clear list - if (e.getSource() == clearButton) { - listModel.clear(); - } - // update - // stringList.setModel(listModel); - for (int i = 0; i < listModel.size(); i++) { - if (!listModel.get(i).toString().equalsIgnoreCase("")) - exampleSet.add(listModel.get(i).toString()); - } - // set entry - value = exampleSet; - setEntry(); - } - } - - /** - * Use this, to set entry for layout 2. - */ - public void specialSet() { - if (isSpecial()) { - this.value = cBL.getSelections(); - setEntry(); - } - } - - public void setEntry() { - StringSetConfigOption specialOption; - specialOption = (StringSetConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<Set<String>> specialEntry = new ConfigEntry<Set<String>>(specialOption, - value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set StringSet: " + configOption.getName() - // + " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("StringSet: not valid value"); - - } - - /** - * Define GridBagConstraints - */ - private void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, - int wy) { - gbc.gridx = gx; - gbc.gridy = gy; - gbc.gridwidth = gw; - gbc.gridheight = gh; - gbc.weightx = wx; - gbc.weighty = wy; - } - - /** - * special layout returns true if 2nd layout should used - */ - private boolean isSpecial() { - if (configOption.getName().equalsIgnoreCase("positiveExamples") - || configOption.getName().equalsIgnoreCase("negativeExamples") - || configOption.getName().equalsIgnoreCase("allowedConcepts") - || configOption.getName().equalsIgnoreCase("ignoredConcepts") - || configOption.getName().equalsIgnoreCase("allowedRoles") - || configOption.getName().equalsIgnoreCase("ignoredRoles")) - return true; - else - return false; - } - - @Override - public void buildWidgetPanel() { - gridbag = new GridBagLayout(); - widgetPanel = new JPanel(); - widgetPanel.setLayout(gridbag); - add(widgetPanel, BorderLayout.CENTER); - add(getLabel()); - - value = config.getConfigOptionValue(component, configOption); - - listModel = new DefaultListModel(); - // fill list - if (value != null) { - setEntry(); - for (Iterator<String> iterator = value.iterator(); iterator.hasNext();) { - String item = iterator.next(); - listModel.addElement(item); - } - } - - constraints = new GridBagConstraints(); - cBL = new CheckBoxList(this); - stringList = new JList(); - stringField = new JTextField(30); - addButton = new JButton("add"); - removeButton = new JButton("remove"); - clearButton = new JButton("clear"); - - if (!isSpecial()) { - // NORMAL LAYOUT - // stringField - buildConstraints(constraints, 0, 1, 1, 1, 100, 100); - gridbag.setConstraints(stringField, constraints); - widgetPanel.add(stringField, constraints); - // addButton - buildConstraints(constraints, 1, 1, 1, 1, 100, 100); - gridbag.setConstraints(addButton, constraints); - widgetPanel.add(addButton, constraints); - // list - stringList.setModel(listModel); - stringList.setLayoutOrientation(JList.VERTICAL); - stringList.setVisibleRowCount(-1); - JScrollPane stringListScroller = new JScrollPane(stringList); - stringListScroller.setPreferredSize(new Dimension(380, 100)); - buildConstraints(constraints, 0, 2, 1, 2, 100, 100); - gridbag.setConstraints(stringListScroller, constraints); - widgetPanel.add(stringListScroller, constraints); - // removeButton - buildConstraints(constraints, 1, 2, 1, 1, 100, 100); - gridbag.setConstraints(removeButton, constraints); - widgetPanel.add(removeButton, constraints); - // clearButton - buildConstraints(constraints, 1, 3, 1, 1, 100, 100); - gridbag.setConstraints(clearButton, constraints); - widgetPanel.add(clearButton, constraints); - } else { - System.out.println("SPECIAL OPTION " + configOption.getName()); - - // SPECIAL LAYOUT - // ComboBoxList - buildConstraints(constraints, 0, 1, 1, 1, 100, 100); - gridbag.setConstraints(cBL, constraints); - widgetPanel.add(cBL, constraints); - // DEFINE LIST - // positiveExamples or negativeExamples - if (configOption.getName().equalsIgnoreCase("positiveExamples") - || configOption.getName().equalsIgnoreCase("negativeExamples")) { - // fill lists - Set<Individual> individualsSet = config.getReasoningService() - .getIndividuals(); - LinkedList<Individual> individuals = new LinkedList<Individual>( - individualsSet); - for (Individual ind : individuals) { - System.out.println(ind.getName()); - cBL.add(ind.getName()); - } - } - // allowedConcepts or ignoredConcepts - if (configOption.getName().equalsIgnoreCase("allowedConcepts") - || configOption.getName().equalsIgnoreCase("ignoredConcepts")) { - // fill lists - Set<NamedClass> atomicsSet = config.getReasoningService() - .getNamedClasses(); - LinkedList<NamedClass> atomicConcepts = new LinkedList<NamedClass>( - atomicsSet); - for (NamedClass ind : atomicConcepts) - cBL.add(ind.getName()); - } - // allowedRoles or ignoredRoles - if (configOption.getName().equalsIgnoreCase("allowedRoles") - || configOption.getName().equalsIgnoreCase("ignoredRoles")) { - // fill lists - Set<ObjectProperty> atomicsSet = config.getReasoningService() - .getObjectProperties(); - LinkedList<ObjectProperty> atomicRoles = new LinkedList<ObjectProperty>( - atomicsSet); - for (ObjectProperty ind : atomicRoles) - cBL.add(ind.getName()); - } - // set selections - if (value != null) - cBL.setSelections(value); - } - - stringList.setModel(listModel); - - // ActionListeners - addButton.addActionListener(this); - removeButton.addActionListener(this); - clearButton.addActionListener(this); - - } - -} Deleted: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringTupleList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringTupleList.java 2008-09-09 13:44:25 UTC (rev 1186) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringTupleList.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -1,220 +0,0 @@ -package org.dllearner.gui; - -/** - * 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/>. - * - */ - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; - -import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.config.StringTupleListConfigOption; -import org.dllearner.utilities.datastructures.StringTuple; - -/** - * Panel for option StringTupleList, defined in - * org.dllearner.core.config.StringTupleListConfigOption. - * - * @author Tilo Hielscher - */ -public class WidgetPanelStringTupleList extends AbstractWidgetPanel<List<StringTuple>> implements ActionListener { - - private static final long serialVersionUID = 7832726987046601916L; - - private GridBagLayout gridbag = new GridBagLayout(); - private GridBagConstraints constraints = new GridBagConstraints(); - - private JPanel widgetPanel = new JPanel(); - private JButton addButton = new JButton("add"); - private JButton removeButton = new JButton("remove"); - private JButton clearButton = new JButton("clear"); - private JTextField stringFieldA = new JTextField(10); - private JTextField stringFieldB = new JTextField(10); - private List<StringTuple> exampleList = new LinkedList<StringTuple>(); - - private List<StringTuple> value = new LinkedList<StringTuple>(); - private JList stringList = new JList(); - private DefaultListModel listModel = new DefaultListModel(); - - private JButton setButton = new JButton("set"); - - public WidgetPanelStringTupleList(Config config, Component component, StringTupleListConfigOption configOption) { - super(config, component, configOption); - } - - public void actionPerformed(ActionEvent e) { - // add to list - if (e.getSource() == addButton - && !listModel.contains(stringFieldA.getText() + " --> " + stringFieldB.getText()) - && !stringFieldA.getText().equalsIgnoreCase("") - && !stringFieldB.getText().equalsIgnoreCase("")) { - listModel.addElement(stringFieldA.getText() + " --> " + stringFieldB.getText()); - exampleList.add(new StringTuple(stringFieldA.getText(), stringFieldB.getText())); - } - // remove selection - if (e.getSource() == removeButton) { - int[] selectedIndices = stringList.getSelectedIndices(); - int count = 0; - // remove i.e. 2 and 4: after delete 2: 4 is now 3 - for (int i : selectedIndices) { - listModel.remove(i - count); - exampleList.remove(i - count++); - } - } - // clear list - if (e.getSource() == clearButton) { - listModel.clear(); - exampleList.clear(); - } - // set entry - value = exampleList; - setEntry(); - } - - public void setEntry() { - StringTupleListConfigOption specialOption; - specialOption = (StringTupleListConfigOption) config.getComponentManager().getConfigOption( - component.getClass(), configOption.getName()); - if (specialOption.isValidValue(value)) { - try { - ConfigEntry<List<StringTuple>> specialEntry = new ConfigEntry<List<StringTuple>>( - specialOption, value); - config.getComponentManager().applyConfigEntry(component, specialEntry); - // System.out.println("set StringTupleList: " + - // configOption.getName() + " = " + value); - } catch (InvalidConfigOptionValueException s) { - s.printStackTrace(); - } - } else - System.out.println("StringTupleList: not valid value"); - } - - /** - * Define GridBagConstraints - */ - private void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, int wx, - int wy) { - gbc.gridx = gx; - gbc.gridy = gy; - gbc.gridwidth = gw; - gbc.gridheight = gh; - gbc.weightx = wx; - gbc.weighty = wy; - } - - @Override - public void buildWidgetPanel() { - - gridbag = new GridBagLayout(); - constraints = new GridBagConstraints(); - - widgetPanel = new JPanel(); - addButton = new JButton("add"); - removeButton = new JButton("remove"); - clearButton = new JButton("clear"); - stringFieldA = new JTextField(10); - stringFieldB = new JTextField(10); - exampleList = new LinkedList<StringTuple>(); - - stringList = new JList(); - listModel = new DefaultListModel(); - - setButton = new JButton("set"); - - widgetPanel.setLayout(gridbag); - add(widgetPanel, BorderLayout.CENTER); - add(getLabel()); - - value = config.getConfigOptionValue(component, configOption); - - if (value != null) { - setEntry(); - exampleList = value; - } - - // fill list - if (value != null) { - for (Iterator<StringTuple> iterator = value.iterator(); iterator.hasNext();) { - StringTuple item = iterator.next(); - listModel.addElement(item); - } - } - - // stringFieldA - buildConstraints(constraints, 0, 1, 1, 1, 100, 100); - gridbag.setConstraints(stringFieldA, constraints); - widgetPanel.add(stringFieldA, constraints); - // arrow - JLabel arrowLabel = new JLabel(" --> "); - buildConstraints(constraints, 1, 1, 1, 1, 100, 100); - constraints.anchor = GridBagConstraints.WEST; - gridbag.setConstraints(arrowLabel, constraints); - widgetPanel.add(arrowLabel, constraints); - // stringFieldB - buildConstraints(constraints, 2, 1, 1, 1, 100, 100); - gridbag.setConstraints(stringFieldB, constraints); - widgetPanel.add(stringFieldB, constraints); - // addButton - buildConstraints(constraints, 3, 1, 1, 1, 100, 100); - gridbag.setConstraints(addButton, constraints); - widgetPanel.add(addButton, constraints); - // list - stringList.setModel(listModel); - stringList.setLayoutOrientation(JList.VERTICAL); - stringList.setVisibleRowCount(-1); - JScrollPane stringListScroller = new JScrollPane(stringList); - stringListScroller.setPreferredSize(new Dimension(280, 100)); - buildConstraints(constraints, 0, 2, 3, 2, 100, 100); - gridbag.setConstraints(stringListScroller, constraints); - widgetPanel.add(stringListScroller, constraints); - // removeButton - buildConstraints(constraints, 3, 2, 1, 1, 100, 100); - gridbag.setConstraints(removeButton, constraints); - widgetPanel.add(removeButton, constraints); - // clearButton - buildConstraints(constraints, 3, 3, 1, 1, 100, 100); - gridbag.setConstraints(clearButton, constraints); - widgetPanel.add(clearButton, constraints); - - stringList.setModel(listModel); - // ActionListeners - addButton.addActionListener(this); - removeButton.addActionListener(this); - clearButton.addActionListener(this); - setButton.addActionListener(this); - } - -} Copied: trunk/src/dl-learner/org/dllearner/gui/widgets/AbstractWidgetPanel.java (from rev 1185, trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/AbstractWidgetPanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/AbstractWidgetPanel.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -0,0 +1,86 @@ +/** + * 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.gui.widgets; + +import javax.swing.JLabel; +import javax.swing.JPanel; + +import org.dllearner.core.Component; +import org.dllearner.core.config.ConfigEntry; +import org.dllearner.core.config.ConfigOption; +import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.gui.Config; + +/** + * Abstract superclass of all widgets. Each widget has an associated component and configuration option, + * for which it allows modification by the user. + * + * @author Jens Lehmann + */ +public abstract class AbstractWidgetPanel<T> extends JPanel { + + protected ConfigOption<T> configOption; + protected Config config; + protected Component component; + + /** + * Constructs a widget. + * @param config The status of all components and options (which may be updated by this widget). + * @param component The component potentially changed by this widget. + * @param optionOption The config option of the specified component, which is potentially changed by this widget. + */ + public AbstractWidgetPanel(Config config, Component component, ConfigOption<T> optionOption) { + this.config = config; + this.component = component; + this.configOption = optionOption; + + if(configOption == null || component == null || config == null) { + System.out.println("| " + component + ", " + configOption + ", " + config + " |"); + throw new Error("Parameters must not be null."); + } + + buildWidgetPanel(); + } + + // convenience method + protected JLabel getLabel() { + JLabel nameLabel = new JLabel(configOption.getName()); + nameLabel.setToolTipText(configOption.getDescription()); + return nameLabel; + } + + // subclasses should call this method if a configuration option has changed + public void fireValueChanged(T value) { + ConfigEntry<T> entry = null; + try { + entry = new ConfigEntry<T>(configOption, value); + } catch (InvalidConfigOptionValueException e) { + // TODO display a message on the status bar (where the init + // has been before) + e.printStackTrace(); + } + // notify config that a value has changed -> it decides what to do + config.applyConfigEntry(component, entry); + } + + // subclasses should use this method to build the graphical representation of the widgets + public abstract void buildWidgetPanel(); + +} Copied: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java (from rev 1185, trunk/src/dl-learner/org/dllearner/gui/WidgetPanelBoolean.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelBoolean.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -0,0 +1,115 @@ +/** + * 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.gui.widgets; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JComboBox; + +import org.dllearner.core.Component; +import org.dllearner.core.config.BooleanConfigOption; +import org.dllearner.core.config.ConfigEntry; +import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.gui.Config; + +/** + * Panel for option Boolean, defined in + * org.dllearner.core.config.BooleanConfigOption. + * + * @author Jens Lehmann + * @author Tilo Hielscher + */ +public class WidgetPanelBoolean extends AbstractWidgetPanel<Boolean> implements ActionListener { + + private static final long serialVersionUID = -4800583253223939928L; + + private Boolean value; +// private String[] kbBoxItems; // = { "false", "true" }; + private JComboBox cb; // = new JComboBox(kbBoxItems); + + public WidgetPanelBoolean(Config config, Component component, BooleanConfigOption configOption) { + super(config, component, configOption); + } + + public void actionPerformed(ActionEvent e) { + if (cb.getSelectedIndex() == 0) + value = false; + else + value = true; + + BooleanConfigOption specialOption; + specialOption = (BooleanConfigOption) config.getComponentManager().getConfigOption( + component.getClass(), configOption.getName()); + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<Boolean> specialEntry = new ConfigEntry<Boolean>(specialOption, value); + config.getComponentManager().applyConfigEntry(component, specialEntry); + // System.out.println("set Boolean: " + configOption.getName() + + // " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("Boolean: not valid value"); + } + + public void setEntry() { + BooleanConfigOption specialOption; + specialOption = (BooleanConfigOption) config.getComponentManager().getConfigOption( + component.getClass(), configOption.getName()); + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<Boolean> specialEntry = new ConfigEntry<Boolean>(specialOption, value); + config.getComponentManager().applyConfigEntry(component, specialEntry); + // System.out.println("set Boolean: " + configOption.getName() + + // " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("Boolean: not valid value"); + } + + @Override + public void buildWidgetPanel() { + add(getLabel()); + + value = config.getConfigOptionValue(component, configOption); + + if (value == null) + value = false; + else + setEntry(); + + // set cb-index + String[] kbBoxItems = { "false", "true" }; + cb = new JComboBox(kbBoxItems); + if (!value) + cb.setSelectedIndex(0); + else + cb.setSelectedIndex(1); + + cb.addActionListener(this); + add(cb); + + } + +} Copied: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDefault.java (from rev 1185, trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDefault.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDefault.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDefault.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -0,0 +1,52 @@ +/** + * 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.gui.widgets; + +import java.awt.Color; + +import javax.swing.JLabel; + +import org.dllearner.core.Component; +import org.dllearner.core.config.ConfigOption; +import org.dllearner.gui.Config; + +/** + * Panel for not defined options. + * + * @author Tilo Hielscher + * + */ +public class WidgetPanelDefault extends AbstractWidgetPanel<Object> { + + private static final long serialVersionUID = 4059515858894036769L; + + public WidgetPanelDefault(Config config, Component component, ConfigOption<Object> configOption) { + super(config, component, configOption); + } + + @Override + public void buildWidgetPanel() { + JLabel notImplementedLabel = new JLabel(configOption.getClass().getSimpleName() + + " not implemented"); + notImplementedLabel.setForeground(Color.RED); + add(notImplementedLabel); + } + +} Copied: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDouble.java (from rev 1185, trunk/src/dl-learner/org/dllearner/gui/WidgetPanelDouble.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDouble.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelDouble.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -0,0 +1,103 @@ +package org.dllearner.gui.widgets; + +/** + * 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/>. + * + */ + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JTextField; + +import org.dllearner.core.Component; +import org.dllearner.core.config.ConfigEntry; +import org.dllearner.core.config.DoubleConfigOption; +import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.gui.Config; + +/** + * Panel for option Double, defined in + * {@link org.dllearner.core.config.DoubleConfigOption}. + * + * @author Tilo Hielscher + * + */ +public class WidgetPanelDouble extends AbstractWidgetPanel<Double> implements ActionListener { + + private static final long serialVersionUID = 5238903690721116289L; + + private JButton setButton = new JButton("Set"); + +// private Class<? extends Component> componentOption; + + private Double value; + private JTextField doubleField = new JTextField(5); + + public WidgetPanelDouble(Config config, Component component, DoubleConfigOption configOption) { + super(config, component, configOption); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == setButton) { + setEntry(); + } + } + + public void setEntry() { + DoubleConfigOption specialOption; + value = Double.parseDouble(doubleField.getText()); // get from input + specialOption = (DoubleConfigOption) config.getComponentManager().getConfigOption( + component.getClass(), configOption.getName()); + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<Double> specialEntry = new ConfigEntry<Double>(specialOption, value); + config.getComponentManager().applyConfigEntry(component, specialEntry); + // System.out.println("set Double: " + configOption.getName() + + // " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("Double: not valid value"); + } + + @Override + public void buildWidgetPanel() { + add(getLabel()); + + value = config.getConfigOptionValue(component, configOption); + + setButton = new JButton("Set"); + doubleField = new JTextField(5); + if (value == null) + value = 0.0; + else { + doubleField.setText(value.toString()); + setEntry(); + } + + doubleField.setText(value.toString()); + doubleField.setToolTipText(configOption.getAllowedValuesDescription()); + setButton.addActionListener(this); + add(doubleField); + add(setButton); + + } +} Copied: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelInteger.java (from rev 1185, trunk/src/dl-learner/org/dllearner/gui/WidgetPanelInteger.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelInteger.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelInteger.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -0,0 +1,100 @@ +package org.dllearner.gui.widgets; + +/** + * 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/>. + * + */ + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JTextField; + +import org.dllearner.core.Component; +import org.dllearner.core.config.ConfigEntry; +import org.dllearner.core.config.IntegerConfigOption; +import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.gui.Config; + +/** + * Panel for option Integer, defined in + * org.dllearner.core.config.IntegerConfigOption. + * + * @author Tilo Hielscher + * + */ +public class WidgetPanelInteger extends AbstractWidgetPanel<Integer> implements ActionListener { + + private static final long serialVersionUID = -1802111225835164644L; + + private JButton setButton = new JButton("Set"); + + private Integer value; + private JTextField integerField = new JTextField(3); + + public WidgetPanelInteger(Config config, Component component, IntegerConfigOption configOption) { + super(config, component, configOption); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == setButton) { + setEntry(); + } + } + + public void setEntry() { + IntegerConfigOption specialOption; + value = Integer.parseInt(integerField.getText()); // get from input + specialOption = (IntegerConfigOption) config.getComponentManager().getConfigOption( + component.getClass(), configOption.getName()); + if (specialOption.isValidValue(value)) { + try { + ConfigEntry<Integer> specialEntry = new ConfigEntry<Integer>(specialOption, value); + config.getComponentManager().applyConfigEntry(component, specialEntry); + // System.out.println("set Integer: " + configOption.getName() + + // " = " + value); + } catch (InvalidConfigOptionValueException s) { + s.printStackTrace(); + } + } else + System.out.println("Integer: not valid value"); + } + + @Override + public void buildWidgetPanel() { + add(getLabel()); + + value = config.getConfigOptionValue(component, configOption); + + setButton = new JButton("Set"); + integerField = new JTextField(3); + if (value == null) + value = 0; + else { + integerField.setText(value.toString()); + setEntry(); + } + + integerField.setText(value.toString()); + integerField.setToolTipText(configOption.getAllowedValuesDescription()); + setButton.addActionListener(this); + add(integerField); + add(setButton); + } +} Copied: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java (from rev 1186, trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelString.java 2008-09-09 13:48:15 UTC (rev 1187) @@ -0,0 +1,131 @@ +/** + * 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.gui.widgets; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JTextField; + +import org.dllearner.core.Component; +import org.dllearner.core.config.StringConfigOption; +import org.dllearner.gui.Config; +import org.dllearner.gui.ExampleFileChooser; +import org.dllearner.kb.OWLFile; + +/** + * Panel for option String, defined in + * {@link org.dllearner.core.config.StringConfigOption}. + * + * @author Jens Lehmann + * @author Tilo Hielscher + * + */ +public class WidgetPanelString extends AbstractWidgetPanel<String> implements ActionListener { + + private static ... [truncated message content] |
From: <Jen...@us...> - 2008-09-09 13:44:33
|
Revision: 1186 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1186&view=rev Author: JensLehmann Date: 2008-09-09 13:44:25 +0000 (Tue, 09 Sep 2008) Log Message: ----------- GUI update: - improved file chooser - tabs enable/disable appropriately - status panel for messages - cleanup Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/gui/ExampleFileChooser.java trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java Modified: trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/AboutWindow.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -1,3 +1,22 @@ +/** + * 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.gui; import java.net.URL; Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -24,11 +24,11 @@ import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; -import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.ReasonerComponent; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; @@ -58,6 +58,10 @@ // have changed configuration options, which require initialisation) private boolean[] needsInit = new boolean[4]; + // specifies whether the panel is enabled, i.e. the user + // can select it (all mandatory variables in selected components have been choosen) + private boolean[] isEnabled = new boolean[4]; + // learning algorithm status private boolean threadIsRunning = false; private Long algorithmRunStartTime = null; @@ -70,6 +74,8 @@ // none of the components is initialised for(int i=0; i<4; i++) { needsInit[i] = true; + // TODO there might be knowledge source without mandatory options + isEnabled[i] = false; } } @@ -282,6 +288,14 @@ return needsInit[3]; } + public boolean needsInit(int tabIndex) { + return needsInit[tabIndex]; + } + + public boolean isEnabled(int tabIndex) { + return isEnabled[tabIndex]; + } + /** * set true if you run LearningAlgorithm.init */ @@ -386,6 +400,9 @@ needsInit[1] = true; needsInit[2] = true; needsInit[3] = true; + if(mandatoryOptionsSpecified(component)) { + isEnabled[1] = true; + } } else if(component instanceof ReasonerComponent) { needsInit[1] = true; needsInit[2] = true; @@ -399,6 +416,10 @@ gui.updateTabColors(); } + private boolean mandatoryOptionsSpecified(Component component) { + return false; + } + // delegate method for getting config option values public <T> T getConfigOptionValue(Component component, ConfigOption<T> option) { return cm.getConfigOptionValue(component, option); Added: trunk/src/dl-learner/org/dllearner/gui/ExampleFileChooser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ExampleFileChooser.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/ExampleFileChooser.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -0,0 +1,58 @@ +/** + * 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.gui; + +import java.io.File; + +import javax.swing.JFileChooser; +import javax.swing.filechooser.FileFilter; + +/** + * Convenience class for choosing files from the example directory with a specific file ending. + * + * @author Jens Lehmann + * + */ +public class ExampleFileChooser extends JFileChooser { + + private static final long serialVersionUID = 1566010391199697892L; + + public ExampleFileChooser(final String fileEnding) { + super(new File("examples/")); + + FileFilter filter = new FileFilter() { + @Override + public boolean accept(File f) { + if (f.isDirectory()) + return true; + return f.getName().toLowerCase().endsWith("." + fileEnding); + } + + @Override + public String getDescription() { + return fileEnding + " files"; // name for filter + } + }; + + addChoosableFileFilter(filter); + setFileFilter(filter); + } + +} Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -20,7 +20,6 @@ package org.dllearner.gui; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; @@ -29,14 +28,16 @@ import javax.swing.JComboBox; import javax.swing.JPanel; -import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; +import org.dllearner.kb.OWLAPIOntology; +import org.dllearner.kb.OWLFile; /** - * KnowledgeSourcePanel, tab 0. Choose Source, change Options and final initiate - * KnowledgeSource. + * Knowledge source panel, tab 0. Choose source, change mandatory options and finally initialise + * knowledge source. * + * @author Jens Lehmann * @author Tilo Hielscher */ public class KnowledgeSourcePanel extends JPanel implements ActionListener { @@ -44,14 +45,14 @@ private static final long serialVersionUID = -7678275020058043937L; private Config config; - private StartGUI startGUI; - private JButton initButton; +// private StartGUI startGUI; +// private JButton initButton; private JButton setButton; private JButton clearButton; private String[] kbBoxItems = {}; private JComboBox cb = new JComboBox(kbBoxItems); private JPanel choosePanel = new JPanel(); - private JPanel initPanel = new JPanel(); +// private JPanel initPanel = new JPanel(); private int choosenClassIndex; private List<Class<? extends KnowledgeSource>> selectableSources; private OptionPanel optionPanel; @@ -60,16 +61,21 @@ super(new BorderLayout()); this.config = config; - this.startGUI = startGUI; +// this.startGUI = startGUI; selectableSources = config.getComponentManager().getKnowledgeSources(); + // to set a default source, we move it to the beginning of the list + selectableSources.remove(OWLFile.class); + selectableSources.add(0, OWLFile.class); + // OWL API ontology is only useful programmatically (not in the GUI itself) + selectableSources.remove(OWLAPIOntology.class); setButton = new JButton("Set"); setButton.addActionListener(this); setButton = new JButton("Clear All"); setButton.addActionListener(this); - initButton = new JButton("Init KnowledgeSource"); - initButton.addActionListener(this); - initButton.setEnabled(true); +// initButton = new JButton("Init KnowledgeSource"); +// initButton.addActionListener(this); +// initButton.setEnabled(true); // add to comboBox for (int i = 0; i < selectableSources.size(); i++) { @@ -90,10 +96,12 @@ add(choosePanel, BorderLayout.PAGE_START); add(optionPanel, BorderLayout.CENTER); - add(initPanel, BorderLayout.PAGE_END); +// add(initPanel, BorderLayout.PAGE_END); - setSource(); - updateAll(); + choosenClassIndex = cb.getSelectedIndex(); + +// setSource(); +// updateAll(); } public void actionPerformed(ActionEvent e) { @@ -101,7 +109,10 @@ choosenClassIndex = cb.getSelectedIndex(); // create a new knowledge source component config.newKnowledgeSource(selectableSources.get(choosenClassIndex)); - updateAll(); +// updateAll(); + updateOptionPanel(); + + System.out.println("update"); // config.setInitKnowledgeSource(false); // init(); } @@ -110,9 +121,9 @@ setSource(); } - if (e.getSource() == initButton) { - init(); - } +// if (e.getSource() == initButton) { +// init(); +// } if (e.getSource() == clearButton) { config.reInit(); @@ -132,6 +143,7 @@ /** * after this, next tab can be used */ + /* public void init() { setSource(); if (config.getKnowledgeSource() != null && config.isSetURL()) { @@ -145,19 +157,21 @@ } } } + */ /** * updateAll */ public void updateAll() { - updateComboBox(); +// updateComboBox(); updateOptionPanel(); - updateInitButtonColor(); +// updateInitButtonColor(); } /** * set ComboBox to selected class */ + /* public void updateComboBox() { if (config.getKnowledgeSource() != null) for (int i = 0; i < selectableSources.size(); i++) @@ -166,7 +180,7 @@ cb.setSelectedIndex(i); } this.choosenClassIndex = cb.getSelectedIndex(); - } + }*/ /** * update OptionPanel with new selection @@ -178,11 +192,13 @@ /** * make init-button red if you have to click */ + /* public void updateInitButtonColor() { if (!config.needsInitKnowledgeSource()) { initButton.setForeground(Color.RED); } else initButton.setForeground(Color.BLACK); } + */ } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -31,7 +31,6 @@ import org.dllearner.algorithms.DBpediaNavigationSuggestor; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; -import org.dllearner.core.ComponentInitException; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblemUnsupportedException; @@ -46,8 +45,8 @@ private static final long serialVersionUID = 8721490771860452959L; private Config config; - private StartGUI startGUI; - private List<Class<? extends LearningAlgorithm>> learner; +// private StartGUI startGUI; + private List<Class<? extends LearningAlgorithm>> selectableAlgorithms; private JPanel choosePanel = new JPanel(); private OptionPanel optionPanel; private JPanel initPanel = new JPanel(); @@ -60,14 +59,14 @@ super(new BorderLayout()); this.config = config; - this.startGUI = startGUI; - learner = config.getComponentManager().getLearningAlgorithms(); +// this.startGUI = startGUI; + selectableAlgorithms = config.getComponentManager().getLearningAlgorithms(); // to set a default learning algorithm, we move it to the beginning of the list - learner.remove(ExampleBasedROLComponent.class); - learner.add(0, ExampleBasedROLComponent.class); + selectableAlgorithms.remove(ExampleBasedROLComponent.class); + selectableAlgorithms.add(0, ExampleBasedROLComponent.class); // we also remove the DBpedia Navigation Suggestor (maybe shouldn't be declared as a learning algorithm at all; // at least it is not doing anything useful at the moment) - learner.remove(DBpediaNavigationSuggestor.class); + selectableAlgorithms.remove(DBpediaNavigationSuggestor.class); initButton = new JButton("Init LearingAlgorithm"); initButton.addActionListener(this); @@ -77,8 +76,8 @@ autoInitButton.addActionListener(this); // add into comboBox - for (int i = 0; i < learner.size(); i++) { - cb.addItem(config.getComponentManager().getComponentName(learner.get(i))); + for (int i = 0; i < selectableAlgorithms.size(); i++) { + cb.addItem(config.getComponentManager().getComponentName(selectableAlgorithms.get(i))); } choosePanel.add(cb); @@ -87,9 +86,9 @@ LearningAlgorithm la = null; try { - la = config.newLearningAlgorithm(learner.get(cb.getSelectedIndex())); + la = config.newLearningAlgorithm(selectableAlgorithms.get(cb.getSelectedIndex())); } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block + // TODO display message (or avoid selection at all) e.printStackTrace(); } optionPanel = new OptionPanel(config, la); @@ -99,7 +98,7 @@ add(initPanel, BorderLayout.PAGE_END); choosenClassIndex = cb.getSelectedIndex(); - updateInitButtonColor(); +// updateInitButtonColor(); } public void actionPerformed(ActionEvent e) { @@ -124,7 +123,7 @@ if (config.getLearningProblem() != null && config.getReasoningService() != null) { try { config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm( - learner.get(choosenClassIndex), config.getLearningProblem(), + selectableAlgorithms.get(choosenClassIndex), config.getLearningProblem(), config.getReasoningService())); updateOptionPanel(); } catch (LearningProblemUnsupportedException e) { @@ -165,7 +164,7 @@ */ public void updateComboBox() { if (config.getLearningAlgorithm() != null) - for (int i = 0; i < learner.size(); i++) + for (int i = 0; i < selectableAlgorithms.size(); i++) if (config.getLearningAlgorithm().getClass().equals( config.getComponentManager().getLearningAlgorithms().get(i))) { cb.setSelectedIndex(i); Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -21,7 +21,6 @@ */ import java.awt.BorderLayout; -import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; @@ -50,7 +49,7 @@ private JPanel choosePanel = new JPanel(); private OptionPanel optionPanel; private JPanel initPanel = new JPanel(); - private JButton initButton, setButton; + private JButton setButton; private int choosenClassIndex; LearningProblemPanel(final Config config, StartGUI startGUI) { Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -30,7 +30,6 @@ import javax.swing.JComboBox; import javax.swing.JPanel; -import org.dllearner.core.ComponentInitException; import org.dllearner.core.ReasonerComponent; import org.dllearner.reasoning.OWLAPIReasoner; @@ -45,7 +44,7 @@ private static final long serialVersionUID = -7678275020058043937L; private Config config; - private StartGUI startGUI; +// private StartGUI startGUI; private List<Class<? extends ReasonerComponent>> reasoner; private JPanel choosePanel = new JPanel(); private JPanel initPanel = new JPanel(); @@ -59,7 +58,7 @@ super(new BorderLayout()); this.config = config; - this.startGUI = startGUI; +// this.startGUI = startGUI; reasoner = config.getComponentManager().getReasonerComponents(); // to set a default reasoner, we move it to the beginning of the list reasoner.remove(OWLAPIReasoner.class); Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -19,25 +19,32 @@ */ package org.dllearner.gui; -import javax.swing.*; -import javax.swing.event.*; - +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.File; +import java.io.FileWriter; +import java.io.PrintWriter; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JTabbedPane; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.filechooser.FileFilter; + import org.apache.log4j.ConsoleAppender; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; -import org.dllearner.core.ComponentInitException; -import java.io.File; -import java.io.PrintWriter; -import java.io.FileWriter; -import javax.swing.filechooser.FileFilter; - /** * This class builds the basic GUI elements and is used to start the DL-Learner * GUI. @@ -71,6 +78,8 @@ private JMenuItem aboutItem = new JMenuItem("About"); private JMenuItem tutorialItem = new JMenuItem("Quick Tutorial"); + private StatusPanel statusPanel = new StatusPanel(); + public StartGUI() { this(null); } @@ -111,7 +120,8 @@ menuHelp.add(aboutItem); aboutItem.addActionListener(this); - add(tabPane); + add(tabPane, BorderLayout.CENTER); + add(statusPanel, BorderLayout.SOUTH); setVisible(true); updateTabColors(); @@ -177,8 +187,9 @@ // force platform look and feel try { UIManager.setLookAndFeel( - // "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); - UIManager.getSystemLookAndFeelClassName()); + UIManager.getCrossPlatformLookAndFeelClassName()); +// "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); +// UIManager.getSystemLookAndFeelClassName()); // TODO: currently everything is in bold on Linux (and Win?) } catch (ClassNotFoundException e) { e.printStackTrace(); @@ -197,21 +208,7 @@ // open config file if (e.getSource() == openItem) { // file dialog - JFileChooser fc = new JFileChooser(new File("examples/")); - // FileFilter only *.conf - fc.addChoosableFileFilter(new FileFilter() { - @Override - public boolean accept(File f) { - if (f.isDirectory()) - return true; - return f.getName().toLowerCase().endsWith(".conf"); - } - - @Override - public String getDescription() { - return "*.conf"; // name for filter - } - }); + JFileChooser fc = new ExampleFileChooser("conf"); if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { System.out.println("FILE: " + fc.getSelectedFile()); configLoad.openFile(fc.getSelectedFile()); @@ -264,25 +261,41 @@ * Update colors of tabulators; red should be clicked, black for OK. */ public void updateTabColors() { - if (config.needsInitKnowledgeSource()) - tabPane.setForegroundAt(0, Color.RED); - else - tabPane.setForegroundAt(0, Color.BLACK); - if (config.needsInitReasoner()) - tabPane.setForegroundAt(1, Color.RED); - else - tabPane.setForegroundAt(1, Color.BLACK); - if (config.needsInitLearningProblem()) - tabPane.setForegroundAt(2, Color.RED); - else - tabPane.setForegroundAt(2, Color.BLACK); - if (config.needsInitLearningAlgorithm()) { - tabPane.setForegroundAt(3, Color.RED); - tabPane.setForegroundAt(4, Color.RED); - } else { - tabPane.setForegroundAt(3, Color.BLACK); - tabPane.setForegroundAt(4, Color.BLACK); + for(int i=0; i<4; i++) { + // red = needs init, black = initialised + if(config.needsInit(i)) { + tabPane.setForegroundAt(i, Color.RED); + } else { + tabPane.setForegroundAt(i, Color.BLACK); + } + + // only enable tabs, which can be selected + // (note the i+1: knowledge source always enabled) + tabPane.setEnabledAt(i+1, config.isEnabled(i)); } + + // run panel is enabled if all mandatory algorithm parameters have been set +// tabPane.setEnabledAt(4, config.isEnabled(4)); + +// if (config.needsInitKnowledgeSource()) +// tabPane.setForegroundAt(0, Color.RED); +// else +// tabPane.setForegroundAt(0, Color.BLACK); +// if (config.needsInitReasoner()) +// tabPane.setForegroundAt(1, Color.RED); +// else +// tabPane.setForegroundAt(1, Color.BLACK); +// if (config.needsInitLearningProblem()) +// tabPane.setForegroundAt(2, Color.RED); +// else +// tabPane.setForegroundAt(2, Color.BLACK); +// if (config.needsInitLearningAlgorithm()) { +// tabPane.setForegroundAt(3, Color.RED); +// tabPane.setForegroundAt(4, Color.RED); +// } else { +// tabPane.setForegroundAt(3, Color.BLACK); +// tabPane.setForegroundAt(4, Color.BLACK); +// } // commented out as I do not see any reason why the method should update // everything @@ -294,4 +307,8 @@ // tab3.updateAll(); } + + public void setStatusMessage(String message) { + statusPanel.setStatus(message); + } } Added: trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/StatusPanel.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -0,0 +1,48 @@ +/** + * 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.gui; + +import javax.swing.JLabel; +import javax.swing.JPanel; + +/** + * Status panel showing help messages, exceptions etc. + * + * @author Jens Lehmann + * + */ +public class StatusPanel extends JPanel { + + private static final long serialVersionUID = 2426470148153461670L; + + private String initText = "Please fill in the mandatory config options and proceed to the next tab."; + + private JLabel statusLabel = new JLabel(initText); + + public StatusPanel() { + super(); + add(statusLabel); + } + + public void setStatus(String message) { + statusLabel.setText(message); + } + +} Modified: trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/TutorialWindow.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -19,6 +19,8 @@ */ package org.dllearner.gui; +import java.awt.Dimension; + import javax.swing.JFrame; import javax.swing.JLabel; @@ -36,7 +38,7 @@ setTitle("Quick Tutorial"); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); setLocationByPlatform(true); - setSize(300, 500); + setSize(300, 600); // display tutorial text String text = "<html><h2>Quick Tutorial</h2><p align=\"justify\">DL-Learner has a component" + @@ -50,12 +52,20 @@ "you have to choose and configure all four types of components." + " The run tab plays a special role: It is used to start the learning algorithm" + " and display statistical information.</p>" + + "<br /><p><i>Tab color explanation:</i> <br />gray = cannot be configured yet (mandatory configuration values missing)<br />" + + "red = needs to be initialised<br />black = component has been initialised</p>" + "<br /><p><i>Further references:</i><br />" + "Homepage: <a href=\"http://dl-learner.org\">http://dl-learner.org</a><br />" + "DL-Learner Architecture: <a href=\"http://dl-learner.org/wiki/Architecture\">http://dl-learner.org/wiki/Architecture</a>" + "</p><br /><p>Please send questions to le...@in....</p></html>"; JLabel label = new JLabel(text); + label.setMaximumSize(new Dimension(300,500)); add(label); +// JScrollPane scrollPane = new JScrollPane(label); +// scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); +// scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); +// scrollPane.setPreferredSize(new Dimension(300,500)); +// add(scrollPane); setVisible(true); } Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -21,7 +21,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.File; import javax.swing.JButton; import javax.swing.JFileChooser; @@ -29,6 +28,7 @@ import org.dllearner.core.Component; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.kb.OWLFile; /** * Panel for option String, defined in @@ -54,9 +54,14 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == setButton) { - if (checkForFilename()) { - // file dialog - JFileChooser fc = new JFileChooser(new File("examples/")); + if (configOption.getName().equals("filename")) { + JFileChooser fc; + if(component instanceof OWLFile) { + fc = new ExampleFileChooser("owl"); + } else { + fc = new ExampleFileChooser("kb"); + } + int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { value = fc.getSelectedFile().toString(); @@ -92,14 +97,6 @@ System.out.println("String: not valid value"); }*/ - /** - * Widget filename getName() == filename you should open a file dialog in - * ActionPerformed - */ - private Boolean checkForFilename() { - return configOption.getName().equalsIgnoreCase("filename"); - } - @Override public void buildWidgetPanel() { add(getLabel()); @@ -123,7 +120,8 @@ add(stringField); add(setButton); - if (checkForFilename()) + // special handling for filename option + if (configOption.getName().equals("filename")) setButton.setText("choose local file"); } Modified: trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2008-09-09 13:40:43 UTC (rev 1185) +++ trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2008-09-09 13:44:25 UTC (rev 1186) @@ -21,12 +21,20 @@ private OWLOntology ontology; + public OWLAPIOntology() { + this(null); + } + public OWLAPIOntology(OWLOntology onto) { this.ontology = onto; this.configurator = new OWLAPIOntologyConfigurator(this); } + public static String getName() { + return "OWL API Ontology"; + } + @Override public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-09 13:40:55
|
Revision: 1185 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1185&view=rev Author: kurzum Date: 2008-09-09 13:40:43 +0000 (Tue, 09 Sep 2008) Log Message: ----------- included for all components Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/core/Component.java trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java trunk/src/dl-learner/org/dllearner/kb/OWLFile.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyInclusionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/RoleLearning.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java trunk/src/dl-learner/org/dllearner/scripts/NewSample.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java trunk/src/dl-learner/org/dllearner/core/configurators/RoleLearningConfigurator.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/algorithms/BruteForceLearner.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -36,6 +36,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.configurators.BruteForceLearnerConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.NamedClass; @@ -57,6 +58,13 @@ * */ public class BruteForceLearner extends LearningAlgorithm { + + private BruteForceLearnerConfigurator configurator; + @Override + public BruteForceLearnerConfigurator getConfigurator(){ + return configurator; + } + private LearningProblem learningProblem; private ReasoningService rs; @@ -77,6 +85,7 @@ public BruteForceLearner(LearningProblem learningProblem, ReasoningService rs) { this.learningProblem = learningProblem; this.rs = rs; + this.configurator = new BruteForceLearnerConfigurator(this); } public static String getName() { Modified: trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/algorithms/DBpediaNavigationSuggestor.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -36,6 +36,8 @@ import org.dllearner.core.config.DoubleConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.configurators.ComponentFactory; +import org.dllearner.core.configurators.DBpediaNavigationSuggestorConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegLP; @@ -53,19 +55,34 @@ */ public class DBpediaNavigationSuggestor extends LearningAlgorithm { + private DBpediaNavigationSuggestorConfigurator configurator; + @Override + public DBpediaNavigationSuggestorConfigurator getConfigurator(){ + return configurator; + } + + // private ReasoningService rs; private ExampleBasedROLComponent learner; private static String defaultSearchTreeFile = "log/searchTree.txt"; public DBpediaNavigationSuggestor(LearningProblem learningProblem, ReasoningService rs) { // this.rs=rs; + this.configurator = new DBpediaNavigationSuggestorConfigurator(this); + try{ if(learningProblem instanceof PosNegLP) { PosNegLP lp = (PosNegLP) learningProblem; - this.learner=new ExampleBasedROLComponent(lp, rs); + this.learner = ComponentFactory.getExampleBasedROLComponent(lp, rs); + //this.learner=new ExampleBasedROLComponent(lp, rs); } else if(learningProblem instanceof PosOnlyDefinitionLP) { PosOnlyDefinitionLP lp = (PosOnlyDefinitionLP) learningProblem; - this.learner=new ExampleBasedROLComponent(lp, rs); + this.learner = ComponentFactory.getExampleBasedROLComponent(lp, rs); + //this.learner=new ExampleBasedROLComponent(lp, rs); } + }catch (Exception e) { + System.out.println("this error should never occur"+this.getClass().getCanonicalName()); + e.printStackTrace(); + } } public static Collection<Class<? extends LearningProblem>> supportedLearningProblems() { Modified: trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/algorithms/RandomGuesser.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -34,10 +34,17 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.configurators.RandomGuesserConfigurator; import org.dllearner.core.owl.Description; public class RandomGuesser extends LearningAlgorithm { + private RandomGuesserConfigurator configurator; + @Override + public RandomGuesserConfigurator getConfigurator(){ + return configurator; + } + private Description bestDefinition = null; private Score bestScore; private double bestFitness = Double.NEGATIVE_INFINITY; @@ -51,6 +58,7 @@ public RandomGuesser(LearningProblem learningProblem, ReasoningService rs) { this.learningProblem = learningProblem; this.rs = rs; + this.configurator = new RandomGuesserConfigurator(this); } public static String getName() { Modified: trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/algorithms/SimpleSuggestionLearningAlgorithm.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -19,15 +19,21 @@ */ package org.dllearner.algorithms; -import java.util.*; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.ReasoningService; +import org.dllearner.core.Score; +import org.dllearner.core.config.ConfigEntry; +import org.dllearner.core.configurators.SimpleSuggestionLearningAlgorithmConfigurator; import org.dllearner.core.owl.Description; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.Score; -import org.dllearner.core.owl.*; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.Thing; /** * TODO: Javadoc @@ -37,7 +43,13 @@ * */ public class SimpleSuggestionLearningAlgorithm extends LearningAlgorithm implements Runnable { - + + private SimpleSuggestionLearningAlgorithmConfigurator configurator; + @Override + public SimpleSuggestionLearningAlgorithmConfigurator getConfigurator(){ + return configurator; + } + // private boolean stop = false; private Score solutionScore; private Description bestSollution; @@ -45,6 +57,7 @@ public SimpleSuggestionLearningAlgorithm() { // this.learningProblem = learningProblem; + this.configurator = new SimpleSuggestionLearningAlgorithmConfigurator(this); } @Override Modified: trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/algorithms/gp/GP.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -42,6 +42,7 @@ import org.dllearner.core.config.IntegerConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.configurators.GPConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Thing; import org.dllearner.learningproblems.PosNegLP; @@ -56,6 +57,13 @@ */ public class GP extends LearningAlgorithm { + private GPConfigurator configurator; + @Override + public GPConfigurator getConfigurator(){ + return configurator; + } + + // NumberFormat f; DecimalFormat df = new DecimalFormat("0.00"); @@ -140,6 +148,7 @@ public GP(PosNegLP learningProblem, ReasoningService rs) { this.learningProblem = learningProblem; this.rs = rs; + this.configurator = new GPConfigurator(this); } public static String getName() { Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -82,6 +82,12 @@ */ public class ExampleBasedROLComponent extends LearningAlgorithm { + private ExampleBasedROLComponentConfigurator configurator; + @Override + public ExampleBasedROLComponentConfigurator getConfigurator(){ + return configurator; + } + // actual algorithm private ExampleBasedROLearner algorithm; private static Logger logger = Logger @@ -91,14 +97,7 @@ // learning problem to solve and background knowledge private ReasoningService rs; private LearningProblem learningProblem; - - private ExampleBasedROLComponentConfigurator configurator; - public ExampleBasedROLComponentConfigurator getConfigurator(){ - return configurator; - } - - - + // configuration options private boolean writeSearchTree; private File searchTreeFile; Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -27,6 +27,7 @@ import org.dllearner.core.config.DoubleConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.configurators.ROLearnerConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.NamedClass; @@ -44,6 +45,12 @@ public class ROLearner extends LearningAlgorithm { + private ROLearnerConfigurator configurator; + @Override + public ROLearnerConfigurator getConfigurator(){ + return configurator; + } + private static Logger logger = Logger .getLogger(LearningAlgorithm.class); @@ -194,13 +201,16 @@ public ROLearner(PosNegLP learningProblem, ReasoningService rs) { this.learningProblem = learningProblem; this.rs = rs; + this.configurator = new ROLearnerConfigurator(this); posOnly=false; baseURI = rs.getBaseURI(); + } public ROLearner(PosOnlyDefinitionLP learningProblem, ReasoningService rs) { this.posOnlyLearningProblem = learningProblem; this.rs = rs; + this.configurator = new ROLearnerConfigurator(this); posOnly=true; baseURI = rs.getBaseURI(); } Modified: trunk/src/dl-learner/org/dllearner/core/Component.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/Component.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/Component.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -26,6 +26,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.DoubleConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.configurators.Configurator; /** * Base class of all components. See also http://dl-learner.org/wiki/Architecture. @@ -35,12 +36,14 @@ */ public abstract class Component { -//protected Configurator configurator; +protected Configurator configurator; - //public Configurator<? extends Configurator> getConfigurator(){ + public abstract Configurator getConfigurator(); //return configurator; //} + + /** * Returns the name of this component. By default, "unnamed * component" is returned, but all implementations of components Modified: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class BruteForceLearnerConfigurator { +public class BruteForceLearnerConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -41,6 +41,7 @@ import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; import org.dllearner.learningproblems.PosOnlyInclusionLP; +import org.dllearner.learningproblems.RoleLearning; import org.dllearner.reasoning.DIGReasoner; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.FastRetrievalReasoner; @@ -167,6 +168,16 @@ } /** +* @param positiveExamples positive examples +* @param negativeExamples negative examples +* @param reasoningService see ReasoningService +* @return a component ready for initialization RoleLearning +**/ +public static RoleLearning getRoleLearning(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { +return RoleLearningConfigurator.getRoleLearning(reasoningService, positiveExamples, negativeExamples); +} + +/** * @param learningProblem see LearningProblem * @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see Added: trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/Configurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -0,0 +1,28 @@ +/** + * 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.core.configurators; + +/** +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update +**/ +public interface Configurator{ +} Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -31,7 +31,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class DBpediaNavigationSuggestorConfigurator { +public class DBpediaNavigationSuggestorConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class DIGReasonerConfigurator { +public class DIGReasonerConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -31,7 +31,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class ExampleBasedROLComponentConfigurator { +public class ExampleBasedROLComponentConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class FastInstanceCheckerConfigurator { +public class FastInstanceCheckerConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class FastRetrievalReasonerConfigurator { +public class FastRetrievalReasonerConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class GPConfigurator { +public class GPConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -27,7 +27,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class KBFileConfigurator { +public class KBFileConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -27,7 +27,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class OWLAPIOntologyConfigurator { +public class OWLAPIOntologyConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class OWLAPIReasonerConfigurator { +public class OWLAPIReasonerConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -27,7 +27,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class OWLFileConfigurator { +public class OWLFileConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosNegDefinitionLPConfigurator { +public class PosNegDefinitionLPConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosNegDefinitionLPStrictConfigurator { +public class PosNegDefinitionLPStrictConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosNegInclusionLPConfigurator { +public class PosNegInclusionLPConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosOnlyDefinitionLPConfigurator { +public class PosOnlyDefinitionLPConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosOnlyInclusionLPConfigurator { +public class PosOnlyInclusionLPConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -31,7 +31,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class ROLearnerConfigurator { +public class ROLearnerConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class RandomGuesserConfigurator { +public class RandomGuesserConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Added: trunk/src/dl-learner/org/dllearner/core/configurators/RoleLearningConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RoleLearningConfigurator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RoleLearningConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -0,0 +1,160 @@ +/** + * 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.core.configurators; + +import java.util.Set; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.ReasoningService; +import org.dllearner.learningproblems.RoleLearning; + +/** +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update +**/ +public class RoleLearningConfigurator implements Configurator { + +private boolean reinitNecessary = false; +@SuppressWarnings("unused") + +private RoleLearning roleLearning; + +/** +* @param roleLearning see RoleLearning +**/ +public RoleLearningConfigurator(RoleLearning roleLearning){ +this.roleLearning = roleLearning; +} + +/** +* @param reasoningService see reasoningService +* @param positiveExamples positive examples +* @param negativeExamples negative examples +* @return RoleLearning +**/ +public static RoleLearning getRoleLearning(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { +RoleLearning component = ComponentManager.getInstance().learningProblem(RoleLearning.class, reasoningService); +ComponentManager.getInstance().applyConfigEntry(component, "positiveExamples", positiveExamples); +ComponentManager.getInstance().applyConfigEntry(component, "negativeExamples", negativeExamples); +return component; +} + +/** +* positiveExamples positive examples. +* mandatory: true| reinit necessary: false +* default value: null +* @return Set(String) +**/ +@SuppressWarnings("unchecked") +public Set<String> getPositiveExamples() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(roleLearning, "positiveExamples") ; +} +/** +* negativeExamples negative examples. +* mandatory: true| reinit necessary: false +* default value: null +* @return Set(String) +**/ +@SuppressWarnings("unchecked") +public Set<String> getNegativeExamples() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(roleLearning, "negativeExamples") ; +} +/** +* useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept.. +* mandatory: false| reinit necessary: true +* default value: false +* @return boolean +**/ +public boolean getUseRetrievalForClassficiation() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(roleLearning, "useRetrievalForClassficiation") ; +} +/** +* percentPerLenghtUnit describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one. +* mandatory: false| reinit necessary: true +* default value: 0.05 +* @return double +**/ +public double getPercentPerLenghtUnit() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(roleLearning, "percentPerLenghtUnit") ; +} +/** +* useMultiInstanceChecks See UseMultiInstanceChecks enum.. +* mandatory: false| reinit necessary: true +* default value: twoChecks +* @return String +**/ +public String getUseMultiInstanceChecks() { +return (String) ComponentManager.getInstance().getConfigOptionValue(roleLearning, "useMultiInstanceChecks") ; +} + +/** +* @param positiveExamples positive examples. +* mandatory: true| reinit necessary: false +* default value: null +**/ +public void setPositiveExamples(Set<String> positiveExamples) { +ComponentManager.getInstance().applyConfigEntry(roleLearning, "positiveExamples", positiveExamples); +} +/** +* @param negativeExamples negative examples. +* mandatory: true| reinit necessary: false +* default value: null +**/ +public void setNegativeExamples(Set<String> negativeExamples) { +ComponentManager.getInstance().applyConfigEntry(roleLearning, "negativeExamples", negativeExamples); +} +/** +* @param useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept.. +* mandatory: false| reinit necessary: true +* default value: false +**/ +public void setUseRetrievalForClassficiation(boolean useRetrievalForClassficiation) { +ComponentManager.getInstance().applyConfigEntry(roleLearning, "useRetrievalForClassficiation", useRetrievalForClassficiation); +reinitNecessary = true; +} +/** +* @param percentPerLenghtUnit describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one. +* mandatory: false| reinit necessary: true +* default value: 0.05 +**/ +public void setPercentPerLenghtUnit(double percentPerLenghtUnit) { +ComponentManager.getInstance().applyConfigEntry(roleLearning, "percentPerLenghtUnit", percentPerLenghtUnit); +reinitNecessary = true; +} +/** +* @param useMultiInstanceChecks See UseMultiInstanceChecks enum.. +* mandatory: false| reinit necessary: true +* default value: twoChecks +**/ +public void setUseMultiInstanceChecks(String useMultiInstanceChecks) { +ComponentManager.getInstance().applyConfigEntry(roleLearning, "useMultiInstanceChecks", useMultiInstanceChecks); +reinitNecessary = true; +} + +/** +* true, if this component needs reinitializsation. +* @return boolean +**/ +public boolean isReinitNecessary(){ +return reinitNecessary; +} + + +} Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class SimpleSuggestionLearningAlgorithmConfigurator { +public class SimpleSuggestionLearningAlgorithmConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class SparqlKnowledgeSourceConfigurator { +public class SparqlKnowledgeSourceConfigurator implements Configurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -66,6 +66,7 @@ private KB kb; private KBFileConfigurator configurator; + @Override public KBFileConfigurator getConfigurator(){ return configurator; } Modified: trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -7,16 +7,24 @@ import org.dllearner.core.OntologyFormat; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.configurators.OWLAPIOntologyConfigurator; import org.dllearner.core.owl.KB; import org.semanticweb.owl.model.OWLOntology; public class OWLAPIOntology extends KnowledgeSource { + private OWLAPIOntologyConfigurator configurator; + @Override + public OWLAPIOntologyConfigurator getConfigurator(){ + return configurator; + } + private OWLOntology ontology; public OWLAPIOntology(OWLOntology onto) { this.ontology = onto; + this.configurator = new OWLAPIOntologyConfigurator(this); } @Override Modified: trunk/src/dl-learner/org/dllearner/kb/OWLFile.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/kb/OWLFile.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -49,7 +49,8 @@ private URL url; private OWLFileConfigurator configurator ; - public OWLFileConfigurator getOWLFileConfigurator(){ + @Override + public OWLFileConfigurator getConfigurator(){ return configurator; } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -87,6 +87,7 @@ /** * @return the configurator for this Knowledgesource */ + @Override public SparqlKnowledgeSourceConfigurator getConfigurator() { return configurator; } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -48,7 +48,7 @@ public class PosNegDefinitionLP extends PosNegLP implements DefinitionLP { private PosNegDefinitionLPConfigurator configurator; - + @Override public PosNegDefinitionLPConfigurator getConfigurator() { return configurator; } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -53,7 +53,7 @@ private double errorPenalty = defaultErrorPenalty; private PosNegDefinitionLPStrictConfigurator configurator; - + @Override public PosNegDefinitionLPStrictConfigurator getConfigurator(){ return configurator; } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -24,7 +24,6 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; -import org.dllearner.core.config.CommonConfigMappings; import org.dllearner.core.configurators.ComponentFactory; import org.dllearner.core.configurators.PosNegInclusionLPConfigurator; import org.dllearner.core.owl.Description; @@ -57,6 +56,7 @@ private PosNegDefinitionLP definitionLP; private PosNegInclusionLPConfigurator configurator; + @Override public PosNegInclusionLPConfigurator getConfigurator(){ return configurator; } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -38,6 +38,7 @@ private PosNegDefinitionLP definitionLP; private PosOnlyDefinitionLPConfigurator configurator; + @Override public PosOnlyDefinitionLPConfigurator getConfigurator(){ return configurator; } @@ -71,7 +72,7 @@ reasoningService, SetManipulation.indToString(positiveExamples), SetManipulation.indToString(pseudoNegatives)); - definitionLP = new PosNegDefinitionLP(reasoningService, positiveExamples, pseudoNegatives); + //definitionLP = new PosNegDefinitionLP(reasoningService, positiveExamples, pseudoNegatives); // TODO: we must make sure that the problem also gets the same // reasoning options (i.e. options are the same up to reversed example sets) definitionLP.init(); Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyInclusionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyInclusionLP.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyInclusionLP.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -23,6 +23,7 @@ import org.dllearner.core.Score; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.configurators.PosOnlyInclusionLPConfigurator; import org.dllearner.core.owl.Description; /** @@ -31,8 +32,16 @@ */ public class PosOnlyInclusionLP extends PosOnlyLP implements InclusionLP { + private PosOnlyInclusionLPConfigurator configurator; + @Override + public PosOnlyInclusionLPConfigurator getConfigurator(){ + return configurator; + } + + public PosOnlyInclusionLP(ReasoningService reasoningService) { super(reasoningService); + this.configurator = new PosOnlyInclusionLPConfigurator(this); } /* (non-Javadoc) Modified: trunk/src/dl-learner/org/dllearner/learningproblems/RoleLearning.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/RoleLearning.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/learningproblems/RoleLearning.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -25,6 +25,7 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; +import org.dllearner.core.configurators.RoleLearningConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.utilities.datastructures.StringTuple; @@ -43,6 +44,13 @@ */ public class RoleLearning extends PosNegLP implements DefinitionLP { + private RoleLearningConfigurator configurator; + @Override + public RoleLearningConfigurator getConfigurator(){ + return configurator; + } + + public RoleLearning(ReasoningService reasoningService) { super(reasoningService); } @@ -51,6 +59,7 @@ SortedSet<Individual> positiveExamples, SortedSet<Individual> negativeExamples) { super(reasoningService); + this.configurator = new RoleLearningConfigurator(this); // TODO sets have to be queried this.positiveExamples = positiveExamples; this.negativeExamples = negativeExamples; Modified: trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -46,10 +46,11 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.configurators.DIGReasonerConfigurator; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Nothing; -import org.dllearner.core.owl.Description; -import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectPropertyHierarchy; import org.dllearner.core.owl.SubsumptionHierarchy; @@ -75,6 +76,13 @@ * */ public class DIGReasoner extends ReasonerComponent { + + private DIGReasonerConfigurator configurator; + @Override + public DIGReasonerConfigurator getConfigurator(){ + return configurator; + } + URL reasonerURL; Set<KnowledgeSource> sources; @@ -105,7 +113,10 @@ private File digProtocolFile; private static String defaultDIGProtocolFile = "log/digProtocol.txt"; + + public DIGReasoner(Set<KnowledgeSource> sources) { + this.configurator = new DIGReasonerConfigurator(this); this.sources = sources; try { reasonerURL = new URL("http://localhost:8081"); Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -92,6 +92,7 @@ private boolean defaultNegation = true; private FastInstanceCheckerConfigurator configurator; + @Override public FastInstanceCheckerConfigurator getConfigurator (){ return configurator; } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -1,8 +1,8 @@ package org.dllearner.reasoning; +import java.util.HashSet; import java.util.Map; import java.util.Set; -import java.util.HashSet; import java.util.SortedSet; import java.util.TreeSet; @@ -13,10 +13,12 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.InvalidConfigOptionValueException; -import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.configurators.ComponentFactory; +import org.dllearner.core.configurators.FastRetrievalReasonerConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.FlatABox; import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectPropertyHierarchy; import org.dllearner.core.owl.SubsumptionHierarchy; @@ -25,6 +27,12 @@ public class FastRetrievalReasoner extends ReasonerComponent { + private FastRetrievalReasonerConfigurator configurator; + @Override + public FastRetrievalReasonerConfigurator getConfigurator(){ + return configurator; + } + FlatABox abox; FastRetrieval fastRetrieval; Set<NamedClass> atomicConcepts; @@ -34,8 +42,12 @@ ReasoningService rs; ReasonerComponent rc; + + public FastRetrievalReasoner(Set<KnowledgeSource> sources) { - rc = new DIGReasoner(sources); + this.configurator = new FastRetrievalReasonerConfigurator(this); + + rc = ComponentFactory.getDIGReasoner(sources); try { rc.init(); } catch (ComponentInitException e1) { @@ -56,6 +68,7 @@ } public FastRetrievalReasoner(FlatABox abox) { + this.configurator = new FastRetrievalReasonerConfigurator(this); this.abox = abox; fastRetrieval = new FastRetrieval(abox); Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -105,6 +105,7 @@ //private String reasonerType = "pellet"; private OWLAPIReasonerConfigurator configurator; + @Override public OWLAPIReasonerConfigurator getConfigurator(){ return configurator; } Modified: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -78,6 +78,8 @@ 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>(); @@ -194,6 +196,7 @@ } makeComponentFactory(); + makeInterface(); System.out.println("Done"); } @@ -252,13 +255,20 @@ .add(makeGetInstanceForConfigurators(getAllCommentsForOptionList(mandatoryOptions))); // body.add(makeApplyConfigEntryForOptionList(ComponentManager.getConfigOptions(component))); - + body.add(expandCollection(getters, "", "", 0)); body.add(expandCollection(setters, "", "", 0)); body.add(REINITGETTER); - String ret = fillClassTemplate(TARGET_PACKAGE, expandCollection( - imports, "import ", ";\n", 0), className + CONFIGURATOR, "", - expandCollection(body, "", "\n", 0)); + String bodytmp = expandCollection(body, "", "\n",0); + String importtmp = expandCollection(imports, "import ", ";\n", 0); + String ret = fillClassTemplate( + TARGET_PACKAGE, + importtmp, + className + CONFIGURATOR, + "", + bodytmp , + "", + CONFIGURATOR); // configuratorMethods.add((className, componentType, // mandatoryOptions)); @@ -270,6 +280,15 @@ .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) { @@ -392,7 +411,7 @@ String ret = fillClassTemplate(TARGET_PACKAGE, expandCollection( COMPONENT_FACTORY_IMPORTS, "import ", ";\n", 0), COMPONENT_FACTORY, "", expandCollection( - COMPONENT_FACTORY_METHODS, "", "\n", 0), "final"); + COMPONENT_FACTORY_METHODS, "", "\n", 0), "final",""); Files.createFile(new File(TARGET_DIR + "/" + COMPONENT_FACTORY + ".java"), ret); @@ -463,30 +482,28 @@ } - private static String fillClassTemplate(String packagE, String imports, - String className, String extendS, String body) { - return fillClassTemplate(packagE, imports, className, extendS, body, ""); - } + private static String fillClassTemplate(String packagE, String imports, - String className, String extendS, String body, String classModifier) { - String comment = "* automatically generated, do not edit manually.\n"; - comment += "* run " + ConfigJavaGenerator.class.getCanonicalName() - + " to update\n"; + String className, String extendS, String body, String classModifier, String implementS) { + String ret = HEADER + "\n"; ret += "package " + packagE + ";\n\n"; ret += imports + "\n"; - ret += fillJavaDocComment(comment); + ret += fillJavaDocComment(CLASS_COMMENT); ret += (INCLUDE_UNUSED) ? UNUSED : ""; 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 String expandCollection(Collection<String> col, String before, String after, int removeChars) { Modified: trunk/src/dl-learner/org/dllearner/scripts/NewSample.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-09 11:38:48 UTC (rev 1184) +++ trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-09 13:40:43 UTC (rev 1185) @@ -121,7 +121,7 @@ String fileURL = new File(owlFile).toURI().toString(); OWLFile ks = ComponentFactory.getOWLFile( fileURL); - + Set<KnowledgeSource> tmp = new HashSet<KnowledgeSource>(); tmp.add(ks); // reasoner This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-09 11:38:50
|
Revision: 1184 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1184&view=rev Author: kurzum Date: 2008-09-09 11:38:48 +0000 (Tue, 09 Sep 2008) Log Message: ----------- some more components integrated Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java 2008-09-09 11:24:26 UTC (rev 1183) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLPStrict.java 2008-09-09 11:38:48 UTC (rev 1184) @@ -30,6 +30,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.DoubleConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; +import org.dllearner.core.configurators.PosNegDefinitionLPStrictConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.Negation; @@ -51,8 +52,15 @@ private static final double defaultErrorPenalty = 3; private double errorPenalty = defaultErrorPenalty; + private PosNegDefinitionLPStrictConfigurator configurator; + + public PosNegDefinitionLPStrictConfigurator getConfigurator(){ + return configurator; + } + public PosNegDefinitionLPStrict(ReasoningService reasoningService) { super(reasoningService); + this.configurator = new PosNegDefinitionLPStrictConfigurator(this); } /* (non-Javadoc) Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-09-09 11:24:26 UTC (rev 1183) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-09-09 11:38:48 UTC (rev 1184) @@ -24,10 +24,14 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; +import org.dllearner.core.config.CommonConfigMappings; +import org.dllearner.core.configurators.ComponentFactory; +import org.dllearner.core.configurators.PosNegInclusionLPConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.Negation; import org.dllearner.utilities.Helper; +import org.dllearner.utilities.datastructures.SetManipulation; /** * The aim of this learning problem is to find an appropriate inclusion axiom @@ -51,9 +55,15 @@ public class PosNegInclusionLP extends PosNegLP implements InclusionLP { private PosNegDefinitionLP definitionLP; + private PosNegInclusionLPConfigurator configurator; + public PosNegInclusionLPConfigurator getConfigurator(){ + return configurator; + } + public PosNegInclusionLP(ReasoningService reasoningService) { super(reasoningService); + configurator = new PosNegInclusionLPConfigurator(this); } /* public static Collection<ConfigOption<?>> createConfigOptions() { @@ -85,7 +95,11 @@ @Override public void init() { super.init(); - definitionLP = new PosNegDefinitionLP(reasoningService, negativeExamples, positiveExamples); + definitionLP = ComponentFactory.getPosNegDefinitionLP( + reasoningService, + SetManipulation.indToString(negativeExamples), + SetManipulation.indToString(positiveExamples)); + //definitionLP = new PosNegDefinitionLP(reasoningService, negativeExamples, positiveExamples); // TODO: we must make sure that the problem also gets the same // reasoning options (i.e. options are the same up to reversed example sets) definitionLP.init(); Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java 2008-09-09 11:24:26 UTC (rev 1183) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosOnlyDefinitionLP.java 2008-09-09 11:38:48 UTC (rev 1184) @@ -21,8 +21,11 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; +import org.dllearner.core.configurators.ComponentFactory; +import org.dllearner.core.configurators.PosOnlyDefinitionLPConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.utilities.Helper; +import org.dllearner.utilities.datastructures.SetManipulation; /** * Definition learning problem from only positive examples. @@ -33,9 +36,15 @@ public class PosOnlyDefinitionLP extends PosOnlyLP implements DefinitionLP { private PosNegDefinitionLP definitionLP; + private PosOnlyDefinitionLPConfigurator configurator; + public PosOnlyDefinitionLPConfigurator getConfigurator(){ + return configurator; + } + public PosOnlyDefinitionLP(ReasoningService reasoningService) { super(reasoningService); + configurator = new PosOnlyDefinitionLPConfigurator(this); } /* @@ -58,6 +67,10 @@ // create an instance of a standard definition learning problem // instanciated with pseudo-negatives + definitionLP = ComponentFactory.getPosNegDefinitionLP( + reasoningService, + SetManipulation.indToString(positiveExamples), + SetManipulation.indToString(pseudoNegatives)); definitionLP = new PosNegDefinitionLP(reasoningService, positiveExamples, pseudoNegatives); // TODO: we must make sure that the problem also gets the same // reasoning options (i.e. options are the same up to reversed example sets) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-09 11:24:30
|
Revision: 1183 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1183&view=rev Author: kurzum Date: 2008-09-09 11:24:26 +0000 (Tue, 09 Sep 2008) Log Message: ----------- compatible with checkstyle Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java trunk/src/dl-learner/org/dllearner/utilities/Files.java Modified: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class BruteForceLearnerConfigurator { +public class BruteForceLearnerConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -45,6 +45,9 @@ } /** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see * @return BruteForceLearner **/ public static BruteForceLearner getBruteForceLearner(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ @@ -91,7 +94,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -50,8 +50,10 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class ComponentFactory { +public final class ComponentFactory { +private ComponentFactory(){} + /** * @param filename pointer to the KB file on local file system * @return a component ready for initialization KBFile Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -31,7 +31,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class DBpediaNavigationSuggestorConfigurator { +public class DBpediaNavigationSuggestorConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -46,6 +46,9 @@ } /** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see * @return DBpediaNavigationSuggestor **/ public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ @@ -528,7 +531,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class DIGReasonerConfigurator { +public class DIGReasonerConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param knowledgeSource see knowledgeSource * @return DIGReasoner **/ public static DIGReasoner getDIGReasoner(Set<KnowledgeSource> knowledgeSource) { @@ -108,7 +109,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -31,7 +31,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class ExampleBasedROLComponentConfigurator { +public class ExampleBasedROLComponentConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -46,6 +46,9 @@ } /** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see * @return ExampleBasedROLComponent **/ public static ExampleBasedROLComponent getExampleBasedROLComponent(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ @@ -582,7 +585,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class FastInstanceCheckerConfigurator { +public class FastInstanceCheckerConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param knowledgeSource see knowledgeSource * @return FastInstanceChecker **/ public static FastInstanceChecker getFastInstanceChecker(Set<KnowledgeSource> knowledgeSource) { @@ -72,7 +73,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class FastRetrievalReasonerConfigurator { +public class FastRetrievalReasonerConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param knowledgeSource see knowledgeSource * @return FastRetrievalReasoner **/ public static FastRetrievalReasoner getFastRetrievalReasoner(Set<KnowledgeSource> knowledgeSource) { @@ -54,7 +55,8 @@ /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class GPConfigurator { +public class GPConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -45,6 +45,9 @@ } /** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see * @return GP **/ public static GP getGP(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ @@ -361,7 +364,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -27,7 +27,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class KBFileConfigurator { +public class KBFileConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -90,7 +90,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -27,7 +27,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class OWLAPIOntologyConfigurator { +public class OWLAPIOntologyConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -52,7 +52,8 @@ /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class OWLAPIReasonerConfigurator { +public class OWLAPIReasonerConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param knowledgeSource see knowledgeSource * @return OWLAPIReasoner **/ public static OWLAPIReasoner getOWLAPIReasoner(Set<KnowledgeSource> knowledgeSource) { @@ -72,7 +73,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -27,7 +27,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class OWLFileConfigurator { +public class OWLFileConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -72,7 +72,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosNegDefinitionLPConfigurator { +public class PosNegDefinitionLPConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param reasoningService see reasoningService * @param positiveExamples positive examples * @param negativeExamples negative examples * @return PosNegDefinitionLP @@ -148,7 +149,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosNegDefinitionLPStrictConfigurator { +public class PosNegDefinitionLPStrictConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param reasoningService see reasoningService * @param positiveExamples positive examples * @param negativeExamples negative examples * @return PosNegDefinitionLPStrict @@ -202,7 +203,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosNegInclusionLPConfigurator { +public class PosNegInclusionLPConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param reasoningService see reasoningService * @param positiveExamples positive examples * @param negativeExamples negative examples * @return PosNegInclusionLP @@ -148,7 +149,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosOnlyDefinitionLPConfigurator { +public class PosOnlyDefinitionLPConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param reasoningService see reasoningService * @param positiveExamples positive examples * @return PosOnlyDefinitionLP **/ @@ -74,7 +75,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -29,7 +29,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class PosOnlyInclusionLPConfigurator { +public class PosOnlyInclusionLPConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -44,6 +44,7 @@ } /** +* @param reasoningService see reasoningService * @param positiveExamples positive examples * @return PosOnlyInclusionLP **/ @@ -74,7 +75,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -31,7 +31,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class ROLearnerConfigurator { +public class ROLearnerConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -46,6 +46,9 @@ } /** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see * @return ROLearner **/ public static ROLearner getROLearner(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ @@ -510,7 +513,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class RandomGuesserConfigurator { +public class RandomGuesserConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -45,6 +45,9 @@ } /** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see * @return RandomGuesser **/ public static RandomGuesser getRandomGuesser(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ @@ -91,7 +94,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class SimpleSuggestionLearningAlgorithmConfigurator { +public class SimpleSuggestionLearningAlgorithmConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -45,6 +45,9 @@ } /** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see * @return SimpleSuggestionLearningAlgorithm **/ public static SimpleSuggestionLearningAlgorithm getSimpleSuggestionLearningAlgorithm(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ @@ -55,7 +58,8 @@ /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -30,7 +30,7 @@ * automatically generated, do not edit manually. * run org.dllearner.scripts.ConfigJavaGenerator to update **/ -public class SparqlKnowledgeSourceConfigurator { +public class SparqlKnowledgeSourceConfigurator { private boolean reinitNecessary = false; @SuppressWarnings("unused") @@ -480,7 +480,8 @@ } /** -* true, if this component needs reinitializsation +* true, if this component needs reinitializsation. +* @return boolean **/ public boolean isReinitNecessary(){ return reinitNecessary; Modified: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -66,7 +66,8 @@ private static final String REINITVAR = "reinitNecessary"; - private static final String REINITGETTER = "/**\n* true, if this component needs reinitializsation\n**/\n" + private static final String REINITGETTER = "/**\n* true, if this component needs reinitializsation.\n" + + "* @return boolean\n**/\n" + "public boolean is" + capitalize(REINITVAR) + "(){\nreturn " @@ -115,19 +116,17 @@ public static void main(String[] args) { Files.backupDirectory(TARGET_DIR); - // System.exit(0); + System.out.println("previous classes were backupped to tmp/+System.currentTimeMillis()"); Files.deleteDir(TARGET_DIR); ComponentManager cm = ComponentManager.getInstance(); - // configuratorImports.add(ComponentManager.class.getCanonicalName()); COMPONENT_FACTORY_IMPORTS.add(KnowledgeSource.class.getCanonicalName()); - // configuratorImports.add(ReasonerComponent.class.getCanonicalName()); COMPONENT_FACTORY_IMPORTS .add(ReasoningService.class.getCanonicalName()); COMPONENT_FACTORY_IMPORTS.add(LearningProblem.class.getCanonicalName()); - // componentFactoryImports.add(LearningAlgorithm.class.getCanonicalName()); COMPONENT_FACTORY_IMPORTS.add(LearningProblemUnsupportedException.class .getCanonicalName()); + COMPONENT_FACTORY_METHODS.add("private "+COMPONENT_FACTORY+"(){}\n"); for (Class<? extends KnowledgeSource> component : cm .getKnowledgeSources()) { @@ -313,11 +312,11 @@ 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)) - + ""; + applyConf += fillApplyConfigEntry("component", mandatoryVars.get(s)); } String parWithType = expandCollection(parametersWithType.keySet(), "", @@ -329,6 +328,7 @@ if (!getinstanceExceptions.isEmpty()) { exceptions += "throws "; exceptions += expandCollection(getinstanceExceptions, "", ", ", 2); + comments+=expandCollection(getinstanceExceptions, "* @throws ", " see \n", 0); } comments = fillJavaDocComment(comments + "* @return " + className + "\n"); @@ -392,7 +392,7 @@ String ret = fillClassTemplate(TARGET_PACKAGE, expandCollection( COMPONENT_FACTORY_IMPORTS, "import ", ";\n", 0), COMPONENT_FACTORY, "", expandCollection( - COMPONENT_FACTORY_METHODS, "", "\n", 0)); + COMPONENT_FACTORY_METHODS, "", "\n", 0), "final"); Files.createFile(new File(TARGET_DIR + "/" + COMPONENT_FACTORY + ".java"), ret); @@ -462,8 +462,14 @@ return ret; } + private static String fillClassTemplate(String packagE, String imports, String className, String extendS, String body) { + return fillClassTemplate(packagE, imports, className, extendS, body, ""); + } + + private static String fillClassTemplate(String packagE, String imports, + String className, String extendS, String body, String classModifier) { String comment = "* automatically generated, do not edit manually.\n"; comment += "* run " + ConfigJavaGenerator.class.getCanonicalName() + " to update\n"; @@ -473,7 +479,7 @@ ret += imports + "\n"; ret += fillJavaDocComment(comment); ret += (INCLUDE_UNUSED) ? UNUSED : ""; - ret += "public class " + className + " " + ret += "public "+classModifier+" class " + className + " " + ((extendS.length() > 0) ? "extends " + extendS : "") + " {\n\n"; ret += body + "\n"; Modified: trunk/src/dl-learner/org/dllearner/utilities/Files.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-09-09 09:42:37 UTC (rev 1182) +++ trunk/src/dl-learner/org/dllearner/utilities/Files.java 2008-09-09 11:24:26 UTC (rev 1183) @@ -157,6 +157,10 @@ } } + /** + * copies all files in dir to "tmp/"+System.currentTimeMillis() + * @param dir the dir to be backupped + */ public static void backupDirectory(String dir){ File f = new File(dir); String backupDir = "tmp/"+System.currentTimeMillis(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-09 09:42:42
|
Revision: 1182 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1182&view=rev Author: kurzum Date: 2008-09-09 09:42:37 +0000 (Tue, 09 Sep 2008) Log Message: ----------- minor changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-09 09:42:10 UTC (rev 1181) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-09 09:42:37 UTC (rev 1182) @@ -24,6 +24,7 @@ import org.dllearner.algorithms.BruteForceLearner; import org.dllearner.algorithms.DBpediaNavigationSuggestor; import org.dllearner.algorithms.RandomGuesser; +import org.dllearner.algorithms.SimpleSuggestionLearningAlgorithm; import org.dllearner.algorithms.gp.GP; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.algorithms.refinement.ROLearner; @@ -32,11 +33,14 @@ import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasoningService; import org.dllearner.kb.KBFile; +import org.dllearner.kb.OWLAPIOntology; import org.dllearner.kb.OWLFile; import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.learningproblems.PosNegDefinitionLP; +import org.dllearner.learningproblems.PosNegDefinitionLPStrict; import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; +import org.dllearner.learningproblems.PosOnlyInclusionLP; import org.dllearner.reasoning.DIGReasoner; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.FastRetrievalReasoner; @@ -57,6 +61,13 @@ } /** +* @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 **/ @@ -119,6 +130,16 @@ * @param positiveExamples positive examples * @param negativeExamples negative examples * @param reasoningService see ReasoningService +* @return a component ready for initialization PosNegDefinitionLPStrict +**/ +public static PosNegDefinitionLPStrict getPosNegDefinitionLPStrict(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { +return PosNegDefinitionLPStrictConfigurator.getPosNegDefinitionLPStrict(reasoningService, positiveExamples, negativeExamples); +} + +/** +* @param positiveExamples positive examples +* @param negativeExamples negative examples +* @param reasoningService see ReasoningService * @return a component ready for initialization PosNegInclusionLP **/ public static PosNegInclusionLP getPosNegInclusionLP(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { @@ -135,6 +156,15 @@ } /** +* @param positiveExamples positive examples +* @param reasoningService see ReasoningService +* @return a component ready for initialization PosOnlyInclusionLP +**/ +public static PosOnlyInclusionLP getPosOnlyInclusionLP(ReasoningService reasoningService, Set<String> positiveExamples) { +return PosOnlyInclusionLPConfigurator.getPosOnlyInclusionLP(reasoningService, positiveExamples); +} + +/** * @param learningProblem see LearningProblem * @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see @@ -168,6 +198,16 @@ * @param learningProblem see LearningProblem * @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see +* @return a component ready for initialization SimpleSuggestionLearningAlgorithm +**/ +public static SimpleSuggestionLearningAlgorithm getSimpleSuggestionLearningAlgorithm(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException { +return SimpleSuggestionLearningAlgorithmConfigurator.getSimpleSuggestionLearningAlgorithm(learningProblem, reasoningService); +} + +/** +* @param learningProblem see LearningProblem +* @param reasoningService see ReasoningService +* @throws LearningProblemUnsupportedException see * @return a component ready for initialization GP **/ public static GP getGP(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException { Added: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIOntologyConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) @@ -0,0 +1,62 @@ +/** + * 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.core.configurators; + +import org.dllearner.core.ComponentManager; +import org.dllearner.kb.OWLAPIOntology; + +/** +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update +**/ +public class OWLAPIOntologyConfigurator { + +private boolean reinitNecessary = false; +@SuppressWarnings("unused") + +private OWLAPIOntology oWLAPIOntology; + +/** +* @param oWLAPIOntology see OWLAPIOntology +**/ +public OWLAPIOntologyConfigurator(OWLAPIOntology oWLAPIOntology){ +this.oWLAPIOntology = oWLAPIOntology; +} + +/** +* @return OWLAPIOntology +**/ +public static OWLAPIOntology getOWLAPIOntology() { +OWLAPIOntology component = ComponentManager.getInstance().knowledgeSource(OWLAPIOntology.class); +return component; +} + + + +/** +* true, if this component needs reinitializsation +**/ +public boolean isReinitNecessary(){ +return reinitNecessary; +} + + +} Added: trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPStrictConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) @@ -0,0 +1,212 @@ +/** + * 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.core.configurators; + +import java.util.Set; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.ReasoningService; +import org.dllearner.learningproblems.PosNegDefinitionLPStrict; + +/** +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update +**/ +public class PosNegDefinitionLPStrictConfigurator { + +private boolean reinitNecessary = false; +@SuppressWarnings("unused") + +private PosNegDefinitionLPStrict posNegDefinitionLPStrict; + +/** +* @param posNegDefinitionLPStrict see PosNegDefinitionLPStrict +**/ +public PosNegDefinitionLPStrictConfigurator(PosNegDefinitionLPStrict posNegDefinitionLPStrict){ +this.posNegDefinitionLPStrict = posNegDefinitionLPStrict; +} + +/** +* @param positiveExamples positive examples +* @param negativeExamples negative examples +* @return PosNegDefinitionLPStrict +**/ +public static PosNegDefinitionLPStrict getPosNegDefinitionLPStrict(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { +PosNegDefinitionLPStrict component = ComponentManager.getInstance().learningProblem(PosNegDefinitionLPStrict.class, reasoningService); +ComponentManager.getInstance().applyConfigEntry(component, "positiveExamples", positiveExamples); +ComponentManager.getInstance().applyConfigEntry(component, "negativeExamples", negativeExamples); +return component; +} + +/** +* positiveExamples positive examples. +* mandatory: true| reinit necessary: false +* default value: null +* @return Set(String) +**/ +@SuppressWarnings("unchecked") +public Set<String> getPositiveExamples() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(posNegDefinitionLPStrict, "positiveExamples") ; +} +/** +* negativeExamples negative examples. +* mandatory: true| reinit necessary: false +* default value: null +* @return Set(String) +**/ +@SuppressWarnings("unchecked") +public Set<String> getNegativeExamples() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(posNegDefinitionLPStrict, "negativeExamples") ; +} +/** +* useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept.. +* mandatory: false| reinit necessary: true +* default value: false +* @return boolean +**/ +public boolean getUseRetrievalForClassficiation() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(posNegDefinitionLPStrict, "useRetrievalForClassficiation") ; +} +/** +* percentPerLenghtUnit describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one. +* mandatory: false| reinit necessary: true +* default value: 0.05 +* @return double +**/ +public double getPercentPerLenghtUnit() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(posNegDefinitionLPStrict, "percentPerLenghtUnit") ; +} +/** +* useMultiInstanceChecks See UseMultiInstanceChecks enum.. +* mandatory: false| reinit necessary: true +* default value: twoChecks +* @return String +**/ +public String getUseMultiInstanceChecks() { +return (String) ComponentManager.getInstance().getConfigOptionValue(posNegDefinitionLPStrict, "useMultiInstanceChecks") ; +} +/** +* penaliseNeutralExamples if set to true neutral examples are penalised. +* mandatory: false| reinit necessary: true +* default value: null +* @return boolean +**/ +public boolean getPenaliseNeutralExamples() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(posNegDefinitionLPStrict, "penaliseNeutralExamples") ; +} +/** +* accuracyPenalty penalty for pos/neg examples which are classified as neutral. +* mandatory: false| reinit necessary: true +* default value: 1.0 +* @return double +**/ +public double getAccuracyPenalty() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(posNegDefinitionLPStrict, "accuracyPenalty") ; +} +/** +* errorPenalty penalty for pos. examples classified as negative or vice versa. +* mandatory: false| reinit necessary: true +* default value: 3.0 +* @return double +**/ +public double getErrorPenalty() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(posNegDefinitionLPStrict, "errorPenalty") ; +} + +/** +* @param positiveExamples positive examples. +* mandatory: true| reinit necessary: false +* default value: null +**/ +public void setPositiveExamples(Set<String> positiveExamples) { +ComponentManager.getInstance().applyConfigEntry(posNegDefinitionLPStrict, "positiveExamples", positiveExamples); +} +/** +* @param negativeExamples negative examples. +* mandatory: true| reinit necessary: false +* default value: null +**/ +public void setNegativeExamples(Set<String> negativeExamples) { +ComponentManager.getInstance().applyConfigEntry(posNegDefinitionLPStrict, "negativeExamples", negativeExamples); +} +/** +* @param useRetrievalForClassficiation Specifies whether to use retrieval or instance checks for testing a concept.. +* mandatory: false| reinit necessary: true +* default value: false +**/ +public void setUseRetrievalForClassficiation(boolean useRetrievalForClassficiation) { +ComponentManager.getInstance().applyConfigEntry(posNegDefinitionLPStrict, "useRetrievalForClassficiation", useRetrievalForClassficiation); +reinitNecessary = true; +} +/** +* @param percentPerLenghtUnit describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one. +* mandatory: false| reinit necessary: true +* default value: 0.05 +**/ +public void setPercentPerLenghtUnit(double percentPerLenghtUnit) { +ComponentManager.getInstance().applyConfigEntry(posNegDefinitionLPStrict, "percentPerLenghtUnit", percentPerLenghtUnit); +reinitNecessary = true; +} +/** +* @param useMultiInstanceChecks See UseMultiInstanceChecks enum.. +* mandatory: false| reinit necessary: true +* default value: twoChecks +**/ +public void setUseMultiInstanceChecks(String useMultiInstanceChecks) { +ComponentManager.getInstance().applyConfigEntry(posNegDefinitionLPStrict, "useMultiInstanceChecks", useMultiInstanceChecks); +reinitNecessary = true; +} +/** +* @param penaliseNeutralExamples if set to true neutral examples are penalised. +* mandatory: false| reinit necessary: true +* default value: null +**/ +public void setPenaliseNeutralExamples(boolean penaliseNeutralExamples) { +ComponentManager.getInstance().applyConfigEntry(posNegDefinitionLPStrict, "penaliseNeutralExamples", penaliseNeutralExamples); +reinitNecessary = true; +} +/** +* @param accuracyPenalty penalty for pos/neg examples which are classified as neutral. +* mandatory: false| reinit necessary: true +* default value: 1.0 +**/ +public void setAccuracyPenalty(double accuracyPenalty) { +ComponentManager.getInstance().applyConfigEntry(posNegDefinitionLPStrict, "accuracyPenalty", accuracyPenalty); +reinitNecessary = true; +} +/** +* @param errorPenalty penalty for pos. examples classified as negative or vice versa. +* mandatory: false| reinit necessary: true +* default value: 3.0 +**/ +public void setErrorPenalty(double errorPenalty) { +ComponentManager.getInstance().applyConfigEntry(posNegDefinitionLPStrict, "errorPenalty", errorPenalty); +reinitNecessary = true; +} + +/** +* true, if this component needs reinitializsation +**/ +public boolean isReinitNecessary(){ +return reinitNecessary; +} + + +} Added: trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyInclusionLPConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) @@ -0,0 +1,84 @@ +/** + * 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.core.configurators; + +import java.util.Set; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.ReasoningService; +import org.dllearner.learningproblems.PosOnlyInclusionLP; + +/** +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update +**/ +public class PosOnlyInclusionLPConfigurator { + +private boolean reinitNecessary = false; +@SuppressWarnings("unused") + +private PosOnlyInclusionLP posOnlyInclusionLP; + +/** +* @param posOnlyInclusionLP see PosOnlyInclusionLP +**/ +public PosOnlyInclusionLPConfigurator(PosOnlyInclusionLP posOnlyInclusionLP){ +this.posOnlyInclusionLP = posOnlyInclusionLP; +} + +/** +* @param positiveExamples positive examples +* @return PosOnlyInclusionLP +**/ +public static PosOnlyInclusionLP getPosOnlyInclusionLP(ReasoningService reasoningService, Set<String> positiveExamples) { +PosOnlyInclusionLP component = ComponentManager.getInstance().learningProblem(PosOnlyInclusionLP.class, reasoningService); +ComponentManager.getInstance().applyConfigEntry(component, "positiveExamples", positiveExamples); +return component; +} + +/** +* positiveExamples positive examples. +* mandatory: true| reinit necessary: false +* default value: null +* @return Set(String) +**/ +@SuppressWarnings("unchecked") +public Set<String> getPositiveExamples() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(posOnlyInclusionLP, "positiveExamples") ; +} + +/** +* @param positiveExamples positive examples. +* mandatory: true| reinit necessary: false +* default value: null +**/ +public void setPositiveExamples(Set<String> positiveExamples) { +ComponentManager.getInstance().applyConfigEntry(posOnlyInclusionLP, "positiveExamples", positiveExamples); +} + +/** +* true, if this component needs reinitializsation +**/ +public boolean isReinitNecessary(){ +return reinitNecessary; +} + + +} Added: trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/SimpleSuggestionLearningAlgorithmConfigurator.java 2008-09-09 09:42:37 UTC (rev 1182) @@ -0,0 +1,65 @@ +/** + * 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.core.configurators; + +import org.dllearner.algorithms.SimpleSuggestionLearningAlgorithm; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.core.ReasoningService; + +/** +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update +**/ +public class SimpleSuggestionLearningAlgorithmConfigurator { + +private boolean reinitNecessary = false; +@SuppressWarnings("unused") + +private SimpleSuggestionLearningAlgorithm simpleSuggestionLearningAlgorithm; + +/** +* @param simpleSuggestionLearningAlgorithm see SimpleSuggestionLearningAlgorithm +**/ +public SimpleSuggestionLearningAlgorithmConfigurator(SimpleSuggestionLearningAlgorithm simpleSuggestionLearningAlgorithm){ +this.simpleSuggestionLearningAlgorithm = simpleSuggestionLearningAlgorithm; +} + +/** +* @return SimpleSuggestionLearningAlgorithm +**/ +public static SimpleSuggestionLearningAlgorithm getSimpleSuggestionLearningAlgorithm(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ +SimpleSuggestionLearningAlgorithm component = ComponentManager.getInstance().learningAlgorithm(SimpleSuggestionLearningAlgorithm.class, learningProblem, reasoningService); +return component; +} + + + +/** +* true, if this component needs reinitializsation +**/ +public boolean isReinitNecessary(){ +return reinitNecessary; +} + + +} Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-09 09:42:10 UTC (rev 1181) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-09 09:42:37 UTC (rev 1182) @@ -142,6 +142,7 @@ public OWLAPIReasoner(Set<KnowledgeSource> sources) { this.sources = sources; this.configurator = new OWLAPIReasonerConfigurator(this); + } public static String getName() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-09 09:42:12
|
Revision: 1181 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1181&view=rev Author: kurzum Date: 2008-09-09 09:42:10 +0000 (Tue, 09 Sep 2008) Log Message: ----------- components.ini Modified Paths: -------------- trunk/lib/components.ini Modified: trunk/lib/components.ini =================================================================== --- trunk/lib/components.ini 2008-09-09 07:34:25 UTC (rev 1180) +++ trunk/lib/components.ini 2008-09-09 09:42:10 UTC (rev 1181) @@ -4,6 +4,7 @@ org.dllearner.kb.OWLFile org.dllearner.kb.KBFile org.dllearner.kb.sparql.SparqlKnowledgeSource +org.dllearner.kb.OWLAPIOntology # reasoners org.dllearner.reasoning.OWLAPIReasoner org.dllearner.reasoning.DIGReasoner @@ -11,12 +12,15 @@ org.dllearner.reasoning.FastInstanceChecker # learning problems org.dllearner.learningproblems.PosNegDefinitionLP +org.dllearner.learningproblems.PosNegDefinitionLPStrict org.dllearner.learningproblems.PosNegInclusionLP org.dllearner.learningproblems.PosOnlyDefinitionLP +org.dllearner.learningproblems.PosOnlyInclusionLP # learning algorithms org.dllearner.algorithms.RandomGuesser org.dllearner.algorithms.BruteForceLearner org.dllearner.algorithms.refinement.ROLearner org.dllearner.algorithms.refexamples.ExampleBasedROLComponent org.dllearner.algorithms.gp.GP -org.dllearner.algorithms.DBpediaNavigationSuggestor \ No newline at end of file +org.dllearner.algorithms.DBpediaNavigationSuggestor +org.dllearner.algorithms.SimpleSuggestionLearningAlgorithm This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-09-09 07:34:31
|
Revision: 1180 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1180&view=rev Author: heeroyuy Date: 2008-09-09 07:34:25 +0000 (Tue, 09 Sep 2008) Log Message: ----------- warnings fixed Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 @@ -786,7 +786,10 @@ public boolean getAlreadyLearned() { return alreadyLearned; } - + /** + * This Method returns the URI of the currently loaded Ontology. + * @return URI Ontology URI + */ public URI getURI() { return editor.getOWLModelManager().getActiveOntology().getURI(); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 @@ -91,7 +91,13 @@ handleVerifyEditorContents(); } }; - + /** + * Konstruktor of the Class Description Editor with integrated DL-Learner Tab. + * @param editorKit OWLEditorKit + * @param description OWLDescription + * @param frame OWLFrame + * @param label String + */ public OWLClassDescriptionEditorWithDLLearnerTab(OWLEditorKit editorKit, OWLDescription description, OWLFrame<OWLClass> frame, String label) { this.editorKit = editorKit; @@ -160,7 +166,10 @@ } return validated; } - + /** + * Returns Editor Component. + * @return JComponent + */ public JComponent getInlineEditorComponent() { // Same as general editor component return editingComponent; @@ -174,7 +183,9 @@ public JComponent getEditorComponent() { return editingComponent; } - + /** + * Removes everything after closing the Class Description Editor. + */ public void clear() { dllearner.unsetEverything(); dllearner.makeView(); @@ -182,7 +193,10 @@ // initialDescription = null; editor.setText(""); } - + /** + * returns the edited Components. + * @return Set of OWLDescriptions + */ public Set<OWLDescription> getEditedObjects() { if (tabbedPane.getSelectedComponent() == classSelectorPanel) { return new HashSet<OWLDescription>(classSelectorPanel @@ -216,7 +230,9 @@ return null; } } - + /** + * Removes everything after protege is closed. + */ public void dispose() { if (classSelectorPanel != null) { classSelectorPanel.dispose(); @@ -232,14 +248,22 @@ private OWLDataFactory getDataFactory() { return editorKit.getOWLModelManager().getOWLDataFactory(); } - + /** + * Adds a Status Changed Listener to all components of the + * class description editor. + * @param listener InputVerificationStatusChangedListener + */ public void addStatusChangedListener( InputVerificationStatusChangedListener listener) { listeners.add(listener); editor.addStatusChangedListener(listener); listener.verifiedStatusChanged(isValidated()); } - + /** + * Removes the Status Changed Listener from all components of the + * class description editor. + * @param listener InputVerificationStatusChangedListener + */ public void removeStatusChangedListener( InputVerificationStatusChangedListener listener) { listeners.remove(listener); @@ -563,7 +587,11 @@ } } - + /** + * This is the class for the object restriktion creator panel. + * + * + */ private class ObjectRestrictionCreatorPanel extends JPanel { @@ -703,7 +731,11 @@ classSelectorPanel.dispose(); } } - + /** + * This is the abstract class of the restriction creator. + * + * + */ private abstract class RestrictionCreator { private String name; @@ -719,7 +751,11 @@ abstract void createRestrictions(Set<OWLObjectProperty> properties, Set<OWLDescription> fillers, Set<OWLDescription> result); } - + /** + * This is the abstract class for the cardinality restriction creator. + * + * + */ private abstract class CardinalityRestrictionCreator extends RestrictionCreator { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 @@ -59,7 +59,11 @@ private boolean inferredEquivalentClasses = true; private OWLFrame<OWLClass> frame; - + /** + * Constructor of the OWLEquivalentClassesAxiomFrameSection. + * @param editorKit OWLEditorKit + * @param frame OWLFrame + */ public OWLEquivalentClassesAxiomFrameSection(OWLEditorKit editorKit, OWLFrame<OWLClass> frame) { super(editorKit, LABEL, frame); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 @@ -56,7 +56,11 @@ private Set<OWLDescription> added = new HashSet<OWLDescription>(); private OWLFrame<OWLClass> frame; - + /** + * Constructor of the OWLSubClassesAxiomFrameSection. + * @param editorKit OWLEditorKit + * @param frame OWLFrame + */ public OWLSubClassAxiomFrameSection(OWLEditorKit editorKit, OWLFrame<OWLClass> frame) { super(editorKit, LABEL, frame); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 @@ -67,4 +67,4 @@ public void disposeView() { list.dispose(); } -} \ No newline at end of file +} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2008-09-08 17:59:49 UTC (rev 1179) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2008-09-09 07:34:25 UTC (rev 1180) @@ -2,7 +2,7 @@ * 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 @@ -99,9 +99,5 @@ public void addSuggestPanelMouseListener(ActionHandler action) { descriptions.addMouseListener(action); - } - - - - -} \ 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: <ku...@us...> - 2008-09-08 17:59:52
|
Revision: 1179 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1179&view=rev Author: kurzum Date: 2008-09-08 17:59:49 +0000 (Mon, 08 Sep 2008) Log Message: ----------- more small changes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/examples/KRKModular.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java Modified: trunk/src/dl-learner/org/dllearner/examples/KRKModular.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/KRKModular.java 2008-09-08 17:26:27 UTC (rev 1178) +++ trunk/src/dl-learner/org/dllearner/examples/KRKModular.java 2008-09-08 17:59:49 UTC (rev 1179) @@ -23,6 +23,7 @@ import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; +import org.dllearner.core.configurators.ComponentFactory; import org.dllearner.core.owl.ClassAssertionAxiom; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; @@ -485,8 +486,10 @@ KBFile kbFile = new KBFile(this.kb); Set<KnowledgeSource> ks = new HashSet<KnowledgeSource>(); ks.add(kbFile); - reasoner = new OWLAPIReasoner(ks); - ((OWLAPIReasoner)reasoner).setReasonerType("fact"); + + reasoner = ComponentFactory.getOWLAPIReasoner(ks); + + ((OWLAPIReasoner)reasoner).getConfigurator().setReasonerType("fact"); try{ reasoner.init(); }catch (Exception e) {e.printStackTrace();} Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-08 17:26:27 UTC (rev 1178) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-08 17:59:49 UTC (rev 1179) @@ -27,6 +27,7 @@ import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; import org.dllearner.core.config.ConfigOption; +import org.dllearner.core.configurators.PosNegDefinitionLPConfigurator; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.utilities.Helper; @@ -46,15 +47,22 @@ */ public class PosNegDefinitionLP extends PosNegLP implements DefinitionLP { + private PosNegDefinitionLPConfigurator configurator; + public PosNegDefinitionLPConfigurator getConfigurator() { + return configurator; + } + public PosNegDefinitionLP(ReasoningService reasoningService) { super(reasoningService); + this.configurator = new PosNegDefinitionLPConfigurator(this); } public PosNegDefinitionLP(ReasoningService reasoningService, SortedSet<Individual> positiveExamples, SortedSet<Individual> negativeExamples) { super(reasoningService); this.positiveExamples = positiveExamples; this.negativeExamples = negativeExamples; + this.configurator = new PosNegDefinitionLPConfigurator(this); } /* Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-08 17:26:27 UTC (rev 1178) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-08 17:59:49 UTC (rev 1179) @@ -626,9 +626,9 @@ rc.releaseKB(); } - public void setReasonerType(String type){ + /*public void setReasonerType(String type){ configurator.setReasonerType(type); - } + }*/ @Override Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-08 17:26:27 UTC (rev 1178) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-08 17:59:49 UTC (rev 1179) @@ -945,9 +945,9 @@ return owlAPIOntologies; } - public void setReasonerType(String type){ + /*public void setReasonerType(String type){ configurator.setReasonerType(type); - } + }*/ @Override public boolean hasDatatypeSupport() { Modified: trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-09-08 17:26:27 UTC (rev 1178) +++ trunk/src/dl-learner/org/dllearner/scripts/DumbLPFinder.java 2008-09-08 17:59:49 UTC (rev 1179) @@ -85,6 +85,7 @@ allIndividuals.addAll( reasoningService.getIndividuals()); reasoningService = null; + ComponentManager.getInstance().freeAllComponents(); int count = 1; while(count<10000){ Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java 2008-09-08 17:26:27 UTC (rev 1178) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/ReasoningServiceFactory.java 2008-09-08 17:59:49 UTC (rev 1179) @@ -81,11 +81,11 @@ break; case OWLAPIREASONERFACT: rc = cm.reasoner(OWLAPIReasoner.class, ks); - ((OWLAPIReasoner)rc).setReasonerType("fact"); + ((OWLAPIReasoner)rc).getConfigurator().setReasonerType("fact"); break; case OWLAPIREASONERPELLET: rc = cm.reasoner(OWLAPIReasoner.class, ks); - ((OWLAPIReasoner)rc).setReasonerType("pellet"); + ((OWLAPIReasoner)rc).getConfigurator().setReasonerType("pellet"); break; default: rc = cm.reasoner(FastInstanceChecker.class, ks); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-08 17:26:35
|
Revision: 1178 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1178&view=rev Author: kurzum Date: 2008-09-08 17:26:27 +0000 (Mon, 08 Sep 2008) Log Message: ----------- some fixes Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java trunk/src/dl-learner/org/dllearner/scripts/NewSample.java Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -77,7 +77,7 @@ * @param knowledgeSource see KnowledgeSource * @return a component ready for initialization DIGReasoner **/ -public static DIGReasoner getDIGReasoner(KnowledgeSource knowledgeSource) { +public static DIGReasoner getDIGReasoner(Set<KnowledgeSource> knowledgeSource) { return DIGReasonerConfigurator.getDIGReasoner(knowledgeSource); } @@ -85,7 +85,7 @@ * @param knowledgeSource see KnowledgeSource * @return a component ready for initialization FastInstanceChecker **/ -public static FastInstanceChecker getFastInstanceChecker(KnowledgeSource knowledgeSource) { +public static FastInstanceChecker getFastInstanceChecker(Set<KnowledgeSource> knowledgeSource) { return FastInstanceCheckerConfigurator.getFastInstanceChecker(knowledgeSource); } @@ -93,7 +93,7 @@ * @param knowledgeSource see KnowledgeSource * @return a component ready for initialization FastRetrievalReasoner **/ -public static FastRetrievalReasoner getFastRetrievalReasoner(KnowledgeSource knowledgeSource) { +public static FastRetrievalReasoner getFastRetrievalReasoner(Set<KnowledgeSource> knowledgeSource) { return FastRetrievalReasonerConfigurator.getFastRetrievalReasoner(knowledgeSource); } @@ -101,7 +101,7 @@ * @param knowledgeSource see KnowledgeSource * @return a component ready for initialization OWLAPIReasoner **/ -public static OWLAPIReasoner getOWLAPIReasoner(KnowledgeSource knowledgeSource) { +public static OWLAPIReasoner getOWLAPIReasoner(Set<KnowledgeSource> knowledgeSource) { return OWLAPIReasonerConfigurator.getOWLAPIReasoner(knowledgeSource); } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -20,6 +20,7 @@ package org.dllearner.core.configurators; +import java.util.Set; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.reasoning.DIGReasoner; @@ -45,7 +46,7 @@ /** * @return DIGReasoner **/ -public static DIGReasoner getDIGReasoner(KnowledgeSource knowledgeSource) { +public static DIGReasoner getDIGReasoner(Set<KnowledgeSource> knowledgeSource) { DIGReasoner component = ComponentManager.getInstance().reasoner(DIGReasoner.class, knowledgeSource); return component; } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -20,6 +20,7 @@ package org.dllearner.core.configurators; +import java.util.Set; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.reasoning.FastInstanceChecker; @@ -45,7 +46,7 @@ /** * @return FastInstanceChecker **/ -public static FastInstanceChecker getFastInstanceChecker(KnowledgeSource knowledgeSource) { +public static FastInstanceChecker getFastInstanceChecker(Set<KnowledgeSource> knowledgeSource) { FastInstanceChecker component = ComponentManager.getInstance().reasoner(FastInstanceChecker.class, knowledgeSource); return component; } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -20,6 +20,7 @@ package org.dllearner.core.configurators; +import java.util.Set; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.reasoning.FastRetrievalReasoner; @@ -45,7 +46,7 @@ /** * @return FastRetrievalReasoner **/ -public static FastRetrievalReasoner getFastRetrievalReasoner(KnowledgeSource knowledgeSource) { +public static FastRetrievalReasoner getFastRetrievalReasoner(Set<KnowledgeSource> knowledgeSource) { FastRetrievalReasoner component = ComponentManager.getInstance().reasoner(FastRetrievalReasoner.class, knowledgeSource); return component; } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -20,6 +20,7 @@ package org.dllearner.core.configurators; +import java.util.Set; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.reasoning.OWLAPIReasoner; @@ -45,7 +46,7 @@ /** * @return OWLAPIReasoner **/ -public static OWLAPIReasoner getOWLAPIReasoner(KnowledgeSource knowledgeSource) { +public static OWLAPIReasoner getOWLAPIReasoner(Set<KnowledgeSource> knowledgeSource) { OWLAPIReasoner component = ComponentManager.getInstance().reasoner(OWLAPIReasoner.class, knowledgeSource); return component; } Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -74,16 +74,19 @@ public class SparqlKnowledgeSource extends KnowledgeSource { // RBC - static final boolean debug = false; + private static final boolean debug = false; // tupleaquisitor - static final boolean debugUseImprovedTupleAquisitor = debug && false; // switches + private static final boolean debugUseImprovedTupleAquisitor = debug && false; // switches // sysex - static final boolean debugExitAfterExtraction = debug && false; // switches + private static final boolean debugExitAfterExtraction = debug && false; // switches private SparqlKnowledgeSourceConfigurator configurator; + /** + * @return the configurator for this Knowledgesource + */ public SparqlKnowledgeSourceConfigurator getConfigurator() { return configurator; } @@ -93,7 +96,7 @@ } // ConfigOptions - public URL url; + private URL url; private String format = "N-TRIPLES"; @@ -101,7 +104,7 @@ private URL dumpFile; - SparqlEndpoint endpoint = null; + private SparqlEndpoint endpoint = null; // received ontology as array, used if format=Array(an element of the // array consists of the subject, predicate and object separated by '<' @@ -113,6 +116,7 @@ // mainly used for statistic private int nrOfExtractedTriples = 0; + public static String getName() { return "SPARQL Endpoint"; } @@ -193,9 +197,9 @@ options.add(CommonConfigOptions.getVerbosityOption()); options.add(new StringSetConfigOption("defaultGraphURIs", - "a list of all default Graph URIs", new TreeSet<String> (), false, true)); + "a list of all default Graph URIs", new TreeSet<String>(), false, true)); options.add(new StringSetConfigOption("namedGraphURIs", - "a list of all named Graph URIs", new TreeSet<String> (), false, true)); + "a list of all named Graph URIs", new TreeSet<String>(), false, true)); return options; } @@ -203,7 +207,7 @@ * @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry) */ @Override - @SuppressWarnings( { "unchecked" }) + @SuppressWarnings({ "unchecked" }) public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { //TODO remove this function @@ -311,11 +315,12 @@ */ @Override public String toDIG(URI kbURI) { - if (format.equals("N-TRIPLES")) + if (format.equals("N-TRIPLES")){ return JenaOWLDIGConverter.getTellsString(dumpFile, OntologyFormat.N_TRIPLES, kbURI); - else + }else { return DIGConverter.getDIGString(kb, kbURI).toString(); + } } /* @@ -332,8 +337,16 @@ throw new OntologyFormatUnsupportedException("export", format); } + /** + * @return the URL of the used sparql endpoint + */ public URL getURL() { - return url; + if(url == null && endpoint!=null){ + return endpoint.getURL(); + } + else{ + return url; + } } public String[] getOntArray() { @@ -366,11 +379,12 @@ // get Options for endpoints - if (configurator.getUseCache()) + if (configurator.getUseCache()){ return new SPARQLTasks(new Cache(configurator.getCacheDir()), getSparqlEndpoint()); - else + }else { return new SPARQLTasks(getSparqlEndpoint()); + } } public SparqlQueryMaker getSparqlQueryMaker() { Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegDefinitionLP.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -46,8 +46,7 @@ */ public class PosNegDefinitionLP extends PosNegLP implements DefinitionLP { - - + public PosNegDefinitionLP(ReasoningService reasoningService) { super(reasoningService); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -39,6 +39,7 @@ import org.dllearner.core.config.ConfigOption; import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; +import org.dllearner.core.configurators.ComponentFactory; import org.dllearner.core.configurators.FastInstanceCheckerConfigurator; import org.dllearner.core.owl.BooleanValueRestriction; import org.dllearner.core.owl.DataRange; @@ -90,8 +91,6 @@ private boolean defaultNegation = true; - private String reasonerType = "pellet"; - private FastInstanceCheckerConfigurator configurator; public FastInstanceCheckerConfigurator getConfigurator (){ return configurator; @@ -128,12 +127,13 @@ public FastInstanceChecker(Set<KnowledgeSource> sources) { this.sources = sources; + this.configurator = new FastInstanceCheckerConfigurator(this); } public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet to dematerialize", "pellet"); + StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet to dematerialize", "pellet", false, true); type.setAllowedValues(new String[] {"fact", "pellet"}); // closure option? see: // http://owlapi.svn.sourceforge.net/viewvc/owlapi/owl1_1/trunk/tutorial/src/main/java/uk/ac/manchester/owl/tutorial/examples/ClosureAxiomsExample.java?view=markup @@ -148,9 +148,6 @@ */ @Override public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { - String name = entry.getOptionName(); - if(name.equals("reasonerType")) - reasonerType = (String) entry.getValue(); } public static String getName() { @@ -165,8 +162,9 @@ */ @Override public void init() throws ComponentInitException { - rc = new OWLAPIReasoner(sources); - rc.setReasonerType(reasonerType); + //rc = new OWLAPIReasoner(sources); + rc = ComponentFactory.getOWLAPIReasoner(sources); + rc.getConfigurator().setReasonerType(configurator.getReasonerType()); rc.init(); try { @@ -629,7 +627,7 @@ } public void setReasonerType(String type){ - reasonerType=type; + configurator.setReasonerType(type); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -103,7 +103,7 @@ // private static Logger logger = Logger // .getLogger(OWLAPIReasoner.class); - private String reasonerType = "pellet"; + //private String reasonerType = "pellet"; private OWLAPIReasonerConfigurator configurator; public OWLAPIReasonerConfigurator getConfigurator(){ return configurator; @@ -151,7 +151,7 @@ public static Collection<ConfigOption<?>> createConfigOptions() { Collection<ConfigOption<?>> options = new LinkedList<ConfigOption<?>>(); - StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet, which means \"pellet\" or \"fact\"", "pellet"); + StringConfigOption type = new StringConfigOption("reasonerType", "FaCT++ or Pellet, which means \"pellet\" or \"fact\"", "pellet", false, true); type.setAllowedValues(new String[] {"fact", "pellet"}); // closure option? see: // http://owlapi.svn.sourceforge.net/viewvc/owlapi/owl1_1/trunk/tutorial/src/main/java/uk/ac/manchester/owl/tutorial/examples/ClosureAxiomsExample.java?view=markup @@ -164,9 +164,7 @@ */ @Override public <T> void applyConfigEntry(ConfigEntry<T> entry) throws InvalidConfigOptionValueException { - String name = entry.getOptionName(); - if(name.equals("reasonerType")) - reasonerType = (String) entry.getValue(); + } @Override @@ -269,7 +267,7 @@ } // create actual reasoner - if(reasonerType.equals("fact")) { + if(configurator.getReasonerType().equals("fact")) { try { reasoner = new uk.ac.manchester.cs.factplusplus.owlapi.Reasoner(manager); } catch (Exception e) { @@ -388,7 +386,7 @@ * @see org.dllearner.core.Reasoner#getReasonerType() */ public ReasonerType getReasonerType() { - if(reasonerType.equals("FaCT++")) + if(configurator.getReasonerType().equals("fact")) return ReasonerType.FACT; else return ReasonerType.PELLET; @@ -948,7 +946,7 @@ } public void setReasonerType(String type){ - reasonerType=type; + configurator.setReasonerType(type); } @Override Modified: trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -26,6 +26,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -148,7 +149,8 @@ ConfigJavaGenerator c = new ConfigJavaGenerator(component, "reasoner"); c.imports.add("org.dllearner.core.KnowledgeSource"); - c.additionalMandatoryVars.put("KnowledgeSource knowledgeSource", + c.imports.add(Set.class.getCanonicalName()); + c.additionalMandatoryVars.put("Set<KnowledgeSource> knowledgeSource", "knowledgeSource"); c.makeConfigurator(); @@ -338,9 +340,13 @@ ret += applyConf; ret += "return component;\n}\n"; + return ret; } + + + private String makeComponentFactoryMethods(String comments) { Map<String, String> parametersWithType = new LinkedHashMap<String, String>(); Modified: trunk/src/dl-learner/org/dllearner/scripts/NewSample.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-08 15:43:39 UTC (rev 1177) +++ trunk/src/dl-learner/org/dllearner/scripts/NewSample.java 2008-09-08 17:26:27 UTC (rev 1178) @@ -20,7 +20,9 @@ import java.io.File; import java.io.IOException; import java.text.DecimalFormat; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -33,6 +35,7 @@ import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasoningService; import org.dllearner.core.configurators.ComponentFactory; @@ -119,9 +122,10 @@ String fileURL = new File(owlFile).toURI().toString(); OWLFile ks = ComponentFactory.getOWLFile( fileURL); - + Set<KnowledgeSource> tmp = new HashSet<KnowledgeSource>(); + tmp.add(ks); // reasoner - FastInstanceChecker f = ComponentFactory.getFastInstanceChecker( ks); + FastInstanceChecker f = ComponentFactory.getFastInstanceChecker(tmp); ReasoningService rs = cm.reasoningService(f); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-09-08 15:43:43
|
Revision: 1177 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1177&view=rev Author: jenslehmann Date: 2008-09-08 15:43:39 +0000 (Mon, 08 Sep 2008) Log Message: ----------- more GUI errors fixed Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java trunk/src/dl-learner/org/dllearner/gui/Config.java trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java Modified: trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/AbstractWidgetPanel.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -23,7 +23,9 @@ import javax.swing.JPanel; import org.dllearner.core.Component; +import org.dllearner.core.config.ConfigEntry; import org.dllearner.core.config.ConfigOption; +import org.dllearner.core.config.InvalidConfigOptionValueException; /** * Abstract superclass of all widgets. Each widget has an associated component and configuration option, @@ -65,9 +67,16 @@ // subclasses should call this method if a configuration option has changed public void fireValueChanged(T value) { - // TODO notify config that an option has changed - // (component manager should be accessed in config only, such that we can intelligently decide which - // panels to initialise) + ConfigEntry<T> entry = null; + try { + entry = new ConfigEntry<T>(configOption, value); + } catch (InvalidConfigOptionValueException e) { + // TODO display a message on the status bar (where the init + // has been before) + e.printStackTrace(); + } + // notify config that a value has changed -> it decides what to do + config.applyConfigEntry(component, entry); } // subclasses should use this method to build the graphical representation of the widgets Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -21,6 +21,7 @@ package org.dllearner.gui; import org.dllearner.core.Component; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningProblem; @@ -38,6 +39,7 @@ * Reasoner, ReasoningService, LearningProblem, LearningAlgorithm; also inits of * these components. * + * @author Jens Lehmann * @author Tilo Hielscher */ public class Config { @@ -51,15 +53,26 @@ private LearningProblem lp; private LearningAlgorithm la; - private boolean[] isInit = new boolean[4]; - // stores whether a component needs to be initialised ("previous" components have changed configuration values) -// private boolean[] needsInit = new boolean[4]; + // stores which components need to be initialised (either + // because they have not been initialiased or previous components + // have changed configuration options, which require initialisation) + private boolean[] needsInit = new boolean[4]; // learning algorithm status - private Boolean threadIsRunning = false; + private boolean threadIsRunning = false; private Long algorithmRunStartTime = null; private Long algorithmRunStopTime = null; + private StartGUI gui; + + public Config(StartGUI gui) { + this.gui = gui; + // none of the components is initialised + for(int i=0; i<4; i++) { + needsInit[i] = true; + } + } + /** * Get ComponentManager. * @@ -74,7 +87,7 @@ * * @return true, if url was set otherwise false */ - public Boolean isSetURL() { + public boolean isSetURL() { if (cm.getConfigOptionValue(source, "url") != null || cm.getConfigOptionValue(source, "filename") != null) return true; @@ -97,7 +110,7 @@ * @return KnowledgeSource */ public KnowledgeSource getKnowledgeSource() { - return this.source; + return source; } /** @@ -199,78 +212,82 @@ return la; } + public boolean tabNeedsInit(int tabIndex) { + return needsInit[tabIndex]; + } + /** * KnowledgeSource.init has run? * * @return true, if init was made, false if not */ - public boolean isInitKnowledgeSource() { - return isInit[0]; + public boolean needsInitKnowledgeSource() { + return needsInit[0]; } /** * Set true if you run KnowwledgeSource.init. The inits from other tabs * behind will automatic set to false. */ - public void setInitKnowledgeSource(Boolean is) { - isInit[0] = is; - for (int i = 1; i < 4; i++) - isInit[i] = false; - } +// public void setInitKnowledgeSource(Boolean is) { +// needsInit[0] = is; +// for (int i = 1; i < 4; i++) +// needsInit[i] = false; +// } /** * Reasoner.init has run? * * @return true, if init was made, false if not */ - public boolean isInitReasoner() { - return isInit[1]; + public boolean needsInitReasoner() { + return needsInit[1]; } /** * Set true if you run Reasoner.init. The inits from other tabs behind will * automatic set to false. */ - public void setInitReasoner(Boolean is) { - isInit[1] = is; - for (int i = 2; i < 4; i++) - isInit[i] = false; - } +// public void setInitReasoner(Boolean is) { +// needsInit[1] = is; +// for (int i = 2; i < 4; i++) +// needsInit[i] = false; +// } /** * LearningProblem.init has run? * * @return true, if init was made, false if not */ - public boolean isInitLearningProblem() { - return isInit[2]; + public boolean needsInitLearningProblem() { + return needsInit[2]; } /** * Set true if you run LearningProblem.init. The inits from other tabs * behind will automatic set to false. */ - public void setInitLearningProblem(Boolean is) { - isInit[2] = is; - for (int i = 3; i < 4; i++) - isInit[i] = false; - } +// public void setInitLearningProblem(Boolean is) { +// needsInit[2] = is; +// for (int i = 3; i < 4; i++) +// needsInit[i] = false; +// } /** * LearningAlgorithm.init() has run? * * @return true, if init was made, false if not */ - public boolean isInitLearningAlgorithm() { - return isInit[3]; + public boolean needsInitLearningAlgorithm() { + return needsInit[3]; } /** * set true if you run LearningAlgorithm.init */ - public void setInitLearningAlgorithm(Boolean is) { - isInit[3] = is; - } +// public void setInitLearningAlgorithm(Boolean is) { +// needsInit[3] = is; +// } /** * Set true if you start the algorithm. @@ -333,19 +350,56 @@ rs = null; lp = null; la = null; - isInit = new boolean[4]; + needsInit = new boolean[4]; threadIsRunning = false; algorithmRunStartTime = null; algorithmRunStopTime = null; } + // init the specified component and record which ones where initialised + public void init(int tabIndex) { + try { + if(tabIndex==0) { + source.init(); + } else if(tabIndex==1) { + reasoner.init(); + } else if(tabIndex==2) { + lp.init(); + } else if(tabIndex == 3) { + la.init(); + } + } catch (ComponentInitException e) { + // TODO display message in status bar + e.printStackTrace(); + } + + needsInit[tabIndex] = false; + System.out.println("component " + tabIndex + " initialised."); + } + // applies a configuration option - used as delegate method, which invalidates components public <T> void applyConfigEntry(Component component, ConfigEntry<T> entry) { cm.applyConfigEntry(component, entry); // invalidate components + if(component instanceof KnowledgeSource) { + needsInit[0] = true; + needsInit[1] = true; + needsInit[2] = true; + needsInit[3] = true; + } else if(component instanceof ReasonerComponent) { + needsInit[1] = true; + needsInit[2] = true; + needsInit[3] = true; + } else if(component instanceof LearningProblem) { + needsInit[2] = true; + needsInit[3] = true; + } else if(component instanceof LearningAlgorithm) { + needsInit[3] = true; + } + gui.updateTabColors(); } - // delegate method for getting + // delegate method for getting config option values public <T> T getConfigOptionValue(Component component, ConfigOption<T> option) { return cm.getConfigOptionValue(component, option); } Modified: trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/ConfigLoad.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -99,7 +99,7 @@ if (config.getKnowledgeSource() != null && config.isSetURL()) { try { config.getKnowledgeSource().init(); - config.setInitKnowledgeSource(true); +// config.setInitKnowledgeSource(true); System.out.println("init KnowledgeSource"); } catch (ComponentInitException e) { e.printStackTrace(); @@ -121,7 +121,7 @@ config.setReasoningService(config.getComponentManager().reasoningService( config.getReasoner())); System.out.println("init ReasoningService"); - config.setInitReasoner(true); +// config.setInitReasoner(true); startGUI.updateTabColors(); } catch (ComponentInitException e) { e.printStackTrace(); @@ -144,7 +144,7 @@ if (config.getReasoner() != null && config.getLearningProblem() != null) { try { config.getLearningProblem().init(); - config.setInitLearningProblem(true); +// config.setInitLearningProblem(true); System.out.println("init LearningProblem"); startGUI.updateTabColors(); } catch (ComponentInitException e) { @@ -168,7 +168,7 @@ if (config.getLearningProblem() != null) { try { config.getLearningAlgorithm().init(); - config.setInitLearningAlgorithm(true); +// config.setInitLearningAlgorithm(true); System.out.println("init LearningAlgorithm"); startGUI.updateTabColors(); } catch (ComponentInitException e) { Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -125,7 +125,7 @@ public void setSource() { config.setKnowledgeSource(config.getComponentManager().knowledgeSource( selectableSources.get(choosenClassIndex))); - config.setInitKnowledgeSource(false); +// config.setInitKnowledgeSource(false); updateAll(); } @@ -137,7 +137,7 @@ if (config.getKnowledgeSource() != null && config.isSetURL()) { try { config.getKnowledgeSource().init(); - config.setInitKnowledgeSource(true); +// config.setInitKnowledgeSource(true); System.out.println("init KnowledgeSource"); startGUI.updateTabColors(); } catch (ComponentInitException e) { @@ -179,7 +179,7 @@ * make init-button red if you have to click */ public void updateInitButtonColor() { - if (!config.isInitKnowledgeSource()) { + if (!config.needsInitKnowledgeSource()) { initButton.setForeground(Color.RED); } else initButton.setForeground(Color.BLACK); Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -106,15 +106,15 @@ // read selected Class if (choosenClassIndex != cb.getSelectedIndex()) { choosenClassIndex = cb.getSelectedIndex(); - config.setInitLearningAlgorithm(false); - init(); +// config.setInitLearningAlgorithm(false); +// init(); } if (e.getSource() == autoInitButton) setLearningAlgorithm(); - if (e.getSource() == initButton) - init(); +// if (e.getSource() == initButton) +// init(); } /** @@ -136,6 +136,7 @@ /** * after this, next tab can be used */ + /* public void init() { setLearningAlgorithm(); if (config.getLearningProblem() != null) { @@ -148,7 +149,7 @@ System.out.println("init LearningAlgorithm"); startGUI.updateTabColors(); } - } + }*/ /** * updateAll @@ -176,16 +177,14 @@ * update OptionPanel with new selection */ public void updateOptionPanel() { - // update OptionPanel - // TODO implement properly !! -// optionPanel.update(config.getLearningAlgorithm(), learner.get(choosenClassIndex)); + optionPanel.update(config.getLearningAlgorithm()); } /** * make init-button red if you have to click */ public void updateInitButtonColor() { - if (!config.isInitLearningAlgorithm()) { + if (!config.needsInitLearningAlgorithm()) { initButton.setForeground(Color.RED); } else initButton.setForeground(Color.BLACK); Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -25,9 +25,11 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.List; -import javax.swing.*; -import org.dllearner.core.ComponentInitException; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JPanel; + import org.dllearner.core.LearningProblem; /** @@ -42,7 +44,7 @@ private Config config; private StartGUI startGUI; - private List<Class<? extends LearningProblem>> problem; + private List<Class<? extends LearningProblem>> lpClasses; private String[] lpBoxItems = {}; private JComboBox cb = new JComboBox(lpBoxItems); private JPanel choosePanel = new JPanel(); @@ -56,12 +58,8 @@ this.config = config; this.startGUI = startGUI; - problem = config.getComponentManager().getLearningProblems(); + lpClasses = config.getComponentManager().getLearningProblems(); - initButton = new JButton("Init LearningProblem"); - initButton.addActionListener(this); - // initPanel.add(initButton); - initButton.setEnabled(true); setButton = new JButton("Set"); setButton.addActionListener(this); choosePanel.add(cb); @@ -69,14 +67,14 @@ cb.addActionListener(this); // add into comboBox - for (int i = 0; i < problem.size(); i++) { - cb.addItem(config.getComponentManager().getComponentName(problem.get(i))); + for (int i = 0; i < lpClasses.size(); i++) { + cb.addItem(config.getComponentManager().getComponentName(lpClasses.get(i))); } // read choosen LearningProblem choosenClassIndex = cb.getSelectedIndex(); - LearningProblem lp = config.newLearningProblem(problem.get(choosenClassIndex)); + LearningProblem lp = config.newLearningProblem(lpClasses.get(choosenClassIndex)); optionPanel = new OptionPanel(config, lp); add(choosePanel, BorderLayout.PAGE_START); @@ -85,31 +83,31 @@ choosenClassIndex = cb.getSelectedIndex(); // setLearningProblem(); - updateInitButtonColor(); +// updateInitButtonColor(); } public void actionPerformed(ActionEvent e) { // read selected LearningProblemClass if (choosenClassIndex != cb.getSelectedIndex()) { this.choosenClassIndex = cb.getSelectedIndex(); - config.setInitLearningProblem(false); - init(); +// config.setInitLearningProblem(false); +// init(); } if (e.getSource() == setButton) setLearningProblem(); - if (e.getSource() == initButton) - init(); +// if (e.getSource() == initButton) +// init(); } /** * after this, you can change widgets */ private void setLearningProblem() { - if (config.isInitReasoner()) { + if (config.needsInitReasoner()) { config.setLearningProblem(config.getComponentManager().learningProblem( - problem.get(choosenClassIndex), config.getReasoningService())); + lpClasses.get(choosenClassIndex), config.getReasoningService())); startGUI.updateTabColors(); updateOptionPanel(); } @@ -118,6 +116,7 @@ /** * after this, next tab can be used */ + /* public void init() { setLearningProblem(); if (config.getReasoner() != null && config.getLearningProblem() != null @@ -131,7 +130,7 @@ e.printStackTrace(); } } - } + }*/ /** * updateAll @@ -139,7 +138,7 @@ public void updateAll() { updateComboBox(); updateOptionPanel(); - updateInitButtonColor(); +// updateInitButtonColor(); } /** @@ -147,7 +146,7 @@ */ public void updateComboBox() { if (config.getLearningProblem() != null) - for (int i = 0; i < problem.size(); i++) + for (int i = 0; i < lpClasses.size(); i++) if (config.getLearningProblem().getClass().equals( config.getComponentManager().getLearningProblems().get(i))) { cb.setSelectedIndex(i); @@ -159,18 +158,17 @@ * update OptionPanel with new selection */ private void updateOptionPanel() { - // update OptionPanel -// TODO: implement properly !! -// optionPanel.update(config.getLearningProblem(), problem.get(choosenClassIndex)); + optionPanel.update(config.getLearningProblem()); } /** * make init-button red if you have to click */ + /* public void updateInitButtonColor() { - if (!config.isInitLearningProblem()) { + if (!config.needsInitLearningProblem()) { initButton.setForeground(Color.RED); } else initButton.setForeground(Color.BLACK); - } + }*/ } Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -99,36 +99,37 @@ // choosenClassIndex = cb.getSelectedIndex(); if (choosenClassIndex != cb.getSelectedIndex()) { choosenClassIndex = cb.getSelectedIndex(); - config.setInitReasoner(false); - init(); +// config.setInitReasoner(false); +// init(); } if (e.getSource() == setButton) { - config.setInitReasoner(false); +// config.setInitReasoner(false); setReasoner(); } - if (e.getSource() == initButton) - init(); +// if (e.getSource() == initButton) +// init(); } /** * after this, you can change widgets */ public void setReasoner() { - if (config.isInitKnowledgeSource()) { + if (config.needsInitKnowledgeSource()) { config.setReasoner(config.getComponentManager().reasoner( reasoner.get(choosenClassIndex), config.getKnowledgeSource())); updateOptionPanel(); - startGUI.updateTabColors(); - config.setInitReasoner(false); - updateInitButtonColor(); +// startGUI.updateTabColors(); +// config.setInitReasoner(false); +// updateInitButtonColor(); } } /** * after this, next tab can be used */ + /* public void init() { setReasoner(); if (config.getKnowledgeSource() != null && config.getReasoner() != null) { @@ -146,7 +147,7 @@ } } - } + }*/ /** * updateAll @@ -174,15 +175,14 @@ * update OptionPanel with new selection */ public void updateOptionPanel() { -// TODO: implement properly !! -// optionPanel.update(config.getReasoner(), reasoner.get(choosenClassIndex)); + optionPanel.update(config.getReasoner()); } /** * make init-button red if you have to click */ public void updateInitButtonColor() { - if (!config.isInitReasoner()) { + if (!config.needsInitReasoner()) { initButton.setForeground(Color.RED); } else initButton.setForeground(Color.BLACK); Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -23,6 +23,7 @@ import javax.swing.event.*; import java.awt.Color; +import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -30,6 +31,7 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.SimpleLayout; +import org.dllearner.core.ComponentInitException; import java.io.File; import java.io.PrintWriter; @@ -37,7 +39,8 @@ import javax.swing.filechooser.FileFilter; /** - * This class builds the basic GUI elements and is used to start the DL-Learner GUI. + * This class builds the basic GUI elements and is used to start the DL-Learner + * GUI. * * @author Tilo Hielscher * @author Jens Lehmann @@ -48,7 +51,7 @@ private JTabbedPane tabPane = new JTabbedPane(); - private Config config = new Config(); + private Config config = new Config(this); private ConfigLoad configLoad = new ConfigLoad(config, this); private ConfigSave configSave = new ConfigSave(config, this); @@ -77,7 +80,7 @@ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationByPlatform(true); this.setSize(800, 600); - + // set icon if (this.getClass().getResource("icon.gif") != null) setIconImage(java.awt.Toolkit.getDefaultToolkit().getImage( @@ -116,13 +119,30 @@ tabPane.addChangeListener(new ChangeListener() { // This method is called whenever the selected tab changes public void stateChanged(ChangeEvent evt) { - System.out.println(evt.getSource()); - if(evt.getSource().equals(tabPane)) { -// tabPane.get -// System.out.println("Tab 2 clicked"); -// System.exit(0); + if (evt.getSource().equals(tabPane)) { + + int index = tabPane.getSelectedIndex(); +// System.out.println(index); + + // check whether we need to initialise components + if (index != 0 && config.tabNeedsInit(index - 1)) { + for (int i = 0; i < index; i++) { + config.init(i); + } + } + + updateTabColors(); + + // TODO: handle init code here => whenever a tab + // is selected, we have to determine whether it + // and the tabs before need to be initialised + + Component c = tabPane.getSelectedComponent(); + if (c == tab0) { + // System.out.println(tab0); + } } -// init(); + // init(); } }); @@ -132,13 +152,14 @@ } } + /* public void init() { tab0.init(); tab1.init(); tab2.init(); tab3.init(); updateTabColors(); - } + }*/ public static void main(String[] args) { // create GUI logger @@ -156,8 +177,8 @@ // force platform look and feel try { UIManager.setLookAndFeel( -// "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); - UIManager.getSystemLookAndFeelClassName()); + // "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + UIManager.getSystemLookAndFeelClassName()); // TODO: currently everything is in bold on Linux (and Win?) } catch (ClassNotFoundException e) { e.printStackTrace(); @@ -168,7 +189,7 @@ } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } - + new StartGUI(file); } @@ -196,7 +217,7 @@ configLoad.openFile(fc.getSelectedFile()); configLoad.startParser(); } - // save as config file + // save as config file } else if (e.getSource() == saveItem) { JFileChooser fc = new JFileChooser(new File("examples/")); // FileFilter only *.conf @@ -227,13 +248,13 @@ } } System.out.println("config file saved"); - // exit + // exit } else if (e.getSource() == exitItem) { dispose(); - // tutorial + // tutorial } else if (e.getSource() == tutorialItem) { new TutorialWindow(); - // about + // about } else if (e.getSource() == aboutItem) { new AboutWindow(); } @@ -243,32 +264,34 @@ * Update colors of tabulators; red should be clicked, black for OK. */ public void updateTabColors() { - if (config.isInitKnowledgeSource()) + if (config.needsInitKnowledgeSource()) + tabPane.setForegroundAt(0, Color.RED); + else tabPane.setForegroundAt(0, Color.BLACK); + if (config.needsInitReasoner()) + tabPane.setForegroundAt(1, Color.RED); else - tabPane.setForegroundAt(0, Color.RED); - if (config.isInitReasoner()) tabPane.setForegroundAt(1, Color.BLACK); + if (config.needsInitLearningProblem()) + tabPane.setForegroundAt(2, Color.RED); else - tabPane.setForegroundAt(1, Color.RED); - if (config.isInitLearningProblem()) tabPane.setForegroundAt(2, Color.BLACK); - else - tabPane.setForegroundAt(2, Color.RED); - if (config.isInitLearningAlgorithm()) { + if (config.needsInitLearningAlgorithm()) { + tabPane.setForegroundAt(3, Color.RED); + tabPane.setForegroundAt(4, Color.RED); + } else { tabPane.setForegroundAt(3, Color.BLACK); tabPane.setForegroundAt(4, Color.BLACK); - } else { - tabPane.setForegroundAt(3, Color.RED); - tabPane.setForegroundAt(4, Color.RED); } - - // commented out as I do not see any reason why the method should update everything - // (it costs performance to update everything when the user only sees one panel) -// tab0.updateAll(); -// tab1.updateAll(); -// tab2.updateAll(); -// tab3.updateAll(); + // commented out as I do not see any reason why the method should update + // everything + // (it costs performance to update everything when the user only sees + // one panel) + // tab0.updateAll(); + // tab1.updateAll(); + // tab2.updateAll(); + // tab3.updateAll(); + } } Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelString.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -28,8 +28,6 @@ import javax.swing.JTextField; import org.dllearner.core.Component; -import org.dllearner.core.config.ConfigEntry; -import org.dllearner.core.config.InvalidConfigOptionValueException; import org.dllearner.core.config.StringConfigOption; /** @@ -47,8 +45,6 @@ // private JPanel widgetPanel = new JPanel(); private JButton setButton; // = new JButton("Set"); - private Class<? extends Component> componentOption; - private String value; private JTextField stringField; // = new JTextField(35); @@ -67,7 +63,9 @@ stringField.setText(value); } } - setEntry(); + value = stringField.getText(); + fireValueChanged(value); +// setEntry(); // if url and value not "" // necessary for init knowledge source if (configOption.getName().equalsIgnoreCase("url") && !value.equalsIgnoreCase("")) { @@ -75,6 +73,7 @@ } } + /* public void setEntry() { StringConfigOption specialOption; value = stringField.getText(); // get from input @@ -91,7 +90,7 @@ } } else System.out.println("String: not valid value"); - } + }*/ /** * Widget filename getName() == filename you should open a file dialog in Modified: trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-09-08 15:41:10 UTC (rev 1176) +++ trunk/src/dl-learner/org/dllearner/gui/WidgetPanelStringSet.java 2008-09-08 15:43:39 UTC (rev 1177) @@ -223,6 +223,8 @@ gridbag.setConstraints(clearButton, constraints); widgetPanel.add(clearButton, constraints); } else { + System.out.println("SPECIAL OPTION " + configOption.getName()); + // SPECIAL LAYOUT // ComboBoxList buildConstraints(constraints, 0, 1, 1, 1, 100, 100); @@ -238,6 +240,7 @@ LinkedList<Individual> individuals = new LinkedList<Individual>( individualsSet); for (Individual ind : individuals) { + System.out.println(ind.getName()); cBL.add(ind.getName()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-09-08 15:41:18
|
Revision: 1176 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1176&view=rev Author: kurzum Date: 2008-09-08 15:41:10 +0000 (Mon, 08 Sep 2008) Log Message: ----------- removed all checkstyle warnings from auto generated classes, finished new options for all knowledgesources Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastInstanceCheckerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/FastRetrievalReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/GPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/KBFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLAPIReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/OWLFileConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosNegInclusionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/PosOnlyDefinitionLPConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/ROLearnerConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/RandomGuesserConfigurator.java trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java trunk/src/dl-learner/org/dllearner/kb/KBFile.java trunk/src/dl-learner/org/dllearner/kb/OWLFile.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlEndpoint.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java trunk/src/dl-learner/org/dllearner/scripts/ConfigJavaGenerator.java Modified: trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-08 12:38:52 UTC (rev 1175) +++ trunk/src/dl-learner/org/dllearner/core/config/BooleanConfigOption.java 2008-09-08 15:41:10 UTC (rev 1176) @@ -26,6 +26,13 @@ */ public class BooleanConfigOption extends ConfigOption<Boolean> { + + + public BooleanConfigOption(String name, String description, Boolean defaultValue, boolean mandatory, boolean requiresInit) { + super(name, description, defaultValue, mandatory, requiresInit); + + } + public BooleanConfigOption(String name, String description, Boolean defaultValue) { super(name, description, defaultValue); Modified: trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-08 12:38:52 UTC (rev 1175) +++ trunk/src/dl-learner/org/dllearner/core/config/ConfigOption.java 2008-09-08 15:41:10 UTC (rev 1176) @@ -196,9 +196,8 @@ } public String getJavaDocString() { - String line = "* option name: " + name + "\n"; - line += "* " + description + "\n"; - //line += "* allowed values: "+ getAllowedValuesDescription() + "\n"; + String line = "* @param " + name + " " + description + ".\n"; + line += "* mandatory: "+isMandatory()+"| reinit necessary: "+requiresInit()+"\n"; line += "* default value: " + defaultValue + "\n"; return line; } Modified: trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-08 12:38:52 UTC (rev 1175) +++ trunk/src/dl-learner/org/dllearner/core/config/IntegerConfigOption.java 2008-09-08 15:41:10 UTC (rev 1176) @@ -32,6 +32,13 @@ private int lowerLimit = Integer.MIN_VALUE; private int upperLimit = Integer.MAX_VALUE; + + + public IntegerConfigOption(String name, String description, Integer defaultValue, boolean mandatory, boolean requiresInit) { + super(name, description, defaultValue, mandatory, requiresInit); + + } + public IntegerConfigOption(String name, String description, Integer defaultValue) { super(name, description, defaultValue); Modified: trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2008-09-08 12:38:52 UTC (rev 1175) +++ trunk/src/dl-learner/org/dllearner/core/config/StringTupleListConfigOption.java 2008-09-08 15:41:10 UTC (rev 1176) @@ -33,15 +33,22 @@ */ public class StringTupleListConfigOption extends ConfigOption<List<StringTuple>> { - public StringTupleListConfigOption(String name, String description) { - this(name, description, null); + + public StringTupleListConfigOption(String name, String description, List<StringTuple> defaultValue, boolean mandatory, boolean requiresInit) { + super(name, description, defaultValue, mandatory, requiresInit); + } - public StringTupleListConfigOption(String name, String description, - List<StringTuple> defaultValue) { + public StringTupleListConfigOption(String name, String description, List<StringTuple> defaultValue) { super(name, description, defaultValue); + } + public StringTupleListConfigOption(String name, String description) { + super(name, description); + + } + /* (non-Javadoc) * @see org.dllearner.core.config.ConfigOption#getValueTypeAsJavaString() */ Modified: trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-08 12:38:52 UTC (rev 1175) +++ trunk/src/dl-learner/org/dllearner/core/configurators/BruteForceLearnerConfigurator.java 2008-09-08 15:41:10 UTC (rev 1176) @@ -2,7 +2,7 @@ * 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 @@ -15,7 +15,8 @@ * * 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; @@ -26,60 +27,72 @@ import org.dllearner.core.ReasoningService; /** -* automatically generated, do not edit manually +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update **/ public class BruteForceLearnerConfigurator { private boolean reinitNecessary = false; -private BruteForceLearner BruteForceLearner; +@SuppressWarnings("unused") -public BruteForceLearnerConfigurator (BruteForceLearner BruteForceLearner){ -this.BruteForceLearner = BruteForceLearner; +private BruteForceLearner bruteForceLearner; + +/** +* @param bruteForceLearner see BruteForceLearner +**/ +public BruteForceLearnerConfigurator(BruteForceLearner bruteForceLearner){ +this.bruteForceLearner = bruteForceLearner; } /** +* @return BruteForceLearner **/ -public static BruteForceLearner getBruteForceLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{ -BruteForceLearner component = ComponentManager.getInstance().learningAlgorithm(BruteForceLearner.class, learningProblem, reasoningService ); +public static BruteForceLearner getBruteForceLearner(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ +BruteForceLearner component = ComponentManager.getInstance().learningAlgorithm(BruteForceLearner.class, learningProblem, reasoningService); return component; } /** -* option name: maxLength -* maximum length of generated concepts +* 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") ; +public int getMaxLength() { +return (Integer) ComponentManager.getInstance().getConfigOptionValue(bruteForceLearner, "maxLength") ; } /** -* option name: 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. +* 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") ; +public String getReturnType() { +return (String) ComponentManager.getInstance().getConfigOptionValue(bruteForceLearner, "returnType") ; } /** -* option name: maxLength -* maximum length of generated concepts +* @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); +public void setMaxLength(int maxLength) { +ComponentManager.getInstance().applyConfigEntry(bruteForceLearner, "maxLength", maxLength); reinitNecessary = true; } /** -* option name: 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. +* @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); +public void setReturnType(String returnType) { +ComponentManager.getInstance().applyConfigEntry(bruteForceLearner, "returnType", returnType); reinitNecessary = true; } +/** +* true, if this component needs reinitializsation +**/ public boolean isReinitNecessary(){ return reinitNecessary; } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 12:38:52 UTC (rev 1175) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2008-09-08 15:41:10 UTC (rev 1176) @@ -2,7 +2,7 @@ * 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 @@ -15,7 +15,8 @@ * * 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; @@ -26,28 +27,10 @@ import org.dllearner.algorithms.gp.GP; import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.algorithms.refinement.ROLearner; -import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; -import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasoningService; -import org.dllearner.core.configurators.BruteForceLearnerConfigurator; -import org.dllearner.core.configurators.DBpediaNavigationSuggestorConfigurator; -import org.dllearner.core.configurators.DIGReasonerConfigurator; -import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator; -import org.dllearner.core.configurators.FastInstanceCheckerConfigurator; -import org.dllearner.core.configurators.FastRetrievalReasonerConfigurator; -import org.dllearner.core.configurators.GPConfigurator; -import org.dllearner.core.configurators.KBFileConfigurator; -import org.dllearner.core.configurators.OWLAPIReasonerConfigurator; -import org.dllearner.core.configurators.OWLFileConfigurator; -import org.dllearner.core.configurators.PosNegDefinitionLPConfigurator; -import org.dllearner.core.configurators.PosNegInclusionLPConfigurator; -import org.dllearner.core.configurators.PosOnlyDefinitionLPConfigurator; -import org.dllearner.core.configurators.ROLearnerConfigurator; -import org.dllearner.core.configurators.RandomGuesserConfigurator; -import org.dllearner.core.configurators.SparqlKnowledgeSourceConfigurator; import org.dllearner.kb.KBFile; import org.dllearner.kb.OWLFile; import org.dllearner.kb.sparql.SparqlKnowledgeSource; @@ -60,111 +43,154 @@ import org.dllearner.reasoning.OWLAPIReasoner; /** -* automatically generated, do not edit manually +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update **/ public class ComponentFactory { /** * @param filename pointer to the KB file on local file system +* @return a component ready for initialization KBFile **/ -public static KBFile getKBFile (String filename ) { +public static KBFile getKBFile(String filename) { return KBFileConfigurator.getKBFile(filename); } /** * @param url URL pointing to the OWL file +* @return a component ready for initialization OWLFile **/ -public static OWLFile getOWLFile (String url ) { +public static OWLFile getOWLFile(String url) { return OWLFileConfigurator.getOWLFile(url); } /** +* @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 (Set<String> instances ) { -return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(instances); +public static SparqlKnowledgeSource getSparqlKnowledgeSource(String url, Set<String> instances) { +return SparqlKnowledgeSourceConfigurator.getSparqlKnowledgeSource(url, instances); } /** +* @param knowledgeSource see KnowledgeSource +* @return a component ready for initialization DIGReasoner **/ -public static DIGReasoner getDIGReasoner (KnowledgeSource knowledgeSource ) { +public static DIGReasoner getDIGReasoner(KnowledgeSource knowledgeSource) { return DIGReasonerConfigurator.getDIGReasoner(knowledgeSource); } /** +* @param knowledgeSource see KnowledgeSource +* @return a component ready for initialization FastInstanceChecker **/ -public static FastInstanceChecker getFastInstanceChecker (KnowledgeSource knowledgeSource ) { +public static FastInstanceChecker getFastInstanceChecker(KnowledgeSource knowledgeSource) { return FastInstanceCheckerConfigurator.getFastInstanceChecker(knowledgeSource); } /** +* @param knowledgeSource see KnowledgeSource +* @return a component ready for initialization FastRetrievalReasoner **/ -public static FastRetrievalReasoner getFastRetrievalReasoner (KnowledgeSource knowledgeSource ) { +public static FastRetrievalReasoner getFastRetrievalReasoner(KnowledgeSource knowledgeSource) { return FastRetrievalReasonerConfigurator.getFastRetrievalReasoner(knowledgeSource); } /** +* @param knowledgeSource see KnowledgeSource +* @return a component ready for initialization OWLAPIReasoner **/ -public static OWLAPIReasoner getOWLAPIReasoner (KnowledgeSource knowledgeSource ) { +public static OWLAPIReasoner getOWLAPIReasoner(KnowledgeSource knowledgeSource) { return OWLAPIReasonerConfigurator.getOWLAPIReasoner(knowledgeSource); } /** * @param positiveExamples positive examples * @param negativeExamples negative examples +* @param reasoningService see ReasoningService +* @return a component ready for initialization PosNegDefinitionLP **/ -public static PosNegDefinitionLP getPosNegDefinitionLP (ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples ) { +public static PosNegDefinitionLP getPosNegDefinitionLP(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { return PosNegDefinitionLPConfigurator.getPosNegDefinitionLP(reasoningService, positiveExamples, negativeExamples); } /** * @param positiveExamples positive examples * @param negativeExamples negative examples +* @param reasoningService see ReasoningService +* @return a component ready for initialization PosNegInclusionLP **/ -public static PosNegInclusionLP getPosNegInclusionLP (ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples ) { +public static PosNegInclusionLP getPosNegInclusionLP(ReasoningService reasoningService, Set<String> positiveExamples, Set<String> negativeExamples) { return PosNegInclusionLPConfigurator.getPosNegInclusionLP(reasoningService, positiveExamples, negativeExamples); } /** * @param positiveExamples positive examples +* @param reasoningService see ReasoningService +* @return a component ready for initialization PosOnlyDefinitionLP **/ -public static PosOnlyDefinitionLP getPosOnlyDefinitionLP (ReasoningService reasoningService, Set<String> positiveExamples ) { +public static PosOnlyDefinitionLP getPosOnlyDefinitionLP(ReasoningService reasoningService, Set<String> positiveExamples) { return PosOnlyDefinitionLPConfigurator.getPosOnlyDefinitionLP(reasoningService, positiveExamples); } /** +* @param learningProblem see LearningProblem +* @param reasoningService see ReasoningService +* @throws LearningProblemUnsupportedException see +* @return a component ready for initialization BruteForceLearner **/ -public static BruteForceLearner getBruteForceLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException { +public static BruteForceLearner getBruteForceLearner(LearningProblem learningProblem, ReasoningService 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 DBpediaNavigationSuggestor **/ -public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException { +public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException { return DBpediaNavigationSuggestorConfigurator.getDBpediaNavigationSuggestor(learningProblem, reasoningService); } /** +* @param learningProblem see LearningProblem +* @param reasoningService see ReasoningService +* @throws LearningProblemUnsupportedException see +* @return a component ready for initialization RandomGuesser **/ -public static RandomGuesser getRandomGuesser (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException { +public static RandomGuesser getRandomGuesser(LearningProblem learningProblem, ReasoningService 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 GP **/ -public static GP getGP (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException { +public static GP getGP(LearningProblem learningProblem, ReasoningService 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 ExampleBasedROLComponent **/ -public static ExampleBasedROLComponent getExampleBasedROLComponent (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException { +public static ExampleBasedROLComponent getExampleBasedROLComponent(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException { return ExampleBasedROLComponentConfigurator.getExampleBasedROLComponent(learningProblem, reasoningService); } /** +* @param learningProblem see LearningProblem +* @param reasoningService see ReasoningService +* @throws LearningProblemUnsupportedException see +* @return a component ready for initialization ROLearner **/ -public static ROLearner getROLearner (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException { +public static ROLearner getROLearner(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException { return ROLearnerConfigurator.getROLearner(learningProblem, reasoningService); } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-08 12:38:52 UTC (rev 1175) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DBpediaNavigationSuggestorConfigurator.java 2008-09-08 15:41:10 UTC (rev 1176) @@ -2,7 +2,7 @@ * 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 @@ -15,7 +15,8 @@ * * 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; @@ -27,472 +28,508 @@ import org.dllearner.core.ReasoningService; /** -* automatically generated, do not edit manually +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update **/ public class DBpediaNavigationSuggestorConfigurator { private boolean reinitNecessary = false; -private DBpediaNavigationSuggestor DBpediaNavigationSuggestor; +@SuppressWarnings("unused") -public DBpediaNavigationSuggestorConfigurator (DBpediaNavigationSuggestor DBpediaNavigationSuggestor){ -this.DBpediaNavigationSuggestor = DBpediaNavigationSuggestor; +private DBpediaNavigationSuggestor dBpediaNavigationSuggestor; + +/** +* @param dBpediaNavigationSuggestor see DBpediaNavigationSuggestor +**/ +public DBpediaNavigationSuggestorConfigurator(DBpediaNavigationSuggestor dBpediaNavigationSuggestor){ +this.dBpediaNavigationSuggestor = dBpediaNavigationSuggestor; } /** +* @return DBpediaNavigationSuggestor **/ -public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor (LearningProblem learningProblem, ReasoningService reasoningService ) throws LearningProblemUnsupportedException{ -DBpediaNavigationSuggestor component = ComponentManager.getInstance().learningAlgorithm(DBpediaNavigationSuggestor.class, learningProblem, reasoningService ); +public static DBpediaNavigationSuggestor getDBpediaNavigationSuggestor(LearningProblem learningProblem, ReasoningService reasoningService) throws LearningProblemUnsupportedException{ +DBpediaNavigationSuggestor component = ComponentManager.getInstance().learningAlgorithm(DBpediaNavigationSuggestor.class, learningProblem, reasoningService); return component; } /** -* option name: writeSearchTree -* specifies whether to write a search tree +* 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(DBpediaNavigationSuggestor, "writeSearchTree") ; +public boolean getWriteSearchTree() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "writeSearchTree") ; } /** -* option name: searchTreeFile -* file to use for the search tree +* 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(DBpediaNavigationSuggestor, "searchTreeFile") ; +public String getSearchTreeFile() { +return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "searchTreeFile") ; } /** -* option name: replaceSearchTree -* specifies whether to replace the search tree in the log file after each run or append the new search tree +* 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(DBpediaNavigationSuggestor, "replaceSearchTree") ; +public boolean getReplaceSearchTree() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "replaceSearchTree") ; } /** -* option name: heuristic -* specifiy the heuristic to use +* heuristic specifiy the heuristic to use. +* mandatory: false| reinit necessary: true * default value: lexicographic +* @return String **/ -public String getHeuristic ( ) { -return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "heuristic") ; +public String getHeuristic() { +return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "heuristic") ; } /** -* option name: applyAllFilter -* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D) +* applyAllFilter usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D). +* mandatory: false| reinit necessary: true * default value: true +* @return boolean **/ -public boolean getApplyAllFilter ( ) { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "applyAllFilter") ; +public boolean getApplyAllFilter() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "applyAllFilter") ; } /** -* option name: applyExistsFilter -* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D) +* applyExistsFilter usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D). +* mandatory: false| reinit necessary: true * default value: true +* @return boolean **/ -public boolean getApplyExistsFilter ( ) { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "applyExistsFilter") ; +public boolean getApplyExistsFilter() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "applyExistsFilter") ; } /** -* option name: useTooWeakList -* try to filter out too weak concepts without sending them to the reasoner +* useTooWeakList try to filter out too weak concepts without sending them to the reasoner. +* mandatory: false| reinit necessary: true * default value: true +* @return boolean **/ -public boolean getUseTooWeakList ( ) { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useTooWeakList") ; +public boolean getUseTooWeakList() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useTooWeakList") ; } /** -* option name: useOverlyGeneralList -* try to find overly general concept without sending them to the reasoner +* useOverlyGeneralList try to find overly general concept without sending them to the reasoner. +* mandatory: false| reinit necessary: true * default value: true +* @return boolean **/ -public boolean getUseOverlyGeneralList ( ) { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useOverlyGeneralList") ; +public boolean getUseOverlyGeneralList() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useOverlyGeneralList") ; } /** -* option name: useShortConceptConstruction -* shorten concept to see whether they already exist +* useShortConceptConstruction shorten concept to see whether they already exist. +* mandatory: false| reinit necessary: true * default value: true +* @return boolean **/ -public boolean getUseShortConceptConstruction ( ) { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useShortConceptConstruction") ; +public boolean getUseShortConceptConstruction() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useShortConceptConstruction") ; } /** -* option name: horizontalExpansionFactor -* horizontal expansion factor (see publication for description) +* horizontalExpansionFactor horizontal expansion factor (see publication for description). +* mandatory: false| reinit necessary: true * default value: 0.6 +* @return double **/ -public double getHorizontalExpansionFactor ( ) { -return (Double) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "horizontalExpansionFactor") ; +public double getHorizontalExpansionFactor() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "horizontalExpansionFactor") ; } /** -* option name: improveSubsumptionHierarchy -* simplify subsumption hierarchy to reduce search space (see publication for description) +* improveSubsumptionHierarchy simplify subsumption hierarchy to reduce search space (see publication for description). +* mandatory: false| reinit necessary: true * default value: true +* @return boolean **/ -public boolean getImproveSubsumptionHierarchy ( ) { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "improveSubsumptionHierarchy") ; +public boolean getImproveSubsumptionHierarchy() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "improveSubsumptionHierarchy") ; } /** -* option name: allowedConcepts -* concepts the algorithm is allowed to use +* 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(DBpediaNavigationSuggestor, "allowedConcepts") ; +public Set<String> getAllowedConcepts() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "allowedConcepts") ; } /** -* option name: ignoredConcepts -* concepts the algorithm must ignore +* 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(DBpediaNavigationSuggestor, "ignoredConcepts") ; +public Set<String> getIgnoredConcepts() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "ignoredConcepts") ; } /** -* option name: allowedRoles -* roles the algorithm is allowed to use +* allowedRoles roles the algorithm is allowed to use. +* mandatory: false| reinit necessary: true * default value: null +* @return Set(String) **/ @SuppressWarnings("unchecked") -public Set<String> getAllowedRoles ( ) { -return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "allowedRoles") ; +public Set<String> getAllowedRoles() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "allowedRoles") ; } /** -* option name: ignoredRoles -* roles the algorithm must ignore +* ignoredRoles roles the algorithm must ignore. +* mandatory: false| reinit necessary: true * default value: null +* @return Set(String) **/ @SuppressWarnings("unchecked") -public Set<String> getIgnoredRoles ( ) { -return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "ignoredRoles") ; +public Set<String> getIgnoredRoles() { +return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "ignoredRoles") ; } /** -* option name: useAllConstructor -* specifies whether the universal concept constructor is used in the learning algorithm +* 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(DBpediaNavigationSuggestor, "useAllConstructor") ; +public boolean getUseAllConstructor() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useAllConstructor") ; } /** -* option name: useExistsConstructor -* specifies whether the existential concept constructor is used in the learning algorithm +* 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(DBpediaNavigationSuggestor, "useExistsConstructor") ; +public boolean getUseExistsConstructor() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useExistsConstructor") ; } /** -* option name: useCardinalityRestrictions -* specifies whether CardinalityRestrictions is used in the learning algorithm +* 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(DBpediaNavigationSuggestor, "useCardinalityRestrictions") ; +public boolean getUseCardinalityRestrictions() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useCardinalityRestrictions") ; } /** -* option name: useNegation -* specifies whether negation is used in the learning algorothm +* useNegation specifies whether negation is used in the learning algorothm. +* mandatory: false| reinit necessary: true * default value: true +* @return boolean **/ -public boolean getUseNegation ( ) { -return (Boolean) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "useNegation") ; +public boolean getUseNegation() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useNegation") ; } /** -* option name: useBooleanDatatypes -* specifies whether boolean datatypes are used in the learning algorothm +* 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(DBpediaNavigationSuggestor, "useBooleanDatatypes") ; +public boolean getUseBooleanDatatypes() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "useBooleanDatatypes") ; } /** -* option name: maxExecutionTimeInSeconds -* algorithm will stop after specified seconds +* maxExecutionTimeInSeconds algorithm will stop after specified seconds. +* mandatory: false| reinit necessary: true * default value: 0 +* @return int **/ -public int getMaxExecutionTimeInSeconds ( ) { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "maxExecutionTimeInSeconds") ; +public int getMaxExecutionTimeInSeconds() { +return (Integer) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "maxExecutionTimeInSeconds") ; } /** -* option name: minExecutionTimeInSeconds -* algorithm will run at least specified seconds +* minExecutionTimeInSeconds algorithm will run at least specified seconds. +* mandatory: false| reinit necessary: true * default value: 0 +* @return int **/ -public int getMinExecutionTimeInSeconds ( ) { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "minExecutionTimeInSeconds") ; +public int getMinExecutionTimeInSeconds() { +return (Integer) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "minExecutionTimeInSeconds") ; } /** -* option name: guaranteeXgoodDescriptions -* algorithm will run until X good (100%) concept descritpions are found +* guaranteeXgoodDescriptions algorithm will run until X good (100%) concept descritpions are found. +* mandatory: false| reinit necessary: true * default value: 1 +* @return int **/ -public int getGuaranteeXgoodDescriptions ( ) { -return (Integer) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "guaranteeXgoodDescriptions") ; +public int getGuaranteeXgoodDescriptions() { +return (Integer) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "guaranteeXgoodDescriptions") ; } /** -* option name: logLevel -* determines the logLevel for this component, can be {TRACE, DEBUG, INFO} +* logLevel determines the logLevel for this component, can be {TRACE, DEBUG, INFO}. +* mandatory: false| reinit necessary: true * default value: DEBUG +* @return String **/ -public String getLogLevel ( ) { -return (String) ComponentManager.getInstance().getConfigOptionValue(DBpediaNavigationSuggestor, "logLevel") ; +public String getLogLevel() { +return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "logLevel") ; } /** -* option name: noisePercentage -* the (approximated) percentage of noise within the examples +* 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(DBpediaNavigationSuggestor, "noisePercentage") ; +public double getNoisePercentage() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "noisePercentage") ; } /** -* option name: startClass -* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class) +* 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(DBpediaNavigationSuggestor, "startClass") ; +public String getStartClass() { +return (String) ComponentManager.getInstance().getConfigOptionValue(dBpediaNavigationSuggestor, "startClass") ; } /** -* option name: writeSearchTree -* specifies whether to write a search tree +* @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(DBpediaNavigationSuggestor, "writeSearchTree", writeSearchTree); +public void setWriteSearchTree(boolean writeSearchTree) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "writeSearchTree", writeSearchTree); reinitNecessary = true; } /** -* option name: searchTreeFile -* file to use for the search tree +* @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(DBpediaNavigationSuggestor, "searchTreeFile", searchTreeFile); +public void setSearchTreeFile(String searchTreeFile) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "searchTreeFile", searchTreeFile); reinitNecessary = true; } /** -* option name: replaceSearchTree -* specifies whether to replace the search tree in the log file after each run or append the new search tree +* @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(DBpediaNavigationSuggestor, "replaceSearchTree", replaceSearchTree); +public void setReplaceSearchTree(boolean replaceSearchTree) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "replaceSearchTree", replaceSearchTree); reinitNecessary = true; } /** -* option name: heuristic -* specifiy the heuristic to use +* @param heuristic specifiy the heuristic to use. +* mandatory: false| reinit necessary: true * default value: lexicographic **/ -public void setHeuristic ( String heuristic) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "heuristic", heuristic); +public void setHeuristic(String heuristic) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "heuristic", heuristic); reinitNecessary = true; } /** -* option name: applyAllFilter -* usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D) +* @param applyAllFilter usage of equivalence ALL R.C AND ALL R.D = ALL R.(C AND D). +* mandatory: false| reinit necessary: true * default value: true **/ -public void setApplyAllFilter ( boolean applyAllFilter) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "applyAllFilter", applyAllFilter); +public void setApplyAllFilter(boolean applyAllFilter) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "applyAllFilter", applyAllFilter); reinitNecessary = true; } /** -* option name: applyExistsFilter -* usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D) +* @param applyExistsFilter usage of equivalence EXISTS R.C OR EXISTS R.D = EXISTS R.(C OR D). +* mandatory: false| reinit necessary: true * default value: true **/ -public void setApplyExistsFilter ( boolean applyExistsFilter) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "applyExistsFilter", applyExistsFilter); +public void setApplyExistsFilter(boolean applyExistsFilter) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "applyExistsFilter", applyExistsFilter); reinitNecessary = true; } /** -* option name: useTooWeakList -* try to filter out too weak concepts without sending them to the reasoner +* @param useTooWeakList try to filter out too weak concepts without sending them to the reasoner. +* mandatory: false| reinit necessary: true * default value: true **/ -public void setUseTooWeakList ( boolean useTooWeakList) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useTooWeakList", useTooWeakList); +public void setUseTooWeakList(boolean useTooWeakList) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useTooWeakList", useTooWeakList); reinitNecessary = true; } /** -* option name: useOverlyGeneralList -* try to find overly general concept without sending them to the reasoner +* @param useOverlyGeneralList try to find overly general concept without sending them to the reasoner. +* mandatory: false| reinit necessary: true * default value: true **/ -public void setUseOverlyGeneralList ( boolean useOverlyGeneralList) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useOverlyGeneralList", useOverlyGeneralList); +public void setUseOverlyGeneralList(boolean useOverlyGeneralList) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useOverlyGeneralList", useOverlyGeneralList); reinitNecessary = true; } /** -* option name: useShortConceptConstruction -* shorten concept to see whether they already exist +* @param useShortConceptConstruction shorten concept to see whether they already exist. +* mandatory: false| reinit necessary: true * default value: true **/ -public void setUseShortConceptConstruction ( boolean useShortConceptConstruction) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useShortConceptConstruction", useShortConceptConstruction); +public void setUseShortConceptConstruction(boolean useShortConceptConstruction) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useShortConceptConstruction", useShortConceptConstruction); reinitNecessary = true; } /** -* option name: horizontalExpansionFactor -* horizontal expansion factor (see publication for description) +* @param horizontalExpansionFactor horizontal expansion factor (see publication for description). +* mandatory: false| reinit necessary: true * default value: 0.6 **/ -public void setHorizontalExpansionFactor ( double horizontalExpansionFactor) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "horizontalExpansionFactor", horizontalExpansionFactor); +public void setHorizontalExpansionFactor(double horizontalExpansionFactor) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "horizontalExpansionFactor", horizontalExpansionFactor); reinitNecessary = true; } /** -* option name: improveSubsumptionHierarchy -* simplify subsumption hierarchy to reduce search space (see publication for description) +* @param improveSubsumptionHierarchy simplify subsumption hierarchy to reduce search space (see publication for description). +* mandatory: false| reinit necessary: true * default value: true **/ -public void setImproveSubsumptionHierarchy ( boolean improveSubsumptionHierarchy) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "improveSubsumptionHierarchy", improveSubsumptionHierarchy); +public void setImproveSubsumptionHierarchy(boolean improveSubsumptionHierarchy) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "improveSubsumptionHierarchy", improveSubsumptionHierarchy); reinitNecessary = true; } /** -* option name: allowedConcepts -* concepts the algorithm is allowed to use +* @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(DBpediaNavigationSuggestor, "allowedConcepts", allowedConcepts); +public void setAllowedConcepts(Set<String> allowedConcepts) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "allowedConcepts", allowedConcepts); reinitNecessary = true; } /** -* option name: ignoredConcepts -* concepts the algorithm must ignore +* @param ignoredConcepts concepts the algorithm must ignore. +* mandatory: false| reinit necessary: true * default value: null **/ -public void setIgnoredConcepts ( Set<String> ignoredConcepts) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "ignoredConcepts", ignoredConcepts); +public void setIgnoredConcepts(Set<String> ignoredConcepts) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "ignoredConcepts", ignoredConcepts); reinitNecessary = true; } /** -* option name: allowedRoles -* roles the algorithm is allowed to use +* @param allowedRoles roles the algorithm is allowed to use. +* mandatory: false| reinit necessary: true * default value: null **/ -public void setAllowedRoles ( Set<String> allowedRoles) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "allowedRoles", allowedRoles); +public void setAllowedRoles(Set<String> allowedRoles) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "allowedRoles", allowedRoles); reinitNecessary = true; } /** -* option name: ignoredRoles -* roles the algorithm must ignore +* @param ignoredRoles roles the algorithm must ignore. +* mandatory: false| reinit necessary: true * default value: null **/ -public void setIgnoredRoles ( Set<String> ignoredRoles) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "ignoredRoles", ignoredRoles); +public void setIgnoredRoles(Set<String> ignoredRoles) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "ignoredRoles", ignoredRoles); reinitNecessary = true; } /** -* option name: useAllConstructor -* specifies whether the universal concept constructor is used in the learning algorithm +* @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(DBpediaNavigationSuggestor, "useAllConstructor", useAllConstructor); +public void setUseAllConstructor(boolean useAllConstructor) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useAllConstructor", useAllConstructor); reinitNecessary = true; } /** -* option name: useExistsConstructor -* specifies whether the existential concept constructor is used in the learning algorithm +* @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(DBpediaNavigationSuggestor, "useExistsConstructor", useExistsConstructor); +public void setUseExistsConstructor(boolean useExistsConstructor) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useExistsConstructor", useExistsConstructor); reinitNecessary = true; } /** -* option name: useCardinalityRestrictions -* specifies whether CardinalityRestrictions is used in the learning algorithm +* @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(DBpediaNavigationSuggestor, "useCardinalityRestrictions", useCardinalityRestrictions); +public void setUseCardinalityRestrictions(boolean useCardinalityRestrictions) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useCardinalityRestrictions", useCardinalityRestrictions); reinitNecessary = true; } /** -* option name: useNegation -* specifies whether negation is used in the learning algorothm +* @param useNegation specifies whether negation is used in the learning algorothm. +* mandatory: false| reinit necessary: true * default value: true **/ -public void setUseNegation ( boolean useNegation) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "useNegation", useNegation); +public void setUseNegation(boolean useNegation) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useNegation", useNegation); reinitNecessary = true; } /** -* option name: useBooleanDatatypes -* specifies whether boolean datatypes are used in the learning algorothm +* @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(DBpediaNavigationSuggestor, "useBooleanDatatypes", useBooleanDatatypes); +public void setUseBooleanDatatypes(boolean useBooleanDatatypes) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "useBooleanDatatypes", useBooleanDatatypes); reinitNecessary = true; } /** -* option name: maxExecutionTimeInSeconds -* algorithm will stop after specified seconds +* @param maxExecutionTimeInSeconds algorithm will stop after specified seconds. +* mandatory: false| reinit necessary: true * default value: 0 **/ -public void setMaxExecutionTimeInSeconds ( int maxExecutionTimeInSeconds) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds); +public void setMaxExecutionTimeInSeconds(int maxExecutionTimeInSeconds) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds); reinitNecessary = true; } /** -* option name: minExecutionTimeInSeconds -* algorithm will run at least specified seconds +* @param minExecutionTimeInSeconds algorithm will run at least specified seconds. +* mandatory: false| reinit necessary: true * default value: 0 **/ -public void setMinExecutionTimeInSeconds ( int minExecutionTimeInSeconds) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "minExecutionTimeInSeconds", minExecutionTimeInSeconds); +public void setMinExecutionTimeInSeconds(int minExecutionTimeInSeconds) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "minExecutionTimeInSeconds", minExecutionTimeInSeconds); reinitNecessary = true; } /** -* option name: guaranteeXgoodDescriptions -* algorithm will run until X good (100%) concept descritpions are found +* @param guaranteeXgoodDescriptions algorithm will run until X good (100%) concept descritpions are found. +* mandatory: false| reinit necessary: true * default value: 1 **/ -public void setGuaranteeXgoodDescriptions ( int guaranteeXgoodDescriptions) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "guaranteeXgoodDescriptions", guaranteeXgoodDescriptions); +public void setGuaranteeXgoodDescriptions(int guaranteeXgoodDescriptions) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "guaranteeXgoodDescriptions", guaranteeXgoodDescriptions); reinitNecessary = true; } /** -* option name: logLevel -* determines the logLevel for this component, can be {TRACE, DEBUG, INFO} +* @param logLevel determines the logLevel for this component, can be {TRACE, DEBUG, INFO}. +* mandatory: false| reinit necessary: true * default value: DEBUG **/ -public void setLogLevel ( String logLevel) { -ComponentManager.getInstance().applyConfigEntry(DBpediaNavigationSuggestor, "logLevel", logLevel); +public void setLogLevel(String logLevel) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "logLevel", logLevel); reinitNecessary = true; } /** -* option name: noisePercentage -* the (approximated) percentage of noise within the examples +* @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(DBpediaNavigationSuggestor, "noisePercentage", noisePercentage); +public void setNoisePercentage(double noisePercentage) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "noisePercentage", noisePercentage); reinitNecessary = true; } /** -* option name: startClass -* the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class) +* @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(DBpediaNavigationSuggestor, "startClass", startClass); +public void setStartClass(String startClass) { +ComponentManager.getInstance().applyConfigEntry(dBpediaNavigationSuggestor, "startClass", startClass); reinitNecessary = true; } +/** +* true, if this component needs reinitializsation +**/ public boolean isReinitNecessary(){ return reinitNecessary; } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 12:38:52 UTC (rev 1175) +++ trunk/src/dl-learner/org/dllearner/core/configurators/DIGReasonerConfigurator.java 2008-09-08 15:41:10 UTC (rev 1176) @@ -2,7 +2,7 @@ * 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 @@ -15,7 +15,8 @@ * * 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; @@ -24,77 +25,90 @@ import org.dllearner.reasoning.DIGReasoner; /** -* automatically generated, do not edit manually +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update **/ public class DIGReasonerConfigurator { private boolean reinitNecessary = false; -private DIGReasoner DIGReasoner; +@SuppressWarnings("unused") -public DIGReasonerConfigurator (DIGReasoner DIGReasoner){ -this.DIGReasoner = DIGReasoner; +private DIGReasoner dIGReasoner; + +/** +* @param dIGReasoner see DIGReasoner +**/ +public DIGReasonerConfigurator(DIGReasoner dIGReasoner){ +this.dIGReasoner = dIGReasoner; } /** +* @return DIGReasoner **/ -public static DIGReasoner getDIGReasoner (KnowledgeSource knowledgeSource ) { -DIGReasoner component = ComponentManager.getInstance().reasoner(DIGReasoner.class, knowledgeSource ); +public static DIGReasoner getDIGReasoner(KnowledgeSource knowledgeSource) { +DIGReasoner component =... [truncated message content] |