From: <hee...@us...> - 2009-03-02 14:50:57
|
Revision: 1642 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1642&view=rev Author: heeroyuy Date: 2009-03-02 14:50:52 +0000 (Mon, 02 Mar 2009) Log Message: ----------- -fixed some errors -removed unnecessary code Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.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/ReadingOntologyThread.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -199,8 +199,6 @@ * MouseEvent */ public void mouseClicked(MouseEvent m) { - //EvaluatedDescription eDescription = null; - if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { SuggestListItem item = (SuggestListItem) view .getSuggestClassPanel().getSuggestList().getSelectedValue(); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -20,11 +20,9 @@ package org.dllearner.tools.protege; -import java.net.URI; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.Vector; import javax.swing.DefaultListModel; @@ -80,7 +78,7 @@ private final ComponentManager cm; - private static final String EQUIVALENT_CLASS_AXIOM_STRING = "Suggest equivalent class"; + private static final String EQUIVALENT_CLASS_AXIOM_STRING = "equivalent class"; private static final String SUPER_CLASS_AXIOM_STRING = "Suggest super class"; private static final String EQUIVALENT_CLASS_LEARNING = "equivalence"; private static final String SUPER_CLASS_LEARNING = "superClass"; @@ -139,7 +137,6 @@ // The Individuals of the Ontology private Set<Individual> individual; - private Set<OWLAPIOntology> ontologies; private int instancesCount; // The error message which is rendered when an error occured @@ -151,12 +148,9 @@ // This is necessary to get the details of the suggested concept - private DefaultListModel posListModel; - private DefaultListModel negListModel; private final Set<KnowledgeSource> sources; private boolean hasIndividuals; private NamedClass currentConcept; - private Vector<IndividualObject> individualVector; private Set<String> ontologieURI; private final boolean ontologyConsistent; private final DLLearnerView view; @@ -182,10 +176,7 @@ ontologyConsistent = true; instancesCount = 0; owlDescription = new HashSet<OWLDescription>(); - posListModel = new DefaultListModel(); - negListModel = new DefaultListModel(); ComponentManager.setComponentClasses(componenten); - individualVector = new Vector<IndividualObject>(); cm = ComponentManager.getInstance(); ds = new HashSet<OWLDescription>(); suggestModel = new DefaultListModel(); @@ -205,24 +196,6 @@ } /** - * This method returns the data for the suggest panel. - * - * @return Model for the suggest panel. - */ - public DefaultListModel getSuggestList() { - return suggestModel; - } - - /** - * This method returns an array of descriptions learned by the DL-Learner. - * - * @return Array of descriptions learned by the DL-Learner. - - public Description[] getDescriptions() { - return description; - }*/ - - /** * This Method returns a List of evaluated descriptions suggested by the * DL-Learner. * @@ -260,8 +233,6 @@ } catch (InconsistentOntologyException incon) { view.setIsInconsistent(true); } - - // rs = cm.reasoningService(reasoner); } /** @@ -337,25 +308,6 @@ } /** - * This method resets the Concepts that are learned. - */ - public void unsetNewConcepts() { - for(OWLDescription o : owlDescription) { - owlDescription.remove(o); - } - } - - /** - * This method returns the Vector of IndividualObjects. - * - * @return individualVector Vector - */ - public Vector<IndividualObject> getIndividualVector() { - return individualVector; - } - - - /** * This method sets the positive examples for learning. * @param ind Set of Individuals */ @@ -389,35 +341,6 @@ } /** - * This method resets the vectors where the check boxes for positive and - * negative Examples are stored. It is called when the DL-Learner View is - * closed. - */ - public void clearVector() { - individualVector.removeAllElements(); - posListModel.removeAllElements(); - negListModel.removeAllElements(); - } - - /** - * This method returns the PosListModel. - * - * @return DefaultListModel posListModel - */ - public DefaultListModel getPosListModel() { - return posListModel; - } - - /** - * This method returns the NegListModel. - * - * @return DefaultListModel negListModel - */ - public DefaultListModel getNegListModel() { - return negListModel; - } - - /** * This method returns the current learning algorithm that is used to learn * new concepts. * @@ -428,28 +351,6 @@ } /** - * This method resets the model for the suggest panel. It is called befor - * the DL-Learner learns the second time or when the DL-Learner tab is - * closed. - */ - public void unsetListModel() { - if (suggestModel != null) { - suggestModel.removeAllElements(); - } - } - - /** - * This method gets a description from the DL-Learner and adds is to the - * model from the suggest panel. - * - * @param descript - * Description from the DL-Learner - */ - public void setSuggestModel(Description descript) { - suggestModel.add(0, descript); - } - - /** * This method returns a set of concepts that are learned by the DL-Learner. * They are already converted into the OWLDescription format. * @@ -472,15 +373,6 @@ } /** - * This method returns a set of OWL descriptions that should - * be added to the OWL file. - * @return Set of OWL descriptions - */ - public Set<OWLDescription> getDescriptions() { - return ds; - } - - /** * This method returns the currently learned description in OWLDescription * format. * @@ -577,15 +469,6 @@ } /** - * This Method returns the URI of the currently loaded Ontology. - * - * @return URI Ontology URI - */ - public URI getURI() { - return editor.getModelManager().getActiveOntology().getURI(); - } - - /** * This method sets the suggestion list. * * @param list @@ -596,32 +479,6 @@ } /** - * This method returns the OWLEditorKit. - * @return OWLEditorKit - */ - public OWLEditorKit getOWLEditorKit() { - return editor; - } - - /** - * This method returns the currently used ontoloies including importet - * ontologies. - * - * @return Set of OWLAPI ontologies - */ - public Set<OWLAPIOntology> getOWLOntologies() { - return ontologies; - } - - /** - * This method returns the Knowledgesources currenty used. - * @return Set of Knowledgesources - */ - public Set<KnowledgeSource> getKnowledgeSources() { - return sources; - } - - /** * This method returns the Strings of the Ontology uri's that are currently used. * @return ontologieURI */ @@ -637,30 +494,6 @@ } /** - * Sets the positive examples. - * @param list list of positive Expamles - */ - public void setPosListModel(DefaultListModel list) { - this.posListModel = list; - } - - /** - * Sets the negative examples. - * @param list list of negative examples - */ - public void setNegListModel(DefaultListModel list) { - this.negListModel = list; - } - - /** - * Sets the individual vector. - * @param indi Vector of Individuals - */ - public void setIndividualVector(Vector<IndividualObject> indi) { - this.individualVector = indi; - } - - /** * This sets the current concept. * @param current currently selected class */ Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -26,6 +26,7 @@ import java.net.URL; import java.util.Set; +import javax.swing.DefaultListModel; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComponent; @@ -43,24 +44,24 @@ * @author Christian Koetteritzsch * */ -public class DLLearnerView extends JPanel{ +public class DLLearnerView { private static final long serialVersionUID = 624829578325729385L; // this is the Component which shows the view of the dllearner - private final JComponent learner; + private JComponent learner; // Accept button to add the learned concept to the owl - private final JButton accept; + private JButton accept; // Runbutton to start the learning algorithm - private final JButton run; + private JButton run; // This is the label for the advanced button. - private final JLabel adv; + private JLabel adv; // This is the color for the error message. It is red. @@ -68,19 +69,19 @@ // This is the text area for the error message when an error occurred - private final JTextArea errorMessage; + private JTextArea errorMessage; // Advanced Button to activate/deactivate the example select panel - private final JToggleButton advanced; + private JToggleButton advanced; // Action Handler that manages the Button actions - private final ActionHandler action; + private ActionHandler action; // This is the model of the dllearner plugin which includes all data - private final DLLearnerModel model; + private DLLearnerModel model; // Panel for the suggested concepts @@ -88,22 +89,23 @@ // Selection panel for the positive and negative examples - private final PosAndNegSelectPanel posPanel; + private PosAndNegSelectPanel posPanel; // Picture for the advanced button when it is not toggled - private final ImageIcon icon; + private ImageIcon icon; // Picture of the advanced button when it is toggled - private final JPanel addButtonPanel; - private final JLabel wikiPane; - private final ImageIcon toggledIcon; - private final JTextArea hint; + private JPanel addButtonPanel; + private JLabel wikiPane; + private ImageIcon toggledIcon; + private JTextArea hint; private boolean isInconsistent; // This is the Panel for more details of the suggested concept - private final MoreDetailForSuggestedConceptsPanel detail; - private final ReadingOntologyThread readThread; + private MoreDetailForSuggestedConceptsPanel detail; + private ReadingOntologyThread readThread; private final OWLEditorKit editorKit; + private final String label; /** * The constructor for the DL-Learner tab in the class description @@ -113,12 +115,33 @@ * @param label String */ public DLLearnerView(String label, OWLEditorKit editor) { + this.label = label; editorKit = editor; + + } + + /** + * This method returns the SuggestClassPanel. + * @return SuggestClassPanel + */ + public SuggestClassPanel getSuggestClassPanel() { + return sugPanel; + } + /** + * This method returns the PosAndNegSelectPanel. + * @return PosAndNegSelectPanel + */ + public PosAndNegSelectPanel getPosAndNegSelectPanel() { + return posPanel; + } + + /** + * This Method renders the view of the plugin. + */ + public void makeView() { model = new DLLearnerModel(editorKit, label, this); sugPanel = new SuggestClassPanel(); action = new ActionHandler(this.action, model, this, label); - readThread = new ReadingOntologyThread(editorKit, null, this, model); - readThread.start(); wikiPane = new JLabel("<html>See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for an introduction.</html>"); URL iconUrl = this.getClass().getResource("arrow.gif"); icon = new ImageIcon(iconUrl); @@ -147,16 +170,16 @@ addRunButtonListener(this.action); addAdvancedButtonListener(this.action); run.setEnabled(false); - model.clearVector(); hint.setText("To get suggestions for class descriptions, please click the button above."); isInconsistent = false; - + readThread = new ReadingOntologyThread(editorKit, this, model); + readThread.start(); hint.setVisible(true); advanced.setIcon(icon); accept.setEnabled(false); action.resetToggled(); addButtonPanel.add("North", accept); - sugPanel.setSuggestList(model.getSuggestList()); + sugPanel.setSuggestList(new DefaultListModel()); sugPanel = sugPanel.updateSuggestClassList(); advanced.setSelected(false); sugPanel.setBounds(10, 35, 490, 110); @@ -181,33 +204,8 @@ learner.add(errorMessage); learner.add(posPanel); detail = new MoreDetailForSuggestedConceptsPanel(model); - - } /** - * This method returns the SuggestClassPanel. - * @return SuggestClassPanel - */ - public SuggestClassPanel getSuggestClassPanel() { - return sugPanel; - } - /** - * This method returns the PosAndNegSelectPanel. - * @return PosAndNegSelectPanel - */ - public PosAndNegSelectPanel getPosAndNegSelectPanel() { - return posPanel; - } - - /** - * This Method renders the view of the plugin. - */ - public void makeView() { - - //add(learner); - - } - /** * This method sets the right icon for the advanced Panel. * @param toggled boolean */ @@ -260,6 +258,14 @@ return model.getNewOWLDescription(); } + + public void dispose() { + this.unsetEverything(); + sugPanel.getSuggestList().removeAll(); + learner.removeAll(); + model.getSuggestModel().clear(); + model.getIndividual().clear(); + } /** * Returns the last added description. @@ -274,7 +280,7 @@ */ public void unsetEverything() { run.setEnabled(true); - model.unsetNewConcepts(); + model.getNewOWLDescription().clear(); action.destroyDLLearnerThread(); errorMessage.setText(""); learner.removeAll(); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -52,9 +52,6 @@ @Override public void mouseMoved(MouseEvent m) { Vector<IndividualPoint> v = panel.getIndividualVector(); - //System.out.println("hier: " + m.getX() + " " + m.getY()); - //System.out.println("bla: " + v.get(0).getXAxis() + " " - // + v.get(0).getYAxis()); for (int i = 0; i < v.size(); i++) { if (v.get(i).getXAxis() >= m.getX() - 5 && v.get(i).getXAxis() <= m.getX() + 5 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -35,60 +35,7 @@ private static final long serialVersionUID = 23632947283479L; - // this is the Panel where the check boxes are. - - private JPanel posAndNegSelectPanel; - - // This is the DLLearner Model - - //private DLLearnerModel model; - - // This is the Scroll pane if there are more Check boxes than the view can - // show - - //private JScrollPane posScrollList; - - //private JScrollPane negScrollList; - - //private JList posList; - //private JList negList; - //private JPanel posPanel; - //private JPanel negPanel; - //private JPanel buttonPanel; - //private JButton addToNegExamples; - //private JButton addToPosExamples; - //private JPanel posLabelPanel; - //private JPanel negLabelPanel; - - // This is the Label that shows "Positive Examples" - - //private JLabel pos; - - // This is the Label that shows "Negative Examples" - - //private JLabel neg; - - // This is the Panel where the Label for Positive Examples and - // a help Button is in - - - // This is the Help button for positive examples - - //private JButton helpForPosExamples; - - // This is the Help button for negative examples - - //private JButton helpForNegExamples; - - // This is the Text area where the help message is displayed. private final OptionPanel optionPanel; - //private DefaultListModel posListModel; - //private ImageIcon addToPosListIcon; - //private ImageIcon addToNegListIcon; - //private DefaultListModel negListModel; - //private JPanel examplePanel; - //private PosAndNegSelectPanelHandler handler; - //private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; /** * This is the constructor for the Panel that shows the check boxes. @@ -103,258 +50,16 @@ super(); setLayout(new GridLayout(0, 1)); setPreferredSize(new Dimension(490, 100)); - //view = v; - //this.model = model; - //handler = new PosAndNegSelectPanelHandler(model, view, this); - //Instantiate all objects needed optionPanel = new OptionPanel(); - //examplePanel = new JPanel(null); - //posLabelPanel = new JPanel(null); - //negLabelPanel = new JPanel(null); - //URL iconUrl = this.getClass().getResource("backspace.gif"); - //addToPosListIcon = new ImageIcon(iconUrl); - //URL toggledIconUrl = this.getClass().getResource("space.gif"); - //addToNegListIcon = new ImageIcon(toggledIconUrl); - //posListModel = new DefaultListModel(); - //negListModel = new DefaultListModel(); - //pos = new JLabel("Positive Examples"); - //pos.setBounds(0, 0, 100, 30); - //neg = new JLabel("Negative Examples"); - //neg.setBounds(0, 0, 100, 30); - //posList = new JList(posListModel); - //posList.setName("pos"); - //posList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - //negList = new JList(negListModel); - //negList.setName("neg"); - //negList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - //addToPosExamples = new JButton(addToPosListIcon); - //addToPosExamples.setName("pos"); - //addToNegExamples = new JButton(addToNegListIcon); - //addToNegExamples.setName("neg"); - //helpForPosExamples = new JButton("?"); - //helpForPosExamples.setBounds(100, 5, 20, 20); - //helpForNegExamples = new JButton("?"); - //helpForNegExamples.setBounds(105, 5, 20, 20); - //helpForPosExamples.setName("PosHelpButton"); - //helpForNegExamples.setName("NegHelpButton"); - //set size for components that have no layout. - //posPanel = new JPanel(null); - //posPanel.setPreferredSize(new Dimension(200, 100)); - //negPanel = new JPanel(null); - //negPanel.setPreferredSize(new Dimension(200, 100)); - //buttonPanel = new JPanel(null); - //buttonPanel.setPreferredSize(new Dimension(90, 85)); - //addToPosExamples.setBounds(0, 50, 70, 30); - //addToNegExamples.setBounds(0, 80, 70, 30); - //buttonPanel.add(addToPosExamples); - //buttonPanel.add(addToNegExamples); - //posLabelPanel.add(pos); - //posLabelPanel.add(helpForPosExamples); - //negLabelPanel.add(neg); - //negLabelPanel.add(helpForNegExamples); - //posScrollList = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - // JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - //posScrollList.setViewportView(posList); - - //negScrollList = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, - // JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - //negScrollList.setViewportView(negList); - - //posLabelPanel.setBounds(0, 0, 200, 30); - //posScrollList.setBounds(0, 40, 190, 85); - - //posPanel.add(posScrollList); - //posPanel.add(posLabelPanel); - - //negLabelPanel.setBounds(0, 0, 200, 30); - //negScrollList.setBounds(0, 40, 185, 85); - //negPanel.add(negLabelPanel); - //negPanel.add(negScrollList); - - //posPanel.setBounds(0, 0, 200, 250); - //buttonPanel.setBounds(210, 0, 90, 250); - //negPanel.setBounds(300, 0, 200, 250); - //examplePanel.add(posPanel); - //examplePanel.add(buttonPanel); - //examplePanel.add(negPanel); - //addHelpButtonListener(handler); add(optionPanel); - //add(examplePanel); - //posList.addMouseListener(handler); - //negList.addMouseListener(handler); - //addToPosExamples.addActionListener(handler); - //addToNegExamples.addActionListener(handler); } - - ///** - // * This method adds the check boxes, the labels and the help buttons for - // * positive and negative examples. - // * @param posData DefaultListModel - // * @param negData DefaultListModel - // */ - //public void setExampleList(DefaultListModel posData, DefaultListModel negData) { - // posListModel = posData; - // negListModel = negData; - // posList.setModel(posListModel); - // negList.setModel(negListModel); - //} - ///** - // * This method returns the pos button. - // * @return JButton - // */ - //public JButton getAddToPosPanelButton() { - // return addToPosExamples; - //} - - ///** - // * This method returns the neg button. - // * @return JButton - // */ - //public JButton getAddToNegPanelButton() { - // return addToNegExamples; - //} - /** - * This method removes the Check boxes, the labels and the help buttons - * after the DL-Learner tab is closed. - */ - public void unsetPosAndNegPanel() { - - } - - /** - * This method adds the item listener for every check box. - * - * @param act - * ActionHandler - */ - public void addListeners(ActionHandler act) { - // adds the listener for the checkboxes - - } - - /** - * Nothing. - * @param act ActionHandler - */ - public void removeListeners(ActionHandler act) { - - } - - /** - * Nothing. - * @param enable boolean - */ - public void setCheckBoxesEnable(boolean enable) { - } - - /** - * This method returns the Panel where the check boxes, labels and help - * buttons are in. - * - * @return JPanel where check boxes, labels and help buttons are in. - */ - public JPanel getPosAndNegSelectPanel() { - return posAndNegSelectPanel; - } - - ///** - // * This message displays the help message after the help button is pressed. - // * - // * @param assistance String - // */ - //public void renderHelpMessage(String assistance) { - // // renders scroll bar if necessary - // JOptionPane.showMessageDialog(null, assistance); - // - //} - - ///** - // * this method sets the example to the other list when button is pressed. - // * @param toPos boolean - // * @param example String - // */ - //public void setExampleToOtherList(boolean toPos, String example) { - // if (toPos) { - // for(int i = 0; i < negListModel.size(); i++) { - // if(negListModel.get(i).equals(example)) { - // negListModel.remove(i); - // for (int j = 0; j < model.getIndividualVector().size(); j++) { - // if (model.getIndividualVector().get(j).getIndividualString().contains(example)) { - // model.getIndividualVector().get(j).setExamplePositive(true); - // break; - // } - // } - // - // } - // } - // posListModel.add(0, example); - // } else { - // for(int i = 0; i < posListModel.size(); i++) { - // if(posListModel.get(i).equals(example)) { - // posListModel.remove(i); - // for (int j = 0; j < model.getIndividualVector().size(); j++) { - // if (model.getIndividualVector().get(j).getIndividualString().contains(example)) { - // model.getIndividualVector().get(j).setExamplePositive(false); - // } - // } - // break; - // } - // } - // negListModel.add(0, example); - // } - // setExampleList(posListModel, negListModel); - // addToPosExamples.setEnabled(false); - // addToNegExamples.setEnabled(false); - // - //} - - ///** - // * This method adds the Action listener to the help buttons. - // * - // * @param handle - // * PosAndNegSelectPanelHandler - // */ - //public void addHelpButtonListener(PosAndNegSelectPanelHandler handle) { - // // adds listener to the help button for the positive examples - // helpForPosExamples.addActionListener(handle); - // // adds listener to the help button for the negative examples - // helpForNegExamples.addActionListener(handle); - //} - - - ///** - // * This Method removes the listeners for the help button. - // * @param a ActionHandler - // */ - //public void removeHelpButtonListener(ActionHandler a) { - // helpForPosExamples.removeActionListener(a); - // helpForNegExamples.removeActionListener(a); - //} - - /** * This method returns the option panel. * @return OptionPanel */ public OptionPanel getOptionPanel() { return optionPanel; } - - ///** - // * This method returns the list of positive examples. - // * @return JList posExampleList - // */ - //public JList getPosExampleList() { - // return posList; - //} - - ///** - // * This method returns the list of negative examples. - // * @return JList negExampleList - // */ - //public JList getNegExampleList() { - // return negList; - //} } Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -1,144 +0,0 @@ -/** - * Copyright (C) 2007-2009, 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.tools.protege; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; - -/** - * This class handles the commands for the example panel. - * @author christian Koetteritzsch - * - */ -public class PosAndNegSelectPanelHandler implements ActionListener, MouseListener { - - -// This is the DLLearnerModel. - -//private DLLearnerModel model; -//private PosAndNegSelectPanel panel; -// This is the view of the DL-Learner tab. -//private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; - -/** - * This is the constructor for the PosAndNegSelectPanelHandler. - * @param m - * DLLearnerModel - * @param v - * OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView - * @param p - * PosAndNegSelectPanel - */ -public PosAndNegSelectPanelHandler(DLLearnerModel m, DLLearnerView v, PosAndNegSelectPanel p) { - //model = m; - //panel = p; - //view = v; -} - -/** - * When a Button is pressed this method select the right. - * @param action ActionEvent - */ -public void actionPerformed(ActionEvent action) { - - //System.out.println(action.getSource()); - //if (action.getSource().toString().contains("pos")) { - //panel.setExampleToOtherList(true, panel.getNegExampleList().getSelectedValue().toString()); - //System.out.println("COUNT: " + panel.getPosExampleList().getModel().getSize()); - //if(panel.getPosExampleList().getModel().getSize()>0) { - // view.getRunButton().setEnabled(true); - //} - //} - - //if (action.getSource().toString().contains("neg")) { - //panel.setExampleToOtherList(false, panel.getPosExampleList().getSelectedValue().toString()); - //} - - //if (action.getActionCommand().equals("?")) { - //if (action.getSource().toString().contains("PosHelpButton")) { - //String help = "An individual that should be an instance of the learned class description.\n" - // +"Per default all that belongs to the class."; - //view.getPosAndNegSelectPanel().renderHelpMessage(help); - //} - - //if (action.getSource().toString().contains("NegHelpButton")) { - //String help = "An individual that should not be instance of the learned class description.\n" - // +" By default, these are all individuals, which are not instances of the current class."; - //view.getPosAndNegSelectPanel().renderHelpMessage(help); - //} - - //} -} - - - - -/** - * Nothing happens here. - * @param m MouseEvent - */ -public void mouseReleased(MouseEvent m) { - -} - - /** - * Nothing happens here. - * @param m MouseEvent - */ -public void mouseEntered(MouseEvent m) { - -} - -/** - * Choses the right EvaluatedDescription object after a concept is chosen in the list. - * @param m MouseEvent - */ -public void mouseClicked(MouseEvent m) { - //if (!panel.getPosExampleList().isSelectionEmpty() && m.toString().contains("pos")) { - // panel.getAddToNegPanelButton().setEnabled(true); - // panel.getAddToPosPanelButton().setEnabled(false); - // panel.getNegExampleList().clearSelection(); - //} - //if (!panel.getNegExampleList().isSelectionEmpty() && m.toString().contains("neg")) { - // panel.getAddToPosPanelButton().setEnabled(true); - // panel.getAddToNegPanelButton().setEnabled(false); - // panel.getPosExampleList().clearSelection(); - //} -} - -/** - * Nothing happens here. - * @param m MouseEvent - */ -public void mouseExited(MouseEvent m) { - -} - -/** - * Sets the ADD button enable after a concept is chosen. - * @param m MouseEvent - */ -public void mousePressed(MouseEvent m) { -} - - -} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -50,9 +50,9 @@ @Override public boolean isValidInput() { - System.out.println("testen2: " + super.getOWLEditorKit().getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass()); - System.out.println("testen: " + super.getOWLEditorKit().getWorkspace()); + System.out.println("testen: " + super.getOWLEditorKit().getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass()); view = new DLLearnerView("equivalent class", this.getOWLEditorKit()); + view.makeView(); return true; } @@ -64,10 +64,12 @@ @Override public void initialise() throws Exception { view = new DLLearnerView("equivalent class", super.getOWLEditorKit()); + view.makeView(); } @Override public void dispose() throws Exception { + view.dispose(); view = null; } @@ -79,6 +81,7 @@ @Override public void removeStatusChangedListener( InputVerificationStatusChangedListener arg0) { + view.dispose(); view = null; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -27,10 +27,8 @@ import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; -import org.dllearner.core.owl.Thing; import org.dllearner.reasoning.FastInstanceChecker; import org.protege.editor.owl.OWLEditorKit; -import org.protege.editor.owl.ui.frame.OWLFrame; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLOntology; @@ -46,11 +44,11 @@ private FastInstanceChecker reasoner; private NamedClass currentConcept; private Set<Individual> individual; - private final Set<String> ontologieURI; + private Set<String> ontologieURI; private final OWLEditorKit editor; private final DLLearnerModel model; private boolean isInconsistent; - private final OWLClass current; + private OWLClass current; private final DLLearnerView view; /** @@ -60,25 +58,23 @@ * @param v DL-Learner view * @param m DL-Learner model */ - public ReadingOntologyThread(OWLEditorKit editorKit, OWLFrame<OWLClass> frame, DLLearnerView v, DLLearnerModel m) { - ontologieURI = new HashSet<String>(); + public ReadingOntologyThread(OWLEditorKit editorKit, DLLearnerView v, DLLearnerModel m) { this.editor = editorKit; - current = editor.getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass(); this.view = v; this.model = m; - } /** * This method sets the individuals that belong to the concept which is * chosen in protege. */ private void setPositiveConcept() { + current = editor.getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass(); if(current != null) { SortedSet<Individual> individuals = null; hasIndividuals = false; // checks if selected concept is thing when yes then it selects all // individuals - if (!(current instanceof Thing)) { + if (!(current.toString().equals("Thing"))) { List<NamedClass> classList = reasoner.getAtomicConceptsList(); for(NamedClass concept : classList) { // if individuals is null @@ -99,7 +95,9 @@ } individual = reasoner.getIndividuals(concept); model.setIndividuals(individual); + model.setHasIndividuals(hasIndividuals); model.setCurrentConcept(currentConcept); + view.getRunButton().setEnabled(true); break; } } @@ -108,6 +106,7 @@ } } } else { + System.out.println("hier"); if (reasoner.getIndividuals().size() > 0) { hasIndividuals = true; @@ -132,6 +131,7 @@ * Checks the URI if a "#" is in it. */ private void checkURI() { + ontologieURI = new HashSet<String>(); Set<OWLOntology> ont = editor.getModelManager().getActiveOntologies(); Set<Individual> indi = reasoner.getIndividuals(); for(OWLOntology onto : ont) { @@ -151,70 +151,9 @@ model.setOntologyURIString(ontologieURI); } - ///** - // * This method sets the check boxes for the positive check boxes checked if - // * the individuals matches the concept that is chosen in protege. - // */ - //private void setPosVector() { - // setPositiveConcept(); - // SortedSet<Individual> reasonerIndi = reasoner.getIndividuals(); - // for(Individual ind : reasonerIndi) { - // Set<String> onto = ontologieURI; - // for(String ont : onto) { - // String indiv = ind.toString(); - // // checks if individual belongs to the selected concept - // if (setPositivExamplesChecked(indiv)) { - // if (indiv.contains(ont)) { - // // when yes then it sets the positive example checked - // - // // OWLExpressionCheckerFactory - // posListModel.add(0, ind.toManchesterSyntaxString(ont, null)); - // individualVector.add(new IndividualObject(indiv, true)); - // break; - // } - // - // } else { - // // When no it unchecks the positive example - // if (indiv.contains(ont)) { - // individualVector - // .add(new IndividualObject(indiv, false)); - // negListModel.add(0, ind.toManchesterSyntaxString(ont, null)); - // break; - // } - // } - // } - // } - // //view.getPosAndNegSelectPanel().setExampleList(posListModel, negListModel); - // model.setPosListModel(posListModel); - // model.setNegListModel(negListModel); - // model.setIndividualVector(individualVector); - //} - - ///** - // * This method gets an Individual and checks if this individual belongs to - // * the concept chosen in protege. - // * - //* @param indi - // * Individual to check if it belongs to the chosen concept - // * @return is Individual belongs to the concept which is chosen in protege. - // */ - //private boolean setPositivExamplesChecked(String indi) { - // boolean isChecked = false; - // // checks if individuals are not empty - // if (individual != null) { - // // checks if the delivered individual belongs to the individuals of - // // the selected concept - // if (individual.toString().contains(indi)) { - // isChecked = true; - // } - // } - // return isChecked; - // - //} - @Override public void run() { - model.unsetListModel(); + model.getSuggestModel().removeAllElements(); model.initReasoner(); reasoner = model.getReasoner(); isInconsistent = false; @@ -222,7 +161,6 @@ this.checkURI(); this.setPositiveConcept(); - //this.setPosVector(); if (this.hasIndividuals()) { view.getRunButton().setEnabled(true); } else { @@ -231,7 +169,6 @@ String message ="There are no Instances for available. Please insert some Instances."; view.renderErrorMessage(message); } - //view.getPosAndNegSelectPanel().setExampleList(model.getPosListModel(), model.getNegListModel()); } else { view.getHintPanel().setForeground(Color.RED); view.getRunButton().setEnabled(false); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-03-02 13:12:26 UTC (rev 1641) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-03-02 14:50:52 UTC (rev 1642) @@ -39,16 +39,12 @@ // Description List - private final JList descriptions; + private JList descriptions; // Panel for the description list - private final JPanel suggestPanel; + private JPanel suggestPanel; - // Date for the description list - - private final DefaultListModel model; - //Scroll panel if the suggestions are longer than the Panel itself private JScrollPane suggestScroll; @@ -61,8 +57,7 @@ suggestScroll = new JScrollPane(); //renders scroll bars if necessary suggestScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - model = new DefaultListModel(); - descriptions = new JList(model); + descriptions = new JList(); descriptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); suggestPanel = new JPanel(); descriptions.setVisible(true); @@ -78,6 +73,17 @@ * @return updated SuggestClassPanel */ public SuggestClassPanel updateSuggestClassList() { + suggestScroll = new JScrollPane(); + //renders scroll bars if necessary + suggestScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); + descriptions = new JList(); + descriptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + suggestPanel = new JPanel(); + descriptions.setVisible(true); + suggestPanel.add(descriptions); + suggestScroll.setPreferredSize(new Dimension(490, 108)); + suggestScroll.setViewportView(descriptions); + descriptions.setCellRenderer(new SuggestListCellRenderer()); add(suggestScroll); return this; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |