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