From: <ton...@us...> - 2008-01-10 16:49:34
|
Revision: 363 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=363&view=rev Author: tonytacker Date: 2008-01-10 08:49:25 -0800 (Thu, 10 Jan 2008) Log Message: ----------- lines 94 and 95 in ReasonerPanel.java produce errors Modified 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/OutputPanel.java trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java trunk/src/dl-learner/org/dllearner/gui/StartGUI.java Modified: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -49,13 +49,16 @@ private JFileChooser fc; private JButton openButton; private JTextField fileDisplay; - private String[] kbBoxItems = StartGUI.myconfig.getKBBoxItems(); + private String[] kbBoxItems = {"Pleae select a type", "KBFile", "OWLFile", "SparqleEndpoint"}; private JComboBox cb = new JComboBox(kbBoxItems); private JPanel openPanel = new JPanel(); - - KnowledgeSourcePanel() { + private Config config; + + KnowledgeSourcePanel(Config config) { super(new BorderLayout()); + this.config = config; + fc = new JFileChooser(new File("examples/")); openButton = new JButton("Open File"); openButton.addActionListener(this); @@ -80,12 +83,12 @@ if (e.getSource() == openButton) { int returnVal = fc.showOpenDialog(KnowledgeSourcePanel.this); if (returnVal == JFileChooser.APPROVE_OPTION) { - StartGUI.myconfig.setFile(fc.getSelectedFile()); //save variable - fileDisplay.setText(StartGUI.myconfig.getFile().toString()); + config.setFile(fc.getSelectedFile()); //save variable + fileDisplay.setText(config.getFile().toString()); //System.out.println("Init KnowledgeSource after loading file ... show over output"); //System.out.println("test: " + StartGUI.myconfig.getFile().toURI().toString()); - StartGUI.myconfig.getComponentManager().applyConfigEntry(StartGUI.myconfig.getKnowledgeSource(), "url", StartGUI.myconfig.getFile().toURI().toString()); - StartGUI.myconfig.getKnowledgeSource().init(); + config.getComponentManager().applyConfigEntry(config.getKnowledgeSource(), "url", config.getFile().toURI().toString()); + config.getKnowledgeSource().init(); } return; } @@ -107,7 +110,7 @@ openPanel.add(fileDisplay); openPanel.add(openButton); openPanel.repaint(); - StartGUI.myconfig.setKnowledgeSource(StartGUI.myconfig.getComponentManager().knowledgeSource(OWLFile.class)); + config.setKnowledgeSource(config.getComponentManager().knowledgeSource(OWLFile.class)); } // choose SPARCLE class if (cb.getSelectedItem().toString() == kbBoxItems[3]) { Modified: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -44,9 +44,13 @@ private JPanel laPanel = new JPanel(); private JButton laButton; - LearningAlgorithmPanel() { + private Config config; + + LearningAlgorithmPanel(Config config) { super(new BorderLayout()); + this.config = config; + laButton = new JButton("Use ROLearner"); laButton.addActionListener(this); @@ -56,9 +60,9 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == laButton) { - if (StartGUI.myconfig.getStatus(6)) { - StartGUI.myconfig.setLearningAlgorithm(StartGUI.myconfig.getComponentManager().learningAlgorithm(ROLearner.class, StartGUI.myconfig.getLearningProblem(), StartGUI.myconfig.getReasoningService())); - StartGUI.myconfig.getLearningAlgorithm().init(); + if (config.getStatus(6)) { + config.setLearningAlgorithm(config.getComponentManager().learningAlgorithm(ROLearner.class, config.getLearningProblem(), config.getReasoningService())); + config.getLearningAlgorithm().init(); } } } Modified: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -42,9 +42,13 @@ private JPanel lpPanel = new JPanel(); private JButton lpButton; - LearningProblemPanel() { + private Config config; + + LearningProblemPanel(Config config) { super(new BorderLayout()); + this.config = config; + lpButton = new JButton("Use PosOnlyDefinitionLP"); lpButton.addActionListener(this); @@ -54,11 +58,11 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == lpButton) { - if (StartGUI.myconfig.getStatus(5)) { - System.out.println(StartGUI.myconfig.getExampleSet()); - StartGUI.myconfig.setLearningProblem(StartGUI.myconfig.getComponentManager().learningProblem(PosOnlyDefinitionLP.class, StartGUI.myconfig.getReasoningService())); - StartGUI.myconfig.getComponentManager().applyConfigEntry(StartGUI.myconfig.getLearningProblem(), "positiveExamples", StartGUI.myconfig.getExampleSet()); - StartGUI.myconfig.getLearningProblem().init(); + if (config.getStatus(5)) { + System.out.println(config.getExampleSet()); + config.setLearningProblem(config.getComponentManager().learningProblem(PosOnlyDefinitionLP.class, config.getReasoningService())); + config.getComponentManager().applyConfigEntry(config.getLearningProblem(), "positiveExamples", config.getExampleSet()); + config.getLearningProblem().init(); } } } Modified: trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -42,10 +42,13 @@ private JButton showButton; private JButton runButton; private JTextArea infoArea; + private Config config; - OutputPanel() { + OutputPanel(Config config) { super(new BorderLayout()); + this.config = config; + showButton = new JButton("Show Variables"); showButton.addActionListener(this); @@ -68,26 +71,26 @@ public void actionPerformed(ActionEvent e) { if (e.getSource() == showButton) { infoArea.setText(""); - if (StartGUI.myconfig.getStatus(2)) { // file is selected and exist? - infoArea.append("SourceClass: " + StartGUI.myconfig.getKnowledgeSource().toString() + "\n"); - infoArea.append("FILE: " + StartGUI.myconfig.getFile() + "\n"); + if (config.getStatus(2)) { // file is selected and exist? + infoArea.append("SourceClass: " + config.getKnowledgeSource().toString() + "\n"); + infoArea.append("FILE: " + config.getFile() + "\n"); } - if (StartGUI.myconfig.getStatus(3)) { // Reasoner is set - infoArea.append("Reasoner: " + StartGUI.myconfig.getReasoner() + "\n"); + if (config.getStatus(3)) { // Reasoner is set + infoArea.append("Reasoner: " + config.getReasoner() + "\n"); } - if (StartGUI.myconfig.getStatus(4)) { // ReasoningServic is set - infoArea.append("ReasoningService: " + StartGUI.myconfig.getReasoningService() + "\n"); + if (config.getStatus(4)) { // ReasoningServic is set + infoArea.append("ReasoningService: " + config.getReasoningService() + "\n"); } if (false) { for (int i = 0; i<8; i++) { // show status-vars - infoArea.append("i: " + StartGUI.myconfig.getStatus(i) + "\n"); + infoArea.append("i: " + config.getStatus(i) + "\n"); } } } if (e.getSource() == runButton) { - if (StartGUI.myconfig.getStatus(6)) { - StartGUI.myconfig.getLearningAlgorithm().start(); - Concept solution = StartGUI.myconfig.getLearningAlgorithm().getBestSolution(); + if (config.getStatus(6)) { + config.getLearningAlgorithm().start(); + Concept solution = config.getLearningAlgorithm().getBestSolution(); infoArea.setText(solution.toString()); } } Modified: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-10 16:49:25 UTC (rev 363) @@ -57,10 +57,13 @@ private JButton digButton; private JList digList = new JList(); private List<Individual> individuals; + private Config config; - ReasonerPanel() { + ReasonerPanel(Config config) { super(new BorderLayout()); + this.config = config; + digButton = new JButton("Use DIG by default"); digButton.addActionListener(this); @@ -76,7 +79,8 @@ centerPanel.add(listScroller); add(centerPanel, BorderLayout.CENTER); - + + digList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { if (evt.getValueIsAdjusting()) @@ -87,25 +91,41 @@ int[] selectedIndices = digList.getSelectedIndices(); for(int i : selectedIndices) exampleSet.add(individuals.get(i).toString()); - StartGUI.myconfig.setExampleSet(exampleSet); - System.out.println("digList: " + StartGUI.myconfig.getExampleSet() ); + //config.setExampleSet(exampleSet); //error + //System.out.println("digList: " + config.getExampleSet() ); //error } }); + } - + + public void valueChanged(ListSelectionEvent evt) { + System.out.println("s"); + if (evt.getValueIsAdjusting()) + return; + System.out.println("Selected from " + evt.getFirstIndex() + " to " + evt.getLastIndex()); + // detect which examples have been selected + Set<String> exampleSet = new HashSet<String>(); + int[] selectedIndices = digList.getSelectedIndices(); + for(int i : selectedIndices) + exampleSet.add(individuals.get(i).toString()); + //StartGUI.myconfig.setExampleSet(exampleSet); + //System.out.println("digList: " + config.getExampleSet() ); + } + + public void actionPerformed(ActionEvent e) { if (e.getSource() == digButton) { // set reasoner - StartGUI.myconfig.setReasoner(StartGUI.myconfig.getComponentManager().reasoner(DIGReasoner.class, StartGUI.myconfig.getKnowledgeSource())); + config.setReasoner(config.getComponentManager().reasoner(DIGReasoner.class, config.getKnowledgeSource())); //System.out.println(StartGUI.myconfig.getKnowledgeSource()); - StartGUI.myconfig.getReasoner().init(); + config.getReasoner().init(); //System.out.println(StartGUI.myconfig.getReasoner()); // set ReasoningService - StartGUI.myconfig.setReasoningService(StartGUI.myconfig.getComponentManager().reasoningService(StartGUI.myconfig.getReasoner())); + config.setReasoningService(config.getComponentManager().reasoningService(config.getReasoner())); // get list from ReasoningService - Set<Individual> individualsSet = StartGUI.myconfig.getReasoningService().getIndividuals(); + Set<Individual> individualsSet = config.getReasoningService().getIndividuals(); //System.out.println("IndividualsSet: " + individualsSet); individuals = new LinkedList<Individual>(individualsSet); //System.out.println("individuals: " + individuals); Modified: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-01-10 16:30:32 UTC (rev 362) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-01-10 16:49:25 UTC (rev 363) @@ -35,7 +35,7 @@ protected static StartGUI myrun; - protected static Config myconfig = new Config(); + //protected static Config myconfig = new Config(); public JTabbedPane tabPane = new JTabbedPane(); @@ -44,17 +44,18 @@ private JPanel tab3 = new JPanel(); private JPanel tab4 = new JPanel(); private JPanel tab5 = new JPanel(); - + public StartGUI() { + Config config = new Config(); this.setTitle("DL-Learner GUI"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationByPlatform(true); this.setSize(640, 480); - tab1.add(new KnowledgeSourcePanel()); - tab2.add(new ReasonerPanel()); - tab3.add(new LearningProblemPanel()); - tab4.add(new LearningAlgorithmPanel()); - tab5.add(new OutputPanel()); + tab1.add(new KnowledgeSourcePanel(config)); + tab2.add(new ReasonerPanel(config)); + tab3.add(new LearningProblemPanel(config)); + tab4.add(new LearningAlgorithmPanel(config)); + tab5.add(new OutputPanel(config)); tabPane.addTab("Knowledge Source", tab1); tabPane.addTab("Reasoner", tab2); tabPane.addTab("Learning Problem", tab3); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |