From: <hee...@us...> - 2009-02-25 13:03:23
|
Revision: 1629 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1629&view=rev Author: heeroyuy Date: 2009-02-25 13:03:17 +0000 (Wed, 25 Feb 2009) Log Message: ----------- -first try to integrate the plugin into protege -removed checkstyle warnings -javadoc 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/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.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 trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007-2008, Jens Lehmann + * Copyright (C) 2007-2009, Jens Lehmann * * This file is part of DL-Learner. * @@ -54,25 +54,24 @@ MouseListener, ListSelectionListener, ListDataListener { // This is the DLLearnerModel. - - //private static Logger logger = Logger.getLogger(ActionHandler.class); - private DLLearnerModel model; + private final DLLearnerModel model; // This is the id that checks if the equivalent class or subclass button is // pressed in protege - private String id; + private final String id; // this is a boolean that checked if the advanced button was pressed or not. private boolean toggled; // This is the Tread of the DL-Learner private EvaluatedDescription evaluatedDescription; // This is the view of the DL-Learner tab. - private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; + //private final OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; private Timer timer; private LearningAlgorithm la; private SuggestionRetriever retriever; private final Color colorRed = new Color(139, 0, 0); private final Color colorGreen = new Color(0, 139, 0); + private final DLLearnerView view; /** * This is the constructor for the action handler. * @@ -87,6 +86,14 @@ * */ public ActionHandler(ActionHandler a, DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view, String i) { + this.view = null; + this.id = i; + this.model = m; + toggled = false; + + } + + public ActionHandler(ActionHandler a, DLLearnerModel m, DLLearnerView view, String i) { this.view = view; this.id = i; this.model = m; @@ -295,7 +302,7 @@ SwingWorker<List<? extends EvaluatedDescription>, List<? extends EvaluatedDescription>> { private Thread dlLearner; - private DefaultListModel dm = new DefaultListModel(); + private final DefaultListModel dm = new DefaultListModel(); @SuppressWarnings("unchecked") @Override @@ -382,12 +389,10 @@ if(eval.getDescription().toString().contains(ontology)) { //dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass)eval).getAccuracy()*100)); if(model.isConsistent(eval)) { - dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass)eval).getAccuracy()*100)); - i++; + dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass) eval).getAccuracy()*100)); break; } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass)eval).getAccuracy()*100)); - i++; + dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass) eval).getAccuracy()*100)); view.setIsInconsistent(true); break; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007-2008, Jens Lehmann + * Copyright (C) 2007-2009, Jens Lehmann * * This file is part of DL-Learner. * @@ -20,13 +20,15 @@ package org.dllearner.tools.protege; import org.protege.editor.owl.OWLEditorKit; +import org.protege.editor.owl.ui.editor.OWLClassDescriptionEditor; import org.protege.editor.owl.ui.frame.AbstractOWLFrame; import org.protege.editor.owl.ui.frame.InheritedAnonymousClassesFrameSection; import org.protege.editor.owl.ui.frame.OWLClassAssertionAxiomIndividualSection; import org.protege.editor.owl.ui.frame.OWLDisjointClassesAxiomFrameSection; -//import org.protege.editor.owl.ui.frame.OWLEquivalentClassesAxiomFrameSection; -//import org.protege.editor.owl.ui.frame.OWLSubClassAxiomFrameSection; +import org.protege.editor.owl.ui.frame.OWLEquivalentClassesAxiomFrameSection; +import org.protege.editor.owl.ui.frame.OWLFrameSectionRowObjectEditor; import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDescription; /** * This class manages the list of the lists for equivalent classes and so on. @@ -37,9 +39,9 @@ * */ public class ButtonList extends AbstractOWLFrame<OWLClass> { - private OWLEquivalentClassesAxiomFrameSection equi; - private OWLSubClassAxiomFrameSection sub; - //private DLLearnerView view; + private final OWLEquivalentClassesAxiomFrameSection equi; + private final OWLSubClassAxiomFrameSection sub; + private final DLLearnerView view; /** * Constructor of the Buttonlist. * @@ -49,12 +51,15 @@ super(editorKit.getModelManager().getOWLOntologyManager()); equi = new OWLEquivalentClassesAxiomFrameSection(editorKit, this); - //view = new DLLearnerView(equi.getName(), editorKit); - //OWLFrameSectionRowObjectEditor<OWLDescription> edit = equi.getObjectEditor(); - //OWLClassDescriptionEditor ed = (OWLClassDescriptionEditor)edit; - //ed.addPanel(view); + view = new DLLearnerView(equi.getName(), editorKit); + OWLFrameSectionRowObjectEditor<OWLDescription> edit = equi.getObjectEditor(); + OWLClassDescriptionEditor ed = (OWLClassDescriptionEditor)edit; + ed.addPanel(view); //equi.getEditor().getEditorComponent().validate(); sub = new OWLSubClassAxiomFrameSection(editorKit, this); + OWLFrameSectionRowObjectEditor<OWLDescription> editor = sub.getObjectEditor(); + OWLClassDescriptionEditor edi = (OWLClassDescriptionEditor)editor; + edi.addPanel(view); // own OWLEquivalentClassesAxiomFrameSection to add the dllearner plugin // to the // OWLClassDescritpionEditor Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007-2008, Jens Lehmann + * Copyright (C) 2007-2009, Jens Lehmann * * This file is part of DL-Learner. * @@ -66,7 +66,7 @@ // The Sting is for components that are available in the DL-Learner - private String[] componenten = { "org.dllearner.kb.OWLFile", + private final String[] componenten = { "org.dllearner.kb.OWLFile", "org.dllearner.reasoning.OWLAPIReasoner", "org.dllearner.reasoning.FastInstanceChecker", "org.dllearner.reasoning.FastRetrievalReasoner", @@ -78,7 +78,7 @@ // Component Manager that manages the components of the DL-Learner - private ComponentManager cm; + private final ComponentManager cm; private static final String EQUIVALENT_CLASS_AXIOM_STRING = "Suggest equivalent class"; private static final String SUPER_CLASS_AXIOM_STRING = "Suggest super class"; @@ -87,7 +87,7 @@ // The View of the DL-Learner Plugin - private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; + //private final OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; // The Learning problem that is used to learn new concepts @@ -103,7 +103,7 @@ // Necessary to get the currently loaded Ontology - private OWLEditorKit editor; + private final OWLEditorKit editor; // The Reasoner which is used to learn @@ -111,7 +111,7 @@ // A Set of Descriptions in OWL Syntax which the DL-Learner suggested - private Set<OWLDescription> owlDescription; + private final Set<OWLDescription> owlDescription; // The most fitting Description in OWL Syntax which the DL-Learner suggested @@ -119,7 +119,7 @@ // String to distinguish between Equivalent classes and sub classes - private String id; + private final String id; // The new Concept which is learned by the DL-Learner @@ -131,11 +131,11 @@ // A Set of Descriptions in OWL Syntax which the DL-Learner suggested - private Set<OWLDescription> ds; + private final Set<OWLDescription> ds; // The model for the suggested Descriptions - private DefaultListModel suggestModel; + private final DefaultListModel suggestModel; // The Individuals of the Ontology @@ -154,12 +154,13 @@ private DefaultListModel posListModel; private DefaultListModel negListModel; - private Set<KnowledgeSource> sources; + private final Set<KnowledgeSource> sources; private boolean hasIndividuals; private NamedClass currentConcept; private Vector<IndividualObject> individualVector; private Set<String> ontologieURI; - private boolean ontologyConsistent; + private final boolean ontologyConsistent; + private final DLLearnerView view; // This is a List of evaluated descriptions to get more information of the // suggested concept @@ -170,8 +171,6 @@ * * @param editorKit * Editor Kit to get the currently loaded Ontology - * @param h - * OWLFrame(OWLClass) to get the base uri of the Ontology * @param id * String if it learns a subclass or a superclass. * @param view @@ -180,6 +179,24 @@ public DLLearnerModel(OWLEditorKit editorKit, String id, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view) { editor = editorKit; this.id = id; + this.view = null; + 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(); + ontologieURI = new HashSet<String>(); + sources = new HashSet<KnowledgeSource>(); + } + + public DLLearnerModel(OWLEditorKit editorKit, String id, DLLearnerView view) { + editor = editorKit; + this.id = id; this.view = view; ontologyConsistent = true; instancesCount = 0; @@ -266,6 +283,10 @@ // rs = cm.reasoningService(reasoner); } + /** + * This method returns the fast instance checker reasoner. + * @return fast instance checker reasoner + */ public FastInstanceChecker getReasoner() { return reasoner; } @@ -326,15 +347,6 @@ } alreadyLearned = true; } - - /** - * This method returns the Concepts from the DL-Learner. - * - * @return Array of learned Concepts. - - public Description[] getSolutions() { - return description; - }*/ /** * Starts the learning algorithm. @@ -361,9 +373,10 @@ return individualVector; } + /** * This method sets the positive examples for learning. - * @param ind + * @param ind Set of Individuals */ public void setIndividuals(Set<Individual> ind) { individual = ind; @@ -372,7 +385,7 @@ /** * This method sets the uri sting for the currently used * for learning. - * @param uri + * @param uri Set of uris */ public void setOntologyURIString(Set<String> uri) { this.ontologieURI = uri; @@ -388,7 +401,7 @@ /** * Sets if the ontology has individuals. - * @param has + * @param has boolean if concept has Individuals */ public void setHasIndividuals(boolean has) { this.hasIndividuals = has; @@ -406,17 +419,6 @@ } /** - * This method gets an array of concepts from the DL-Learner and stores it - * in the description array. - * - * @param list - * Array of concepts from DL-Learner - - public void setDescriptionList(Description[] list) { - description = list; - }*/ - - /** * This method returns the PosListModel. * * @return DefaultListModel posListModel @@ -445,16 +447,6 @@ } /** - * This method resets the array of concepts from the DL_Learner. It is - * called after the DL-Learner tab is closed. - - public void resetSuggestionList() { - for (int i = 0; i < description.length; i++) { - description[i] = null; - } - }*/ - - /** * 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. @@ -498,9 +490,15 @@ return oldConceptOWLAPI; } + /** + * 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. @@ -589,7 +587,7 @@ */ public boolean isConsistent(EvaluatedDescription eDescription) { boolean isConsistent = false; - if (((EvaluatedDescriptionClass)eDescription).getCoveredInstances().size() < instancesCount) { + if (((EvaluatedDescriptionClass) eDescription).getCoveredInstances().size() < instancesCount) { isConsistent = false; } else { isConsistent = true; @@ -659,7 +657,7 @@ /** * Sets the positive examples. - * @param list + * @param list list of positive Expamles */ public void setPosListModel(DefaultListModel list) { this.posListModel = list; @@ -667,7 +665,7 @@ /** * Sets the negative examples. - * @param list + * @param list list of negative examples */ public void setNegListModel(DefaultListModel list) { this.negListModel = list; @@ -675,7 +673,7 @@ /** * Sets the individual vector. - * @param indi + * @param indi Vector of Individuals */ public void setIndividualVector(Vector<IndividualObject> indi) { this.individualVector = indi; @@ -683,19 +681,25 @@ /** * This sets the current concept. - * @param current + * @param current currently selected class */ public void setCurrentConcept(NamedClass current) { this.currentConcept = current; } /** + * This method returns a set of individuals belonging to the + * currently selected class. * @return the individual */ public Set<Individual> getIndividual() { return individual; } + /** + * This method sets the number of instances. + * @param i number of instances + */ public void setInstancesCount(int i) { instancesCount = i; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,3 +1,22 @@ +/** + * 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.BorderLayout; @@ -19,7 +38,13 @@ import org.protege.editor.owl.OWLEditorKit; import org.protege.editor.owl.ui.editor.OWLDescriptionEditor; import org.semanticweb.owl.model.OWLDescription; - +/** + * This class is responsible for the view of the dllearner. It renders the + * output for the user and is the graphical component of the plugin. + * + * @author Christian Koetteritzsch + * + */ public class DLLearnerView extends JPanel implements OWLDescriptionEditor{ @@ -27,19 +52,19 @@ //private OWLClassDescriptionEditorWithDLLearnerTab mainWindow; // this is the Component which shows the view of the dllearner private static final String TITLE = "DL-Learner"; - private JComponent learner; + private final JComponent learner; // Accept button to add the learned concept to the owl - private JButton accept; + private final JButton accept; // Runbutton to start the learning algorithm - private JButton run; + private final JButton run; // This is the label for the advanced button. - private JLabel adv; + private final JLabel adv; // This is the color for the error message. It is red. @@ -47,19 +72,19 @@ // This is the text area for the error message when an error occurred - private JTextArea errorMessage; + private final JTextArea errorMessage; // Advanced Button to activate/deactivate the example select panel - private JToggleButton advanced; + private final JToggleButton advanced; // Action Handler that manages the Button actions - private ActionHandler action; + private final ActionHandler action; // This is the model of the dllearner plugin which includes all data - private DLLearnerModel model; + private final DLLearnerModel model; // Panel for the suggested concepts @@ -67,48 +92,48 @@ // Selection panel for the positive and negative examples - private PosAndNegSelectPanel posPanel; + private final PosAndNegSelectPanel posPanel; // Picture for the advanced button when it is not toggled - private ImageIcon icon; + private final ImageIcon icon; // Picture of the advanced button when it is toggled - private JPanel addButtonPanel; - private JLabel wikiPane; - private ImageIcon toggledIcon; - private JTextArea hint; + private final JPanel addButtonPanel; + private final JLabel wikiPane; + private final ImageIcon toggledIcon; + private final JTextArea hint; private boolean isInconsistent; // This is the Panel for more details of the suggested concept private MoreDetailForSuggestedConceptsPanel detail; //private OWLFrame<OWLClass> frame; private ReadingOntologyThread readThread; - //private OWLEditorKit editorKit; + private final OWLEditorKit editorKit; /** * The constructor for the DL-Learner tab in the class description * editor. * - * @param current OWLFrame + * @param editor OWLEditorKit * @param label String - * @param dlLearner OWLClassDescriptionEditorWithDLLearnerTab */ public DLLearnerView(String label, OWLEditorKit editor) { //mainWindow = dlLearner; - //editorKit = editor; + editorKit = editor; 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); URL toggledIconUrl = this.getClass().getResource("arrow2.gif"); toggledIcon = new ImageIcon(toggledIconUrl); - //model = new DLLearnerModel(editorKit, label, this); + model = new DLLearnerModel(editorKit, label, this); sugPanel = new SuggestClassPanel(); - //action = new ActionHandler(this.action, model, this, label); + action = new ActionHandler(this.action, model, this, label); adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); run = new JButton(label); accept = new JButton("ADD"); + System.out.println("blub"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); errorMessage = new JTextArea(); @@ -122,10 +147,11 @@ learner.setPreferredSize(new Dimension(600, 520)); accept.setPreferredSize(new Dimension(290, 50)); advanced.setName("Advanced"); - //posPanel = new PosAndNegSelectPanel(model, action, this); + posPanel = new PosAndNegSelectPanel(model, action); addAcceptButtonListener(this.action); addRunButtonListener(this.action); addAdvancedButtonListener(this.action); + this.makeView(); } @@ -145,13 +171,6 @@ } /** - * Returns the Mainwindow where the Plugin is integratet. - * @return OWLClassDescriptionWithDLLearnerTab MainWindow - */ - //public OWLClassDescriptionEditorWithDLLearnerTab getMainWindow() { - // return mainWindow; - //} - /** * This Method renders the view of the plugin. */ public void makeView() { @@ -159,7 +178,7 @@ model.clearVector(); hint.setText("To get suggestions for class descriptions, please click the button above."); isInconsistent = false; - //readThread = new ReadingOntologyThread(editorKit, this, model); + readThread = new ReadingOntologyThread(editorKit, null, this, model); readThread.start(); //TODO: runbutton wird auf enable gesetzt obwohl keine instanzdaten vorhanden sind. @@ -179,8 +198,6 @@ advanced.setBounds(10, 200, 20, 20); sugPanel.setVisible(true); posPanel.setVisible(false); - //posPanel.getAddToNegPanelButton().setEnabled(false); - //posPanel.getAddToPosPanelButton().setEnabled(false); posPanel.setBounds(10, 230, 490, 250); accept.setBounds(510, 40, 80, 110); hint.setBounds(10, 150, 490, 35); @@ -218,16 +235,14 @@ public void setHintMessage(String message) { hint.setText(message); } + + /** + * This method returns the hint panel. + * @return hint panel + */ public JTextArea getHintPanel() { return hint; } - /** - * This Method returns the DL_Learner tab. - * @return JComponent - */ - public JComponent getLearnerPanel() { - return learner; - } /** * Sets the panel to select/deselect the examples visible/invisible. @@ -238,28 +253,14 @@ } /** - * Returns nothing. - * @return null - */ - public JPanel getOptionPanel() { - return null; - } - - /** * Returns the AddButton. * @return JButton */ public JButton getAddButton() { return accept; } + /** - * This Method updates the the view of protege after - * adding a new concept. - */ - //public void updateWindow() { - // mainWindow.getHandler().handleEditingFinished(mainWindow.getEditedObjects()); - //} - /** * Returns all added descriptions. * @return Set(OWLDescription) */ @@ -327,8 +328,6 @@ run.removeActionListener(action); accept.removeActionListener(action); advanced.removeActionListener(action); - //posPanel.removeListeners(action); - //posPanel.removeHelpButtonListener(action); } /** @@ -374,7 +373,7 @@ @Override public JComponent getComponent() { - return this; + return learner; } @Override Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,3 +1,22 @@ +/** + * 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.Color; @@ -13,34 +32,46 @@ import org.dllearner.algorithms.EvaluatedDescriptionClass; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Individual; - +/** + * This class draws the graphical coverage of a learned concept. + * @author Christian Koetteritzsch + * + */ public class GraphicalCoveragePanel extends JPanel { private static final long serialVersionUID = 855436961912515267L; - private static final int height =250; - private static final int width = 250; - private static final int maxNumberOfIndividualPoints = 20; - private static final int gap = 20; + private static final int HEIGHT =250; + private static final int WIDTH = 250; + private static final int MAX_NUMBER_OF_INDIVIDUAL_POINTS = 20; + private static final int GAP = 20; private int shiftXAxis; private int distortionOld; - private Ellipse2D oldConcept; + private final Ellipse2D oldConcept; private Ellipse2D newConcept; - private EvaluatedDescription eval; - private DLLearnerModel model; - private String conceptNew; - private Vector<IndividualPoint> posCovIndVector; - private Vector<IndividualPoint> posNotCovIndVector; - private Vector<IndividualPoint> points; - private GraphicalCoveragePanelHandler handler; + private final EvaluatedDescription eval; + private final DLLearnerModel model; + private final String conceptNew; + private final Vector<IndividualPoint> posCovIndVector; + private final Vector<IndividualPoint> posNotCovIndVector; + private final Vector<IndividualPoint> points; + private final GraphicalCoveragePanelHandler handler; private int adjustment; - private MoreDetailForSuggestedConceptsPanel panel; + private final MoreDetailForSuggestedConceptsPanel panel; /** + * * This is the constructor for the GraphicalCoveragePanel. + * + * @param desc EvaluatedDescription + * @param m DLLearnerModel + * @param concept String + * @param w width + * @param h height + * @param p MoreDetailForSuggestedConceptsPanel */ public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, String concept, int w, int h, MoreDetailForSuggestedConceptsPanel p) { - setPreferredSize(new Dimension(width, height)); + setPreferredSize(new Dimension(WIDTH, HEIGHT)); setVisible(true); setForeground(Color.GREEN); repaint(); @@ -53,30 +84,23 @@ points = new Vector<IndividualPoint>(); this.computeGraphics(); handler = new GraphicalCoveragePanelHandler(this); - oldConcept = new Ellipse2D.Float(5, 25+adjustment, width-distortionOld, height-distortionOld); - newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, width, height); + oldConcept = new Ellipse2D.Float(5, 25+adjustment, WIDTH-distortionOld, HEIGHT-distortionOld); + newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, WIDTH, HEIGHT); this.computeIndividualPoints(); this.addMouseMotionListener(handler); this.addPropertyChangeListener(handler); } - - public void drawCoverageForLearnedClassDescription( - Set<Individual> posCovInd, Set<Individual> posNotCovInd, - Set<Individual> negCovInd) { - - - } @Override protected void paintComponent(Graphics g) { Graphics2D g2D; g2D = (Graphics2D) g; g2D.setColor(Color.GREEN); - g2D.draw (oldConcept); + g2D.draw(oldConcept); g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); g2D.setColor(Color.RED); - g2D.draw (newConcept); - g2D.drawString(conceptNew, 10 + width, 15); + g2D.draw(newConcept); + g2D.drawString(conceptNew, 10 + WIDTH, 15); @@ -93,15 +117,15 @@ } private void computeGraphics(){ - int add = ((EvaluatedDescriptionClass)eval).getAdditionalInstances().size(); + int add = ((EvaluatedDescriptionClass) eval).getAdditionalInstances().size(); distortionOld = 0; adjustment = 0; - double additional = ((EvaluatedDescriptionClass)eval).getAddition(); - double coverage = ((EvaluatedDescriptionClass)eval).getCoverage(); - shiftXAxis = (int) Math.round(width* (1-coverage)); + double additional = ((EvaluatedDescriptionClass) eval).getAddition(); + double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); + shiftXAxis = (int) Math.round(WIDTH* (1-coverage)); if(add != 0) { - distortionOld = (int) Math.round(width*additional); - newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, width, height); + distortionOld = (int) Math.round(WIDTH*additional); + newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, WIDTH, HEIGHT); adjustment = (int) Math.round(newConcept.getCenterY()/4); } @@ -109,7 +133,7 @@ } private void computeIndividualPoints() { - Set<Individual> posInd = ((EvaluatedDescriptionClass)eval).getCoveredInstances(); + Set<Individual> posInd = ((EvaluatedDescriptionClass) eval).getCoveredInstances(); int i = 0; double x = 20; @@ -117,11 +141,11 @@ boolean flag = true; for(Individual ind : posInd) { flag = true; - if(i<maxNumberOfIndividualPoints) { + if(i<MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while(flag) { if(x >= oldConcept.getMaxX()) { x = (int) oldConcept.getMinX(); - y = y + gap; + y = y + GAP; } if(y >= oldConcept.getMaxY()) { @@ -130,7 +154,7 @@ if(x >= newConcept.getMaxX()) { x = (int) newConcept.getMinX(); - y = y + gap; + y = y + GAP; } if(y >= newConcept.getMaxY()) { @@ -140,30 +164,30 @@ while(x < newConcept.getMaxX()) { if(newConcept.contains(x, y) && oldConcept.contains(x, y)) { - posCovIndVector.add(new IndividualPoint("+",(int)x,(int)y,ind.toString())); + posCovIndVector.add(new IndividualPoint("+", (int) x, (int) y, ind.toString())); i++; flag = false; - x = x + gap; + x = x + GAP; break; } else { - x = x + gap; + x = x + GAP; } } } } } - Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass)eval).getAdditionalInstances(); + Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval).getAdditionalInstances(); int j = 0; x = 20; y = 20; for(Individual ind : posNotCovInd) { flag = true; - if(j<maxNumberOfIndividualPoints) { + if(j<MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while(flag) { if(x >= newConcept.getMaxX()) { x = (int) oldConcept.getMinX(); - y = y + gap; + y = y + GAP; } if(y >= newConcept.getMaxY()) { @@ -173,13 +197,13 @@ while(x < newConcept.getMaxX()) { if(!oldConcept.contains(x, y) && newConcept.contains(x, y)) { - posNotCovIndVector.add(new IndividualPoint("-",(int)x,(int)y,ind.toString())); + posNotCovIndVector.add(new IndividualPoint("-", (int) x, (int) y, ind.toString())); j++; flag = false; - x = x + gap; + x = x + GAP; break; } else { - x = x + gap; + x = x + GAP; } } } @@ -193,11 +217,11 @@ y = 20; for(Individual ind : notCovInd) { flag = true; - if(k<maxNumberOfIndividualPoints) { + if(k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while(flag) { if(x >= oldConcept.getMaxX()) { x = (int) oldConcept.getMinX(); - y = y + gap; + y = y + GAP; } if(y >= oldConcept.getMaxY()) { @@ -207,13 +231,13 @@ while(x < oldConcept.getMaxX()) { if(oldConcept.contains(x, y) && !newConcept.contains(x, y)) { - posNotCovIndVector.add(new IndividualPoint("-",(int)x,(int)y,ind.toString())); + posNotCovIndVector.add(new IndividualPoint("-", (int) x, (int) y, ind.toString())); k++; flag = false; - x = x + gap; + x = x + GAP; break; } else { - x = x + gap; + x = x + GAP; } } } @@ -223,14 +247,27 @@ points.addAll(posNotCovIndVector); } + /** + * This method returns a Vector of all individuals that are drawn + * in the panel. + * @return Vector of Individuals + */ public Vector<IndividualPoint> getIndividualVector() { return points; } + /** + * This method returns the GraphicalCoveragePanel. + * @return GraphicalCoveragePanel + */ public GraphicalCoveragePanel getGraphicalCoveragePanel() { return this; } + /** + * This method returns the MoreDetailForSuggestedConceptsPanel. + * @return MoreDetailForSuggestedConceptsPanel + */ public MoreDetailForSuggestedConceptsPanel getMoreDetailForSuggestedConceptsPanel() { return panel; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,3 +1,22 @@ +/** + * 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.MouseEvent; @@ -7,11 +26,19 @@ import java.util.Vector; - +/** + * This class takes care of all events happening in the GraphicalCoveragePanel. + * @author Christian Koetteritzsch + * + */ public class GraphicalCoveragePanelHandler implements MouseMotionListener, PropertyChangeListener { - private GraphicalCoveragePanel panel; + private final GraphicalCoveragePanel panel; + /** + * This is the constructor for the handler. + * @param p GraphicalCoveragePanel + */ public GraphicalCoveragePanelHandler(GraphicalCoveragePanel p) { this.panel = p; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007-2008, Jens Lehmann + * Copyright (C) 2007-2009, Jens Lehmann * * This file is part of DL-Learner. * @@ -25,7 +25,7 @@ */ public class IndividualObject { - private String normalIndividual; + private final String normalIndividual; private boolean isPos; /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,12 +1,44 @@ +/** + * 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; +/** + * This class is a datastructure for one individual shown in + * the GraphicalCoveragePanel. + * @author Christian Koetteritzsch + * + */ public class IndividualPoint { private String point; private int xAxis; private int yAxis; - private String individual; + private final String individual; + /** + * Constructor of the class. + * @param p display String + * @param x coordinate on the x axis + * @param y coordinate on the y axis + * @param ind Name of the Individual + */ public IndividualPoint(String p, int x, int y, String ind) { this.point = p; this.xAxis = x; @@ -15,6 +47,7 @@ } /** + * This method sets the display string of the individual. * @param point the point to set */ public void setPoint(String point) { @@ -22,6 +55,7 @@ } /** + * This method returns the display string of the individual. * @return the point */ public String getPoint() { @@ -29,6 +63,7 @@ } /** + * This method sets the x axis coordinate. * @param xAxis the xAxis to set */ public void setXAxis(int xAxis) { @@ -36,6 +71,7 @@ } /** + * This method returns the x axis coordinate. * @return the xAxis */ public int getXAxis() { @@ -43,6 +79,7 @@ } /** + * This method sets the y axis coordinate. * @param yAxis the yAxis to set */ public void setYAxis(int yAxis) { @@ -50,12 +87,17 @@ } /** + * This method returns the y axis coordinate. * @return the yAxis */ public int getYAxis() { return yAxis; } + /** + * This method returns the name of the Individual. + * @return name of the Individual + */ public String getIndividualName() { return individual; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007-2008, Jens Lehmann + * Copyright (C) 2007-2009, Jens Lehmann * * This file is part of DL-Learner. * @@ -50,7 +50,7 @@ // Model of the dllearner - private DLLearnerModel model; + private final DLLearnerModel model; // Textarea to render the accuracy of the concept @@ -115,12 +115,12 @@ private JTextArea conceptText; private final Color colorRed = new Color(139, 0, 0); private final Color colorGreen = new Color(0, 139, 0); - private static final int height = 500; - private static final int width = 600; + private static final int HEIGHT = 500; + private static final int WIDTH = 600; private GraphicalCoveragePanel p; - private JButton allPositiveIndividuals; - private JButton allNegativeIndividuals; - private MoreDetailForSuggestedConceptsPanelHandler handler; + private final JButton allPositiveIndividuals; + private final JButton allNegativeIndividuals; + private final MoreDetailForSuggestedConceptsPanelHandler handler; /** * This is the constructor for the Panel. * @param model DLLearnerModel @@ -128,7 +128,7 @@ public MoreDetailForSuggestedConceptsPanel(DLLearnerModel model) { super(); setLayout(null); - setPreferredSize(new Dimension(width, height)); + setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.model = model; handler = new MoreDetailForSuggestedConceptsPanelHandler(model); allPositiveIndividuals = new JButton("old"); @@ -216,10 +216,10 @@ //panel for the informations of the selected concept //this method adds the informations for the selected concept to the panel setInformation(); - p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), width, height-200, this); + p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), WIDTH, HEIGHT-200, this); p.setBounds(5, 110, 600, 300); detailPopup = new JDialog(); - detailPopup.setSize(width, height); + detailPopup.setSize(WIDTH, HEIGHT); //window will be disposed if the x button is pressed detailPopup.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); detailPopup.setVisible(true); @@ -242,21 +242,23 @@ add(allPositiveIndividuals); add(allNegativeIndividuals); handler.setEvaluadtedDescription(eval); - /* - add(coveredPositiveExamples); - add(notCoveredPositiveExamples); - add(coveredNegativeExamples); - add(notCoveredNegativeExamples); - add(posCoveredScroll); - add(posNotCoveredScroll); - add(negCoveredScroll); - add(negNotCoveredScroll);*/ detailPopup.add(this); } + + /** + * This method returns the Button where you can get + * all individuals of the old concept. + * @return JButton + */ public JButton getAllPositiveindividuals() { return allPositiveIndividuals; } + /** + * This method returns the Button where you can get + * all individuals of the new concept. + * @return JButton + */ public JButton getAllNegativeIndividuals() { return allNegativeIndividuals; } @@ -278,63 +280,8 @@ } //sets the accuracy of the concept - double acc = ((EvaluatedDescriptionClass)eval).getAccuracy()*100; + double acc = ((EvaluatedDescriptionClass) eval).getAccuracy()*100; accuracyText.setText(String.valueOf(acc)+"%"); - - //Sets positive Covered Examples for the detail panel - /*Set<Individual> indi = ((EvaluatedDescriptionPosNeg)eval).getCoveredPositives(); - for(Individual ind : indi) { - for(String ontology : ontologiesStrings) { - if(ind.toString().contains(ontology)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(ontology, null)); - posLabel.setForeground(colorGreen); - posCoveredPanel.add(posLabel); - break; - } - } } - - - - //sets the positive examples that are not covered - Set<Individual> individuals = ((EvaluatedDescriptionPosNeg)eval).getNotCoveredPositives(); - for(Individual ind : individuals) { - for(String onto : ontologiesStrings) { - if(ind.toString().contains(onto)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(onto, null)); - posLabel.setForeground(colorRed); - posNotCoveredPanel.add(posLabel); - break; - } - } - } - - - //sets the negative examples that are covered - Set<Individual> negCoveredIndi = ((EvaluatedDescriptionPosNeg)eval).getCoveredNegatives(); - for(Individual negIndi : negCoveredIndi) { - for(String ont : ontologiesStrings) { - if(negIndi.toString().contains(ont)) { - JLabel posLabel = new JLabel(negIndi.toManchesterSyntaxString(ont, null)); - posLabel.setForeground(colorRed); - negCoveredPanel.add(posLabel); - break; - } - } - } - - //sets the negative examples that are not covered - Set<Individual> negNotCoveredIndi = ((EvaluatedDescriptionPosNeg)eval).getNotCoveredNegatives(); - for(Individual negNotIndi : negNotCoveredIndi) { - for(String ontol : ontologiesStrings) { - if(negNotIndi.toString().contains(ontol)) { - JLabel posLabel = new JLabel(negNotIndi.toManchesterSyntaxString(ontol, null)); - posLabel.setForeground(colorGreen); - negNotCoveredPanel.add(posLabel); - break; - } - } - }*/ } - } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,3 +1,22 @@ +/** + * 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; @@ -8,16 +27,25 @@ import javax.swing.JOptionPane; import org.dllearner.algorithms.EvaluatedDescriptionClass; -import org.dllearner.algorithms.EvaluatedDescriptionPosNeg; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Individual; +/** + * This class takes care of all events happening in the MoreDetailForSuggestedConceptsPanelHandler. + * @author Christian Koetteritzsch + * + */ public class MoreDetailForSuggestedConceptsPanelHandler implements ActionListener{ private static final String OLD_BUTTON_LABEL = "old"; private static final String NEW_BUTTON_LABEL = "new"; - private DLLearnerModel model; + private final DLLearnerModel model; private EvaluatedDescription eval; + + /** + * This is the constructor of the MoreDetailForSuggestedConceptsPanelHandler. + * @param m Model of the DL-Learner + */ public MoreDetailForSuggestedConceptsPanelHandler(DLLearnerModel m) { model = m; } @@ -39,8 +67,8 @@ } if(a.getActionCommand().equals(NEW_BUTTON_LABEL)) { - Set<Individual> posInd = ((EvaluatedDescriptionClass)eval).getCoveredInstances(); - posInd.addAll(((EvaluatedDescriptionClass)eval).getAdditionalInstances()); + Set<Individual> posInd = ((EvaluatedDescriptionClass) eval).getCoveredInstances(); + posInd.addAll(((EvaluatedDescriptionClass) eval).getAdditionalInstances()); Set<String> uri = model.getOntologyURIString(); String toolTip = "This are the Individuals beloning to\n "; for(String u : uri) { @@ -49,7 +77,7 @@ } } - for(Individual ind : posInd ) { + for(Individual ind : posInd) { for(String u : uri) { if(ind.toString().contains(u)) { @@ -64,6 +92,10 @@ } + /** + * This method sets the currently selected evaluated description. + * @param e evaluated description + */ public void setEvaluadtedDescription(EvaluatedDescription e) { eval = e; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,5 +1,5 @@ /** - * Copyright (C) 2007-2008, Jens Lehmann + * Copyright (C) 2007-2009, Jens Lehmann * * This file is part of DL-Learner. * @@ -80,26 +80,26 @@ private static final String SUGGEST_EQUIVALENT_CLASS_LABEL = "Suggest equivalent class"; private static final String SUGGEST_SUBCLASS_LABEL = "Suggest super class"; - private OWLEditorKit editorKit; + private final OWLEditorKit editorKit; - private ExpressionEditor<OWLDescription> editor; + private final ExpressionEditor<OWLDescription> editor; - private JComponent editingComponent; + private final JComponent editingComponent; - private JTabbedPane tabbedPane; + private final JTabbedPane tabbedPane; private DLLearnerView dllearner; - private ActionHandler action; + private final ActionHandler action; private OWLClassSelectorPanel classSelectorPanel; private ObjectRestrictionCreatorPanel restrictionCreatorPanel; - //private OWLDescription initialDescription; + //private final OWLDescription initialDescription; - private Set<InputVerificationStatusChangedListener> listeners = new HashSet<InputVerificationStatusChangedListener>(); + private final Set<InputVerificationStatusChangedListener> listeners = new HashSet<InputVerificationStatusChangedListener>(); - private ChangeListener changeListener = new ChangeListener() { + private final ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { handleVerifyEditorContents(); } @@ -286,8 +286,6 @@ */ public void removeStatusChangedListener( InputVerificationStatusChangedListener listener) { - //TODO: Suchen - //System.out.println("Comp: "+editorKit.getWorkspace().getComponents()); listeners.remove(listener); editor.removeStatusChangedListener(listener); } @@ -302,22 +300,22 @@ public class DLLearnerView extends JPanel { private static final long serialVersionUID = 624829578325729385L; - private OWLClassDescriptionEditorWithDLLearnerTab mainWindow; + private final OWLClassDescriptionEditorWithDLLearnerTab mainWindow; // this is the Component which shows the view of the dllearner - private JComponent learner; + private final JComponent learner; // Accept button to add the learned concept to the owl - private JButton accept; + private final JButton accept; // Runbutton to start the learning algorithm - private JButton run; + private final JButton run; // This is the label for the advanced button. - private JLabel adv; + private final JLabel adv; // This is the color for the error message. It is red. @@ -325,19 +323,19 @@ // This is the text area for the error message when an error occurred - private JTextArea errorMessage; + private final JTextArea errorMessage; // Advanced Button to activate/deactivate the example select panel - private JToggleButton advanced; + private final JToggleButton advanced; // Action Handler that manages the Button actions - private ActionHandler action; + private final ActionHandler action; // This is the model of the dllearner plugin which includes all data - private DLLearnerModel model; + private final DLLearnerModel model; // Panel for the suggested concepts @@ -345,21 +343,21 @@ // Selection panel for the positive and negative examples - private PosAndNegSelectPanel posPanel; + private final PosAndNegSelectPanel posPanel; // Picture for the advanced button when it is not toggled - private ImageIcon icon; + private final ImageIcon icon; // Picture of the advanced button when it is toggled - private JPanel addButtonPanel; - private JLabel wikiPane; - private ImageIcon toggledIcon; - private JTextArea hint; + private final JPanel addButtonPanel; + private final JLabel wikiPane; + private final ImageIcon toggledIcon; + private final JTextArea hint; private boolean isInconsistent; // This is the Panel for more details of the suggested concept private MoreDetailForSuggestedConceptsPanel detail; - private OWLFrame<OWLClass> frame; + private final OWLFrame<OWLClass> frame; private ReadingOntologyThread readThread; /** @@ -401,7 +399,7 @@ learner.setPreferredSize(new Dimension(600, 520)); accept.setPreferredSize(new Dimension(290, 50)); advanced.setName("Advanced"); - posPanel = new PosAndNegSelectPanel(model, action, this); + posPanel = new PosAndNegSelectPanel(model, action); addAcceptButtonListener(this.action); addRunButtonListener(this.action); addAdvancedButtonListener(this.action); @@ -427,9 +425,9 @@ * Returns the Mainwindow where the Plugin is integratet. * @return OWLClassDescriptionWithDLLearnerTab MainWindow */ - public OWLClassDescriptionEditorWithDLLearnerTab getMainWindow() { + /*public OWLClassDescriptionEditorWithDLLearnerTab getMainWindow() { return mainWindow; - } + }*/ /** * This Method renders the view of the plugin. */ @@ -458,8 +456,6 @@ advanced.setBounds(10, 200, 20, 20); sugPanel.setVisible(true); posPanel.setVisible(false); - //posPanel.getAddToNegPanelButton().setEnabled(false); - //posPanel.getAddToPosPanelButton().setEnabled(false); posPanel.setBounds(10, 230, 490, 250); accept.setBounds(510, 40, 80, 110); hint.setBounds(10, 150, 490, 35); @@ -497,16 +493,14 @@ public void setHintMessage(String message) { hint.setText(message); } + + /** + * This method returns the hint panel. + * @return hint panel + */ public JTextArea getHintPanel() { return hint; } - /** - * This Method returns the DL_Learner tab. - * @return JComponent - */ - public JComponent getLearnerPanel() { - return learner; - } /** * Sets the panel to select/deselect the examples visible/invisible. @@ -516,13 +510,6 @@ posPanel.setVisible(visible); } - /** - * Returns nothing. - * @return null - */ - public JPanel getOptionPanel() { - return null; - } /** * Returns the AddButton. @@ -661,13 +648,13 @@ private static final long serialVersionUID = 1695484991927845068L; - private OWLObjectPropertySelectorPanel objectPropertySelectorPanel; + private final OWLObjectPropertySelectorPanel objectPropertySelectorPanel; - private OWLClassSelectorPanel classSelectorPanel; + private final OWLClassSelectorPanel classSelectorPanel; - private JSpinner cardinalitySpinner; + private final JSpinner cardinalitySpinner; - private JComboBox typeCombo; + private final JComboBox typeCombo; public ObjectRestrictionCreatorPanel() { objectPropertySelectorPanel = new OWLObjectPropertySelectorPanel( @@ -807,7 +794,7 @@ */ private abstract class RestrictionCreator { - private String name; + private final String name; protected RestrictionCreator(String name) { this.name = name; @@ -829,7 +816,7 @@ private abstract class CardinalityRestrictionCreator extends RestrictionCreator { - private JSpinner cardinalitySpinner; + private final JSpinner cardinalitySpinner; protected CardinalityRestrictionCreator(String name, JSpinner cardinalitySpinner) { Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java 2009-02-25 12:39:02 UTC (rev 1628) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java 2009-02-25 13:03:17 UTC (rev 1629) @@ -1,198 +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.tools.protege; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.protege.editor.owl.OWLEditorKit; -import org.protege.editor.owl.ui.frame.OWLEquivalentClassesAxiomFrameSectionRow; -import org.protege.editor.owl.ui.frame.OWLFrame; -import org.protege.editor.owl.ui.frame.OWLFrameSectionRow; -import org.protege.editor.owl.ui.frame.OWLFrameSectionRowObjectEditor; -import org.protege.editor.owl.ui.frame.cls.AbstractOWLClassAxiomFrameSection; -import org.semanticweb.owl.inference.OWLReasonerException; -import org.semanticweb.owl.inference.UnsupportedReasonerOperationException; -import org.semanticweb.owl.model.AddAxiom; -import org.semanticweb.owl.model.OWLAxiom; -import org.semanticweb.owl.model.OWLClass; -import org.semanticweb.owl.model.OWLDescription; -import org.semanticweb.owl.model.OWLEquivalentClassesAxiom; -import org.semanticweb.owl.model.OWLObject; -import org.semanticweb.owl.model.OWLOntology; -import org.semanticweb.owl.model.OWLOntologyChange; -import org.semanticweb.owl.util.CollectionFactory; - -/** - * Here a only caged in the method getObjectEditor() the call for the - * OWLClassDescriptionEditor to OWLClassDescriptionEditorWithDLLearnerTab. - * @author Matthew Horridge and Christian Koetteritzsch<br> - * The University Of Manchester<br> - * Bio-Health Informatics Group<br> - * Date: 19-Jan-2007<br> - * <br> - */ -public class OWLEquivalentClassesAxiomFrameSection extends AbstractOWLClassAxiomFrameSection<OWLEquivalentClassesAxiom, OWLDescription> { - - private static final String LABEL = "equivalent classes"; - - private Set<OWLDescription> added = new HashSet<OWLDescription>(); - - private boolean inferredEquivalentClasses = true; - - private OWLFrame<OWLClass> frame; - - - public OWLEquivalentClassesAxiomFrameSection(OWLEditorKit editorKit, OWLFrame<OWLClass> frame) { - super(editorKit, LABEL, "Equivalent class", frame); - this.frame = frame; - } - - - protected void clear() { - added.clear(); - } - - - protected void addAxiom(OWLEquivalentClassesAxiom ax, OWLOntology ontology) { - addRow(new OWLEquivalentClassesAxiomFrameSectionRow(getOWLEditorKit(), - this, - ontology, - getRootObject(), - ax)); - for (OWLDescription desc : ax.getDescriptions()) { - added.add(desc); - } - } - - - protected Set<OWLEquivalentClassesAxiom> getClassAxioms(OWLDescription descr, OWLOntology ont) { - if (!descr.isAnonymous()){ - return ont.getEquivalentClassesAxioms(descr.asOWLClass()); - } - else{ - Set<OWLEquivalentClassesAxiom> axioms = new HashSet<OWLEquivalentClassesAxiom>(); - for (OWLAxiom ax ... [truncated message content] |