From: <ton...@us...> - 2008-01-03 15:33:45
|
Revision: 338 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=338&view=rev Author: tonytacker Date: 2008-01-03 07:33:41 -0800 (Thu, 03 Jan 2008) Log Message: ----------- version 1 Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/gui/ComponentRetrievalTest.java Added Paths: ----------- 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/OutputPanel.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/Startgui$1.class trunk/src/dl-learner/org/dllearner/gui/Startgui.class Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/gui/StartGUI_v4.java Modified: trunk/src/dl-learner/org/dllearner/gui/ComponentRetrievalTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ComponentRetrievalTest.java 2008-01-02 13:52:44 UTC (rev 337) +++ trunk/src/dl-learner/org/dllearner/gui/ComponentRetrievalTest.java 2008-01-03 15:33:41 UTC (rev 338) @@ -37,6 +37,7 @@ ComponentManager cm = ComponentManager.getInstance(); List<Class<? extends KnowledgeSource>> sources = cm.getKnowledgeSources(); cm.knowledgeSource(sources.get(0)); + System.out.println(sources.get(1).toString()); } } Added: trunk/src/dl-learner/org/dllearner/gui/Config.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/Config.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2008-01-03 15:33:41 UTC (rev 338) @@ -0,0 +1,123 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import java.io.File; +import java.util.List; + +import org.dllearner.core.ComponentManager; +import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.ReasoningService; +import org.dllearner.core.dl.Individual; + +/** + * config + * + * this class save all together used variables + * + * @author Tilo Hielscher + * + */ + +public class Config { + protected static ComponentManager cm = ComponentManager.getInstance(); + protected static KnowledgeSource source; + protected static File selectedFile; + protected static ReasonerComponent reasoner; + protected static ReasoningService rs; + protected static List<Individual> individuals; + protected static String[] kbBoxItems = {"Pleae select a type", "KBFile", "OWLFile", "SparqleEndpoint"}; + + /** + * status should show witch variables are set + * status[0] ... cm + * status[1] ... KnowledgeSource + * status[2] ... File or URL + * status[3] ... + */ + protected static boolean[] status = new boolean[8]; + + protected boolean getStatus(int position) { + if (status[position]) + return true; + else + return false; + } + + protected ComponentManager getComponentManager() { + return cm; + } + + protected void setComponentManager (ComponentManager input) { + cm = input; + } + + protected File getFile () { + return selectedFile; + } + + protected void setFile (File input) { + status[2] = true; + selectedFile = input; + } + + protected ReasonerComponent getReasoner () { + return reasoner; + } + + protected void setReasoner (ReasonerComponent input) { + status[3] = true; + reasoner = input; + } + + + protected ReasoningService getReasoningService () { + return rs; + } + + protected void setReasoningService (ReasoningService input) { + status[4] = true; + rs = input; + } + + protected List<Individual> getListIndividuals () { + return individuals; + } + + protected void setListIndividuals (List<Individual> input) { + individuals = input; + } + + protected String[] getKBBoxItems() { + return kbBoxItems; + } + + protected KnowledgeSource getKnowledgeSource() { + status[1] = true; + return source; + } + + protected void setKnowledgeSource(KnowledgeSource input) { + source = input; + } + +} Added: trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/KnowledgeSourcePanel.java 2008-01-03 15:33:41 UTC (rev 338) @@ -0,0 +1,122 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import java.io.File; +//import java.util.List; + +import javax.swing.*; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import org.dllearner.kb.OWLFile; +import org.dllearner.kb.KBFile; + + + +/** + * KnowledgeSourcePanel + * + * @author Tilo Hielscher + * + */ + +public class KnowledgeSourcePanel extends JPanel implements ActionListener { + + private static final long serialVersionUID = -7678275020058043937L; + + private JFileChooser fc; + private JButton openButton; + private JTextField fileDisplay; + private String[] kbBoxItems = StartGUI.config.getKBBoxItems(); + private JComboBox cb = new JComboBox(kbBoxItems); + private JPanel openPanel = new JPanel(); + + KnowledgeSourcePanel() { + super(new BorderLayout()); + + fc = new JFileChooser(new File("examples/")); + openButton = new JButton("Open File"); + openButton.addActionListener(this); + fileDisplay = new JTextField(35); + fileDisplay.setEditable(false); + + // test output + //List<Class<? extends KnowledgeSource>> sources = config.getComponentManager().getKnowledgeSources(); + //for (int i=0; i<sources.size(); i++) cb.addItem(sources.get(i)); + cb.addActionListener(this); + + JPanel choosePanel = new JPanel(); + choosePanel.add(cb); + + add(choosePanel, BorderLayout.PAGE_START); + add(openPanel, BorderLayout.CENTER); + } + + public void actionPerformed(ActionEvent e) { + // open File + if (e.getSource() == openButton) { + int returnVal = fc.showOpenDialog(KnowledgeSourcePanel.this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + StartGUI.config.setFile(fc.getSelectedFile()); //save variable + fileDisplay.setText(StartGUI.config.getFile().toString()); + StartGUI.config.getComponentManager().applyConfigEntry(StartGUI.config.getKnowledgeSource(), "url", StartGUI.config.getFile().toURI().toString()); + StartGUI.config.getKnowledgeSource().init(); + } + } + // choose none + if (cb.getSelectedItem().toString() == kbBoxItems[0]) { + System.out.println("Item: " + cb.getSelectedItem()); + makeCenterClean(); + } + // choose KB class + if (cb.getSelectedItem().toString() == kbBoxItems[1]) { + System.out.println("Item: " + cb.getSelectedItem()); + makeCenterClean(); + openPanel.add(fileDisplay); + openPanel.add(openButton); + openPanel.repaint(); + StartGUI.config.setKnowledgeSource(StartGUI.config.getComponentManager().knowledgeSource(KBFile.class)); + } + // choose OWL class + if (cb.getSelectedItem().toString() == kbBoxItems[2]) { + makeCenterClean(); + openPanel.add(fileDisplay); + openPanel.add(openButton); + openPanel.repaint(); + StartGUI.config.setKnowledgeSource(StartGUI.config.getComponentManager().knowledgeSource(OWLFile.class)); + } + // choose SPARCLE class + if (cb.getSelectedItem().toString() == kbBoxItems[3]) { + System.out.println("Item: " + cb.getSelectedItem()); + makeCenterClean(); + } + } + + private void makeCenterClean() { + openPanel.remove(fileDisplay); + openPanel.remove(openButton); + openPanel.repaint(); + StartGUI.renew(); + } +} Added: trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/LearningAlgorithmPanel.java 2008-01-03 15:33:41 UTC (rev 338) @@ -0,0 +1,39 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import javax.swing.*; + +/** + * LearningAlgorithmPanel + * + * @author Tilo Hielscher + * + */ + +public class LearningAlgorithmPanel extends JPanel { + + private static final long serialVersionUID = 8721490771860452959L; + + LearningAlgorithmPanel() { + + } +} Added: trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/LearningProblemPanel.java 2008-01-03 15:33:41 UTC (rev 338) @@ -0,0 +1,39 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import javax.swing.*; + +/** + * LearningProblemPanel + * + * @author Tilo Hielscher + * + */ + +public class LearningProblemPanel extends JPanel { + + private static final long serialVersionUID = -3819627680918930203L; + + LearningProblemPanel() { + + } +} Added: trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/OutputPanel.java 2008-01-03 15:33:41 UTC (rev 338) @@ -0,0 +1,71 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.*; + +/** + * OutputPanel + * + * @author Tilo Hielscher + * + */ + +public class OutputPanel extends JPanel implements ActionListener { + + private static final long serialVersionUID = 1643304576470046636L; + + private JButton showButton; + private JTextArea infoArea; + + OutputPanel() { + super(new BorderLayout()); + + showButton = new JButton("Show Variables"); + showButton.addActionListener(this); + infoArea = new JTextArea(20,40); + + JPanel showPanel = new JPanel(); + showPanel.add(showButton); + JPanel infoPanel = new JPanel(); + infoPanel.add(infoArea); + + add(showPanel, BorderLayout.PAGE_START); + add(infoPanel, BorderLayout.CENTER); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == showButton) { + if (StartGUI.config.getStatus(1)) { // file is selected and exist? + infoArea.append("SourceClass: " + StartGUI.config.getKnowledgeSource().toString() + "\n"); + infoArea.append("FILE: " + StartGUI.config.getFile().toString() + "\n"); + } + if (StartGUI.config.getStatus(2)) { + + } + + } + } +} Added: trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/ReasonerPanel.java 2008-01-03 15:33:41 UTC (rev 338) @@ -0,0 +1,99 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.*; + +import org.dllearner.reasoning.DIGReasoner; + +//import org.dllearner.core.ReasonerComponent; +//import org.dllearner.reasoning.DIGReasoner; + +//import org.dllearner.core.ComponentManager; +//import org.dllearner.core.ReasoningService; + +/** + * ReasonerPanel + * + * @author Tilo Hielscher + * + */ + +public class ReasonerPanel extends JPanel implements ActionListener { + + private static final long serialVersionUID = -7678275020058043937L; + + private JPanel digPanel = new JPanel(); + private JPanel centerPanel = new JPanel(); + private JButton digButton; + private JList digList = new JList(); + + ReasonerPanel() { + super(new BorderLayout()); + + digButton = new JButton("Use DIG by default"); + digButton.addActionListener(this); + + // create a scrollable list of examples + digList.setLayoutOrientation(JList.VERTICAL); + digList.setVisibleRowCount(-1); + JScrollPane listScroller = new JScrollPane(digList); + listScroller.setPreferredSize(new Dimension(250, 80)); + centerPanel.add(listScroller); + + digPanel.add(digButton); + add(digPanel, BorderLayout.PAGE_START); + + centerPanel.add(digList); + add(centerPanel, BorderLayout.CENTER); + + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == digButton) { // DIG + StartGUI.config.setReasoner(StartGUI.config.getComponentManager().reasoner(DIGReasoner.class, StartGUI.config.getKnowledgeSource())); + //StartGUI.config.getReasoner().init(); //error + System.out.println("test"); + + //config.setReasoningService(config.getComponentManager().reasoningService(config.getReasoner())); + + // set list + //Set<Individual> individualsSet = config.getReasoningService().getIndividuals(); + //config.setListIndividuals(new LinkedList<Individual>(individualsSet)); + + // graphic + //DefaultListModel listModel = new DefaultListModel(); + //for(Individual ind : config.getListIndividuals()) + //listModel.addElement(ind); + + // graphic + //Set<String> exampleSet = new HashSet<String>(); + //int[] selectedIndices = digList.getSelectedIndices(); + //for(int i : selectedIndices) + //exampleSet.add(config.getListIndividuals().get(i).toString()); + } + } +} Added: trunk/src/dl-learner/org/dllearner/gui/StartGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI.java 2008-01-03 15:33:41 UTC (rev 338) @@ -0,0 +1,71 @@ +package org.dllearner.gui; + +/** + * Copyright (C) 2007, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +import javax.swing.*; + +/** + * StartGUI + * + * @author Tilo Hielscher + * + */ + +public class StartGUI extends JFrame { + + private static final long serialVersionUID = -739265982906533775L; + + public static Config config = new Config(); + + private static final JTabbedPane tabPane = new JTabbedPane(); + private JPanel tab1 = new JPanel(); + private JPanel tab2 = new JPanel(); + private JPanel tab3 = new JPanel(); + private JPanel tab4 = new JPanel(); + private JPanel tab5 = new JPanel(); + + public StartGUI() { + 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()); + tabPane.addTab("Knowledge Source", tab1); + tabPane.addTab("Reasoner", tab2); + tabPane.addTab("Learning Problem", tab3); + tabPane.addTab("Learning Algortihm", tab4); + tabPane.addTab("Output", tab5); + this.add(tabPane); + this.setVisible(true); + } + + public static void main(String[] args) { + new StartGUI(); + } + + protected static void renew() { + tabPane.repaint(); + } +} Deleted: trunk/src/dl-learner/org/dllearner/gui/StartGUI_v4.java =================================================================== --- trunk/src/dl-learner/org/dllearner/gui/StartGUI_v4.java 2008-01-02 13:52:44 UTC (rev 337) +++ trunk/src/dl-learner/org/dllearner/gui/StartGUI_v4.java 2008-01-03 15:33:41 UTC (rev 338) @@ -1,214 +0,0 @@ -package org.dllearner.gui; - -//File : gui/containers/dialogs/filechooser/CountWords.java -//Purpose: Counts words in file. -// Illustrates menus, JFileChooser, Scanner.. -//Author : Fred Swartz - 2006-10-10 - Placed in public domain. - -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; - -//import org.dllearner.algorithms.RandomGuesser; -//import org.dllearner.core.Component; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.KnowledgeSource; -//import org.dllearner.core.LearningAlgorithm; -//import org.dllearner.core.LearningProblem; -//import org.dllearner.core.ReasonerComponent; -//import org.dllearner.core.ReasoningService; -import org.dllearner.kb.OWLFile; -//import org.dllearner.learningproblems.PosNegDefinitionLP; -//import org.dllearner.reasoning.DIGReasoner; - -import java.io.*; -import java.util.*; - -////////////////////////////////////////////////////////CountWords -public class StartGUI_v4 extends JFrame { - - - /** - * - */ - private static final long serialVersionUID = 9151367563590748364L; - -//====================================================== fields - JTextField _fileNameTF = new JTextField(15); - JTextField _wordCountTF = new JTextField(4); - JFileChooser _fileChooser = new JFileChooser(); - JTextArea _textField = new JTextArea(); - ComponentManager cm = ComponentManager.getInstance(); // create singleton instance - - //================================================= constructor - StartGUI_v4() { - //... Create / set component characteristics. - _fileNameTF.setEditable(false); - _wordCountTF.setEditable(false); - - //... Add listeners <-- extra classes - - //... Create content pane, layout components - JPanel content = new JPanel(); - content.setLayout(new FlowLayout()); - content.add(new JLabel("File:")); // name of opend file - content.add(_fileNameTF); - content.add(new JLabel("Word Count:")); // test - content.add(_wordCountTF); // test - content.add(_textField); // test_output - - //... Create menu elements (menubar, menu, menu item) - JMenuBar menubar = new JMenuBar(); - JMenu fileMenu = new JMenu("File"); - JMenuItem openItem = new JMenuItem("Open"); - openItem.addActionListener(new OpenAction()); - JMenuItem saveItem = new JMenuItem("Save"); - saveItem.addActionListener(new SaveAction()); - JMenuItem exitItem = new JMenuItem("Exit"); - exitItem.addActionListener(new ExitAction()); - - - //... Assemble the menu - menubar.add(fileMenu); - fileMenu.add(openItem); - //fileMenu.add(saveItem); - fileMenu.add(exitItem); - - //... _textField (TextArea) into a JScrollPane - JScrollPane scrollPane = new JScrollPane(_textField); - scrollPane.setPreferredSize(new Dimension(320, 240)); - - //... Set window characteristics - this.setJMenuBar(menubar); - this.setContentPane(content); - this.setTitle("DL-Learner"); - this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - this.add(scrollPane); - this.pack(); // Layout components. - this.setLocationRelativeTo(null); // Center window. - - // RUN - - - //System.out.println("components"); - //System.out.println(cm.getComponents()); // show components - //System.out.println("knowledgeSources"); - //System.out.println(cm.getKnowledgeSources()); // possible sources - - - -/* - // create DIG reasoning service with standard settings - ReasonerComponent reasoner = cm.reasoner(DIGReasoner.class, source); - // ReasoningService rs = cm.reasoningService(DIGReasonerNew.class, source); - reasoner.init(); - ReasoningService rs = cm.reasoningService(reasoner); - - // create a learning problem and set positive and negative examples - LearningProblem lp = cm.learningProblem(PosNegDefinitionLP.class, rs); - Set<String> positiveExamples = new TreeSet<String>(); - positiveExamples.add("http://example.com/father#stefan"); - positiveExamples.add("http://example.com/father#markus"); - positiveExamples.add("http://example.com/father#martin"); - Set<String> negativeExamples = new TreeSet<String>(); - negativeExamples.add("http://example.com/father#heinz"); - negativeExamples.add("http://example.com/father#anna"); - negativeExamples.add("http://example.com/father#michelle"); - cm.applyConfigEntry(lp, "positiveExamples", positiveExamples); - cm.applyConfigEntry(lp, "negativeExamples", negativeExamples); - lp.init(); - - // create the learning algorithm - LearningAlgorithm la = cm.learningAlgorithm(RandomGuesser.class, lp, rs); - cm.applyConfigEntry(la, "numberOfTrees", 100); - cm.applyConfigEntry(la, "maxDepth", 5); - la.init(); - - // start the algorithm and print the best concept found - //la.start(); - //System.out.println(la.getBestSolution()); -*/ - - } - - // a test method - //============================================= countWordsInFile - private int countWordsInFile(File f) { - - int numberOfWords = 0; // Count of words. - - try { - Scanner in = new Scanner(f); - - while (in.hasNext()) { - String word = in.next(); // Read a "token". - numberOfWords++; - } - in.close(); // Close Scanner's file. - - } catch (FileNotFoundException fnfex) { - // ... We just got the file from the JFileChooser, - // so it's hard to believe there's problem, but... - JOptionPane.showMessageDialog(StartGUI_v4.this, - fnfex.getMessage()); - } - return numberOfWords; - } - - - ///////////////////////////////////////////////////// OpenAction - class OpenAction implements ActionListener { - public void actionPerformed(ActionEvent ae) { - //... Open a file dialog. - int retval = _fileChooser.showOpenDialog(StartGUI_v4.this); - if (retval == JFileChooser.APPROVE_OPTION) { - //... The user selected a file, get it, use it. - File file = _fileChooser.getSelectedFile(); - - //... Update user interface. - _fileNameTF.setText(file.getName()); - _wordCountTF.setText("" + countWordsInFile(file)); - //show file in _textField - try { - _textField.read(new FileReader(file), ""); - } catch (Exception e) { - e.printStackTrace(); - } - // create knowledge source - KnowledgeSource source = cm.knowledgeSource(OWLFile.class); - //String example = "examples/father.owl"; - cm.applyConfigEntry(source, "url", file.toURI().toString()); - source.init(); - } - } - } - - ///////////////////////////////////////////////////// OpenAction - class SaveAction implements ActionListener { - public void actionPerformed(ActionEvent ae) { - //... Open a file dialog. - int retval = _fileChooser.showOpenDialog(StartGUI_v4.this); - if (retval == JFileChooser.APPROVE_OPTION) { - //... The user selected a file, get it, use it. - File file = _fileChooser.getSelectedFile(); - - //... Update user interface. - _fileNameTF.setText(file.getName()); - _wordCountTF.setText("" + countWordsInFile(file)); - } - } - } - - ///////////////////////////////////////////////////// ExitAction - class ExitAction implements ActionListener { - public void actionPerformed(ActionEvent ae) { - System.exit(0); - } - } - - //========================================================= main - public static void main(String[] args) { - JFrame window = new StartGUI_v4(); - window.setVisible(true); - } -} \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/gui/Startgui$1.class =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/gui/Startgui$1.class ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/src/dl-learner/org/dllearner/gui/Startgui.class =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/gui/Startgui.class ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |