From: <hee...@us...> - 2009-03-05 19:09:10
|
Revision: 1644 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1644&view=rev Author: heeroyuy Date: 2009-03-05 19:09:08 +0000 (Thu, 05 Mar 2009) Log Message: ----------- -fixed panel update problems 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/OptionPanel.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 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-03 23:22:22 UTC (rev 1643) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-05 19:09:08 UTC (rev 1644) @@ -84,7 +84,7 @@ * id if it is a subclass or an equivalent class * */ - public ActionHandler(ActionHandler a, DLLearnerModel m, DLLearnerView view, String i) { + public ActionHandler(DLLearnerModel m, DLLearnerView view, String i) { this.view = view; this.id = i; this.model = m; @@ -109,6 +109,7 @@ view.renderErrorMessage("learning started"); retriever = new SuggestionRetriever(); retriever.execute(); + //model.setCurrentConcept(null); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-03 23:22:22 UTC (rev 1643) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-05 19:09:08 UTC (rev 1644) @@ -116,7 +116,7 @@ // String to distinguish between Equivalent classes and sub classes - private final String id; + private String id; // The new Concept which is learned by the DL-Learner @@ -169,9 +169,9 @@ * @param view * current view of the DL-Learner tab */ - public DLLearnerModel(OWLEditorKit editorKit, String id, DLLearnerView view) { + public DLLearnerModel(OWLEditorKit editorKit, DLLearnerView view) { editor = editorKit; - this.id = id; + this.view = view; ontologyConsistent = true; instancesCount = 0; @@ -183,7 +183,10 @@ ontologieURI = new HashSet<String>(); sources = new HashSet<KnowledgeSource>(); } - + + public void setID(String id) { + this.id = id; + } /** * This method initializes the SimpleSuggestionLearningAlgorithm and adds * the suggestions to the suggest panel model. @@ -258,6 +261,7 @@ public void setLearningProblem() { lp = cm.learningProblem(ClassLearningProblem.class, reasoner); cm.applyConfigEntry(lp, "classToDescribe", currentConcept.toString()); + System.out.println("lern: " + currentConcept); if (id.equals(EQUIVALENT_CLASS_AXIOM_STRING)) { // sets the learning problem to PosNegDefinitionLP when the // dllearner should suggest an equivalent class @@ -517,7 +521,6 @@ 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-03-03 23:22:22 UTC (rev 1643) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-05 19:09:08 UTC (rev 1644) @@ -49,19 +49,19 @@ private static final long serialVersionUID = 624829578325729385L; // 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. @@ -69,19 +69,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 @@ -89,17 +89,17 @@ // 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; @@ -117,31 +117,10 @@ 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); + model = new DLLearnerModel(editorKit, this); + model.setID(label); sugPanel = new SuggestClassPanel(); - action = new ActionHandler(this.action, model, this, label); + action = new ActionHandler(model, this, label); 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); @@ -169,6 +148,28 @@ addAcceptButtonListener(this.action); addRunButtonListener(this.action); addAdvancedButtonListener(this.action); + + } + + /** + * 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() { run.setEnabled(false); hint.setText("To get suggestions for class descriptions, please click the button above."); isInconsistent = false; @@ -191,6 +192,7 @@ sugPanel.setVisible(true); posPanel.setVisible(false); posPanel.setBounds(10, 230, 490, 250); + posPanel.getOptionPanel().resetOptions(); accept.setBounds(510, 40, 80, 110); hint.setBounds(10, 150, 490, 35); errorMessage.setBounds(10, 180, 490, 20); @@ -203,7 +205,8 @@ learner.add(hint); learner.add(errorMessage); learner.add(posPanel); - detail = new MoreDetailForSuggestedConceptsPanel(model); + this.renderErrorMessage(""); + detail = new MoreDetailForSuggestedConceptsPanel(model); } /** * This method sets the right icon for the advanced Panel. @@ -233,7 +236,7 @@ public JTextArea getHintPanel() { return hint; } - + /** * Sets the panel to select/deselect the examples visible/invisible. * @param visible boolean @@ -254,7 +257,7 @@ * Returns all added descriptions. * @return Set(OWLDescription) */ - public Set<OWLDescription> getSollutions() { + public Set<OWLDescription> getSolutions() { return model.getNewOWLDescription(); } @@ -263,6 +266,7 @@ this.unsetEverything(); sugPanel.getSuggestList().removeAll(); learner.removeAll(); + sugPanel = null; model.getSuggestModel().clear(); model.getIndividual().clear(); } @@ -271,7 +275,7 @@ * Returns the last added description. * @return OWLDescription */ - public OWLDescription getSollution() { + public OWLDescription getSolution() { return model.getSolution(); } @@ -366,4 +370,8 @@ public DLLearnerModel getDLLearnerModel() { return model; } + + public ReadingOntologyThread getReadingOntologyThread() { + return readThread; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-03 23:22:22 UTC (rev 1643) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-05 19:09:08 UTC (rev 1644) @@ -109,4 +109,10 @@ public int getNrOfConcepts() { return nrOfConcepts.getValue(); } + + public void resetOptions() { + minAccuracy.setValue(90); + maxExecutionTime.setValue(5); + nrOfConcepts.setValue(10); + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-03 23:22:22 UTC (rev 1643) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-05 19:09:08 UTC (rev 1644) @@ -37,6 +37,7 @@ public class ProtegePlugin extends AbstractOWLDescriptionEditor { private static final long serialVersionUID = 728362819273927L; private DLLearnerView view; + @Override public JComponent getComponent() { @@ -45,13 +46,11 @@ @Override public Set<OWLDescription> getDescriptions() { - return view.getDLLearnerModel().getNewOWLDescription(); + return view.getSolutions(); } @Override public boolean isValidInput() { - System.out.println("testen: " + super.getOWLEditorKit().getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass()); - view = new DLLearnerView("equivalent class", this.getOWLEditorKit()); view.makeView(); return true; } @@ -81,8 +80,6 @@ @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-03 23:22:22 UTC (rev 1643) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-03-05 19:09:08 UTC (rev 1644) @@ -46,10 +46,10 @@ private Set<Individual> individual; private Set<String> ontologieURI; private final OWLEditorKit editor; - private final DLLearnerModel model; + private DLLearnerModel model; private boolean isInconsistent; private OWLClass current; - private final DLLearnerView view; + private DLLearnerView view; /** * This is the constructor of the ReadingOntologyThread. @@ -63,6 +63,14 @@ this.view = v; this.model = m; } + + public void setDLLearnerView(DLLearnerView v) { + this.view = v; + } + + public void setDLLearnerModel(DLLearnerModel m) { + this.model = m; + } /** * This method sets the individuals that belong to the concept which is * chosen in protege. @@ -96,6 +104,7 @@ individual = reasoner.getIndividuals(concept); model.setIndividuals(individual); model.setHasIndividuals(hasIndividuals); + System.out.println("current: " + currentConcept); model.setCurrentConcept(currentConcept); view.getRunButton().setEnabled(true); break; @@ -175,4 +184,8 @@ view.setHintMessage("The ontology is inconsistent and suggestions for class descriptions can only \nbe computed on consistent ontologies. Please repair the ontology first"); } } + + public NamedClass getCurrentConcept() { + return currentConcept; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-03-03 23:22:22 UTC (rev 1643) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-03-05 19:09:08 UTC (rev 1644) @@ -39,11 +39,11 @@ // Description List - private JList descriptions; + private final JList descriptions; // Panel for the description list - private JPanel suggestPanel; + private final JPanel suggestPanel; //Scroll panel if the suggestions are longer than the Panel itself @@ -73,17 +73,6 @@ * @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. |