From: <hee...@us...> - 2008-12-15 12:22:15
|
Revision: 1552 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1552&view=rev Author: heeroyuy Date: 2008-12-15 12:03:26 +0000 (Mon, 15 Dec 2008) Log Message: ----------- -added ignored classes when learning a super class 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/INSTALL trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.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/README Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -75,8 +75,8 @@ 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 Color colorRed = new Color(139, 0, 0); + private final Color colorGreen = new Color(0, 139, 0); /** * This is the constructor for the action handler. * Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url 2008-12-15 12:03:26 UTC (rev 1552) @@ -1,6 +0,0 @@ -[InternetShortcut] -URL=http://dl-learner.org/files/screencast/protege/prot.htm -HotKey=0 -IDList= -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -356,6 +356,19 @@ } Set<String> ignore = new TreeSet<String>(); ignore.add(currentConcept.toString()); + if(id.equals(SUPER_CLASS_AXIOM_STRING)) { + Description currentClass = (Description)currentConcept; + String currentClassString = currentConcept.toString(); + while(!currentClassString.contains("TOP")) { + Iterator<Description> it = reasoner.getSuperClasses(currentClass).iterator(); + while(it.hasNext()) { + Description ignoredClass = it.next(); + if(!ignoredClass.toString().equals("TOP")) { + ignore.add(ignoredClass.toString()); + } + } + } + } cm.applyConfigEntry(la, "ignoredConcepts", ignore); cm.applyConfigEntry(la, "noisePercentage", 5.0); cm.applyConfigEntry(la, "terminateOnNoiseReached", false); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-15 12:03:26 UTC (rev 1552) @@ -1,15 +1,16 @@ Requirements ============ -Java 6 and the Prot\xE9g\xE9 4.0 Beta are required. (All other libraries are included in the release.) +Java 6 and the Protégé 4.0 Beta are required. (All other libraries are included in the release.) Installation ============ -Put the DL-Learner-protege-plugin.jar in your plugin folder of Prot\xE9g\xE9. +Put the DL-Learner-protege-plugin.jar in your plugin folder of Protégé. Running Instructions ==================== To use the plugin go to view --> class views and click on class descriptions (including DL-Learner plugin). -Put the new frame somewhere in the classes tab in Prot\xE9g\xE9 and close the old class description view. All features are included in the plugin. -If you have problems look at the screen cast link in the release bundle. +Put the new frame somewhere in the classes tab in Protégé and close the old class description view. All features are included in the plugin. +If you have problems look at the screen cast: http://dl-learner.org/files/screencast/protege/prot.htm + Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -111,8 +111,8 @@ private EvaluatedDescription eval; private JTextArea concept; private JTextArea conceptText; - private final Color colorRed = new Color(139,0,0); - private final Color colorGreen = new Color(0,139,0); + private final Color colorRed = new Color(139, 0, 0); + private final Color colorGreen = new Color(0, 139, 0); /** * This is the constructor for the Panel. * @param model DLLearnerModel Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -144,7 +144,7 @@ helpForPosExamples = new JButton("?"); helpForPosExamples.setBounds(100, 5, 20, 20); helpForNegExamples = new JButton("?"); - helpForNegExamples.setBounds(100, 5, 20, 20); + helpForNegExamples.setBounds(105, 5, 20, 20); helpForPosExamples.setName("PosHelpButton"); helpForNegExamples.setName("NegHelpButton"); //set size for components that have no layout. Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -76,12 +76,13 @@ 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."; + +"Per default all that belongs to the class."; view.getPosAndNegSelectPanel().renderHelpMessage(help); } if (action.getSource().toString().contains("NegHelpButton")) { - String help = "A Instance tht doesn't follow from the classdescription."; + 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); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/README =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/README 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/README 2008-12-15 12:03:26 UTC (rev 1552) @@ -1,15 +1,17 @@ README ====== -The Prot\xE9g\xE9 DL-Learner plugin allows to learn equivalence and super class axioms based on -the instance data in the ontologies loaded in Prot\xE9g\xE9. It integrated seamlessly in Prot\xE9g\xE9. +The Protégé DL-Learner plugin allows to learn equivalence and super class axioms based on +the instance data in the ontologies loaded in Protégé. It integrated seamlessly in Protégé. Homepage: http://dl-learner.org/wiki/ProtegePlugin Sourceforge.net Project Page: http://sourceforge.net/projects/dl-learner/ Bugs & Feature Requests: http://sourceforge.net/tracker/?group_id=203619 Mailing Lists: http://sourceforge.net/mail/?group_id=203619 Latest Release: http://sourceforge.net/project/showfiles.php?group_id=203619 +Sourcecode: https://dl-learner.svn.sourceforge.net/svnroot/dl-learner/trunk/src/dl-learner/org/dllearner/tools/protege/ -The Prot\xE9g\xE9 Plugin is Open Source and licenced under the GNU General Public License. +The Protégé Plugin is Open Source and licenced under the GNU General Public License. -Documentation for the Prot\xE9g\xE9 Plugin can be found +Documentation for the Protégé Plugin can be found at http://dl-learner.org/wiki/ProtegePlugin. + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-17 15:05:38
|
Revision: 1557 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1557&view=rev Author: heeroyuy Date: 2008-12-17 15:05:28 +0000 (Wed, 17 Dec 2008) Log Message: ----------- -code cleanup -added accuracy in suggest list 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/INSTALL trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -26,8 +26,8 @@ import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.util.Iterator; import java.util.List; +import java.util.Set; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ExecutionException; @@ -44,9 +44,6 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; -import org.protege.editor.owl.OWLEditorKit; -import org.semanticweb.owl.model.OWLOntology; - /** * This class processes input from the user. * @@ -61,7 +58,6 @@ private static Logger logger = Logger.getLogger(ActionHandler.class); private DLLearnerModel model; - private OWLEditorKit editorKit; // This is the id that checks if the equivalent class or subclass button is // pressed in protege @@ -93,8 +89,7 @@ */ public ActionHandler(ActionHandler a, DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view, - String i, OWLEditorKit editor) { - this.editorKit = editor; + String i) { this.view = view; this.id = i; this.model = m; @@ -212,36 +207,22 @@ * MouseEvent */ public void mouseClicked(MouseEvent m) { - EvaluatedDescription eDescription = null; + //EvaluatedDescription eDescription = null; if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { SuggestListItem item = (SuggestListItem) view .getSuggestClassPanel().getSuggestList().getSelectedValue(); String desc = item.getValue(); if (model.getEvaluatedDescriptionList() != null) { - for (Iterator<EvaluatedDescription> i = model - .getEvaluatedDescriptionList().iterator(); i.hasNext();) { - eDescription = i.next(); - if(eDescription.getDescription().toString().contains("#")) { + List<EvaluatedDescription> evalList = model.getEvaluatedDescriptionList(); + Set<String> onto = model.getOntologyURIString(); + for(EvaluatedDescription eDescription : evalList) { + for(String ont : onto) { if (desc.equals(eDescription.getDescription() - .toManchesterSyntaxString( - editorKit.getModelManager() - .getActiveOntology().getURI().toString() + "#" - , null))) { + .toManchesterSyntaxString(ont, null))) { evaluatedDescription = eDescription; - break; } - } else { - if (desc.equals(eDescription.getDescription() - .toManchesterSyntaxString( - editorKit.getModelManager() - .getActiveOntology().getURI().toString() - , null))) { - evaluatedDescription = eDescription; - - break; - } } } } @@ -403,36 +384,20 @@ public void run() { model.setSuggestList(result); - // learnPanel.getListModel().clear(); dm.clear(); - Iterator<EvaluatedDescription> it = result.iterator(); int i = 0; - while (it.hasNext()) { - Iterator<OWLOntology> ont = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - EvaluatedDescription eval = it.next(); - while(ont.hasNext()) { - String onto = ont.next().getURI().toString(); - if(eval.getDescription().toString().contains(onto)) { - if(eval.getDescription().toString().contains("#")) { - if(model.isConsistent(eval)) { - dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); - i++; - break; - } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); - i++; - break; - } + for(EvaluatedDescription eval : result) { + Set<String> ont = model.getOntologyURIString(); + for(String ontology : ont) { + if(eval.getDescription().toString().contains(ontology)) { + if(model.isConsistent(eval)) { + dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null),eval.getAccuracy()*100)); + i++; + break; } else { - if(model.isConsistent(eval)) { - dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(onto, null))); - i++; - break; - } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(onto, null))); - i++; - break; - } + dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null),eval.getAccuracy()*100)); + i++; + break; } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -22,7 +22,6 @@ import java.net.URI; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.SortedSet; @@ -43,6 +42,7 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Thing; import org.dllearner.kb.OWLAPIOntology; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegInclusionLP; @@ -185,10 +185,10 @@ private DefaultListModel posListModel; private DefaultListModel negListModel; private Set<KnowledgeSource> sources; - // private KnowledgeSource source; private boolean hasIndividuals; private NamedClass currentConcept; private Vector<IndividualObject> individualVector; + private Set<String> ontologieURI; // This is a List of evaluated descriptions to get more information of the // suggested concept @@ -221,10 +221,10 @@ cm = ComponentManager.getInstance(); ds = new HashSet<OWLDescription>(); suggestModel = new DefaultListModel(); + ontologieURI = new HashSet<String>(); detailPane = new JXTaskPane(); detailPane.setTitle("Details"); sources = new HashSet<KnowledgeSource>(); - } /** @@ -289,12 +289,9 @@ * OWLAPIOntology will be available. */ public void setKnowledgeSource() { - // source = new - // OWLAPIOntology(editor.getModelManager().getActiveOntology()); - Iterator<OWLOntology> it = editor.getModelManager() - .getActiveOntologies().iterator(); - while (it.hasNext()) { - sources.add(new OWLAPIOntology(it.next())); + Set<OWLOntology> ontologies = editor.getModelManager().getActiveOntologies(); + for(OWLOntology onto : ontologies) { + sources.add(new OWLAPIOntology(onto)); } } @@ -333,7 +330,7 @@ } // adds the positive examples cm.applyConfigEntry(lp, "positiveExamples", positiveExamples); - // adds the neagtive examples + // adds the negative examples cm.applyConfigEntry(lp, "negativeExamples", negativeExamples); try { lp.init(); @@ -358,14 +355,13 @@ ignore.add(currentConcept.toString()); if(id.equals(SUPER_CLASS_AXIOM_STRING)) { Description currentClass = (Description)currentConcept; - String currentClassString = currentConcept.toString(); - while(!currentClassString.contains("TOP")) { - Iterator<Description> it = reasoner.getSuperClasses(currentClass).iterator(); - while(it.hasNext()) { - Description ignoredClass = it.next(); - if(!ignoredClass.toString().equals("TOP")) { + while(!(currentClass instanceof Thing)) { + SortedSet<Description> superClasses = reasoner.getSuperClasses(currentClass); + for(Description ignoredClass : superClasses) { + if(!(ignoredClass instanceof Thing)) { ignore.add(ignoredClass.toString()); } + currentClass = ignoredClass; } } } @@ -406,61 +402,31 @@ public void setPosVector() { setPositiveConcept(); SortedSet<Individual> reasonerIndi = reasoner.getIndividuals(); - Iterator<Individual> reasonerIt = reasonerIndi.iterator(); - while (reasonerIt.hasNext()) { - Individual ind = reasonerIt.next(); - Iterator<OWLOntology> onto = editor.getModelManager() - .getActiveOntologies().iterator(); - while (onto.hasNext()) { - OWLOntology ont = onto.next(); + 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(ind.toString().contains("#")) { if (setPositivExamplesChecked(indiv)) { - if (indiv.contains(ont.getURI().toString())) { + if (indiv.contains(ont)) { // when yes then it sets the positive example checked // OWLExpressionCheckerFactory - posListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString()+"#", null)); + 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.getURI().toString())) { + if (indiv.contains(ont)) { individualVector .add(new IndividualObject(indiv, false)); - negListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString()+"#", null)); + negListModel.add(0, ind.toManchesterSyntaxString(ont, null)); break; } } - } else { - if (setPositivExamplesChecked(indiv)) { - if (indiv.contains(ont.getURI().toString())) { - // when yes then it sets the positive example checked - - // OWLExpressionCheckerFactory - posListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString(), null)); - individualVector.add(new IndividualObject(indiv, true)); - break; - } - - } else { - // When no it unchecks the positive example - if (indiv.contains(ont.getURI().toString())) { - individualVector - .add(new IndividualObject(indiv, false)); - negListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString(), null)); - break; - } - } } - } } } @@ -469,9 +435,8 @@ * This method resets the Concepts that are learned. */ public void unsetNewConcepts() { - while (owlDescription.iterator().hasNext()) { - owlDescription.remove(owlDescription.iterator().next()); - + for(OWLDescription o : owlDescription) { + owlDescription.remove(o); } } @@ -493,17 +458,16 @@ hasIndividuals = false; // checks if selected concept is thing when yes then it selects all // individuals - if (!current.getRootObject().toString().equals("Thing")) { - - for (Iterator<NamedClass> i = reasoner.getAtomicConceptsList() - .iterator(); i.hasNext();) { + if (!(current.getRootObject() instanceof Thing)) { + List<NamedClass> classList = reasoner.getAtomicConceptsList(); + for(NamedClass concept : classList) { // if individuals is null if (individuals == null) { - NamedClass concept = i.next(); // checks if the concept is the selected concept in protege - if (concept.toString().contains("#")) { - if (concept.toString().endsWith( - "#" + current.getRootObject().toString())) { + for(String onto : ontologieURI) { + if (concept.toString().contains(onto)) { + if (concept.toString().equals( + onto + current.getRootObject().toString())) { // if individuals is not null it gets all // individuals of // the concept @@ -516,24 +480,10 @@ break; } } - } else { - if (concept.toString().endsWith( - current.getRootObject().toString())) { - // if individuals is not null it gets all - // individuals of - // the concept - currentConcept = concept; - if (reasoner.getIndividuals(concept) != null) { - if (reasoner.getIndividuals(concept).size() > 0) { - hasIndividuals = true; - } - individual = reasoner.getIndividuals(concept); - break; - } - } } } } + } } else { if (reasoner.getIndividuals().size() > 0) { hasIndividuals = true; @@ -719,25 +669,6 @@ return suggestModel; } - /* - * This method gets the old concept from checking the positive examples. - * - * private void setOldConceptOWLAPI() { // gets all individuals - * SortedSet<Individual> indi = reasoner.getIndividuals(); // Iterator of - * Individuals for (Iterator<Individual> i = indi.iterator(); i.hasNext();) - * { Individual indi2 = i.next(); // checks if the current individual - * belongs to positive examples if (positiveExamples != null) { if - * (positiveExamples.toString().contains(indi2.toString())) { // if yes then - * get the concepts of this individuals Set<NamedClass> concept = - * reasoner.getTypes(indi2); // adds all concepts to old concept OWLAPI for - * (Iterator<NamedClass> k = concept.iterator(); k .hasNext();) { - * OWLDescription oldOWLAPI = OWLAPIDescriptionConvertVisitor - * .getOWLDescription(k.next()); oldConceptOWLAPI = oldOWLAPI; - * ds.add(oldOWLAPI); } - * - * } } } } - */ - /** * This method stores the new concept learned by the DL-Learner in the * Ontology. @@ -748,7 +679,6 @@ public void changeDLLearnerDescriptionsToOWLDescriptions( Description descript) { setNewConceptOWLAPI(descript); - // setOldConceptOWLAPI(); oldConceptOWLAPI = OWLAPIDescriptionConvertVisitor .getOWLDescription(currentConcept); ds.add(oldConceptOWLAPI); @@ -853,47 +783,36 @@ public Set<KnowledgeSource> getKnowledgeSources() { return sources; } - - /*public void updateSuggestListItems() { - evalDescriptions = la.getCurrentlyBestEvaluatedDescriptions(view - .getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts(), - view.getPosAndNegSelectPanel().getOptionPanel() - .getMinAccuracy(), true); - // learnPanel.getListModel().clear(); - DefaultListModel dm = new DefaultListModel(); - Iterator<EvaluatedDescription> it = evalDescriptions.iterator(); - int i = 0; - while (it.hasNext()) { - Iterator<OWLOntology> ont = editor.getModelManager() - .getActiveOntologies().iterator(); - EvaluatedDescription eval = it.next(); - while (ont.hasNext()) { - String onto = ont.next().getURI().toString(); - if (eval.getDescription().toString().contains(onto)) { - if (isConsistent(eval)) { - dm.add(i, new SuggestListItem(Color.GREEN, eval - .getDescription().toManchesterSyntaxString( - onto, null))); - i++; + + /** + * Checks the URI if a "#" is in it. + */ + public void checkURI() { + Set<OWLOntology> ont = editor.getModelManager().getActiveOntologies(); + Set<Individual> indi = reasoner.getIndividuals(); + for(OWLOntology onto : ont) { + String ontURI = onto.getURI().toString(); + for(Individual ind : indi) { + if(ind.toString().contains(ontURI)) { + if(ind.toString().contains("#")) { + ontologieURI.add(onto.getURI().toString()+"#"); break; } else { - dm.add(i, new SuggestListItem(Color.RED, eval - .getDescription().toManchesterSyntaxString( - onto, null))); - i++; + ontologieURI.add(onto.getURI().toString()); break; } } } - } - view.getSuggestClassPanel().setSuggestList(dm); + } } - public void algorithmTerminated() { - error = "learning succesful"; - String message = "To view details about why a class description was suggested, please doubleclick on it."; - // start the algorithm and print the best concept found - view.renderErrorMessage(error); - view.setHintMessage(message); - }*/ + /** + * This method returns the Strings of the Ontology uri's that are currently used. + * @return ontologieURI + */ + public Set<String> getOntologyURIString() { + return ontologieURI; + } + + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-17 15:05:28 UTC (rev 1557) @@ -11,6 +11,6 @@ To use the plugin go to view --> class views and click on class descriptions (including DL-Learner plugin). Put the new frame somewhere in the classes tab in Protégé and close the old class description view. All features are included in the plugin. -If you have problems look at the screen cast: http://dl-learner.org/files/screencast/protege/prot.htm +If you have problems look at the screen cast: http://dl-learner.org/wiki/ProtegePlugin. Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -21,7 +21,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; -import java.util.Iterator; +import java.util.Set; import javax.swing.JDialog; import javax.swing.JLabel; @@ -32,7 +32,6 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Individual; -import org.semanticweb.owl.model.OWLOntology; @@ -110,6 +109,7 @@ private JPanel negNotCoveredPanel; private EvaluatedDescription eval; private JTextArea concept; + private Set<String> ontologiesStrings; private JTextArea conceptText; private final Color colorRed = new Color(139, 0, 0); private final Color colorGreen = new Color(0, 139, 0); @@ -237,120 +237,74 @@ * This method sets the Informations of the selected description. */ private void setInformation() { + ontologiesStrings = model.getOntologyURIString(); if(eval!=null) { //sets the accuracy of the selected concept - System.out.println("EVAL: " + eval.getDescription()); - if(eval.getDescription().toString().contains("#")) { - conceptText.setText(eval.getDescription().toManchesterSyntaxString(model.getURI().toString() + "#", null)); - } else { - conceptText.setText(eval.getDescription().toManchesterSyntaxString(model.getURI().toString(), null)); + for(String ontoString : ontologiesStrings) { + if(eval.getDescription().toString().contains(ontoString)) { + conceptText.setText(eval.getDescription().toManchesterSyntaxString(ontoString, null)); + break; + } } + + //sets the accuracy of the concept double acc = (eval.getAccuracy())*100; accuracyText.setText(String.valueOf(acc)+"%"); - Iterator<Individual> i = eval.getCoveredPositives().iterator(); - while (i.hasNext()) { - Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - Individual ind = i.next(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if(ind.toString().contains("#")) { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); - posLabel.setForeground(colorGreen); - posCoveredPanel.add(posLabel); - break; - } - } else { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorGreen); - posCoveredPanel.add(posLabel); - break; - } - } + + //Sets positive Covered Examples for the detail panel + Set<Individual> indi = 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 - Iterator<Individual> a = eval.getNotCoveredPositives().iterator(); - while (a.hasNext()) { - Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - Individual ind = a.next(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if(ind.toString().contains("#")) { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); - posLabel.setForeground(colorRed); - posNotCoveredPanel.add(posLabel); - break; - } - } else { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorRed); - posNotCoveredPanel.add(posLabel); - break; - } + Set<Individual> individuals = 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 - Iterator<Individual> b = eval.getCoveredNegatives().iterator(); - while (b.hasNext()) { - Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - Individual ind = b.next(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if(ind.toString().contains("#")) { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); - posLabel.setForeground(colorRed); - negCoveredPanel.add(posLabel); - break; - } - } else { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorRed); - negCoveredPanel.add(posLabel); - break; - } + Set<Individual> negCoveredIndi = 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 - Iterator<Individual> c = eval.getNotCoveredNegatives().iterator(); - while (c.hasNext()) { - Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - Individual ind = c.next(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if(ind.toString().contains("#")) { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); - posLabel.setForeground(colorGreen); - negNotCoveredPanel.add(posLabel); - } - } else { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorGreen); - negNotCoveredPanel.add(posLabel); - } + Set<Individual> negNotCoveredIndi = 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/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -119,8 +119,7 @@ editor = new ExpressionEditor<OWLDescription>(editorKit, editorKit.getModelManager().getOWLExpressionCheckerFactory().getOWLDescriptionChecker()); editor.setExpressionObject(description); - action = new ActionHandler(this.action, null, dllearner, null, - editorKit); + action = new ActionHandler(this.action, null, dllearner, null); tabbedPane = new JTabbedPane(); tabbedPane.setFocusable(false); editingComponent = new JPanel(new BorderLayout()); @@ -381,8 +380,7 @@ toggledIcon = new ImageIcon(toggledIconUrl); model = new DLLearnerModel(editorKit, current, label, this); sugPanel = new SuggestClassPanel(); - action = new ActionHandler(this.action, model, this, label, - editorKit); + action = new ActionHandler(this.action, model, this, label); adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); @@ -438,6 +436,7 @@ model.clearVector(); model.unsetListModel(); model.initReasoner(); + model.checkURI(); model.setPosVector(); hint.setVisible(true); if (model.hasIndividuals()) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -36,7 +36,7 @@ private static final long serialVersionUID = 8040385703448641356L; /** - * Construktor for the Cell Renderer for the Suggest List. + * Constructor for the Cell Renderer for the Suggest List. */ public SuggestListCellRenderer() { setOpaque(true); @@ -55,7 +55,7 @@ int arg2, boolean iss, boolean arg4) { // Set the text and // background color for rendering - setText(((SuggestListItem) value).getValue()); + setText(((SuggestListItem) value).getValue() + " " + "Accuracy: " + ((SuggestListItem) value).getAccuracy()+"%"); setBackground(Color.WHITE); setForeground(((SuggestListItem) value).getColor()); // Set a border if the list Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -29,15 +29,18 @@ private Color color; private String value; + private double accuracy; /** * Constructor for the SuggestListItem. * @param c Color Color in which the text is painted. * @param s String text that is shown. */ public SuggestListItem( - Color c, String s) { - color = c; - value = s; + Color c, String s, double acc) { + this.color = c; + this.value = s; + this.accuracy = acc; + } /** @@ -55,5 +58,13 @@ public String getValue() { return value; } + + /** + * This method returns the accuracy of the current list item. + * @return accuracy + */ + public double getAccuracy() { + return accuracy; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-22 13:30:11
|
Revision: 1565 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1565&view=rev Author: heeroyuy Date: 2008-12-22 13:30:05 +0000 (Mon, 22 Dec 2008) Log Message: ----------- -shows learning panel with warning when ontology is inconsistent -shows warning when suggested class descriptions leads to inconsistency 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/OWLClassDescriptionEditorWithDLLearnerTab.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-22 13:18:39 UTC (rev 1564) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-22 13:30:05 UTC (rev 1565) @@ -397,6 +397,7 @@ } else { dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null),eval.getAccuracy()*100)); i++; + view.setIsInconsistent(true); break; } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-22 13:18:39 UTC (rev 1564) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-22 13:30:05 UTC (rev 1565) @@ -49,6 +49,7 @@ import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.jdesktop.swingx.JXTaskPane; +import org.mindswap.pellet.exceptions.InconsistentOntologyException; import org.protege.editor.owl.OWLEditorKit; import org.protege.editor.owl.ui.frame.OWLFrame; import org.semanticweb.owl.apibinding.OWLManager; @@ -189,6 +190,7 @@ private NamedClass currentConcept; private Vector<IndividualObject> individualVector; private Set<String> ontologieURI; + private boolean ontologyConsistent; // This is a List of evaluated descriptions to get more information of the // suggested concept @@ -213,6 +215,7 @@ current = h; this.id = id; this.view = view; + ontologyConsistent = true; owlDescription = new HashSet<OWLDescription>(); posListModel = new DefaultListModel(); negListModel = new DefaultListModel(); @@ -301,14 +304,18 @@ */ public void setReasoner() { this.reasoner = cm.reasoner(FastInstanceChecker.class, sources); - try { reasoner.init(); + reasoner.isSatisfiable(); + view.setIsInconsistent(false); } catch (ComponentInitException e) { // TODO Auto-generated catch block - System.out.println("fehler!!!!!!!!!"); + System.out.println("fehler!!!!!!!!!"); e.printStackTrace(); + } catch (InconsistentOntologyException incon) { + view.setIsInconsistent(true); } + // rs = cm.reasoningService(reasoner); } @@ -814,6 +821,13 @@ public Set<String> getOntologyURIString() { return ontologieURI; } + /** + * This method reutrns a bollean if an ontology is inconsistent. + * @return ontologyInconsistent + */ + public boolean getOntologyConsistent() { + return ontologyConsistent; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-12-22 13:18:39 UTC (rev 1564) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-12-22 13:30:05 UTC (rev 1565) @@ -356,6 +356,7 @@ private JLabel wikiPane; private ImageIcon toggledIcon; private JTextArea hint; + private boolean isInconsistent; // This is the Panel for more details of the suggested concept private MoreDetailForSuggestedConceptsPanel detail; private OWLFrame<OWLClass> frame; @@ -434,22 +435,30 @@ public void makeView() { model.clearVector(); + hint.setText("To get suggestions for class descriptions, please click the button above."); + isInconsistent = false; model.unsetListModel(); model.initReasoner(); - model.checkURI(); - model.setPosVector(); - hint.setVisible(true); - if (model.hasIndividuals()) { - run.setEnabled(true); + if(!isInconsistent) { + + model.checkURI(); + model.setPosVector(); + if (model.hasIndividuals()) { + run.setEnabled(true); + } else { + run.setEnabled(false); + hint.setVisible(false); + String message ="There are no Instances for "+ frame.getRootObject()+" available. Please insert some Instances."; + renderErrorMessage(message); + } + posPanel.setExampleList(model.getPosListModel(), model.getNegListModel()); } else { + hint.setForeground(Color.RED); run.setEnabled(false); - hint.setVisible(false); - String message ="There are no Instances for "+ frame.getRootObject()+" available. Please insert some Instances."; - renderErrorMessage(message); - } + hint.setText("Can't reason with inconsistent ontology"); + } + hint.setVisible(true); advanced.setIcon(icon); - - posPanel.setExampleList(model.getPosListModel(), model.getNegListModel()); accept.setEnabled(false); action.resetToggled(); addButtonPanel.add("North", accept); @@ -468,8 +477,8 @@ posPanel.getAddToPosPanelButton().setEnabled(false); posPanel.setBounds(10, 230, 490, 250); accept.setBounds(510, 40, 80, 110); - hint.setBounds(10, 150, 490, 20); - errorMessage.setBounds(10, 170, 490, 20); + hint.setBounds(10, 150, 490, 35); + errorMessage.setBounds(10, 180, 490, 20); learner.add(run); learner.add(wikiPane); learner.add(adv); @@ -481,6 +490,7 @@ learner.add(posPanel); detail = new MoreDetailForSuggestedConceptsPanel(model); add(learner); + } /** * This method sets the right icon for the advanced Panel. @@ -593,7 +603,10 @@ public JButton getRunButton() { return run; } - + + public void setIsInconsistent(boolean isIncon) { + this.isInconsistent = isIncon; + } /** * Destroys the view after the plugin is closed. */ @@ -634,7 +647,12 @@ */ public void algorithmTerminated() { String error = "learning succesful"; - String message = "To view details about why a class description was suggested, please doubleclick on it."; + String message = ""; + if(isInconsistent) { + message = "Class descriptions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; + } else { + message = "To view details about why a class description was suggested, please doubleclick on it."; + } run.setEnabled(true); // start the algorithm and print the best concept found renderErrorMessage(error); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-02-03 12:22:17
|
Revision: 1584 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1584&view=rev Author: heeroyuy Date: 2009-02-03 11:35:36 +0000 (Tue, 03 Feb 2009) Log Message: ----------- -started graphical display for coverage of learned concept -started own thread for selecting positive and negative examples 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/IndividualObject.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java Added Paths: ----------- 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/IndividualPoint.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-01-26 11:55:26 UTC (rev 1583) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -84,8 +84,7 @@ * DLlearner tab * @param i * id if it is a subclass or an equivalent class - * @param editor - * OWLEditorKit + * */ public ActionHandler(ActionHandler a, DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view, @@ -302,7 +301,13 @@ private Thread dlLearner; private DefaultListModel dm = new DefaultListModel(); + /** + * Errorlogger. + */ Logger logger = Logger.getLogger(SuggestionRetriever.class); + /** + * Errorlogger. + */ Logger rootLogger = Logger.getRootLogger(); @SuppressWarnings("unchecked") @@ -391,11 +396,11 @@ for(String ontology : ont) { if(eval.getDescription().toString().contains(ontology)) { if(model.isConsistent(eval)) { - dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null),eval.getAccuracy()*100)); + dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null), eval.getAccuracy()*100)); i++; break; } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null),eval.getAccuracy()*100)); + dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null), eval.getAccuracy()*100)); i++; view.setIsInconsistent(true); break; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-01-26 11:55:26 UTC (rev 1583) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -38,7 +38,6 @@ import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.ReasonerComponent; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; @@ -48,7 +47,6 @@ import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; -import org.jdesktop.swingx.JXTaskPane; import org.mindswap.pellet.exceptions.InconsistentOntologyException; import org.protege.editor.owl.OWLEditorKit; import org.protege.editor.owl.ui.frame.OWLFrame; @@ -90,7 +88,7 @@ // The Reasoning Service for the Reasoner - private ReasonerComponent rs; + //private ReasonerComponent rs; private static final String EQUIVALENT_CLASS_AXIOM_STRING = "Suggest equivalent class"; private static final String SUPER_CLASS_AXIOM_STRING = "Suggest super class"; @@ -102,7 +100,7 @@ // A Array of Concepts which the DL-Learner suggested - private Description[] description; + //private Description[] description; // The Learning problem that is used to learn new concepts @@ -114,7 +112,7 @@ // The Ontology which is currently used - private OWLOntology ontology; + //private OWLOntology ontology; // This is the learning algorithm @@ -182,7 +180,7 @@ // This is necessary to get the details of the suggested concept - private JXTaskPane detailPane; + //private JXTaskPane detailPane; private DefaultListModel posListModel; private DefaultListModel negListModel; private Set<KnowledgeSource> sources; @@ -225,8 +223,8 @@ ds = new HashSet<OWLDescription>(); suggestModel = new DefaultListModel(); ontologieURI = new HashSet<String>(); - detailPane = new JXTaskPane(); - detailPane.setTitle("Details"); + //detailPane = new JXTaskPane(); + //detailPane.setTitle("Details"); sources = new HashSet<KnowledgeSource>(); } @@ -272,10 +270,10 @@ * 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 @@ -292,8 +290,8 @@ * OWLAPIOntology will be available. */ public void setKnowledgeSource() { - Set<OWLOntology> ontologies = editor.getModelManager().getActiveOntologies(); - for(OWLOntology onto : ontologies) { + Set<OWLOntology> ontologieSet = editor.getModelManager().getActiveOntologies(); + for(OWLOntology onto : ontologieSet) { sources.add(new OWLAPIOntology(onto)); } } @@ -318,8 +316,19 @@ // rs = cm.reasoningService(reasoner); } - + + public FastInstanceChecker getReasoner() { + return reasoner; + } + /** + * This method returns the current concept. + * @return current concept + */ + public NamedClass getCurrentConcept() { + return currentConcept; + } + /** * This method sets the Learning problem for the learning process. * PosNegDefinitonLp for equivalent classes and PosNegInclusionLP for super * classes. @@ -361,7 +370,7 @@ Set<String> ignore = new TreeSet<String>(); ignore.add(currentConcept.toString()); if(id.equals(SUPER_CLASS_AXIOM_STRING)) { - Description currentClass = (Description)currentConcept; + Description currentClass = (Description) currentConcept; while(!(currentClass instanceof Thing)) { SortedSet<Description> superClasses = reasoner.getSuperClasses(currentClass); for(Description ignoredClass : superClasses) { @@ -393,10 +402,11 @@ * This method returns the Concepts from the DL-Learner. * * @return Array of learned Concepts. - */ + public Description[] getSolutions() { return description; - } + }*/ + /** * Starts the learning algorithm. */ @@ -499,8 +509,24 @@ individual = reasoner.getIndividuals(); } } - + /** + * This method sets the positive examples for learning. + * @param ind + */ + public void setIndividuals(Set<Individual> ind) { + this.individual = ind; + } + + /** + * This method sets the uri sting for the currently used + * for learning. + * @param uri + */ + public void setOntologyURIString(Set<String> uri) { + this.ontologieURI = uri; + } + /** * This Method checks if the selected class has any individuals. * * @return boolean hasIndividuals @@ -508,6 +534,14 @@ public boolean hasIndividuals() { return hasIndividuals; } + + /** + * Sets if the ontology has individuals. + * @param has + */ + public void setHasIndividuals(boolean has) { + this.hasIndividuals = has; + } /** * This method gets an Individual and checks if this individual belongs to @@ -517,7 +551,7 @@ * Individual to check if it belongs to the chosen concept * @return is Individual belongs to the concept which is chosen in protege. */ - public boolean setPositivExamplesChecked(String indi) { + private boolean setPositivExamplesChecked(String indi) { boolean isChecked = false; // checks if individuals are not empty if (individual != null) { @@ -548,10 +582,10 @@ * * @param list * Array of concepts from DL-Learner - */ + public void setDescriptionList(Description[] list) { description = list; - } + }*/ /** * This method returns the PosListModel. @@ -584,12 +618,12 @@ /** * 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 @@ -617,10 +651,10 @@ * This method returns the current OWLOntology that is loaded in protege. * * @return current ontology - */ + public OWLOntology getOWLOntology() { return ontology; - } + } */ /** * This method returns a set of concepts that are learned by the DL-Learner. @@ -639,6 +673,8 @@ * @return Old Concept in OWLDescription format. */ public OWLDescription getOldConceptOWLAPI() { + oldConceptOWLAPI = OWLAPIDescriptionConvertVisitor + .getOWLDescription(currentConcept); return oldConceptOWLAPI; } @@ -714,10 +750,10 @@ * This method returns the currently used reasoning service. * * @return current reasoning service - */ + public ReasonerComponent getReasonerComponent() { return rs; - } + }*/ /** * This method gets the status if the DL-Learner has already learned. It is @@ -778,7 +814,7 @@ * This method returns the currently used ontoloies including importet * ontologies. * - * @return Set<OWLAPIOntology> ontologies + * @return Set of OWLAPI ontologies */ public Set<OWLAPIOntology> getOWLOntologies() { return ontologies; @@ -786,7 +822,7 @@ /** * This method returns the Knowledgesources currenty used. - * @return Set<KnowledgSource> + * @return Set of Knowledgesources */ public Set<KnowledgeSource> getKnowledgeSources() { return sources; @@ -822,12 +858,45 @@ return ontologieURI; } /** - * This method reutrns a bollean if an ontology is inconsistent. + * This method returns a boolean if an ontology is inconsistent. * @return ontologyInconsistent */ public boolean getOntologyConsistent() { return ontologyConsistent; } + + /** + * Sets the positive examples. + * @param list + */ + public void setPosListModel(DefaultListModel list) { + this.posListModel = list; + } + + /** + * Sets the negative examples. + * @param list + */ + public void setNegListModel(DefaultListModel list) { + this.negListModel = list; + } + + /** + * Sets the individual vector. + * @param indi + */ + public void setIndividualVector(Vector<IndividualObject> indi) { + this.individualVector = indi; + } + + /** + * This sets the current concept. + * @param current + */ + public void setCurrentConcept(NamedClass current) { + this.currentConcept = current; + } +} -} + Added: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -0,0 +1,204 @@ +package org.dllearner.tools.protege; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.geom.Ellipse2D; +import java.util.Set; +import java.util.Vector; + +import javax.swing.JButton; +import javax.swing.JPanel; + +import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.owl.Individual; + +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 int shiftXAxis; + private int distortion; + private 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> negCovIndVector; + private JButton allPositiveIndividuals; + private JButton allNegativeIndividuals; + + /** + * This is the constructor for the GraphicalCoveragePanel. + */ + public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, String concept, int w, int h) { + setPreferredSize(new Dimension(width, height)); + setVisible(true); + setForeground(Color.GREEN); + repaint(); + eval = desc; + model = m; + conceptNew = concept; + posCovIndVector = new Vector<IndividualPoint>(); + posNotCovIndVector = new Vector<IndividualPoint>(); + negCovIndVector = new Vector<IndividualPoint>(); + this.computeGraphics(); + oldConcept = new Ellipse2D.Float(5, 25, 250, 250); + newConcept = new Ellipse2D .Float(5+shiftXAxis, 25, width+distortion, height+distortion); + allPositiveIndividuals = new JButton(); + //immer in der mitte und unten rauszubekommen mittels getMittelpunkt fuer x + //und getMaxY fuer y. + //allPositiveIndividuals.setBounds(arg0, arg1, arg2, arg3); + allNegativeIndividuals = new JButton(); + //allNegativeIndividuals.setBounds(arg0, arg1, arg2, arg3); + this.computeIndividualPoints(); + } + + public void drawCoverageForLearnedClassDescription( + Set<Individual> posCovInd, Set<Individual> posNotCovInd, + Set<Individual> negCovInd) { + + + } + + protected void paintComponent(Graphics g) { + g.setColor(Color.RED); + g.drawOval((5+shiftXAxis), 25, width+distortion, height+distortion); + g.drawString(conceptNew, 10 + width, 15); + g.setColor(Color.GREEN); + g.drawOval(5, 25, 250, 250); + g.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); + + for(int i = 0; i < posCovIndVector.size(); i++) { + g.setColor(Color.BLACK); + g.drawString(posCovIndVector.get(i).getPoint(), posCovIndVector.get(i).getXAxis(), posCovIndVector.get(i).getYAxis()); + } + + for(int i = 0; i < posNotCovIndVector.size(); i++) { + g.setColor(Color.BLACK); + g.drawString(posNotCovIndVector.get(i).getPoint(), posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); + } + + for(int i = 0; i < negCovIndVector.size(); i++) { + g.setColor(Color.BLACK); + g.drawString(negCovIndVector.get(i).getPoint(), negCovIndVector.get(i).getXAxis(), negCovIndVector.get(i).getYAxis()); + } + + } + + private void computeGraphics(){ + int posGes = model.getPosListModel().size(); + int notCovPos = eval.getNotCoveredPositives().size(); + int covNeg = eval.getCoveredNegatives().size(); + int negGes = model.getNegListModel().size(); + double notCov = notCovPos; + float shift = (float) (width*(notCov/posGes)); + shiftXAxis = Math.round(shift); + distortion = 0; + if(shiftXAxis == 0) { + distortion = Math.round((width*(covNeg/negGes))/4); + } + + } + + private void computeIndividualPoints() { + Set<Individual> posInd = eval.getCoveredPositives(); + int i = 0; + double x = 20; + double y = 20; + for(Individual ind : posInd) { + if(i<maxNumberOfIndividualPoints) { + i++; + if(x >= oldConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + gap; + } + + if(y >= oldConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); + } + + if(x >= newConcept.getMaxX()) { + x = (int) newConcept.getMinX(); + y = y + gap; + } + + if(y >= newConcept.getMaxY()) { + y = (int) newConcept.getMinY(); + } + + while(x < newConcept.getMaxX()) { + + if(newConcept.contains(x, y) && oldConcept.contains(x, y)) { + posCovIndVector.add(new IndividualPoint("+",(int)x,(int)y,ind.toString())); + x = x + gap; + break; + } else { + x = x + gap; + } + } + } + } + + Set<Individual> posNotCovInd = eval.getNotCoveredPositives(); + int j = 0; + for(Individual ind : posNotCovInd) { + if(j<maxNumberOfIndividualPoints) { + j++; + if(x >= oldConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + gap; + } + + if(y >= oldConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); + } + + while(x < oldConcept.getMaxX()) { + + if(oldConcept.contains(x, y)&&!newConcept.contains(x, y)) { + posNotCovIndVector.add(new IndividualPoint("-",(int)x,(int)y,ind.toString())); + x = x + gap; + break; + } else { + x = x + gap; + } + } + } + } + + Set<Individual> negCovInd = eval.getCoveredNegatives(); + int k = 0; + for(Individual ind : negCovInd) { + if(k<maxNumberOfIndividualPoints) { + k++; + if(x >= newConcept.getMaxX()) { + x = (int) newConcept.getMinX(); + y = y + gap; + } + + if(y >= newConcept.getMaxY()) { + y = (int) newConcept.getMinY(); + } + + while(x < newConcept.getMaxX()) { + if(newConcept.contains(x, y) && !oldConcept.contains(x, y)) { + negCovIndVector.add(new IndividualPoint("o",(int)x,(int)y,ind.toString())); + x = x + gap; + break; + } else { + x = x + gap; + } + } + } + } + } + + +} Added: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -0,0 +1,6 @@ +package org.dllearner.tools.protege; + +//hier irgendwie umsetzen das wenn ueber individual fahre das name angezeigt wird. +public class GraphicalCoveragePanelHandler { + +} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-01-26 11:55:26 UTC (rev 1583) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -55,7 +55,7 @@ } /** - * This method sets the example positive or negative if changed to the othe list. + * This method sets the example positive or negative if changed to the other list. * @param pos boolean */ public void setExamplePositive(boolean pos) { Added: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -0,0 +1,59 @@ +package org.dllearner.tools.protege; + +public class IndividualPoint { + + private String point; + private int xAxis; + private int yAxis; + private String individual; + + public IndividualPoint(String p, int x, int y, String ind) { + this.point = p; + this.xAxis = x; + this.yAxis = y; + this.individual = ind; + } + + /** + * @param point the point to set + */ + public void setPoint(String point) { + this.point = point; + } + + /** + * @return the point + */ + public String getPoint() { + return point; + } + + /** + * @param xAxis the xAxis to set + */ + public void setXAxis(int xAxis) { + this.xAxis = xAxis; + } + + /** + * @return the xAxis + */ + public int getXAxis() { + return xAxis; + } + + /** + * @param yAxis the yAxis to set + */ + public void setYAxis(int yAxis) { + this.yAxis = yAxis; + } + + /** + * @return the yAxis + */ + public int getYAxis() { + return yAxis; + } + +} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-01-26 11:55:26 UTC (rev 1583) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -37,11 +37,12 @@ /** * This class shows more details of the suggested concepts. It shows the positive and negative examples - * that are covered and that are not covered by the suggested concepts. It also shows the accuracya of the + * that are covered and that are not covered by the suggested concepts. It also shows the accuracy of the * selected concept. * @author Christian Koetteritzsch * */ + public class MoreDetailForSuggestedConceptsPanel extends JPanel { private static final long serialVersionUID = 785272797932584581L; @@ -113,6 +114,9 @@ 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 GraphicalCoveragePanel p; /** * This is the constructor for the Panel. * @param model DLLearnerModel @@ -120,7 +124,7 @@ public MoreDetailForSuggestedConceptsPanel(DLLearnerModel model) { super(); setLayout(null); - setPreferredSize(new Dimension(600, 500)); + setPreferredSize(new Dimension(width, height)); this.model = model; @@ -150,6 +154,7 @@ negNotCoveredScroll.setBounds(300, 325, 280, 140); eval = desc; concept = new JTextArea("Class Description:"); + concept.setEditable(false); coveredPositiveExamples = new JLabel("Covered Positive Examples:"); coveredPositiveExamples.setForeground(colorGreen); @@ -168,7 +173,7 @@ conceptPanel.setBounds(5, 0, 600, 50); accuracyPanel = new JPanel(new GridLayout(0, 1)); accuracyPanel.setBounds(5, 60, 600, 50); - + posCoveredPanel = new JPanel(new GridLayout(0, 1)); posNotCoveredPanel = new JPanel(new GridLayout(0, 1)); negCoveredPanel = new JPanel(new GridLayout(0, 1)); @@ -199,8 +204,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); + p.setBounds(5, 110, 600, 650); detailPopup = new JDialog(); - detailPopup.setSize(600, 500); + detailPopup.setSize(width, height); //window will be disposed if the x button is pressed detailPopup.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); detailPopup.setVisible(true); @@ -219,6 +226,8 @@ add(conceptPanel); add(accuracyPanel); + add(p); + /* add(coveredPositiveExamples); add(notCoveredPositiveExamples); add(coveredNegativeExamples); @@ -226,7 +235,7 @@ add(posCoveredScroll); add(posNotCoveredScroll); add(negCoveredScroll); - add(negNotCoveredScroll); + add(negNotCoveredScroll);*/ detailPopup.add(this); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-01-26 11:55:26 UTC (rev 1583) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -360,6 +360,7 @@ // This is the Panel for more details of the suggested concept private MoreDetailForSuggestedConceptsPanel detail; private OWLFrame<OWLClass> frame; + private ReadingOntologyThread readThread; /** * The constructor for the DL-Learner tab in the class description @@ -437,26 +438,10 @@ model.clearVector(); hint.setText("To get suggestions for class descriptions, please click the button above."); isInconsistent = false; - model.unsetListModel(); - model.initReasoner(); - if(!isInconsistent) { - - model.checkURI(); - model.setPosVector(); - if (model.hasIndividuals()) { - run.setEnabled(true); - } else { - run.setEnabled(false); - hint.setVisible(false); - String message ="There are no Instances for "+ frame.getRootObject()+" available. Please insert some Instances."; - renderErrorMessage(message); - } - posPanel.setExampleList(model.getPosListModel(), model.getNegListModel()); - } else { - hint.setForeground(Color.RED); - run.setEnabled(false); - hint.setText("The ontology is inconsistent and suggestions for class descriptions can only \nbe computed on consistent ontologies. Please repair the ontology first"); - } + readThread = new ReadingOntologyThread(editorKit, frame, this, model); + readThread.start(); + //TODO: runbutton wird auf enable gesetzt obwohl keine instanzdaten vorhanden sind. + hint.setVisible(true); advanced.setIcon(icon); accept.setEnabled(false); @@ -512,7 +497,9 @@ public void setHintMessage(String message) { hint.setText(message); } - + public JTextArea getHintPanel() { + return hint; + } /** * This Method returns the DL_Learner tab. * @return JComponent @@ -604,6 +591,10 @@ return run; } + /** + * This method sets if ontology is inconsistent or not. + * @param isIncon boolean if ontology is consisten + */ public void setIsInconsistent(boolean isIncon) { this.isInconsistent = isIncon; } Added: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -0,0 +1,215 @@ +package org.dllearner.tools.protege; + +import java.awt.Color; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.SortedSet; +import java.util.Vector; + +import javax.swing.DefaultListModel; + +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; + +public class ReadingOntologyThread extends Thread { + + + private boolean hasIndividuals; + private OWLFrame<OWLClass> current; + private FastInstanceChecker reasoner; + private NamedClass currentConcept; + private Set<Individual> individual; + private Set<String> ontologieURI; + private OWLEditorKit editor; + private DefaultListModel posListModel; + private DefaultListModel negListModel; + private DLLearnerModel model; + private boolean isInconsistent; + private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; + private Vector<IndividualObject> individualVector; + + public ReadingOntologyThread(OWLEditorKit editorKit, OWLFrame<OWLClass> h, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView v, DLLearnerModel m) { + posListModel = new DefaultListModel(); + negListModel = new DefaultListModel(); + ontologieURI = new HashSet<String>(); + individualVector = new Vector<IndividualObject>(); + this.editor = editorKit; + this.current = h; + this.view = v; + this.model = m; + + } + /** + * This method sets the individuals that belong to the concept which is + * chosen in protege. + */ + private void setPositiveConcept() { + SortedSet<Individual> individuals = null; + hasIndividuals = false; + // checks if selected concept is thing when yes then it selects all + // individuals + if (!(current.getRootObject() instanceof Thing)) { + List<NamedClass> classList = reasoner.getAtomicConceptsList(); + for(NamedClass concept : classList) { + // if individuals is null + if (individuals == null) { + // checks if the concept is the selected concept in protege + for(String onto : ontologieURI) { + if (concept.toString().contains(onto)) { + if (concept.toString().equals( + onto + current.getRootObject().toString())) { + // if individuals is not null it gets all + // individuals of + // the concept + currentConcept = concept; + if (reasoner.getIndividuals(concept) != null) { + if (reasoner.getIndividuals(concept).size() > 0) { + hasIndividuals = true; + } + individual = reasoner.getIndividuals(concept); + model.setIndividuals(individual); + model.setCurrentConcept(currentConcept); + break; + } + } + } + } + } + } + } else { + if (reasoner.getIndividuals().size() > 0) { + hasIndividuals = true; + + } + individual = reasoner.getIndividuals(); + model.setIndividuals(individual); + model.setHasIndividuals(hasIndividuals); + } + } + + /** + * This Method checks if the selected class has any individuals. + * + * @return boolean hasIndividuals + */ + public boolean hasIndividuals() { + return hasIndividuals; + } + + /** + * Checks the URI if a "#" is in it. + */ + private void checkURI() { + Set<OWLOntology> ont = editor.getModelManager().getActiveOntologies(); + Set<Individual> indi = reasoner.getIndividuals(); + for(OWLOntology onto : ont) { + String ontURI = onto.getURI().toString(); + for(Individual ind : indi) { + if(ind.toString().contains(ontURI)) { + if(ind.toString().contains("#")) { + ontologieURI.add(onto.getURI().toString()+"#"); + break; + } else { + ontologieURI.add(onto.getURI().toString()); + break; + } + } + } + } + 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; + + } + + public void run() { + model.unsetListModel(); + model.initReasoner(); + reasoner = model.getReasoner(); + isInconsistent = false; + if(!isInconsistent) { + + this.checkURI(); + this.setPositiveConcept(); + this.setPosVector(); + if (this.hasIndividuals()) { + view.getRunButton().setEnabled(true); + } else { + view.getRunButton().setEnabled(false); + view.getHintPanel().setVisible(false); + String message ="There are no Instances for "+ current.getRootObject()+" 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); + view.setHintMessage("The ontology is inconsistent and suggestions for class descriptions can only \nbe computed on consistent ontologies. Please repair the ontology first"); + } + } +} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java 2009-01-26 11:55:26 UTC (rev 1583) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java 2009-02-03 11:35:36 UTC (rev 1584) @@ -34,6 +34,7 @@ * Constructor for the SuggestListItem. * @param c Color Color in which the text is painted. * @param s String text that is shown. + * @param acc Accuracy of the concept */ public SuggestListItem( Color c, String s, double acc) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-02-19 10:07:43
|
Revision: 1614 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1614&view=rev Author: heeroyuy Date: 2009-02-19 10:07:39 +0000 (Thu, 19 Feb 2009) Log Message: ----------- -changes to get the plugin to run after refactoring -removed example selection panel 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/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.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 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -40,7 +40,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import org.apache.log4j.Logger; +//import org.apache.log4j.Logger; import org.dllearner.algorithms.EvaluatedDescriptionPosNeg; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; @@ -56,7 +56,7 @@ // This is the DLLearnerModel. - private static Logger logger = Logger.getLogger(ActionHandler.class); + //private static Logger logger = Logger.getLogger(ActionHandler.class); private DLLearnerModel model; @@ -113,7 +113,7 @@ model.setLearningAlgorithm(); view.getRunButton().setEnabled(false); view.renderErrorMessage("learning started"); - view.getPosAndNegSelectPanel().setCheckBoxesEnable(false); + //view.getPosAndNegSelectPanel().setCheckBoxesEnable(false); retriever = new SuggestionRetriever(); retriever.execute(); @@ -305,11 +305,11 @@ /** * Errorlogger. */ - Logger logger = Logger.getLogger(SuggestionRetriever.class); + //Logger logger = Logger.getLogger(SuggestionRetriever.class); /** * Errorlogger. */ - Logger rootLogger = Logger.getRootLogger(); + //Logger rootLogger = Logger.getRootLogger(); @SuppressWarnings("unchecked") @Override @@ -382,7 +382,7 @@ private void updateList(final List<? extends EvaluatedDescription> result) { - logger.debug("update list with " + result); + //logger.debug("update list with " + result); Runnable doUpdateList = new Runnable() { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -23,6 +23,8 @@ 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.semanticweb.owl.model.OWLClass; import org.protege.editor.owl.OWLEditorKit; @@ -35,21 +37,26 @@ * */ public class ButtonList extends AbstractOWLFrame<OWLClass> { + private OWLEquivalentClassesAxiomFrameSection equi; + private OWLSubClassAxiomFrameSection sub; /** - * Construktor of the Buttonlist. + * Constructor of the Buttonlist. * * @param editorKit EditorKit from Protege */ public ButtonList(OWLEditorKit editorKit) { + super(editorKit.getModelManager().getOWLOntologyManager()); + equi = new OWLEquivalentClassesAxiomFrameSection(editorKit, this); + sub = new OWLSubClassAxiomFrameSection(editorKit, this); // own OWLEquivalentClassesAxiomFrameSection to add the dllearner plugin // to the // OWLClassDescritpionEditor - addSection(new OWLEquivalentClassesAxiomFrameSection(editorKit, this)); + addSection(equi); // own OWLEquivalentClassesAxiomFrameSection to add the dllearner plugin // to the // OWLClassDescritpionEditor - addSection(new OWLSubClassAxiomFrameSection(editorKit, this)); + addSection(sub); addSection(new InheritedAnonymousClassesFrameSection(editorKit, this)); addSection(new OWLClassAssertionAxiomIndividualSection(editorKit, this)); addSection(new OWLDisjointClassesAxiomFrameSection(editorKit, this)); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -44,8 +44,8 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Thing; import org.dllearner.kb.OWLAPIOntology; +import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosNegLPStandard; -import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.mindswap.pellet.exceptions.InconsistentOntologyException; @@ -80,8 +80,9 @@ "org.dllearner.learningproblems.PosNegDefinitionLP", "org.dllearner.algorithms.RandomGuesser", "org.dllearner.algorithms.refinement.ROLearner", - "org.dllearner.algorithms.refexamples.ExampleBasedROLComponent", - "org.dllearner.algorithms.gp.GP" }; + "org.dllearner.algorithms.refinement2.ROLComponent2", + "org.dllearner.algorithms.gp.GP", "org.dllearner.learningproblems.PosOnlyLP", + "org.dllearner.learningproblems.PosNegLPStandard", "org.dllearner.learningproblems.ClassLearningProblem"}; // Component Manager that manages the components of the DL-Learner @@ -190,6 +191,7 @@ private Vector<IndividualObject> individualVector; private Set<String> ontologieURI; private boolean ontologyConsistent; + private String learning; // This is a List of evaluated descriptions to get more information of the // suggested concept @@ -215,6 +217,7 @@ this.id = id; this.view = view; ontologyConsistent = true; + learning = ""; owlDescription = new HashSet<OWLDescription>(); posListModel = new DefaultListModel(); negListModel = new DefaultListModel(); @@ -339,12 +342,18 @@ // sets the learning problem to PosNegDefinitionLP when the // dllearner should suggest an equivalent class lp = cm.learningProblem(PosNegLPStandard.class, reasoner); + learning = "equivalence"; } if (id.equals(SUPER_CLASS_AXIOM_STRING)) { // sets the learning problem to PosNegInclusionLP when the dllearner // should suggest a subclass + learning = "superClass"; lp = cm.learningProblem(PosNegInclusionLP.class, reasoner); } + System.out.println("CURRENT: " + currentConcept); + //lp = cm.learningProblem(ClassLearningProblem.class, reasoner); + //cm.applyConfigEntry(lp, "classToDescribe", currentConcept); + //cm.applyConfigEntry(lp, "type", learning); // adds the positive examples cm.applyConfigEntry(lp, "positiveExamples", positiveExamples); // adds the negative examples Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -34,6 +34,7 @@ private Vector<IndividualPoint> negCovIndVector; private JButton allPositiveIndividuals; private JButton allNegativeIndividuals; + private GraphicalCoveragePanelHandler handler; /** * This is the constructor for the GraphicalCoveragePanel. @@ -50,6 +51,7 @@ posNotCovIndVector = new Vector<IndividualPoint>(); negCovIndVector = new Vector<IndividualPoint>(); this.computeGraphics(); + handler = new GraphicalCoveragePanelHandler(); oldConcept = new Ellipse2D.Float(5, 25, 250, 250); newConcept = new Ellipse2D .Float(5+shiftXAxis, 25, width+distortion, height+distortion); allPositiveIndividuals = new JButton(); @@ -59,6 +61,7 @@ allNegativeIndividuals = new JButton(); //allNegativeIndividuals.setBounds(arg0, arg1, arg2, arg3); this.computeIndividualPoints(); + this.addMouseListener(handler); } public void drawCoverageForLearnedClassDescription( Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -1,6 +1,44 @@ package org.dllearner.tools.protege; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + //hier irgendwie umsetzen das wenn ueber individual fahre das name angezeigt wird. -public class GraphicalCoveragePanelHandler { +public class GraphicalCoveragePanelHandler implements MouseListener{ + + public GraphicalCoveragePanelHandler() { + + } + + @Override + public void mouseClicked(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseEntered(MouseEvent arg0) { + System.out.println("test: " + arg0.getSource()); + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -434,7 +434,7 @@ * This Method renders the view of the plugin. */ public void makeView() { - + run.setEnabled(false); model.clearVector(); hint.setText("To get suggestions for class descriptions, please click the button above."); isInconsistent = false; @@ -458,8 +458,8 @@ advanced.setBounds(10, 200, 20, 20); sugPanel.setVisible(true); posPanel.setVisible(false); - posPanel.getAddToNegPanelButton().setEnabled(false); - posPanel.getAddToPosPanelButton().setEnabled(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); @@ -563,7 +563,7 @@ model.unsetNewConcepts(); action.destroyDLLearnerThread(); errorMessage.setText(""); - posPanel.unsetPosAndNegPanel(); + //posPanel.unsetPosAndNegPanel(); learner.removeAll(); } @@ -605,8 +605,8 @@ run.removeActionListener(action); accept.removeActionListener(action); advanced.removeActionListener(action); - posPanel.removeListeners(action); - posPanel.removeHelpButtonListener(action); + //posPanel.removeListeners(action); + //posPanel.removeHelpButtonListener(action); } /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -26,7 +26,11 @@ import java.util.Set; import org.protege.editor.owl.OWLEditorKit; -import org.protege.editor.owl.ui.frame.*; +import org.protege.editor.owl.ui.frame.AbstractOWLFrameSection; +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.semanticweb.owl.inference.OWLReasonerException; import org.semanticweb.owl.inference.UnsupportedReasonerOperationException; import org.semanticweb.owl.model.AddAxiom; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -21,17 +21,17 @@ import java.awt.Dimension; import java.awt.GridLayout; -import java.net.URL; +//import java.net.URL; -import javax.swing.DefaultListModel; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; +//import javax.swing.DefaultListModel; +//import javax.swing.ImageIcon; +//import javax.swing.JButton; +//import javax.swing.JLabel; +//import javax.swing.JList; +//import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.ListSelectionModel; +//import javax.swing.JScrollPane; +//import javax.swing.ListSelectionModel; /** * This class is the Panel for the Check boxes where the positive and negative @@ -50,32 +50,32 @@ // This is the DLLearner Model - private DLLearnerModel 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 posScrollList; - private JScrollPane negScrollList; + //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; + //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; + //private JLabel pos; // This is the Label that shows "Negative Examples" - private JLabel neg; + //private JLabel neg; // This is the Panel where the Label for Positive Examples and // a help Button is in @@ -83,21 +83,21 @@ // This is the Help button for positive examples - private JButton helpForPosExamples; + //private JButton helpForPosExamples; // This is the Help button for negative examples - private JButton helpForNegExamples; + //private JButton helpForNegExamples; // This is the Text area where the help message is displayed. private OptionPanel optionPanel; - private DefaultListModel posListModel; - private ImageIcon addToPosListIcon; - private ImageIcon addToNegListIcon; - private DefaultListModel negListModel; - private JPanel examplePanel; - private PosAndNegSelectPanelHandler handler; - private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; + //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. @@ -113,87 +113,87 @@ super(); setLayout(new GridLayout(0, 1)); setPreferredSize(new Dimension(490, 250)); - view = v; - this.model = model; - handler = new PosAndNegSelectPanelHandler(model, view, this); + //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"); + //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); + //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); + //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); + //posLabelPanel.setBounds(0, 0, 200, 30); + //posScrollList.setBounds(0, 40, 190, 85); - posPanel.add(posScrollList); - posPanel.add(posLabelPanel); + //posPanel.add(posScrollList); + //posPanel.add(posLabelPanel); - negLabelPanel.setBounds(0, 0, 200, 30); - negScrollList.setBounds(0, 40, 185, 85); - negPanel.add(negLabelPanel); - negPanel.add(negScrollList); + //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); + //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); + //add(examplePanel); + //posList.addMouseListener(handler); + //negList.addMouseListener(handler); + //addToPosExamples.addActionListener(handler); + //addToNegExamples.addActionListener(handler); } /** @@ -202,28 +202,28 @@ * @param posData DefaultListModel * @param negData DefaultListModel */ - public void setExampleList(DefaultListModel posData, DefaultListModel negData) { - posListModel = posData; - negListModel = negData; - posList.setModel(posListModel); - negList.setModel(negListModel); - } + //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; - } + //public JButton getAddToPosPanelButton() { + // return addToPosExamples; + //} /** * This method returns the neg button. * @return JButton */ - public JButton getAddToNegPanelButton() { - return addToNegExamples; - } + //public JButton getAddToNegPanelButton() { + // return addToNegExamples; + //} /** * This method removes the Check boxes, the labels and the help buttons @@ -274,51 +274,51 @@ * * @param assistance String */ - public void renderHelpMessage(String assistance) { - // renders scroll bar if necessary - JOptionPane.showMessageDialog(null, assistance); - - } + //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); - - } + //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. @@ -326,20 +326,20 @@ * @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); - } + //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); - } + //public void removeHelpButtonListener(ActionHandler a) { + // helpForPosExamples.removeActionListener(a); + // helpForNegExamples.removeActionListener(a); + //} /** * This method returns the option panel. @@ -353,16 +353,16 @@ * This method returns the list of positive examples. * @return JList posExampleList */ - public JList getPosExampleList() { - return posList; - } + //public JList getPosExampleList() { + // return posList; + //} /** * This method returns the list of negative examples. * @return JList negExampleList */ - public JList getNegExampleList() { - return negList; - } + //public JList getNegExampleList() { + // return negList; + //} } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -35,9 +35,9 @@ // This is the DLLearnerModel. //private DLLearnerModel model; -private PosAndNegSelectPanel panel; +//private PosAndNegSelectPanel panel; // This is the view of the DL-Learner tab. -private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; +//private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; /** * This is the constructor for the PosAndNegSelectPanelHandler. @@ -50,8 +50,8 @@ */ public PosAndNegSelectPanelHandler(DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView v, PosAndNegSelectPanel p) { //model = m; - panel = p; - view = v; + //panel = p; + //view = v; } /** @@ -62,28 +62,28 @@ 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); - } + //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()); + //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); + //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); + //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); } } @@ -113,16 +113,16 @@ * @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(); - } + //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(); + //} } /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -19,11 +19,11 @@ */ package org.dllearner.tools.protege; -import org.apache.log4j.FileAppender; -import org.apache.log4j.HTMLLayout; -import org.apache.log4j.Layout; -import org.apache.log4j.Level; -import org.apache.log4j.Logger; +//import org.apache.log4j.FileAppender; +//import org.apache.log4j.HTMLLayout; +//import org.apache.log4j.Layout; +//import org.apache.log4j.Level; +//import org.apache.log4j.Logger; import org.protege.editor.owl.ui.view.AbstractOWLClassViewComponent; import org.semanticweb.owl.model.OWLClass; import org.protege.editor.owl.ui.framelist.OWLFrameList2; @@ -39,7 +39,7 @@ public class ProtegePlugin extends AbstractOWLClassViewComponent { private static final long serialVersionUID = 728362819273927L; /** - * List of the lists for equibvalent classes and so on. + * List of the lists for equivalent classes and so on. */ private OWLFrameList2<OWLClass> list; @@ -54,21 +54,21 @@ add(dlLearner); // add file logger (comment out if not needed) - boolean useAdditionalLogger = true; - if(useAdditionalLogger) { - Layout layout = new HTMLLayout(); - String fileName = "logs/dllearner_log.html"; - FileAppender fileAppender = new FileAppender(layout, fileName, true); + //boolean useAdditionalLogger = true; + //if(useAdditionalLogger) { + // Layout layout = new HTMLLayout(); + // String fileName = "logs/dllearner_log.html"; + // FileAppender fileAppender = new FileAppender(layout, fileName, true); // only add log statements in protege package to log file - Logger protegeLogger = Logger.getLogger("org.dllearner.tools.protege"); - protegeLogger.addAppender(fileAppender); - protegeLogger.setLevel(Level.DEBUG); - } + // Logger protegeLogger = Logger.getLogger("org.dllearner.tools.protege"); + // protegeLogger.addAppender(fileAppender); + // protegeLogger.setLevel(Level.DEBUG); + //} } @Override /** - * updates the view if somthing changes + * updates the view if something changes */ protected OWLClass updateView(OWLClass selectedClass) { list.setRootObject(selectedClass); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-02-18 17:13:11 UTC (rev 1613) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-02-19 10:07:39 UTC (rev 1614) @@ -141,13 +141,13 @@ 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)) { @@ -159,7 +159,7 @@ } } } - view.getPosAndNegSelectPanel().setExampleList(posListModel, negListModel); + //view.getPosAndNegSelectPanel().setExampleList(posListModel, negListModel); model.setPosListModel(posListModel); model.setNegListModel(negListModel); model.setIndividualVector(individualVector); @@ -184,7 +184,7 @@ } } return isChecked; - + } @Override @@ -206,7 +206,7 @@ String message ="There are no Instances for "+ current.getRootObject()+" available. Please insert some Instances."; view.renderErrorMessage(message); } - view.getPosAndNegSelectPanel().setExampleList(model.getPosListModel(), model.getNegListModel()); + //view.getPosAndNegSelectPanel().setExampleList(model.getPosListModel(), model.getNegListModel()); } else { view.getHintPanel().setForeground(Color.RED); view.getRunButton().setEnabled(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-02-19 13:23:19
|
Revision: 1616 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1616&view=rev Author: heeroyuy Date: 2009-02-19 12:32:54 +0000 (Thu, 19 Feb 2009) Log Message: ----------- -shows individual name when hovering over the point in the GraphicalCoveragePanel Modified Paths: -------------- 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/IndividualPoint.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-19 12:08:55 UTC (rev 1615) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-19 12:32:54 UTC (rev 1616) @@ -3,6 +3,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.geom.Ellipse2D; import java.util.Set; import java.util.Vector; @@ -32,28 +33,32 @@ private Vector<IndividualPoint> posCovIndVector; private Vector<IndividualPoint> posNotCovIndVector; private Vector<IndividualPoint> negCovIndVector; + private Vector<IndividualPoint> points; private JButton allPositiveIndividuals; private JButton allNegativeIndividuals; private GraphicalCoveragePanelHandler handler; + private MoreDetailForSuggestedConceptsPanel panel; /** * This is the constructor for the GraphicalCoveragePanel. */ - public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, String concept, int w, int h) { + public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, String concept, int w, int h, MoreDetailForSuggestedConceptsPanel p) { setPreferredSize(new Dimension(width, height)); setVisible(true); setForeground(Color.GREEN); repaint(); eval = desc; model = m; + panel = p; conceptNew = concept; posCovIndVector = new Vector<IndividualPoint>(); posNotCovIndVector = new Vector<IndividualPoint>(); negCovIndVector = new Vector<IndividualPoint>(); + points = new Vector<IndividualPoint>(); this.computeGraphics(); - handler = new GraphicalCoveragePanelHandler(); + handler = new GraphicalCoveragePanelHandler(this); oldConcept = new Ellipse2D.Float(5, 25, 250, 250); - newConcept = new Ellipse2D .Float(5+shiftXAxis, 25, width+distortion, height+distortion); + newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, width+distortion, height+distortion); allPositiveIndividuals = new JButton(); //immer in der mitte und unten rauszubekommen mittels getMittelpunkt fuer x //und getMaxY fuer y. @@ -61,7 +66,9 @@ allNegativeIndividuals = new JButton(); //allNegativeIndividuals.setBounds(arg0, arg1, arg2, arg3); this.computeIndividualPoints(); - this.addMouseListener(handler); + //this.addMouseListener(handler); + this.addMouseMotionListener(handler); + this.addPropertyChangeListener(handler); } public void drawCoverageForLearnedClassDescription( @@ -73,26 +80,30 @@ @Override protected void paintComponent(Graphics g) { - g.setColor(Color.RED); - g.drawOval((5+shiftXAxis), 25, width+distortion, height+distortion); - g.drawString(conceptNew, 10 + width, 15); - g.setColor(Color.GREEN); - g.drawOval(5, 25, 250, 250); - g.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); + Graphics2D g2D; + g2D = (Graphics2D) g; + + g2D.setColor(Color.RED); + g2D.draw (newConcept); + //g.drawOval((5+shiftXAxis), 25, width+distortion, height+distortion); + g2D.drawString(conceptNew, 10 + width, 15); + g2D.setColor(Color.GREEN); + g2D.draw (oldConcept); + g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); for(int i = 0; i < posCovIndVector.size(); i++) { - g.setColor(Color.BLACK); - g.drawString(posCovIndVector.get(i).getPoint(), posCovIndVector.get(i).getXAxis(), posCovIndVector.get(i).getYAxis()); + g2D.setColor(Color.BLACK); + g2D.drawString(posCovIndVector.get(i).getPoint(), posCovIndVector.get(i).getXAxis(), posCovIndVector.get(i).getYAxis()); } for(int i = 0; i < posNotCovIndVector.size(); i++) { - g.setColor(Color.BLACK); - g.drawString(posNotCovIndVector.get(i).getPoint(), posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); + g2D.setColor(Color.BLACK); + g2D.drawString(posNotCovIndVector.get(i).getPoint(), posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); } for(int i = 0; i < negCovIndVector.size(); i++) { - g.setColor(Color.BLACK); - g.drawString(negCovIndVector.get(i).getPoint(), negCovIndVector.get(i).getXAxis(), negCovIndVector.get(i).getYAxis()); + g2D.setColor(Color.BLACK); + g2D.drawString(negCovIndVector.get(i).getPoint(), negCovIndVector.get(i).getXAxis(), negCovIndVector.get(i).getYAxis()); } } @@ -106,9 +117,9 @@ float shift = (float) (width*(notCov/posGes)); shiftXAxis = Math.round(shift); distortion = 0; - if(shiftXAxis == 0) { - distortion = Math.round((width*(covNeg/negGes))/4); - } + //if(shiftXAxis == 0) { + // distortion = Math.round((width*(covNeg/negGes))/4); + //} } @@ -203,7 +214,23 @@ } } } + points.addAll(posCovIndVector); + points.addAll(posNotCovIndVector); + points.addAll(negCovIndVector); } + public Vector<IndividualPoint> getIndividualVector() { + return points; + } + public GraphicalCoveragePanel getGraphicalCoveragePanel() { + return this; + } + + 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-19 12:08:55 UTC (rev 1615) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-02-19 12:32:54 UTC (rev 1616) @@ -1,44 +1,49 @@ package org.dllearner.tools.protege; import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.Vector; -//hier irgendwie umsetzen das wenn ueber individual fahre das name angezeigt wird. -public class GraphicalCoveragePanelHandler implements MouseListener{ - - public GraphicalCoveragePanelHandler() { - + +public class GraphicalCoveragePanelHandler implements MouseMotionListener, PropertyChangeListener { + + private GraphicalCoveragePanel panel; + + public GraphicalCoveragePanelHandler(GraphicalCoveragePanel p) { + this.panel = p; } - + @Override - public void mouseClicked(MouseEvent arg0) { + public void mouseDragged(MouseEvent arg0) { // TODO Auto-generated method stub - - } - @Override - public void mouseEntered(MouseEvent arg0) { - System.out.println("test: " + arg0.getSource()); - } @Override - public void mouseExited(MouseEvent arg0) { - // TODO Auto-generated method stub - - } + 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 + && v.get(i).getYAxis() >= m.getY() - 5 + && v.get(i).getYAxis() <= m.getY() + 5) { + panel.getGraphicalCoveragePanel().setToolTipText(v.get(i).getIndividualName()); + } - @Override - public void mousePressed(MouseEvent arg0) { - // TODO Auto-generated method stub - + } + } @Override - public void mouseReleased(MouseEvent arg0) { - // TODO Auto-generated method stub - + public void propertyChange(PropertyChangeEvent arg0) { + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-02-19 12:08:55 UTC (rev 1615) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-02-19 12:32:54 UTC (rev 1616) @@ -55,5 +55,9 @@ public int getYAxis() { return yAxis; } + + 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-19 12:08:55 UTC (rev 1615) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-02-19 12:32:54 UTC (rev 1616) @@ -205,7 +205,7 @@ //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); + p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), width, height, this); p.setBounds(5, 110, 600, 650); detailPopup = new JDialog(); detailPopup.setSize(width, height); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-02-19 13:56:34
|
Revision: 1617 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1617&view=rev Author: heeroyuy Date: 2009-02-19 13:55:58 +0000 (Thu, 19 Feb 2009) Log Message: ----------- -added method to display all individuals belonging to the old class and the new learned class description Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-19 12:32:54 UTC (rev 1616) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-19 13:55:58 UTC (rev 1617) @@ -191,7 +191,7 @@ private Vector<IndividualObject> individualVector; private Set<String> ontologieURI; private boolean ontologyConsistent; - private String learning; + //private String learning; // This is a List of evaluated descriptions to get more information of the // suggested concept @@ -217,7 +217,7 @@ this.id = id; this.view = view; ontologyConsistent = true; - learning = ""; + //learning = ""; owlDescription = new HashSet<OWLDescription>(); posListModel = new DefaultListModel(); negListModel = new DefaultListModel(); @@ -342,12 +342,12 @@ // sets the learning problem to PosNegDefinitionLP when the // dllearner should suggest an equivalent class lp = cm.learningProblem(PosNegLPStandard.class, reasoner); - learning = "equivalence"; + //learning = "equivalence"; } if (id.equals(SUPER_CLASS_AXIOM_STRING)) { // sets the learning problem to PosNegInclusionLP when the dllearner // should suggest a subclass - learning = "superClass"; + //Slearning = "superClass"; lp = cm.learningProblem(PosNegInclusionLP.class, reasoner); } System.out.println("CURRENT: " + currentConcept); @@ -713,7 +713,7 @@ owlDescription.add(newConceptOWLAPI); this.desc = newConceptOWLAPI; } - + /** * This methode returns the Model for the suggested Concepts. * Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-19 12:32:54 UTC (rev 1616) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-19 13:55:58 UTC (rev 1617) @@ -8,7 +8,6 @@ import java.util.Set; import java.util.Vector; -import javax.swing.JButton; import javax.swing.JPanel; import org.dllearner.algorithms.EvaluatedDescriptionPosNeg; @@ -34,8 +33,6 @@ private Vector<IndividualPoint> posNotCovIndVector; private Vector<IndividualPoint> negCovIndVector; private Vector<IndividualPoint> points; - private JButton allPositiveIndividuals; - private JButton allNegativeIndividuals; private GraphicalCoveragePanelHandler handler; private MoreDetailForSuggestedConceptsPanel panel; @@ -59,12 +56,6 @@ handler = new GraphicalCoveragePanelHandler(this); oldConcept = new Ellipse2D.Float(5, 25, 250, 250); newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, width+distortion, height+distortion); - allPositiveIndividuals = new JButton(); - //immer in der mitte und unten rauszubekommen mittels getMittelpunkt fuer x - //und getMaxY fuer y. - //allPositiveIndividuals.setBounds(arg0, arg1, arg2, arg3); - allNegativeIndividuals = new JButton(); - //allNegativeIndividuals.setBounds(arg0, arg1, arg2, arg3); this.computeIndividualPoints(); //this.addMouseListener(handler); this.addMouseMotionListener(handler); @@ -111,8 +102,8 @@ private void computeGraphics(){ int posGes = model.getPosListModel().size(); int notCovPos = ((EvaluatedDescriptionPosNeg)eval).getNotCoveredPositives().size(); - int covNeg = ((EvaluatedDescriptionPosNeg)eval).getCoveredNegatives().size(); - int negGes = model.getNegListModel().size(); + //int covNeg = ((EvaluatedDescriptionPosNeg)eval).getCoveredNegatives().size(); + //int negGes = model.getNegListModel().size(); double notCov = notCovPos; float shift = (float) (width*(notCov/posGes)); shiftXAxis = Math.round(shift); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-02-19 12:32:54 UTC (rev 1616) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-02-19 13:55:58 UTC (rev 1617) @@ -23,6 +23,7 @@ import java.awt.GridLayout; import java.util.Set; +import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JPanel; @@ -118,6 +119,9 @@ private static final int height = 500; private static final int width = 600; private GraphicalCoveragePanel p; + private JButton allPositiveIndividuals; + private JButton allNegativeIndividuals; + private MoreDetailForSuggestedConceptsPanelHandler handler; /** * This is the constructor for the Panel. * @param model DLLearnerModel @@ -127,8 +131,17 @@ setLayout(null); setPreferredSize(new Dimension(width, height)); this.model = model; + handler = new MoreDetailForSuggestedConceptsPanelHandler(model); + allPositiveIndividuals = new JButton("old"); + allPositiveIndividuals.setBounds(100, 400, 50, 30); + allPositiveIndividuals.addActionListener(handler); + allNegativeIndividuals = new JButton("new"); + allNegativeIndividuals.setBounds(400, 400, 50, 30); + allNegativeIndividuals.addActionListener(handler); + + } /** * This method returns the Detail Panel. @@ -137,7 +150,6 @@ public JDialog getMoreDialog() { return detailPopup; } - /** * This method renders the output for the detail panel. @@ -205,8 +217,8 @@ //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, this); - p.setBounds(5, 110, 600, 650); + p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), width, height-200, this); + p.setBounds(5, 110, 600, 300); detailPopup = new JDialog(); detailPopup.setSize(width, height); //window will be disposed if the x button is pressed @@ -228,6 +240,9 @@ add(conceptPanel); add(accuracyPanel); add(p); + add(allPositiveIndividuals); + add(allNegativeIndividuals); + handler.setEvaluadtedDescription(eval); /* add(coveredPositiveExamples); add(notCoveredPositiveExamples); @@ -239,7 +254,13 @@ add(negNotCoveredScroll);*/ detailPopup.add(this); } + public JButton getAllPositiveindividuals() { + return allPositiveIndividuals; + } + public JButton getAllNegativeIndividuals() { + return allNegativeIndividuals; + } private void unsetEverything() { removeAll(); } Added: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-02-19 13:55:58 UTC (rev 1617) @@ -0,0 +1,68 @@ +package org.dllearner.tools.protege; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Set; +import java.util.SortedSet; + +import javax.swing.JOptionPane; + +import org.dllearner.algorithms.EvaluatedDescriptionPosNeg; +import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.owl.Individual; + +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 EvaluatedDescription eval; + public MoreDetailForSuggestedConceptsPanelHandler(DLLearnerModel m) { + model = m; + } + + @Override + public void actionPerformed(ActionEvent a) { + if(a.getActionCommand().equals(OLD_BUTTON_LABEL)) { + String toolTip = "This are the Individuals beloning to " + model.getOldConceptOWLAPI() +":\n\n"; + SortedSet<Individual> ind = model.getReasoner().getIndividuals(model.getCurrentConcept()); + for(Individual i : ind) { + Set<String> ur = model.getOntologyURIString(); + for(String str : ur) { + if(i.toString().contains(str)) { + toolTip = toolTip + i.toManchesterSyntaxString(str, null) + "\n"; + } + } + } + JOptionPane.showMessageDialog(null, toolTip); + } + + if(a.getActionCommand().equals(NEW_BUTTON_LABEL)) { + Set<Individual> posInd = ((EvaluatedDescriptionPosNeg)eval).getCoveredPositives(); + Set<String> uri = model.getOntologyURIString(); + String toolTip = "This are the Individuals beloning to\n "; + for(String u : uri) { + if(eval.getDescription().toString().contains(u)) { + toolTip = toolTip + eval.getDescription().toManchesterSyntaxString(u, null) + ":\n\n"; + } + } + + for(Individual ind : posInd ) { + + for(String u : uri) { + if(ind.toString().contains(u)) { + toolTip = toolTip + ind.toManchesterSyntaxString(u, null) + "\n"; + } + } + + } + JOptionPane.showMessageDialog(null, toolTip); + + } + + } + + public void setEvaluadtedDescription(EvaluatedDescription e) { + eval = e; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-02-23 16:07:18
|
Revision: 1623 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1623&view=rev Author: heeroyuy Date: 2009-02-23 16:07:10 +0000 (Mon, 23 Feb 2009) Log Message: ----------- -adjusting the graphicalCoveragePanel to the new learning algorithm -started new view for the more integrated version of the plugin 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/GraphicalCoveragePanel.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/OWLEquivalentClassesAxiomFrameSection.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -40,8 +40,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -//import org.apache.log4j.Logger; -import org.dllearner.algorithms.EvaluatedDescriptionPosNeg; +import org.dllearner.algorithms.EvaluatedDescriptionClass; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; @@ -87,9 +86,7 @@ * id if it is a subclass or an equivalent class * */ - public ActionHandler(ActionHandler a, DLLearnerModel m, - OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view, - String i) { + public ActionHandler(ActionHandler a, DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view, String i) { this.view = view; this.id = i; this.model = m; @@ -108,12 +105,10 @@ if (z.getActionCommand().equals(id)) { model.setKnowledgeSource(); model.setReasoner(); - model.setPositiveAndNegativeExamples(); model.setLearningProblem(); model.setLearningAlgorithm(); view.getRunButton().setEnabled(false); view.renderErrorMessage("learning started"); - //view.getPosAndNegSelectPanel().setCheckBoxesEnable(false); retriever = new SuggestionRetriever(); retriever.execute(); @@ -132,7 +127,6 @@ } String message = "class description added"; view.renderErrorMessage(message); - view.updateWindow(); } if (z.getActionCommand().equals("")) { if (!toggled) { @@ -302,14 +296,6 @@ private Thread dlLearner; private DefaultListModel dm = new DefaultListModel(); - /** - * Errorlogger. - */ - //Logger logger = Logger.getLogger(SuggestionRetriever.class); - /** - * Errorlogger. - */ - //Logger rootLogger = Logger.getRootLogger(); @SuppressWarnings("unchecked") @Override @@ -321,8 +307,7 @@ @Override public void run() { if (la != null) { - publish(la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts() - , view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true)); + publish(la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts(), view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true)); } } @@ -382,7 +367,6 @@ private void updateList(final List<? extends EvaluatedDescription> result) { - //logger.debug("update list with " + result); Runnable doUpdateList = new Runnable() { @@ -396,12 +380,13 @@ Set<String> ont = model.getOntologyURIString(); for(String ontology : ont) { 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), ((EvaluatedDescriptionPosNeg)eval).getAccuracy()*100)); + dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass)eval).getAccuracy()*100)); i++; break; } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionPosNeg)eval).getAccuracy()*100)); + dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass)eval).getAccuracy()*100)); i++; 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-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -19,6 +19,7 @@ */ package org.dllearner.tools.protege; +import org.protege.editor.owl.OWLEditorKit; import org.protege.editor.owl.ui.frame.AbstractOWLFrame; import org.protege.editor.owl.ui.frame.InheritedAnonymousClassesFrameSection; import org.protege.editor.owl.ui.frame.OWLClassAssertionAxiomIndividualSection; @@ -26,7 +27,6 @@ //import org.protege.editor.owl.ui.frame.OWLEquivalentClassesAxiomFrameSection; //import org.protege.editor.owl.ui.frame.OWLSubClassAxiomFrameSection; import org.semanticweb.owl.model.OWLClass; -import org.protege.editor.owl.OWLEditorKit; /** * This class manages the list of the lists for equivalent classes and so on. @@ -39,6 +39,7 @@ public class ButtonList extends AbstractOWLFrame<OWLClass> { private OWLEquivalentClassesAxiomFrameSection equi; private OWLSubClassAxiomFrameSection sub; + //private DLLearnerView view; /** * Constructor of the Buttonlist. * @@ -48,6 +49,11 @@ 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); + //equi.getEditor().getEditorComponent().validate(); sub = new OWLSubClassAxiomFrameSection(editorKit, this); // own OWLEquivalentClassesAxiomFrameSection to add the dllearner plugin // to the Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -24,14 +24,12 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; import java.util.Vector; import javax.swing.DefaultListModel; -import org.dllearner.algorithms.EvaluatedDescriptionPosNeg; -import org.dllearner.algorithms.refinement2.ROLComponent2; +import org.dllearner.algorithms.EvaluatedDescriptionClass; +import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; import org.dllearner.core.EvaluatedDescription; @@ -42,19 +40,15 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; -import org.dllearner.core.owl.Thing; import org.dllearner.kb.OWLAPIOntology; -import org.dllearner.learningproblems.PosNegInclusionLP; -import org.dllearner.learningproblems.PosNegLPStandard; +import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.mindswap.pellet.exceptions.InconsistentOntologyException; import org.protege.editor.owl.OWLEditorKit; -import org.protege.editor.owl.ui.frame.OWLFrame; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.model.AddAxiom; import org.semanticweb.owl.model.OWLAxiom; -import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLDataFactory; import org.semanticweb.owl.model.OWLDescription; import org.semanticweb.owl.model.OWLOntology; @@ -76,11 +70,9 @@ "org.dllearner.reasoning.OWLAPIReasoner", "org.dllearner.reasoning.FastInstanceChecker", "org.dllearner.reasoning.FastRetrievalReasoner", - "org.dllearner.learningproblems.PosNegInclusionLP", - "org.dllearner.learningproblems.PosNegDefinitionLP", "org.dllearner.algorithms.RandomGuesser", "org.dllearner.algorithms.refinement.ROLearner", - "org.dllearner.algorithms.refinement2.ROLComponent2", + "org.dllearner.algorithms.celoe.CELOE", "org.dllearner.algorithms.gp.GP", "org.dllearner.learningproblems.PosOnlyLP", "org.dllearner.learningproblems.PosNegLPStandard", "org.dllearner.learningproblems.ClassLearningProblem"}; @@ -88,22 +80,15 @@ private ComponentManager cm; - // The Reasoning Service for the Reasoner - - //private ReasonerComponent rs; private static final String EQUIVALENT_CLASS_AXIOM_STRING = "Suggest 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"; // The View of the DL-Learner Plugin private OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; - // This is the count of Concepts which you get after learning - - // A Array of Concepts which the DL-Learner suggested - - //private Description[] description; - // The Learning problem that is used to learn new concepts private LearningProblem lp; @@ -112,10 +97,6 @@ private boolean alreadyLearned = false; - // The Ontology which is currently used - - //private OWLOntology ontology; - // This is the learning algorithm private LearningAlgorithm la = null; @@ -124,10 +105,6 @@ private OWLEditorKit editor; - // Necessary to get the BaseUri of the currently loaded Ontology - - private OWLFrame<OWLClass> current; - // The Reasoner which is used to learn private FastInstanceChecker reasoner; @@ -136,14 +113,6 @@ private Set<OWLDescription> owlDescription; - // This set stores the positive examples. - - private Set<String> positiveExamples; - - // This set stores the negative examples that doesn't belong to the concept. - - private Set<String> negativeExamples; - // The most fitting Description in OWL Syntax which the DL-Learner suggested private OWLDescription desc; @@ -172,6 +141,7 @@ private Set<Individual> individual; private Set<OWLAPIOntology> ontologies; + private int instancesCount; // The error message which is rendered when an error occured @@ -182,7 +152,6 @@ // This is necessary to get the details of the suggested concept - //private JXTaskPane detailPane; private DefaultListModel posListModel; private DefaultListModel negListModel; private Set<KnowledgeSource> sources; @@ -191,7 +160,6 @@ private Vector<IndividualObject> individualVector; private Set<String> ontologieURI; private boolean ontologyConsistent; - //private String learning; // This is a List of evaluated descriptions to get more information of the // suggested concept @@ -209,15 +177,12 @@ * @param view * current view of the DL-Learner tab */ - public DLLearnerModel(OWLEditorKit editorKit, OWLFrame<OWLClass> h, - String id, - OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view) { + public DLLearnerModel(OWLEditorKit editorKit, String id, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view) { editor = editorKit; - current = h; this.id = id; this.view = view; ontologyConsistent = true; - //learning = ""; + instancesCount = 0; owlDescription = new HashSet<OWLDescription>(); posListModel = new DefaultListModel(); negListModel = new DefaultListModel(); @@ -227,8 +192,6 @@ ds = new HashSet<OWLDescription>(); suggestModel = new DefaultListModel(); ontologieURI = new HashSet<String>(); - //detailPane = new JXTaskPane(); - //detailPane.setTitle("Details"); sources = new HashSet<KnowledgeSource>(); } @@ -244,24 +207,6 @@ } /** - * This method checks which positive and negative examples are checked and - * puts the checked examples into a tree set. - */ - public void setPositiveAndNegativeExamples() { - positiveExamples = new TreeSet<String>(); - negativeExamples = new TreeSet<String>(); - for (int i = 0; i < individualVector.size(); i++) { - if (individualVector.get(i).isPositiveExample()) { - positiveExamples.add(individualVector.get(i) - .getIndividualString()); - } else { - negativeExamples.add(individualVector.get(i) - .getIndividualString()); - } - } - } - - /** * This method returns the data for the suggest panel. * * @return Model for the suggest panel. @@ -338,26 +283,18 @@ * classes. */ public void setLearningProblem() { + lp = cm.learningProblem(ClassLearningProblem.class, reasoner); + cm.applyConfigEntry(lp, "classToDescribe", currentConcept.toString()); if (id.equals(EQUIVALENT_CLASS_AXIOM_STRING)) { // sets the learning problem to PosNegDefinitionLP when the // dllearner should suggest an equivalent class - lp = cm.learningProblem(PosNegLPStandard.class, reasoner); - //learning = "equivalence"; + cm.applyConfigEntry(lp, "type", EQUIVALENT_CLASS_LEARNING); } if (id.equals(SUPER_CLASS_AXIOM_STRING)) { // sets the learning problem to PosNegInclusionLP when the dllearner // should suggest a subclass - //Slearning = "superClass"; - lp = cm.learningProblem(PosNegInclusionLP.class, reasoner); + cm.applyConfigEntry(lp, "type", SUPER_CLASS_LEARNING); } - System.out.println("CURRENT: " + currentConcept); - //lp = cm.learningProblem(ClassLearningProblem.class, reasoner); - //cm.applyConfigEntry(lp, "classToDescribe", currentConcept); - //cm.applyConfigEntry(lp, "type", learning); - // adds the positive examples - cm.applyConfigEntry(lp, "positiveExamples", positiveExamples); - // adds the negative examples - cm.applyConfigEntry(lp, "negativeExamples", negativeExamples); try { lp.init(); } catch (ComponentInitException e) { @@ -370,32 +307,14 @@ */ public void setLearningAlgorithm() { try { - // sets the learning algorithm to ROlearner - this.la = cm.learningAlgorithm(ROLComponent2.class, lp, + this.la = cm.learningAlgorithm(CELOE.class, lp, reasoner); } catch (LearningProblemUnsupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); } - Set<String> ignore = new TreeSet<String>(); - ignore.add(currentConcept.toString()); - if(id.equals(SUPER_CLASS_AXIOM_STRING)) { - Description currentClass = (Description) currentConcept; - while(!(currentClass instanceof Thing)) { - SortedSet<Description> superClasses = reasoner.getSuperClasses(currentClass); - for(Description ignoredClass : superClasses) { - if(!(ignoredClass instanceof Thing)) { - ignore.add(ignoredClass.toString()); - } - currentClass = ignoredClass; - } - } - cm.applyConfigEntry(la, "useNegation", false); - } - cm.applyConfigEntry(la, "ignoredConcepts", ignore); + cm.applyConfigEntry(la, "useNegation", false); cm.applyConfigEntry(la, "noisePercentage", 5.0); - cm.applyConfigEntry(la, "terminateOnNoiseReached", false); - cm.applyConfigEntry(la, "negationPenalty", 2); cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view .getPosAndNegSelectPanel().getOptionPanel() .getMaxExecutionTime()); @@ -423,42 +342,7 @@ public void run() { la.start(); } - /** - * This method sets the check boxes for the positive check boxes checked if - * the individuals matches the concept that is chosen in protege. - */ - public 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; - } - } - } - } - - } - /** * This method resets the Concepts that are learned. */ @@ -478,54 +362,11 @@ } /** - * This method sets the individuals that belong to the concept which is - * chosen in protege. - */ - public void setPositiveConcept() { - SortedSet<Individual> individuals = null; - hasIndividuals = false; - // checks if selected concept is thing when yes then it selects all - // individuals - if (!(current.getRootObject() instanceof Thing)) { - List<NamedClass> classList = reasoner.getAtomicConceptsList(); - for(NamedClass concept : classList) { - // if individuals is null - if (individuals == null) { - // checks if the concept is the selected concept in protege - for(String onto : ontologieURI) { - if (concept.toString().contains(onto)) { - if (concept.toString().equals( - onto + current.getRootObject().toString())) { - // if individuals is not null it gets all - // individuals of - // the concept - currentConcept = concept; - if (reasoner.getIndividuals(concept) != null) { - if (reasoner.getIndividuals(concept).size() > 0) { - hasIndividuals = true; - } - individual = reasoner.getIndividuals(concept); - break; - } - } - } - } - } - } - } else { - if (reasoner.getIndividuals().size() > 0) { - hasIndividuals = true; - } - individual = reasoner.getIndividuals(); - } - } - - /** * This method sets the positive examples for learning. * @param ind */ public void setIndividuals(Set<Individual> ind) { - this.individual = ind; + individual = ind; } /** @@ -554,28 +395,6 @@ } /** - * 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; - - } - - /** * 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. @@ -658,15 +477,6 @@ } /** - * This method returns the current OWLOntology that is loaded in protege. - * - * @return current ontology - - public OWLOntology getOWLOntology() { - return ontology; - } */ - - /** * This method returns a set of concepts that are learned by the DL-Learner. * They are already converted into the OWLDescription format. * @@ -687,7 +497,10 @@ .getOWLDescription(currentConcept); return oldConceptOWLAPI; } - + + public Set<OWLDescription> getDescriptions() { + return ds; + } /** * This method returns the currently learned description in OWLDescription * format. @@ -757,15 +570,6 @@ } /** - * This method returns the currently used reasoning service. - * - * @return current reasoning service - - public ReasonerComponent getReasonerComponent() { - return rs; - }*/ - - /** * This method gets the status if the DL-Learner has already learned. It is * only for reseting the suggest panel. * @@ -785,10 +589,10 @@ */ public boolean isConsistent(EvaluatedDescription eDescription) { boolean isConsistent = false; - if (((EvaluatedDescriptionPosNeg)eDescription).getNotCoveredPositives().isEmpty()) { - isConsistent = true; - } else { + if (((EvaluatedDescriptionClass)eDescription).getCoveredInstances().size() < instancesCount) { isConsistent = false; + } else { + isConsistent = true; } return isConsistent; } @@ -839,28 +643,6 @@ } /** - * Checks the URI if a "#" is in it. - */ - public void checkURI() { - Set<OWLOntology> ont = editor.getModelManager().getActiveOntologies(); - Set<Individual> indi = reasoner.getIndividuals(); - for(OWLOntology onto : ont) { - String ontURI = onto.getURI().toString(); - for(Individual ind : indi) { - if(ind.toString().contains(ontURI)) { - if(ind.toString().contains("#")) { - ontologieURI.add(onto.getURI().toString()+"#"); - break; - } else { - ontologieURI.add(onto.getURI().toString()); - break; - } - } - } - } - } - - /** * This method returns the Strings of the Ontology uri's that are currently used. * @return ontologieURI */ @@ -907,6 +689,17 @@ this.currentConcept = current; } + /** + * @return the individual + */ + public Set<Individual> getIndividual() { + return individual; + } + + public void setInstancesCount(int i) { + instancesCount = i; + } + } Added: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -0,0 +1,415 @@ +package org.dllearner.tools.protege; + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.event.ActionListener; +import java.net.URL; +import java.util.Set; + +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.JToggleButton; + +import org.protege.editor.core.ui.util.InputVerificationStatusChangedListener; +import org.protege.editor.owl.OWLEditorKit; +import org.protege.editor.owl.ui.editor.OWLDescriptionEditor; +import org.semanticweb.owl.model.OWLDescription; + +public class DLLearnerView extends JPanel implements OWLDescriptionEditor{ + + + private static final long serialVersionUID = 624829578325729385L; + //private OWLClassDescriptionEditorWithDLLearnerTab mainWindow; + // this is the Component which shows the view of the dllearner + private static final String TITLE = "DL-Learner"; + private JComponent learner; + + // Accept button to add the learned concept to the owl + + private JButton accept; + + // Runbutton to start the learning algorithm + + private JButton run; + + // This is the label for the advanced button. + + private JLabel adv; + + // This is the color for the error message. It is red. + + private final Color colorRed = Color.red; + + // This is the text area for the error message when an error occurred + + private JTextArea errorMessage; + + // Advanced Button to activate/deactivate the example select panel + + private JToggleButton advanced; + + // Action Handler that manages the Button actions + + private ActionHandler action; + + // This is the model of the dllearner plugin which includes all data + + private DLLearnerModel model; + + // Panel for the suggested concepts + + private SuggestClassPanel sugPanel; + + // Selection panel for the positive and negative examples + + private PosAndNegSelectPanel posPanel; + + // Picture for the advanced button when it is not toggled + + private ImageIcon icon; + + // Picture of the advanced button when it is toggled + 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 MoreDetailForSuggestedConceptsPanel detail; + //private OWLFrame<OWLClass> frame; + private ReadingOntologyThread readThread; + //private OWLEditorKit editorKit; + + /** + * The constructor for the DL-Learner tab in the class description + * editor. + * + * @param current OWLFrame + * @param label String + * @param dlLearner OWLClassDescriptionEditorWithDLLearnerTab + */ + public DLLearnerView(String label, OWLEditorKit editor) { + //mainWindow = dlLearner; + //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); + sugPanel = new SuggestClassPanel(); + //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"); + addButtonPanel = new JPanel(new BorderLayout()); + sugPanel.addSuggestPanelMouseListener(action); + errorMessage = new JTextArea(); + errorMessage.setEditable(false); + hint = new JTextArea(); + hint.setEditable(false); + hint.setText("To get suggestions for class descriptions, please click the button above."); + learner = new JPanel(); + advanced.setSize(20, 20); + learner.setLayout(null); + learner.setPreferredSize(new Dimension(600, 520)); + accept.setPreferredSize(new Dimension(290, 50)); + advanced.setName("Advanced"); + //posPanel = new PosAndNegSelectPanel(model, action, this); + 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; + } + + /** + * 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() { + 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(); + //TODO: runbutton wird auf enable gesetzt obwohl keine instanzdaten vorhanden sind. + + hint.setVisible(true); + advanced.setIcon(icon); + accept.setEnabled(false); + action.resetToggled(); + addButtonPanel.add("North", accept); + sugPanel.setSuggestList(model.getSuggestList()); + sugPanel = sugPanel.updateSuggestClassList(); + advanced.setSelected(false); + sugPanel.setBounds(10, 35, 490, 110); + adv.setBounds(40, 200, 200, 20); + wikiPane.setBounds(220, 0, 350, 30); + addButtonPanel.setBounds(510, 40, 80, 110); + run.setBounds(10, 0, 200, 30); + 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); + errorMessage.setBounds(10, 180, 490, 20); + learner.add(run); + learner.add(wikiPane); + learner.add(adv); + learner.add(advanced); + learner.add(sugPanel); + learner.add(addButtonPanel); + learner.add(hint); + learner.add(errorMessage); + learner.add(posPanel); + detail = new MoreDetailForSuggestedConceptsPanel(model); + add(learner); + + } + /** + * This method sets the right icon for the advanced Panel. + * @param toggled boolean + */ + public void setIconToggled(boolean toggled) { + if (toggled) { + advanced.setIcon(toggledIcon); + } + if (!toggled) { + advanced.setIcon(icon); + } + } + + /** + * This Method changes the hint message. + * @param message String hintmessage + */ + public void setHintMessage(String message) { + hint.setText(message); + } + 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. + * @param visible boolean + */ + public void setExamplePanelVisible(boolean visible) { + posPanel.setVisible(visible); + } + + /** + * 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) + */ + public Set<OWLDescription> getSollutions() { + + return model.getNewOWLDescription(); + } + + /** + * Returns the last added description. + * @return OWLDescription + */ + public OWLDescription getSollution() { + return model.getSolution(); + } + + /** + * Destroys everything in the view after the plugin is closed. + */ + public void unsetEverything() { + run.setEnabled(true); + model.unsetNewConcepts(); + action.destroyDLLearnerThread(); + errorMessage.setText(""); + //posPanel.unsetPosAndNegPanel(); + learner.removeAll(); + } + + /** + * Renders the error message when an error occured. + * @param s String + */ + public void renderErrorMessage(String s) { + errorMessage.setForeground(colorRed); + errorMessage.setText(s); + } + /** + * This Method returns the panel for more details for the chosen concept. + * @return MoreDetailForSuggestedConceptsPanel + */ + public MoreDetailForSuggestedConceptsPanel getMoreDetailForSuggestedConceptsPanel() { + return detail; + } + + /** + * This Method returns the run button. + * @return JButton + */ + public JButton getRunButton() { + return run; + } + + /** + * This method sets if ontology is inconsistent or not. + * @param isIncon boolean if ontology is consisten + */ + public void setIsInconsistent(boolean isIncon) { + this.isInconsistent = isIncon; + } + /** + * Destroys the view after the plugin is closed. + */ + @Override + public void dispose() { + run.removeActionListener(action); + accept.removeActionListener(action); + advanced.removeActionListener(action); + //posPanel.removeListeners(action); + //posPanel.removeHelpButtonListener(action); + } + + /** + * Adds Actionlistener to the run button. + * @param a ActionListener + */ + public void addRunButtonListener(ActionListener a) { + run.addActionListener(a); + } + + /** + * Adds Actionlistener to the add button. + * @param a ActionListener + */ + public void addAcceptButtonListener(ActionListener a) { + accept.addActionListener(a); + } + + /** + * Adds Actionlistener to the advanced button. + * @param a ActionListener + */ + public void addAdvancedButtonListener(ActionListener a) { + advanced.addActionListener(a); + } + + /** + * This method sets the run button enable after learning. + */ + public void algorithmTerminated() { + String error = "learning succesful"; + String message = ""; + if(isInconsistent) { + message = "Class descriptions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; + } else { + message = "To view details about why a class description was suggested, please doubleclick on it."; + } + run.setEnabled(true); + // start the algorithm and print the best concept found + renderErrorMessage(error); + setHintMessage(message); + } + + @Override + public JComponent getComponent() { + return this; + } + + @Override + public Set<OWLDescription> getDescriptions() { + return model.getDescriptions(); + } + + @Override + public String getEditorName() { + return TITLE; + } + + @Override + public boolean isValidInput() { + return true; + } + + @Override + public boolean setDescription(OWLDescription arg0) { + // TODO Auto-generated method stub + return true; + } + + @Override + public void addStatusChangedListener( + InputVerificationStatusChangedListener arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void removeStatusChangedListener( + InputVerificationStatusChangedListener arg0) { + // TODO Auto-generated method stub + + } + +} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -10,7 +10,7 @@ import javax.swing.JPanel; -import org.dllearner.algorithms.EvaluatedDescriptionPosNeg; +import org.dllearner.algorithms.EvaluatedDescriptionClass; import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Individual; @@ -22,7 +22,7 @@ private static final int maxNumberOfIndividualPoints = 20; private static final int gap = 20; private int shiftXAxis; - private int distortion; + private int distortionOld; private Ellipse2D oldConcept; private Ellipse2D newConcept; @@ -31,9 +31,9 @@ private String conceptNew; private Vector<IndividualPoint> posCovIndVector; private Vector<IndividualPoint> posNotCovIndVector; - private Vector<IndividualPoint> negCovIndVector; private Vector<IndividualPoint> points; private GraphicalCoveragePanelHandler handler; + private int adjustment; private MoreDetailForSuggestedConceptsPanel panel; /** @@ -50,14 +50,12 @@ conceptNew = concept; posCovIndVector = new Vector<IndividualPoint>(); posNotCovIndVector = new Vector<IndividualPoint>(); - negCovIndVector = new Vector<IndividualPoint>(); points = new Vector<IndividualPoint>(); this.computeGraphics(); handler = new GraphicalCoveragePanelHandler(this); - oldConcept = new Ellipse2D.Float(5, 25, 250, 250); - newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, width+distortion, height+distortion); + oldConcept = new Ellipse2D.Float(5, 25+adjustment, width-distortionOld, height-distortionOld); + newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, width, height); this.computeIndividualPoints(); - //this.addMouseListener(handler); this.addMouseMotionListener(handler); this.addPropertyChangeListener(handler); } @@ -73,15 +71,15 @@ protected void paintComponent(Graphics g) { Graphics2D g2D; g2D = (Graphics2D) g; - + g2D.setColor(Color.GREEN); + g2D.draw (oldConcept); + g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); g2D.setColor(Color.RED); g2D.draw (newConcept); - //g.drawOval((5+shiftXAxis), 25, width+distortion, height+distortion); g2D.drawString(conceptNew, 10 + width, 15); - g2D.setColor(Color.GREEN); - g2D.draw (oldConcept); - g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); + + for(int i = 0; i < posCovIndVector.size(); i++) { g2D.setColor(Color.BLACK); g2D.drawString(posCovIndVector.get(i).getPoint(), posCovIndVector.get(i).getXAxis(), posCovIndVector.get(i).getYAxis()); @@ -91,123 +89,138 @@ g2D.setColor(Color.BLACK); g2D.drawString(posNotCovIndVector.get(i).getPoint(), posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); } - - for(int i = 0; i < negCovIndVector.size(); i++) { - g2D.setColor(Color.BLACK); - g2D.drawString(negCovIndVector.get(i).getPoint(), negCovIndVector.get(i).getXAxis(), negCovIndVector.get(i).getYAxis()); - } } private void computeGraphics(){ - int posGes = model.getPosListModel().size(); - int notCovPos = ((EvaluatedDescriptionPosNeg)eval).getNotCoveredPositives().size(); - //int covNeg = ((EvaluatedDescriptionPosNeg)eval).getCoveredNegatives().size(); - //int negGes = model.getNegListModel().size(); - double notCov = notCovPos; - float shift = (float) (width*(notCov/posGes)); - shiftXAxis = Math.round(shift); - distortion = 0; - //if(shiftXAxis == 0) { - // distortion = Math.round((width*(covNeg/negGes))/4); - //} - + 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)); + if(add != 0) { + distortionOld = (int) Math.round(width*additional); + newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, width, height); + adjustment = (int) Math.round(newConcept.getCenterY()/4); + + } + } private void computeIndividualPoints() { - Set<Individual> posInd = ((EvaluatedDescriptionPosNeg)eval).getCoveredPositives(); + Set<Individual> posInd = ((EvaluatedDescriptionClass)eval).getCoveredInstances(); + int i = 0; double x = 20; double y = 20; + boolean flag = true; for(Individual ind : posInd) { + flag = true; if(i<maxNumberOfIndividualPoints) { - i++; - if(x >= oldConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + gap; - } + while(flag) { + if(x >= oldConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + gap; + } - if(y >= oldConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - } + if(y >= oldConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); + } - if(x >= newConcept.getMaxX()) { - x = (int) newConcept.getMinX(); - y = y + gap; - } + if(x >= newConcept.getMaxX()) { + x = (int) newConcept.getMinX(); + y = y + gap; + } - if(y >= newConcept.getMaxY()) { - y = (int) newConcept.getMinY(); - } + if(y >= newConcept.getMaxY()) { + y = (int) newConcept.getMinY(); + } - while(x < newConcept.getMaxX()) { + while(x < newConcept.getMaxX()) { - if(newConcept.contains(x, y) && oldConcept.contains(x, y)) { - posCovIndVector.add(new IndividualPoint("+",(int)x,(int)y,ind.toString())); - x = x + gap; - break; - } else { - x = x + gap; + if(newConcept.contains(x, y) && oldConcept.contains(x, y)) { + posCovIndVector.add(new IndividualPoint("+",(int)x,(int)y,ind.toString())); + i++; + flag = false; + x = x + gap; + break; + } else { + x = x + gap; + } } } } } - Set<Individual> posNotCovInd = ((EvaluatedDescriptionPosNeg)eval).getNotCoveredPositives(); + Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass)eval).getAdditionalInstances(); int j = 0; + x = 20; + y = 20; for(Individual ind : posNotCovInd) { + flag = true; if(j<maxNumberOfIndividualPoints) { - j++; - if(x >= oldConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + gap; - } + while(flag) { + if(x >= newConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + gap; + } - if(y >= oldConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - } + if(y >= newConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); + } - while(x < oldConcept.getMaxX()) { + while(x < newConcept.getMaxX()) { - if(oldConcept.contains(x, y)&&!newConcept.contains(x, y)) { - posNotCovIndVector.add(new IndividualPoint("-",(int)x,(int)y,ind.toString())); - x = x + gap; - break; - } else { - x = x + gap; + if(!oldConcept.contains(x, y) && newConcept.contains(x, y)) { + posNotCovIndVector.add(new IndividualPoint("-",(int)x,(int)y,ind.toString())); + j++; + flag = false; + x = x + gap; + break; + } else { + x = x + gap; + } } } } } - Set<Individual> negCovInd = ((EvaluatedDescriptionPosNeg)eval).getCoveredNegatives(); + Set<Individual> notCovInd = model.getReasoner().getIndividuals(model.getCurrentConcept()); + notCovInd.removeAll(posInd); int k = 0; - for(Individual ind : negCovInd) { + x = 20; + y = 20; + for(Individual ind : notCovInd) { + flag = true; if(k<maxNumberOfIndividualPoints) { - k++; - if(x >= newConcept.getMaxX()) { - x = (int) newConcept.getMinX(); - y = y + gap; - } + while(flag) { + if(x >= oldConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + gap; + } - if(y >= newConcept.getMaxY()) { - y = (int) newConcept.getMinY(); - } + if(y >= oldConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); + } - while(x < newConcept.getMaxX()) { - if(newConcept.contains(x, y) && !oldConcept.contains(x, y)) { - negCovIndVector.add(new IndividualPoint("o",(int)x,(int)y,ind.toString())); - x = x + gap; - break; - } else { - x = x + gap; + while(x < oldConcept.getMaxX()) { + + if(oldConcept.contains(x, y) && !newConcept.contains(x, y)) { + posNotCovIndVector.add(new IndividualPoint("-",(int)x,(int)y,ind.toString())); + k++; + flag = false; + x = x + gap; + break; + } else { + x = x + gap; + } } } } } points.addAll(posCovIndVector); points.addAll(posNotCovIndVector); - points.addAll(negCovIndVector); } public Vector<IndividualPoint> getIndividualVector() { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-02-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -31,9 +31,8 @@ import javax.swing.JTextArea; import javax.swing.WindowConstants; -import org.dllearner.algorithms.EvaluatedDescriptionPosNeg; +import org.dllearner.algorithms.EvaluatedDescriptionClass; import org.dllearner.core.EvaluatedDescription; -import org.dllearner.core.owl.Individual; @@ -279,11 +278,11 @@ } //sets the accuracy of the concept - double acc = ((EvaluatedDescriptionPosNeg)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(); + /*Set<Individual> indi = ((EvaluatedDescriptionPosNeg)eval).getCoveredPositives(); for(Individual ind : indi) { for(String ontology : ontologiesStrings) { if(ind.toString().contains(ontology)) { @@ -335,7 +334,7 @@ break; } } - } + }*/ } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-02-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -7,6 +7,7 @@ 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; @@ -38,7 +39,8 @@ } if(a.getActionCommand().equals(NEW_BUTTON_LABEL)) { - Set<Individual> posInd = ((EvaluatedDescriptionPosNeg)eval).getCoveredPositives(); + 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) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -95,7 +95,7 @@ private ObjectRestrictionCreatorPanel restrictionCreatorPanel; - // private OWLDescription initialDescription; + //private OWLDescription initialDescription; private Set<InputVerificationStatusChangedListener> listeners = new HashSet<InputVerificationStatusChangedListener>(); @@ -114,12 +114,12 @@ public OWLClassDescriptionEditorWithDLLearnerTab(OWLEditorKit editorKit, OWLDescription description, OWLFrame<OWLClass> frame, String label) { this.editorKit = editorKit; - // this.initialDescription = description; - //checker = new OWLDescriptionChecker(editorKit); + //this.initialDescription = description; + //checker = new OWLDescriptionChecker(editorKit.getModelManager()); editor = new ExpressionEditor<OWLDescription>(editorKit, editorKit.getModelManager().getOWLExpressionCheckerFactory().getOWLDescriptionChecker()); editor.setExpressionObject(description); - action = new ActionHandler(this.action, null, dllearner, null); + action = new ActionHandler(this.action, null, dllearner, label); tabbedPane = new JTabbedPane(); tabbedPane.setFocusable(false); editingComponent = new JPanel(new BorderLayout()); @@ -380,7 +380,7 @@ icon = new ImageIcon(iconUrl); URL toggledIconUrl = this.getClass().getResource("arrow2.gif"); toggledIcon = new ImageIcon(toggledIconUrl); - model = new DLLearnerModel(editorKit, current, label, this); + model = new DLLearnerModel(editorKit, label, this); sugPanel = new SuggestClassPanel(); action = new ActionHandler(this.action, model, this, label); adv = new JLabel("Advanced Settings"); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java 2009-02-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLEquivalentClassesAxiomFrameSection.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -26,11 +26,11 @@ import java.util.Set; import org.protege.editor.owl.OWLEditorKit; -import org.protege.editor.owl.ui.frame.AbstractOWLFrameSection; 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; @@ -52,145 +52,147 @@ * Date: 19-Jan-2007<br> * <br> */ -public class OWLEquivalentClassesAxiomFrameSection - extends - AbstractOWLFrameSection<OWLClass, OWLEquivalentClassesAxiom, OWLDescription> { +public class OWLEquivalentClassesAxiomFrameSection extends AbstractOWLClassAxiomFrameSection<OWLEquivalentClassesAxiom, OWLDescription> { - private static final String LABEL = "equivalent classes"; + private static final String LABEL = "equivalent classes"; - private Set<OWLClass> added; + private Set<OWLDescription> added = new HashSet<OWLDescription>(); - private boolean inferredEquivalentClasses = true; - private OWLClassDescriptionEditorWithDLLearnerTab dlLearner; + private boolean inferredEquivalentClasses = true; + + private OWLFrame<OWLClass> frame; - private OWLFrame<OWLClass> frame; - /** - * Constructor of the OWLEquivalentClassesAxiomFrameSection. - * @param editorKit OWLEditorKit - * @param frame OWLFrame - */ - public OWLEquivalentClassesAxiomFrameSection(OWLEditorKit editorKit, - OWLFrame<OWLClass> frame) { - super(editorKit, LABEL, frame); - added = new HashSet<OWLClass>(); - this.frame = frame; - } - @Override - protected void clear() { - added.clear(); - } + public OWLEquivalentClassesAxiomFrameSection(OWLEditorKit editorKit, OWLFrame<OWLClass> frame) { + super(editorKit, LABEL, "Equivalent class", frame); + this.frame = frame; + } - /** - * Refills the section with rows. This method will be called by the system - * and should be directly called. - * @param ontology OWLOntology - */ - @Override - protected void refill(OWLOntology ontology) { - for (OWLEquivalentClassesAxiom ax : ontology - .getEquivalentClassesAxioms(getRootObject())) { - addRow(new OWLEquivalentClassesAxiomFrameSectionRow( - getOWLEditorKit(), this, ontology, getRootObject(), ax)); - for (OWLDescription desc : ax.getDescriptions()) { - if (!desc.isAnonymous()) { - added.add(desc.asOWLClass()); - } - } - } - } - @Override - protected void refillInferred() { - if (!inferredEquivalentClasses) { - return; - } - try { - if (!getOWLModelManager().getReasoner().isSatisfiable( - getRootObject())) { - addRow(new OWLEquivalentClassesAxiomFrameSectionRow( - getOWLEditorKit(), this, null, getRootObject(), - getOWLDataFactory().getOWLEquivalentClassesAxiom( - CollectionFactory.createSet(getRootObject(), - getOWLModelManager() - .getOWLDataFactory() - .getOWLNothing())))); - return; - } - for (OWLClass cls : getOWLModelManager().getReasoner() - .getEquivalentClasses(getRootObject())) { - if (!added.contains(cls) && !cls.equals(getRootObject())) { - addRow(new OWLEquivalentClassesAxiomFrameSectionRow( - getOWLEditorKit(), this, null, getRootObject(), - getOWLDataFactory().getOWLEquivalentClassesAxiom( - CollectionFactory.createSet( - getRootObject(), cls)))); - } - } - } catch (UnsupportedReasonerOperationException e) { - inferredEquivalentClasses = false; - } catch (OWLReasonerException e) { - e.printStackTrace(); - } - } + protected void clear() { + added.clear(); + } - @Override - public void visit(OWLEquivalentClassesAxiom axiom) { - if (axiom.getDescriptions().contains(getRootObject())) { - reset(); - } - } - @Override - protected OWLEquivalentClassesAxiom createAxiom(OWLDescription object) { - return getOWLDataFactory().getOWLEquivalentClassesAxiom( - CollectionFactory.createSet(getRootObject(), object)); - } + protected void addAxiom(OWLEquivalentClassesAxiom ax, OWLOntology ontology) { + addRow(new OWLEquivalentClassesAxiomFrameSectionRow(getOWLEditorKit(), + this, + ontology, + getRootObject(), + ax)); + for (OWLDescription desc : ax.getDescriptions()) { + added.add(desc); + } + } - @Override - public OWLFrameSectionRowObjectEditor<OWLDescription> getObjectEditor() { - // Own OWLClassDescriptionEditor to integrate the dllearner in protege - // This is to suggest equivalent classes - dlLearner = new OWLClassDescriptionEditorWithDLLearnerTab(getOWLEditorKit(), - null, frame, LABEL); - return dlLearner; - } - @Override - public boolean canAcceptDrop(List<OWLObject> objects) { - for (OWLObject obj : objects) { - if (!(obj instanceof OWLDescription)) { - return false; - } - } - return true; - } + 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 : ont.getGeneralClassAxioms()){ + if (ax instanceof OWLEquivalentClassesAxiom && + ((OWLEquivalentClassesAxiom)ax).getDescriptions().contains(descr)){ + axioms.add((OWLEquivalentClassesAxiom)ax); + } + } + return axioms; + } + } - @Override - public boolean dropObjects(List<OWLObject> objects) { - List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); - for (OWLObject obj : objects) { - if (obj instanceof OWLDescription) { - OWLDescription desc = (OWLDescription) obj; - OWLAxiom ax = getOWLDataFactory().getOWLEquivalentClassesAxiom( - CollectionFactory.createSet(getRootObject(), desc)); - changes.add(new AddAxiom(getOWLModelManager() - .getActiveOntology(), ax)); - } else { - return false; - } - } - getOWLModelManager().applyChanges(changes); - return true; - } - /** - * Obtains a comparator which can be used to sort the rows in this section. - * - * @return A comparator if to sort the rows in this section, or - * <code>null</code> if the rows shouldn't be sorted. - */ - public Comparator<OWLFrameSectionRow<OWLClass, OWLEquivalentClassesAxiom, OWLDescription>> getRowComparator() { - return null; - } -} + protected void refillInferred() { + if (!inferredEquivalentClasses) { + return; + } + try { + if (!getOWLModelManager().getReasoner().isSatisfiable(getRootObject())) { + addRow(new OWLEquivalentClassesAxiomFrameSectionRow(getOWLEditorKit(), + this, + null, + getRootObject(), + getOWLDataFactory().getOWLEquivalentClassesAxiom( + CollectionFactory.createSet(getRootObject(), + getOWLModelManager().getOWLDataFactory().getOWLNothing())))); + } + else{ + for (OWLDescription cls : getOWLModelManager().getReasoner().getEquivalentClasses(getRootObject())) { + if (!added.contains(cls) && !cls.equals(getRootObject())) { + addRow(new OWLEquivalentClassesAxiomFrameSectionRow(getOWLEditorKit(), + this, + null, + getRootObject(), + getOWLDataFactory().getOWLEquivalentClassesAxiom( + CollectionFactory.createSet( + getRootObject(), + cls)))); + } + } + } + } + catch (UnsupportedReasonerOperationException e) { + inferredEquivalentClasses = false; + } + catch (OWLReasonerException e) { + e.printStackTrace(); + } + } + + + public void visit(OWLEquivalentClassesAxiom axiom) { + if (axiom.getDescriptions().contains(getRootObject())) { + reset(); + } + } + + + protected OWLEquivalentClassesAxiom createAxiom(OWLDescription object) { + return getOWLDataFactory().getOWLEquivalentClassesAxiom(CollectionFactory.createSet(getRootObject(), object)); + } + + + public OWLFrameSectionRowObjectEditor<OWLDescription> getObjectEditor() { + return new OWLClassDescriptionEditorWithDLLearnerTab(getOWLEditorKit(), null, frame, LABEL); + } + + + public boolean canAcceptDrop(List<OWLObject> objects) { + for (OWLObject obj : objects) { + if (!(obj instanceof OWLDescription)) { + return false; + } + } + return true; + } + + + public boolean dropObjects(List<OWLObject> objects) { + List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); + for (OWLObject obj : objects) { + if (obj instanceof OWLDescription) { + OWLDescription desc = (OWLDescription) obj; + OWLAxiom ax = getOWLDataFactory().getOWLEquivalentClassesAxiom(CollectionFactory.createSet(getRootObject(), + desc)); + changes.add(new AddAxiom(getOWLModelManager().getActiveOntology(), ax)); + } + else { + return false; + } + } + getOWLModelManager().applyChanges(changes); + return true; + } + + + /** + * Obtains a comparator which can be used to sort the rows + * in this section. + * @return A comparator if to sort the rows in this section, + * or <code>null</code> if the rows shouldn't be sorted. + */ + public Comparator<OWLFrameSectionRow<OWLDescription, OWLEquivalentClassesAxiom, OWLDescription>> getRowComparator() { + return null; + } +} \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java 2009-02-23 08:13:57 UTC (rev 1622) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java 2009-02-23 16:07:10 UTC (rev 1623) @@ -26,8 +26,11 @@ import java.util.Set; import org.protege.editor.owl.OWLEditorKit; -import org.protege.editor.owl.ui.f... [truncated message content] |
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] |
From: <hee...@us...> - 2009-02-26 19:03:43
|
Revision: 1636 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1636&view=rev Author: heeroyuy Date: 2009-02-26 19:03:36 +0000 (Thu, 26 Feb 2009) Log Message: ----------- -some bugfixes -simple test class for the new plugin version -removed duplicated protege 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/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 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 Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -65,7 +65,6 @@ // This is the Tread of the DL-Learner private EvaluatedDescription evaluatedDescription; // This is the view of the DL-Learner tab. - //private final OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; private Timer timer; private LearningAlgorithm la; private SuggestionRetriever retriever; @@ -85,14 +84,6 @@ * id if it is a subclass or an equivalent class * */ - 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; Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ButtonList.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -1,77 +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 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.OWLFrameSectionRowObjectEditor; -import org.protege.editor.owl.ui.frame.OWLSubClassAxiomFrameSection; -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. - * This is necessary to implement the dllearner plugin in the - * OWLClassDescriptionEditor. - * - * @author Christian Koetteritzsch - * - */ -public class ButtonList extends AbstractOWLFrame<OWLClass> { - private final OWLEquivalentClassesAxiomFrameSection equi; - private final OWLSubClassAxiomFrameSection sub; - private final DLLearnerView view; - /** - * Constructor of the Buttonlist. - * - * @param editorKit EditorKit from Protege - */ - public ButtonList(OWLEditorKit editorKit) { - - 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); - //equi.getEditor().getEditorComponent().validate(); - sub = new OWLSubClassAxiomFrameSection(editorKit, this); - OWLFrameSectionRowObjectEditor<OWLDescription> editor = sub.getObjectEditor(); - System.out.println("test"); - OWLClassDescriptionEditor edi = (OWLClassDescriptionEditor)editor; - edi.addPanel(view); - // own OWLEquivalentClassesAxiomFrameSection to add the dllearner plugin - // to the - // OWLClassDescritpionEditor - addSection(equi); - // own OWLEquivalentClassesAxiomFrameSection to add the dllearner plugin - // to the - // OWLClassDescritpionEditor - addSection(sub); - addSection(new InheritedAnonymousClassesFrameSection(editorKit, this)); - addSection(new OWLClassAssertionAxiomIndividualSection(editorKit, this)); - addSection(new OWLDisjointClassesAxiomFrameSection(editorKit, this)); - } -} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -87,7 +87,6 @@ // The View of the DL-Learner Plugin - //private final OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; // The Learning problem that is used to learn new concepts @@ -176,24 +175,6 @@ * @param view * current view of the DL-Learner tab */ - 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; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -45,7 +45,7 @@ * @author Christian Koetteritzsch * */ -public class DLLearnerView extends JPanel implements OWLDescriptionEditor{ +public class DLLearnerView implements OWLDescriptionEditor{ private static final long serialVersionUID = 624829578325729385L; @@ -212,7 +212,7 @@ learner.add(errorMessage); learner.add(posPanel); detail = new MoreDetailForSuggestedConceptsPanel(model); - add(learner); + //add(learner); } /** @@ -410,5 +410,15 @@ // TODO Auto-generated method stub } + @Override + public void setup(String arg0, String arg1, OWLEditorKit arg2) { + // TODO Auto-generated method stub + + } + @Override + public void initialise() throws Exception { + // TODO Auto-generated method stub + + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -159,6 +159,7 @@ if(y >= newConcept.getMaxY()) { y = (int) newConcept.getMinY(); + break; } while(x < newConcept.getMaxX()) { @@ -192,6 +193,7 @@ if(y >= newConcept.getMaxY()) { y = (int) oldConcept.getMinY(); + break; } while(x < newConcept.getMaxX()) { @@ -226,6 +228,7 @@ if(y >= oldConcept.getMaxY()) { y = (int) oldConcept.getMinY(); + break; } while(x < oldConcept.getMaxX()) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 2009-02-26 19:03:36 UTC (rev 1636) @@ -1,10 +1,9 @@ <?xml version="1.0" ?> <plugin> - <extension id="org.dllearner.tools.protege.ProtegePlugin" - point="org.protege.editor.core.application.ViewComponent"> - <label value="Class Descriptions (including DL-Learner plugin)"/> - <class value="org.dllearner.tools.protege.ProtegePlugin"/> - <headerColor value="@org.protege.classcolor"/> - <category value="@org.protege.classcategory"/> - </extension> + <extension id="org.dllearner.tools.protege.ProtegePlugin" + point="org.protege.editor.owl.ui.editor"> + <label value="DL-Learner"/> + <class value="org.dllearner.tools.protege.ProtegePlugin"/> + </extension> + </plugin> \ No newline at end of file Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -1,842 +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.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.swing.BorderFactory; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSpinner; -import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.JToggleButton; -import javax.swing.SpinnerNumberModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -import org.protege.editor.core.ui.util.ComponentFactory; -import org.protege.editor.core.ui.util.InputVerificationStatusChangedListener; -import org.protege.editor.core.ui.util.VerifiedInputEditor; -import org.protege.editor.owl.OWLEditorKit; -import org.protege.editor.owl.model.cache.OWLExpressionUserCache; -import org.protege.editor.owl.ui.clsdescriptioneditor.ExpressionEditor; -import org.protege.editor.owl.ui.frame.AbstractOWLFrameSectionRowObjectEditor; -import org.protege.editor.owl.ui.frame.OWLFrame; -import org.protege.editor.owl.ui.selector.OWLClassSelectorPanel; -import org.protege.editor.owl.ui.selector.OWLObjectPropertySelectorPanel; -import org.semanticweb.owl.model.OWLClass; -import org.semanticweb.owl.model.OWLDataFactory; -import org.semanticweb.owl.model.OWLDescription; -import org.semanticweb.owl.model.OWLException; -import org.semanticweb.owl.model.OWLObjectProperty; - -/** - * Added a new Tab for the DL-Learner GUI. - * - * @author Matthew Horridge - * @author Christian Koetteritzsch - */ -public class OWLClassDescriptionEditorWithDLLearnerTab extends - AbstractOWLFrameSectionRowObjectEditor<OWLDescription> implements - VerifiedInputEditor { - - private static final String CLASS_EXPRESSION_EDITOR_LABEL = "Class expression editor"; - private static final String CLASS_TREE_LABEL = "Class tree"; - private static final String RESTRICTION_CREATOR_LABEL = "Restriction creator"; - private static final String SUGGEST_EQUIVALENT_CLASS_LABEL = "Suggest equivalent class"; - private static final String SUGGEST_SUBCLASS_LABEL = "Suggest super class"; - - private final OWLEditorKit editorKit; - - private final ExpressionEditor<OWLDescription> editor; - - private final JComponent editingComponent; - - private final JTabbedPane tabbedPane; - - private DLLearnerView dllearner; - private final ActionHandler action; - - private OWLClassSelectorPanel classSelectorPanel; - - private ObjectRestrictionCreatorPanel restrictionCreatorPanel; - - //private final OWLDescription initialDescription; - - private final Set<InputVerificationStatusChangedListener> listeners = new HashSet<InputVerificationStatusChangedListener>(); - - private final ChangeListener changeListener = new ChangeListener() { - public void stateChanged(ChangeEvent changeEvent) { - handleVerifyEditorContents(); - } - }; - /** - * Konstruktor of the Class Description Editor with integrated DL-Learner Tab. - * @param editorKit OWLEditorKit - * @param description OWLDescription - * @param frame OWLFrame - * @param label String - */ - public OWLClassDescriptionEditorWithDLLearnerTab(OWLEditorKit editorKit, - OWLDescription description, OWLFrame<OWLClass> frame, String label) { - this.editorKit = editorKit; - //this.initialDescription = description; - //checker = new OWLDescriptionChecker(editorKit.getModelManager()); - editor = new ExpressionEditor<OWLDescription>(editorKit, editorKit.getModelManager().getOWLExpressionCheckerFactory().getOWLDescriptionChecker()); - editor.setExpressionObject(description); - - action = new ActionHandler(this.action, null, dllearner, label); - tabbedPane = new JTabbedPane(); - tabbedPane.setFocusable(false); - editingComponent = new JPanel(new BorderLayout()); - editingComponent.add(tabbedPane); - editingComponent.setPreferredSize(new Dimension(600, 520)); - if (label.equals("equivalent classes")) { - dllearner = new DLLearnerView(frame, SUGGEST_EQUIVALENT_CLASS_LABEL, this); - tabbedPane.add(SUGGEST_EQUIVALENT_CLASS_LABEL, dllearner); - } - if (label.equals("super classes")) { - dllearner = new DLLearnerView(frame, SUGGEST_SUBCLASS_LABEL, this); - tabbedPane.add(SUGGEST_SUBCLASS_LABEL, dllearner); - } - - // - tabbedPane.add(CLASS_EXPRESSION_EDITOR_LABEL, new JScrollPane(editor)); - if (description == null || !description.isAnonymous()) { - classSelectorPanel = new OWLClassSelectorPanel(editorKit); - tabbedPane.add(CLASS_TREE_LABEL, classSelectorPanel); - if (description != null) { - classSelectorPanel.setSelection(description.asOWLClass()); - } - classSelectorPanel.addSelectionListener(changeListener); - - restrictionCreatorPanel = new ObjectRestrictionCreatorPanel(); - tabbedPane.add(RESTRICTION_CREATOR_LABEL, restrictionCreatorPanel); - restrictionCreatorPanel.classSelectorPanel - .addSelectionListener(changeListener); - restrictionCreatorPanel.objectPropertySelectorPanel - .addSelectionListener(changeListener); - - tabbedPane.addChangeListener(changeListener); - } - - } - - private void handleVerifyEditorContents() { - for (InputVerificationStatusChangedListener l : listeners) { - l.verifiedStatusChanged(isValidated()); - } - } - - private boolean isValidated() { - boolean validated = false; - final String selectedTabTitle = tabbedPane.getTitleAt(tabbedPane - .getSelectedIndex()); - if (selectedTabTitle.equals(CLASS_EXPRESSION_EDITOR_LABEL)) { - validated = editor.isWellFormed(); - } else if (selectedTabTitle.equals(CLASS_TREE_LABEL)) { - validated = classSelectorPanel.getSelectedObject() != null; - } else if (selectedTabTitle.equals(RESTRICTION_CREATOR_LABEL)) { - validated = restrictionCreatorPanel.classSelectorPanel - .getSelectedObject() != null - && restrictionCreatorPanel.objectPropertySelectorPanel - .getSelectedObject() != null; - } else if (selectedTabTitle.equals(SUGGEST_EQUIVALENT_CLASS_LABEL)) { - validated = true; - } else if (selectedTabTitle.equals(SUGGEST_SUBCLASS_LABEL)) { - validated = true; - } - return validated; - } - /** - * Returns Editor Component. - * @return JComponent - */ - public JComponent getInlineEditorComponent() { - // Same as general editor component - return editingComponent; - } - - /** - * Gets a component that will be used to edit the specified object. - * - * @return The component that will be used to edit the object - */ - public JComponent getEditorComponent() { - return editingComponent; - } - /** - * Removes everything after closing the Class Description Editor. - */ - public void clear() { - dllearner.unsetEverything(); - dllearner.makeView(); - - handleVerifyEditorContents(); - // initialDescription = null; - editor.setText(""); - } - /** - * returns the edited Components. - * @return Set of OWLDescriptions - */ - @Override - public Set<OWLDescription> getEditedObjects() { - if (tabbedPane.getSelectedComponent() == classSelectorPanel) { - return new HashSet<OWLDescription>(classSelectorPanel - .getSelectedObjects()); - } else if (tabbedPane.getSelectedComponent() == restrictionCreatorPanel) { - return restrictionCreatorPanel.createRestrictions(); - } else if (tabbedPane.getSelectedComponent() == dllearner) { - return dllearner.getSollutions(); - } - return super.getEditedObjects(); - } - - /** - * Gets the object that has been edited. - * - * @return The edited object - */ - public OWLDescription getEditedObject() { - try { - - if (editor.isWellFormed()) { - OWLDescription owlDescription = editor.createObject(); - OWLExpressionUserCache.getInstance(editorKit.getModelManager()).add(owlDescription, editor.getText()); - return owlDescription; - } - if (!dllearner.getSollutions().isEmpty()) { - return dllearner.getSollution(); - } else { - return null; - } - } catch (OWLException e) { - return null; - } - - } - /** - * Removes everything after protege is closed. - */ - public void dispose() { - if (classSelectorPanel != null) { - classSelectorPanel.dispose(); - } - if (restrictionCreatorPanel != null) { - restrictionCreatorPanel.dispose(); - } - if (dllearner != null) { - dllearner.dispose(); - } - } - - private OWLDataFactory getDataFactory() { - return editorKit.getModelManager().getOWLDataFactory(); - } - /** - * Adds a Status Changed Listener to all components of the - * class description editor. - * @param listener InputVerificationStatusChangedListener - */ - public void addStatusChangedListener( - InputVerificationStatusChangedListener listener) { - listeners.add(listener); - editor.addStatusChangedListener(listener); - listener.verifiedStatusChanged(isValidated()); - } - /** - * Removes the Status Changed Listener from all components of the - * class description editor. - * @param listener InputVerificationStatusChangedListener - */ - public void removeStatusChangedListener( - InputVerificationStatusChangedListener listener) { - listeners.remove(listener); - editor.removeStatusChangedListener(listener); - } - - /** - * 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 { - - private static final long serialVersionUID = 624829578325729385L; - private final OWLClassDescriptionEditorWithDLLearnerTab mainWindow; - // this is the Component which shows the view of the dllearner - - private final JComponent learner; - - // Accept button to add the learned concept to the owl - - private final JButton accept; - - // Runbutton to start the learning algorithm - - private final JButton run; - - // This is the label for the advanced button. - - private final JLabel adv; - - // This is the color for the error message. It is red. - - private final Color colorRed = Color.red; - - // This is the text area for the error message when an error occurred - - private final JTextArea errorMessage; - - // Advanced Button to activate/deactivate the example select panel - - private final JToggleButton advanced; - - // Action Handler that manages the Button actions - - private final ActionHandler action; - - // This is the model of the dllearner plugin which includes all data - - private final DLLearnerModel model; - - // Panel for the suggested concepts - - private SuggestClassPanel sugPanel; - - // Selection panel for the positive and negative examples - - private final PosAndNegSelectPanel posPanel; - - // Picture for the advanced button when it is not toggled - - private final 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 boolean isInconsistent; - // This is the Panel for more details of the suggested concept - private MoreDetailForSuggestedConceptsPanel detail; - private final OWLFrame<OWLClass> frame; - private ReadingOntologyThread readThread; - - /** - * The constructor for the DL-Learner tab in the class description - * editor. - * - * @param current OWLFrame - * @param label String - * @param dlLearner OWLClassDescriptionEditorWithDLLearnerTab - */ - public DLLearnerView(OWLFrame<OWLClass> current, String label, OWLClassDescriptionEditorWithDLLearnerTab dlLearner) { - classSelectorPanel = new OWLClassSelectorPanel(editorKit); - mainWindow = dlLearner; - frame = current; - wikiPane = new JLabel("<html>See <a href=\"http://dl-learner.org/wiki/ProtegePlugin\">http://dl-learner.org/wiki/ProtegePlugin</a> for an introduction.</html>"); - classSelectorPanel.firePropertyChange("test", false, true); - 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); - sugPanel = new SuggestClassPanel(); - 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"); - addButtonPanel = new JPanel(new BorderLayout()); - sugPanel.addSuggestPanelMouseListener(action); - errorMessage = new JTextArea(); - errorMessage.setEditable(false); - hint = new JTextArea(); - hint.setEditable(false); - hint.setText("To get suggestions for class descriptions, please click the button above."); - learner = new JPanel(); - advanced.setSize(20, 20); - learner.setLayout(null); - learner.setPreferredSize(new Dimension(600, 520)); - accept.setPreferredSize(new Dimension(290, 50)); - advanced.setName("Advanced"); - posPanel = new PosAndNegSelectPanel(model, action); - 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; - } - - /** - * 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() { - run.setEnabled(false); - model.clearVector(); - hint.setText("To get suggestions for class descriptions, please click the button above."); - isInconsistent = false; - readThread = new ReadingOntologyThread(editorKit, frame, this, model); - readThread.start(); - //TODO: runbutton wird auf enable gesetzt obwohl keine instanzdaten vorhanden sind. - - hint.setVisible(true); - advanced.setIcon(icon); - accept.setEnabled(false); - action.resetToggled(); - addButtonPanel.add("North", accept); - sugPanel.setSuggestList(model.getSuggestList()); - sugPanel = sugPanel.updateSuggestClassList(); - advanced.setSelected(false); - sugPanel.setBounds(10, 35, 490, 110); - adv.setBounds(40, 200, 200, 20); - wikiPane.setBounds(220, 0, 350, 30); - addButtonPanel.setBounds(510, 40, 80, 110); - run.setBounds(10, 0, 200, 30); - advanced.setBounds(10, 200, 20, 20); - sugPanel.setVisible(true); - posPanel.setVisible(false); - posPanel.setBounds(10, 230, 490, 250); - accept.setBounds(510, 40, 80, 110); - hint.setBounds(10, 150, 490, 35); - errorMessage.setBounds(10, 180, 490, 20); - learner.add(run); - learner.add(wikiPane); - learner.add(adv); - learner.add(advanced); - learner.add(sugPanel); - learner.add(addButtonPanel); - learner.add(hint); - learner.add(errorMessage); - learner.add(posPanel); - detail = new MoreDetailForSuggestedConceptsPanel(model); - add(learner); - - } - /** - * This method sets the right icon for the advanced Panel. - * @param toggled boolean - */ - public void setIconToggled(boolean toggled) { - if (toggled) { - advanced.setIcon(toggledIcon); - } - if (!toggled) { - advanced.setIcon(icon); - } - } - - /** - * This Method changes the hint message. - * @param message String hintmessage - */ - public void setHintMessage(String message) { - hint.setText(message); - } - - /** - * This method returns the hint panel. - * @return hint panel - */ - public JTextArea getHintPanel() { - return hint; - } - - /** - * Sets the panel to select/deselect the examples visible/invisible. - * @param visible boolean - */ - public void setExamplePanelVisible(boolean visible) { - posPanel.setVisible(visible); - } - - - /** - * 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) - */ - public Set<OWLDescription> getSollutions() { - - return model.getNewOWLDescription(); - } - - /** - * Returns the last added description. - * @return OWLDescription - */ - public OWLDescription getSollution() { - return model.getSolution(); - } - - /** - * Destroys everything in the view after the plugin is closed. - */ - public void unsetEverything() { - run.setEnabled(true); - model.unsetNewConcepts(); - action.destroyDLLearnerThread(); - errorMessage.setText(""); - //posPanel.unsetPosAndNegPanel(); - learner.removeAll(); - } - - /** - * Renders the error message when an error occured. - * @param s String - */ - public void renderErrorMessage(String s) { - errorMessage.setForeground(colorRed); - errorMessage.setText(s); - } - /** - * This Method returns the panel for more details for the chosen concept. - * @return MoreDetailForSuggestedConceptsPanel - */ - public MoreDetailForSuggestedConceptsPanel getMoreDetailForSuggestedConceptsPanel() { - return detail; - } - - /** - * This Method returns the run button. - * @return JButton - */ - public JButton getRunButton() { - return run; - } - - /** - * This method sets if ontology is inconsistent or not. - * @param isIncon boolean if ontology is consisten - */ - public void setIsInconsistent(boolean isIncon) { - this.isInconsistent = isIncon; - } - /** - * Destroys the view after the plugin is closed. - */ - public void dispose() { - run.removeActionListener(action); - accept.removeActionListener(action); - advanced.removeActionListener(action); - //posPanel.removeListeners(action); - //posPanel.removeHelpButtonListener(action); - } - - /** - * Adds Actionlistener to the run button. - * @param a ActionListener - */ - public void addRunButtonListener(ActionListener a) { - run.addActionListener(a); - } - - /** - * Adds Actionlistener to the add button. - * @param a ActionListener - */ - public void addAcceptButtonListener(ActionListener a) { - accept.addActionListener(a); - } - - /** - * Adds Actionlistener to the advanced button. - * @param a ActionListener - */ - public void addAdvancedButtonListener(ActionListener a) { - advanced.addActionListener(a); - } - - /** - * This method sets the run button enable after learning. - */ - public void algorithmTerminated() { - String error = "learning succesful"; - String message = ""; - if(isInconsistent) { - message = "Class descriptions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; - } else { - message = "To view details about why a class description was suggested, please doubleclick on it."; - } - run.setEnabled(true); - // start the algorithm and print the best concept found - renderErrorMessage(error); - setHintMessage(message); - } - - } - /** - * This is the class for the object restriktion creator panel. - * - * - */ - private class ObjectRestrictionCreatorPanel extends JPanel { - - - private static final long serialVersionUID = 1695484991927845068L; - - private final OWLObjectPropertySelectorPanel objectPropertySelectorPanel; - - private final OWLClassSelectorPanel classSelectorPanel; - - private final JSpinner cardinalitySpinner; - - private final JComboBox typeCombo; - - public ObjectRestrictionCreatorPanel() { - objectPropertySelectorPanel = new OWLObjectPropertySelectorPanel( - editorKit); - objectPropertySelectorPanel.setBorder(ComponentFactory - .createTitledBorder("Restricted properties")); - cardinalitySpinner = new JSpinner(new SpinnerNumberModel(1, 0, - Integer.MAX_VALUE, 1)); - JComponent cardinalitySpinnerEditor = cardinalitySpinner - .getEditor(); - Dimension prefSize = cardinalitySpinnerEditor.getPreferredSize(); - cardinalitySpinnerEditor.setPreferredSize(new Dimension(50, - prefSize.height)); - classSelectorPanel = new OWLClassSelectorPanel(editorKit); - classSelectorPanel.setBorder(ComponentFactory - .createTitledBorder("Restriction fillers")); - setLayout(new BorderLayout()); - JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - false); - splitPane.setResizeWeight(0.5); - splitPane.setLeftComponent(objectPropertySelectorPanel); - splitPane.setRightComponent(classSelectorPanel); - add(splitPane); - splitPane.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); - List<RestrictionCreator> types = new ArrayList<RestrictionCreator>(); - types.add(new RestrictionCreator("Some (existential)") { - @Override - public void createRestrictions( - Set<OWLObjectProperty> properties, - Set<OWLDescription> fillers, Set<OWLDescription> result) { - for (OWLObjectProperty prop : properties) { - for (OWLDescription filler : fillers) { - result.add(getDataFactory() - .getOWLObjectSomeRestriction(prop, filler)); - } - } - } - }); - types.add(new RestrictionCreator("Only (universal)") { - @Override - public void createRestrictions( - Set<OWLObjectProperty> properties, - Set<OWLDescription> fillers, Set<OWLDescription> result) { - for (OWLObjectProperty prop : properties) { - if (fillers.isEmpty()) { - return; - } - OWLDescription filler; - if (fillers.size() > 1) { - filler = getDataFactory().getOWLObjectUnionOf( - fillers); - } else { - filler = fillers.iterator().next(); - } - result.add(getDataFactory().getOWLObjectAllRestriction( - prop, filler)); - } - } - }); - types.add(new CardinalityRestrictionCreator( - "Min (min cardinality)", cardinalitySpinner) { - @Override - public OWLDescription createRestriction(OWLObjectProperty prop, - OWLDescription filler, int card) { - return getDataFactory() - .getOWLObjectMinCardinalityRestriction(prop, card, - filler); - } - }); - types.add(new CardinalityRestrictionCreator( - "Exactly (exact cardinality)", cardinalitySpinner) { - @Override - public OWLDescription createRestriction(OWLObjectProperty prop, - OWLDescription filler, int card) { - return getDataFactory() - .getOWLObjectExactCardinalityRestriction(prop, - card, filler); - } - }); - types.add(new CardinalityRestrictionCreator( - "Max (max cardinality)", cardinalitySpinner) { - @Override - public OWLDescription createRestriction(OWLObjectProperty prop, - OWLDescription filler, int card) { - return getDataFactory() - .getOWLObjectMaxCardinalityRestriction(prop, card, - filler); - } - }); - typeCombo = new JComboBox(types.toArray()); - - final JPanel typePanel = new JPanel(); - typePanel.setBorder(ComponentFactory - .createTitledBorder("Restriction type")); - add(typePanel, BorderLayout.SOUTH); - typePanel.add(typeCombo); - typeCombo.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - cardinalitySpinner - .setEnabled(typeCombo.getSelectedItem() instanceof CardinalityRestrictionCreator); - } - }); - JPanel spinnerHolder = new JPanel(new BorderLayout(4, 4)); - spinnerHolder.setBorder(BorderFactory - .createEmptyBorder(0, 10, 0, 0)); - spinnerHolder.add(new JLabel("Cardinality"), BorderLayout.WEST); - spinnerHolder.add(cardinalitySpinner, BorderLayout.EAST); - JPanel spinnerAlignmentPanel = new JPanel(new BorderLayout()); - spinnerAlignmentPanel.add(spinnerHolder, BorderLayout.WEST); - typePanel.add(spinnerAlignmentPanel); - cardinalitySpinner - .setEnabled(typeCombo.getSelectedItem() instanceof CardinalityRestrictionCreator); - } - - public Set<OWLDescription> createRestrictions() { - Set<OWLDescription> result = new HashSet<OWLDescription>(); - RestrictionCreator creator = (RestrictionCreator) typeCombo - .getSelectedItem(); - if (creator == null) { - return Collections.emptySet(); - } - creator.createRestrictions(objectPropertySelectorPanel - .getSelectedObjects(), new HashSet<OWLDescription>( - classSelectorPanel.getSelectedObjects()), result); - return result; - } - - public void dispose() { - objectPropertySelectorPanel.dispose(); - classSelectorPanel.dispose(); - } - } - /** - * This is the abstract class of the restriction creator. - * - * - */ - private abstract class RestrictionCreator { - - private final String name; - - protected RestrictionCreator(String name) { - this.name = name; - } - - @Override - public String toString() { - return name; - } - - abstract void createRestrictions(Set<OWLObjectProperty> properties, - Set<OWLDescription> fillers, Set<OWLDescription> result); - } - /** - * This is the abstract class for the cardinality restriction creator. - * - * - */ - private abstract class CardinalityRestrictionCreator extends - RestrictionCreator { - - private final JSpinner cardinalitySpinner; - - protected CardinalityRestrictionCreator(String name, - JSpinner cardinalitySpinner) { - super(name); - this.cardinalitySpinner = cardinalitySpinner; - } - - @Override - public void createRestrictions(Set<OWLObjectProperty> properties, - Set<OWLDescription> fillers, Set<OWLDescription> result) { - for (OWLObjectProperty prop : properties) { - for (OWLDescription desc : fillers) { - result.add(createRestriction(prop, desc, - (Integer) cardinalitySpinner.getValue())); - } - } - } - - public abstract OWLDescription createRestriction( - OWLObjectProperty prop, OWLDescription filler, int card); - } - -} Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLSubClassAxiomFrameSection.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -1,219 +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.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.OWLFrame; -import org.protege.editor.owl.ui.frame.OWLFrameSectionRow; -import org.protege.editor.owl.ui.frame.OWLFrameSectionRowObjectEditor; -import org.protege.editor.owl.ui.frame.OWLSubClassAxiomFrameSectionRow; -import org.protege.editor.owl.ui.frame.cls.AbstractOWLClassAxiomFrameSection; -import org.semanticweb.owl.inference.OWLReasonerException; -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.OWLObject; -import org.semanticweb.owl.model.OWLObjectProperty; -import org.semanticweb.owl.model.OWLOntology; -import org.semanticweb.owl.model.OWLOntologyChange; -import org.semanticweb.owl.model.OWLSubClassAxiom; - -/** - * 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 OWLSubClassAxiomFrameSection extends AbstractOWLClassAxiomFrameSection<OWLSubClassAxiom, OWLDescription> { - - private static final String LABEL = "super classes"; - - private final Set<OWLDescription> added = new HashSet<OWLDescription>(); - private final OWLFrame<OWLClass> frame; - - /** - * Constructor. - * @param editorKit editorKit - * @param frame OWLFrame - */ - public OWLSubClassAxiomFrameSection(OWLEditorKit editorKit, OWLFrame<OWLClass> frame) { - super(editorKit, LABEL, "Superclass", frame); - this.frame = frame; - } - - - @Override - protected void clear() { - added.clear(); - } - - - @Override - protected void addAxiom(OWLSubClassAxiom ax, OWLOntology ont) { - addRow(new OWLSubClassAxiomFrameSectionRow(getOWLEditorKit(), this, ont, getRootObject(), ax)); - added.add(ax.getSuperClass()); - } - - - @Override - protected Set<OWLSubClassAxiom> getClassAxioms(OWLDescription descr, OWLOntology ont) { - if (!descr.isAnonymous()){ - return ont.getSubClassAxiomsForLHS(descr.asOWLClass()); - }else{ - Set<OWLSubClassAxiom> axioms = new HashSet<OWLSubClassAxiom>(); - for (OWLAxiom ax : ont.getGeneralClassAxioms()){ - if (ax instanceof OWLSubClassAxiom && ((OWLSubClassAxiom) ax).getSubClass().equals(descr)){ - axioms.add((OWLSubClassAxiom) ax); - } - } - return axioms; - } - } - - - @Override - protected void refillInferred() { - try { - if (getOWLModelManager().getReasoner().isSatisfiable(getRootObject())) { - - for (Set<OWLClass> descs : getOWLModelManager().getReasoner().getSuperClasses(getRootObject())) { - for (OWLDescription desc : descs) { - if (!added.contains(desc) && !getRootObject().equals(desc)) { - addRow(new OWLSubClassAxiomFrameSectionRow(getOWLEditorKit(), - this, - null, - getRootObject(), - getOWLModelManager().getOWLDataFactory().getOWLSubClassAxiom( - getRootObject(), - desc))); - added.add(desc); - } - } - } - } - }catch (OWLReasonerException e) { - throw new RuntimeException(e); - } - } - - - @Override - protected OWLSubClassAxiom createAxiom(OWLDescription object) { - return getOWLDataFactory().getOWLSubClassAxiom(getRootObject(), object); - } - - - @Override - public OWLFrameSectionRowObjectEditor<OWLDescription> getObjectEditor() { - return new OWLClassDescriptionEditorWithDLLearnerTab(getOWLEditorKit(), null, frame, LABEL); - } - - - @Override - public boolean canAcceptDrop(List<OWLObject> objects) { - for (OWLObject obj : objects) { - if (!(obj instanceof OWLDescription)) { - return false; - } - } - return true; - } - - - private OWLObjectProperty prop; - - - @Override - public boolean dropObjects(List<OWLObject> objects) { - List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); - for (OWLObject obj : objects) { - if (obj instanceof OWLDescription) { - OWLDescription desc; - if (prop != null) { - desc = getOWLDataFactory().getOWLObjectSomeRestriction(prop, (OWLDescription) obj); - }else { - desc = (OWLDescription) obj; - } - OWLAxiom ax = getOWLDataFactory().getOWLSubClassAxiom(getRootObject(), desc); - changes.add(new AddAxiom(getOWLModelManager().getActiveOntology(), ax)); - } else if (obj instanceof OWLObjectProperty) { - // Prime - prop = (OWLObjectProperty) obj; - }else { - return false; - } - } - getOWLModelManager().applyChanges(changes); - return true; - } - - - @Override - public void visit(OWLSubClassAxiom axiom) { - if (axiom.getSubClass().equals(getRootObject())) { - reset(); - } - } - - - /** - * Obtains a comparator which can be used to sort the rows - * in this section. - * @return A comparator if to sort the rows in this section, - * or <code>null</code> if the rows shouldn't be sorted. - */ - public Comparator<OWLFrameSectionRow<OWLDescription, OWLSubClassAxiom, OWLDescription>> getRowComparator() { - return new Comparator<OWLFrameSectionRow<OWLDescription, OWLSubClassAxiom, OWLDescription>>() { - - - public int compare(OWLFrameSectionRow<OWLDescription, OWLSubClassAxiom, OWLDescription> o1, - OWLFrameSectionRow<OWLDescription, OWLSubClassAxiom, OWLDescription> o2) { - if (o1.isInferred()) { - if (!o2.isInferred()) { - return 1; - } - }else { - if (o2.isInferred()) { - return -1; - } - } -// int val = o1.getAxiom().getSuperClass().compareTo(o2.getAxiom().getSuperClass()); - int val = getOWLModelManager().getOWLObjectComparator().compare(o1.getAxiom(), o2.getAxiom()); - - if(val == 0) { - return o1.getOntology().getURI().compareTo(o2.getOntology().getURI()); - }else { - return val; - } - - } - }; - } -} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -48,7 +48,7 @@ * @param p * PosAndNegSelectPanel */ -public PosAndNegSelectPanelHandler(DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView v, PosAndNegSelectPanel p) { +public PosAndNegSelectPanelHandler(DLLearnerModel m, DLLearnerView v, PosAndNegSelectPanel p) { //model = m; //panel = p; //view = v; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -19,63 +19,90 @@ */ package org.dllearner.tools.protege; -import java.awt.BorderLayout; +import java.util.Set; -import javax.swing.JScrollPane; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; -import org.protege.editor.owl.ui.framelist.OWLFrameList2; -import org.protege.editor.owl.ui.view.AbstractOWLClassViewComponent; -import org.semanticweb.owl.model.OWLClass; +import org.protege.editor.core.ui.util.InputVerificationStatusChangedListener; +import org.protege.editor.owl.ui.editor.AbstractOWLDescriptionEditor; +import org.semanticweb.owl.model.OWLDescription; /** - * This is the class that must be implemented to get the plugin integrated - * in protege. + * This is the class that must be implemented to get the plugin integrated in + * protege. + * * @author Christian Koetteritzsch - * + * */ -public class ProtegePlugin extends AbstractOWLClassViewComponent { -private static final long serialVersionUID = 728362819273927L; -/** - * List of the lists for equivalent classes and so on. - */ -private OWLFrameList2<OWLClass> list; +public class ProtegePlugin extends AbstractOWLDescriptionEditor { + private static final long serialVersionUID = 728362819273927L; + private JPanel test; + private SimpleViewTest tes; + + @Override + public JComponent getComponent() { + System.out.println("1"); + // TODO Auto-generated method stub + return test; + } @Override - /** - * This method initializes the view of the plugin. - */ - public void initialiseClassView() throws Exception { - list = new OWLFrameList2<OWLClass>(getOWLEditorKit(), new ButtonList(getOWLEditorKit())); - setLayout(new BorderLayout()); - JScrollPane dlLearner = new JScrollPane(list); - add(dlLearner); - // add file logger (comment out if not needed) - //boolean useAdditionalLogger = true; - //if(useAdditionalLogger) { - // Layout layout = new HTMLLayout(); - // String fileName = "logs/dllearner_log.html"; - // FileAppender fileAppender = new FileAppender(layout, fileName, true); - // only add log statements in protege package to log file - // Logger protegeLogger = Logger.getLogger("org.dllearner.tools.protege"); - // protegeLogger.addAppender(fileAppender); - // protegeLogger.setLevel(Level.DEBUG); - //} + public Set<OWLDescription> getDescriptions() { + System.out.println("2"); + // TODO Auto-generated method stub + return null; } - + @Override - /** - * updates the view if something changes - */ - protected OWLClass updateView(OWLClass selectedClass) { - list.setRootObject(selectedClass); - return selectedClass; - } + public boolean isValidInput() { + System.out.println("3"); + // TODO Auto-generated method stub + return true; + } @Override - /** - * destroys every listener when protege is closed - */ - public void disposeView() { - list.dispose(); - } -} + public boolean setDescription(OWLDescription arg0) { + System.out.println("4"); + // TODO Auto-generated method stub + return true; + } + + @Override + public void initialise() throws Exception { + System.out.println("5"); + tes = new SimpleViewTest(); + this.getOWLEditorKit().getOWLWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null).addPanel(tes); + test = new JPanel(); + test.add(new JLabel("TEST")); + + } + + @Override + public void dispose() throws Exception { + System.out.println("6"); + // TODO Auto-generated method stub + + } + + @Override + public void addStatusChangedListener( + InputVerificationStatusChangedListener arg0) { + System.out.println("7"); + // TODO Auto-generated method stub + + } + + @Override + public void removeStatusChangedListener( + InputVerificationStatusChangedListener arg0) { + System.out.println("8"); + // TODO Auto-generated method stub + + } + + + + +} \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-02-26 16:24:18 UTC (rev 1635) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-02-26 19:03:36 UTC (rev 1636) @@ -35,7 +35,7 @@ import org.semanticweb.owl.model.OWLOntology; /** - * This class reads the ontologie in a seperate thread. + * This class reads the ontologie in a separate thread. * @author Christian Koetteritzsch * */ @@ -50,7 +50,6 @@ private final OWLEditorKit editor; private final DLLearnerModel model; private boolean isInconsistent; - //private final OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view; private final OWLFrame<OWLClass> current; private final DLLearnerView view; @@ -61,15 +60,6 @@ * @param v DL-Learner view * @param m DL-Learner model */ - public ReadingOntologyThread(OWLEditorKit editorKit, OWLFrame<OWLClass> frame, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView v, DLLearnerModel m) { - ontologieURI = new HashSet<String>(); - this.editor = editorKit; - current = frame; - this.view = null; - this.model = m; - - } - public ReadingOntologyThread(OWLEditorKit editorKit, OWLFrame<OWLClass> frame, DLLearnerView v, DLLearnerModel m) { ontologieURI = new HashSet<String>(); this.editor = editorKit; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-02-27 20:41:58
|
Revision: 1638 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1638&view=rev Author: heeroyuy Date: 2009-02-27 20:41:57 +0000 (Fri, 27 Feb 2009) Log Message: ----------- -started integrating the plugin in protege Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-02-27 11:39:32 UTC (rev 1637) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-02-27 20:41:57 UTC (rev 1638) @@ -34,9 +34,7 @@ import javax.swing.JTextArea; import javax.swing.JToggleButton; -import org.protege.editor.core.ui.util.InputVerificationStatusChangedListener; 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 @@ -45,13 +43,12 @@ * @author Christian Koetteritzsch * */ -public class DLLearnerView implements OWLDescriptionEditor{ +public class DLLearnerView extends JPanel{ private static final long serialVersionUID = 624829578325729385L; //private OWLClassDescriptionEditorWithDLLearnerTab mainWindow; // this is the Component which shows the view of the dllearner - private static final String TITLE = "DL-Learner"; private final JComponent learner; // Accept button to add the learned concept to the owl @@ -105,9 +102,9 @@ private final JTextArea hint; private boolean isInconsistent; // This is the Panel for more details of the suggested concept - private MoreDetailForSuggestedConceptsPanel detail; + private final MoreDetailForSuggestedConceptsPanel detail; //private OWLFrame<OWLClass> frame; - private ReadingOntologyThread readThread; + private final ReadingOntologyThread readThread; private final OWLEditorKit editorKit; /** @@ -151,29 +148,6 @@ addAcceptButtonListener(this.action); addRunButtonListener(this.action); addAdvancedButtonListener(this.action); - this.makeView(); - - - } - /** - * 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); model.clearVector(); hint.setText("To get suggestions for class descriptions, please click the button above."); @@ -212,6 +186,29 @@ 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); } @@ -320,15 +317,6 @@ public void setIsInconsistent(boolean isIncon) { this.isInconsistent = isIncon; } - /** - * Destroys the view after the plugin is closed. - */ - @Override - public void dispose() { - run.removeActionListener(action); - accept.removeActionListener(action); - advanced.removeActionListener(action); - } /** * Adds Actionlistener to the run button. @@ -371,54 +359,7 @@ setHintMessage(message); } - @Override - public JComponent getComponent() { + public JComponent getLearnerView() { return learner; } - - @Override - public Set<OWLDescription> getDescriptions() { - return model.getDescriptions(); - } - - @Override - public String getEditorName() { - return TITLE; - } - - @Override - public boolean isValidInput() { - return true; - } - - @Override - public boolean setDescription(OWLDescription arg0) { - // TODO Auto-generated method stub - return true; - } - - @Override - public void addStatusChangedListener( - InputVerificationStatusChangedListener arg0) { - // TODO Auto-generated method stub - - } - - @Override - public void removeStatusChangedListener( - InputVerificationStatusChangedListener arg0) { - // TODO Auto-generated method stub - - } - @Override - public void setup(String arg0, String arg1, OWLEditorKit arg2) { - // TODO Auto-generated method stub - - } - @Override - public void initialise() throws Exception { - // TODO Auto-generated method stub - - } - } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 2009-02-27 11:39:32 UTC (rev 1637) +++ trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 2009-02-27 20:41:57 UTC (rev 1638) @@ -1,7 +1,7 @@ <?xml version="1.0" ?> <plugin> <extension id="org.dllearner.tools.protege.ProtegePlugin" - point="org.protege.editor.owl.ui.editor"> + point="org.protege.editor.owl.ui.editor.description"> <label value="DL-Learner"/> <class value="org.dllearner.tools.protege.ProtegePlugin"/> </extension> Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-02-27 11:39:32 UTC (rev 1637) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-02-27 20:41:57 UTC (rev 1638) @@ -22,7 +22,6 @@ import java.util.Set; import javax.swing.JComponent; -import javax.swing.JLabel; import javax.swing.JPanel; import org.protege.editor.core.ui.util.InputVerificationStatusChangedListener; @@ -39,13 +38,13 @@ public class ProtegePlugin extends AbstractOWLDescriptionEditor { private static final long serialVersionUID = 728362819273927L; private JPanel test; - private SimpleViewTest tes; + private DLLearnerView view; @Override public JComponent getComponent() { System.out.println("1"); // TODO Auto-generated method stub - return test; + return view.getLearnerView(); } @Override @@ -58,6 +57,7 @@ @Override public boolean isValidInput() { System.out.println("3"); + view = new DLLearnerView("equivalent class", this.getOWLEditorKit()); // TODO Auto-generated method stub return true; } @@ -72,11 +72,8 @@ @Override public void initialise() throws Exception { System.out.println("5"); - tes = new SimpleViewTest(); - this.getOWLEditorKit().getOWLWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null).addPanel(tes); - test = new JPanel(); - test.add(new JLabel("TEST")); - + System.out.println("test: " + this.getOWLEditorKit().getOWLWorkspace().getViewManager().getClass()); + view = new DLLearnerView("equivalent class", this.getOWLEditorKit()); } @Override @@ -98,6 +95,7 @@ public void removeStatusChangedListener( InputVerificationStatusChangedListener arg0) { System.out.println("8"); + view = null; // TODO Auto-generated method stub } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-02-27 11:39:32 UTC (rev 1637) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-02-27 20:41:57 UTC (rev 1638) @@ -50,7 +50,7 @@ private final OWLEditorKit editor; private final DLLearnerModel model; private boolean isInconsistent; - private final OWLFrame<OWLClass> current; + private final OWLClass current; private final DLLearnerView view; /** @@ -63,7 +63,7 @@ public ReadingOntologyThread(OWLEditorKit editorKit, OWLFrame<OWLClass> frame, DLLearnerView v, DLLearnerModel m) { ontologieURI = new HashSet<String>(); this.editor = editorKit; - current = frame; + current = editor.getOWLWorkspace().getOWLComponentFactory().getOWLClassSelectorPanel().getSelectedObject(); this.view = v; this.model = m; @@ -78,7 +78,7 @@ hasIndividuals = false; // checks if selected concept is thing when yes then it selects all // individuals - if (!(current.getRootObject() instanceof Thing)) { + if (!(current instanceof Thing)) { List<NamedClass> classList = reasoner.getAtomicConceptsList(); for(NamedClass concept : classList) { // if individuals is null @@ -87,7 +87,7 @@ for(String onto : ontologieURI) { if (concept.toString().contains(onto)) { if (concept.toString().equals( - onto + current.getRootObject().toString())) { + onto + current.toString())) { // if individuals is not null it gets all // individuals of // the concept This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-02 11:15:24
|
Revision: 1639 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1639&view=rev Author: heeroyuy Date: 2009-03-02 11:15:14 +0000 (Mon, 02 Mar 2009) Log Message: ----------- -fixed error that selected class isn't updated after restarting the plugin Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-02-27 20:41:57 UTC (rev 1638) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-02 11:15:14 UTC (rev 1639) @@ -46,8 +46,7 @@ public class DLLearnerView extends JPanel{ - private static final long serialVersionUID = 624829578325729385L; - //private OWLClassDescriptionEditorWithDLLearnerTab mainWindow; + private static final long serialVersionUID = 624829578325729385L; // this is the Component which shows the view of the dllearner private final JComponent learner; @@ -103,7 +102,6 @@ private boolean isInconsistent; // This is the Panel for more details of the suggested concept private final MoreDetailForSuggestedConceptsPanel detail; - //private OWLFrame<OWLClass> frame; private final ReadingOntologyThread readThread; private final OWLEditorKit editorKit; @@ -115,7 +113,6 @@ * @param label String */ public DLLearnerView(String label, OWLEditorKit editor) { - //mainWindow = dlLearner; 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"); @@ -130,7 +127,6 @@ 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(); @@ -154,8 +150,7 @@ isInconsistent = false; readThread = new ReadingOntologyThread(editorKit, null, this, model); readThread.start(); - //TODO: runbutton wird auf enable gesetzt obwohl keine instanzdaten vorhanden sind. - + hint.setVisible(true); advanced.setIcon(icon); accept.setEnabled(false); @@ -362,4 +357,8 @@ public JComponent getLearnerView() { return learner; } + + public DLLearnerModel getDLLearnerModel() { + return model; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-02-27 20:41:57 UTC (rev 1638) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-02 11:15:14 UTC (rev 1639) @@ -22,7 +22,6 @@ import java.util.Set; import javax.swing.JComponent; -import javax.swing.JPanel; import org.protege.editor.core.ui.util.InputVerificationStatusChangedListener; import org.protege.editor.owl.ui.editor.AbstractOWLDescriptionEditor; @@ -37,67 +36,50 @@ */ public class ProtegePlugin extends AbstractOWLDescriptionEditor { private static final long serialVersionUID = 728362819273927L; - private JPanel test; private DLLearnerView view; @Override public JComponent getComponent() { - System.out.println("1"); - // TODO Auto-generated method stub return view.getLearnerView(); } @Override public Set<OWLDescription> getDescriptions() { - System.out.println("2"); - // TODO Auto-generated method stub - return null; + return view.getDLLearnerModel().getNewOWLDescription(); } @Override public boolean isValidInput() { - System.out.println("3"); + System.out.println("testen2: " + super.getOWLEditorKit().getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass()); + System.out.println("testen: " + super.getOWLEditorKit().getWorkspace()); view = new DLLearnerView("equivalent class", this.getOWLEditorKit()); - // TODO Auto-generated method stub return true; } @Override public boolean setDescription(OWLDescription arg0) { - System.out.println("4"); - // TODO Auto-generated method stub return true; } @Override public void initialise() throws Exception { - System.out.println("5"); - System.out.println("test: " + this.getOWLEditorKit().getOWLWorkspace().getViewManager().getClass()); - view = new DLLearnerView("equivalent class", this.getOWLEditorKit()); + view = new DLLearnerView("equivalent class", super.getOWLEditorKit()); } @Override public void dispose() throws Exception { - System.out.println("6"); - // TODO Auto-generated method stub - + view = null; } @Override public void addStatusChangedListener( InputVerificationStatusChangedListener arg0) { - System.out.println("7"); - // TODO Auto-generated method stub - } @Override public void removeStatusChangedListener( InputVerificationStatusChangedListener arg0) { - System.out.println("8"); view = null; - // TODO Auto-generated method stub - } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-02-27 20:41:57 UTC (rev 1638) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-03-02 11:15:14 UTC (rev 1639) @@ -63,7 +63,7 @@ public ReadingOntologyThread(OWLEditorKit editorKit, OWLFrame<OWLClass> frame, DLLearnerView v, DLLearnerModel m) { ontologieURI = new HashSet<String>(); this.editor = editorKit; - current = editor.getOWLWorkspace().getOWLComponentFactory().getOWLClassSelectorPanel().getSelectedObject(); + current = editor.getOWLWorkspace().getOWLSelectionModel().getLastSelectedClass(); this.view = v; this.model = m; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-02 13:12:29
|
Revision: 1641 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1641&view=rev Author: heeroyuy Date: 2009-03-02 13:12:26 +0000 (Mon, 02 Mar 2009) Log Message: ----------- -fixed option panel Modified Paths: -------------- 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/PosAndNegSelectPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-02 11:17:08 UTC (rev 1640) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-02 13:12:26 UTC (rev 1641) @@ -114,14 +114,16 @@ */ public DLLearnerView(String label, OWLEditorKit editor) { editorKit = editor; + 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); URL toggledIconUrl = this.getClass().getResource("arrow2.gif"); toggledIcon = new ImageIcon(toggledIconUrl); - model = new DLLearnerModel(editorKit, label, this); - sugPanel = new SuggestClassPanel(); - action = new ActionHandler(this.action, model, this, label); adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); @@ -148,8 +150,6 @@ model.clearVector(); hint.setText("To get suggestions for class descriptions, please click the button above."); isInconsistent = false; - readThread = new ReadingOntologyThread(editorKit, null, this, model); - readThread.start(); hint.setVisible(true); advanced.setIcon(icon); @@ -277,7 +277,6 @@ model.unsetNewConcepts(); action.destroyDLLearnerThread(); errorMessage.setText(""); - //posPanel.unsetPosAndNegPanel(); learner.removeAll(); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-02 11:17:08 UTC (rev 1640) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-02 13:12:26 UTC (rev 1641) @@ -20,7 +20,6 @@ package org.dllearner.tools.protege; import java.awt.Dimension; -import java.awt.GridLayout; import javax.swing.JLabel; import javax.swing.JPanel; @@ -40,25 +39,26 @@ private final JSlider minAccuracy; private final JSlider maxExecutionTime; private final JSlider nrOfConcepts; - private final JPanel optionPanel; private double accuracy; /** - * Construktor for the Option Panel. + * Constructor for the Option Panel. */ public OptionPanel() { - - setPreferredSize(new Dimension(490, 120)); - setLayout(new GridLayout(0, 1)); - optionPanel = new JPanel(new GridLayout(0, 2)); + setPreferredSize(new Dimension(490, 100)); + setLayout(null); minAccuracyLabel = new JLabel("minimum accuracy"); + minAccuracyLabel.setBounds(5, 0, 150, 40); maxExecutionTimeLabel = new JLabel("maximum execution time"); + maxExecutionTimeLabel.setBounds(5, 40, 150, 40); nrOfConceptsLabel = new JLabel("maximum number of results"); + nrOfConceptsLabel.setBounds(5, 80, 150, 40); minAccuracy = new JSlider(50, 100, 90); minAccuracy.setPaintTicks(true); minAccuracy.setMajorTickSpacing(10); minAccuracy.setMinorTickSpacing(1); minAccuracy.setPaintLabels(true); + minAccuracy.setBounds(160, 0, 200, 40); maxExecutionTime = new JSlider(2, 20, 5); @@ -66,6 +66,7 @@ maxExecutionTime.setMajorTickSpacing(5); maxExecutionTime.setMinorTickSpacing(1); maxExecutionTime.setPaintLabels(true); + maxExecutionTime.setBounds(160, 40, 200, 40); nrOfConcepts = new JSlider(2, 20, 10); @@ -73,15 +74,14 @@ nrOfConcepts.setMajorTickSpacing(2); nrOfConcepts.setMinorTickSpacing(1); nrOfConcepts.setPaintLabels(true); + nrOfConcepts.setBounds(160, 80, 200, 40); - optionPanel.add(minAccuracyLabel); - optionPanel.add(minAccuracy); - optionPanel.add(maxExecutionTimeLabel); - optionPanel.add(maxExecutionTime); - optionPanel.add(nrOfConceptsLabel); - optionPanel.add(nrOfConcepts); - add(optionPanel); - + add(minAccuracyLabel); + add(minAccuracy); + add(maxExecutionTimeLabel); + add(maxExecutionTime); + add(nrOfConceptsLabel); + add(nrOfConcepts); } /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2009-03-02 11:17:08 UTC (rev 1640) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2009-03-02 13:12:26 UTC (rev 1641) @@ -102,7 +102,7 @@ //set layout for parent Panel super(); setLayout(new GridLayout(0, 1)); - setPreferredSize(new Dimension(490, 250)); + setPreferredSize(new Dimension(490, 100)); //view = v; //this.model = model; //handler = new PosAndNegSelectPanelHandler(model, view, this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
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. |
From: <jen...@us...> - 2009-03-06 10:35:50
|
Revision: 1645 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1645&view=rev Author: jenslehmann Date: 2009-03-06 10:35:34 +0000 (Fri, 06 Mar 2009) Log Message: ----------- fix in Protege plugin Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-05 19:09:08 UTC (rev 1644) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-06 10:35:34 UTC (rev 1645) @@ -330,8 +330,7 @@ // TODO Auto-generated catch block e.printStackTrace(); } - List<? extends EvaluatedDescription> result = la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts() - , view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true); + List<? extends EvaluatedDescription> result = la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts()); return result; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-05 19:09:08 UTC (rev 1644) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-06 10:35:34 UTC (rev 1645) @@ -46,7 +46,7 @@ public OptionPanel() { setPreferredSize(new Dimension(490, 100)); setLayout(null); - minAccuracyLabel = new JLabel("minimum accuracy"); + minAccuracyLabel = new JLabel("noise in %"); minAccuracyLabel.setBounds(5, 0, 150, 40); maxExecutionTimeLabel = new JLabel("maximum execution time"); maxExecutionTimeLabel.setBounds(5, 40, 150, 40); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-11 16:44:21
|
Revision: 1648 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1648&view=rev Author: heeroyuy Date: 2009-03-11 16:44:10 +0000 (Wed, 11 Mar 2009) Log Message: ----------- -some changes in the graphical panel Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.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/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -44,6 +44,7 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; + /** * This class processes input from the user. * @@ -54,7 +55,7 @@ MouseListener, ListSelectionListener, ListDataListener { // This is the DLLearnerModel. - + private final DLLearnerModel model; // This is the id that checks if the equivalent class or subclass button is @@ -71,6 +72,7 @@ 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. * @@ -100,7 +102,7 @@ */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals(id)) { + if (z.getActionCommand().equals("Suggest " + id +" description")) { model.setKnowledgeSource(); model.setReasoner(); model.setLearningProblem(); @@ -109,11 +111,12 @@ view.renderErrorMessage("learning started"); retriever = new SuggestionRetriever(); retriever.execute(); - //model.setCurrentConcept(null); + // model.setCurrentConcept(null); } if (z.getActionCommand().equals("ADD")) { + view.getMoreDetailForSuggestedConceptsPanel().repaint(); if (evaluatedDescription != null) { model .changeDLLearnerDescriptionsToOWLDescriptions(evaluatedDescription @@ -141,6 +144,7 @@ if (z.getActionCommand().equals("Why")) { view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel( evaluatedDescription); + view.getMoreDetailForSuggestedConceptsPanel().repaint(); } } @@ -205,10 +209,11 @@ .getSuggestClassPanel().getSuggestList().getSelectedValue(); String desc = item.getValue(); if (model.getEvaluatedDescriptionList() != null) { - List<? extends EvaluatedDescription> evalList = model.getEvaluatedDescriptionList(); + List<? extends EvaluatedDescription> evalList = model + .getEvaluatedDescriptionList(); Set<String> onto = model.getOntologyURIString(); - for(EvaluatedDescription eDescription : evalList) { - for(String ont : onto) { + for (EvaluatedDescription eDescription : evalList) { + for (String ont : onto) { if (desc.equals(eDescription.getDescription() .toManchesterSyntaxString(ont, null))) { evaluatedDescription = eDescription; @@ -217,11 +222,9 @@ } } } - - if (m.getClickCount() == 2) { - view.getMoreDetailForSuggestedConceptsPanel() - .renderDetailPanel(evaluatedDescription); - } + view.getMoreDetailForSuggestedConceptsPanel() + .renderDetailPanel(evaluatedDescription); + view.getMoreDetailForSuggestedConceptsPanel().repaint(); } } @@ -253,7 +256,7 @@ * Destroys the Thread after the Pluigin is closed. */ public void destroyDLLearnerThread() { - //dlLearner = null; + // dlLearner = null; } /** @@ -280,31 +283,36 @@ // TODO Auto-generated method stub } - - - -/** - * Inner Class that retrieves the concepts given by the DL-Learner. - * @author Christian Koetteritzsch - * - */ - class SuggestionRetriever extends + + /** + * Inner Class that retrieves the concepts given by the DL-Learner. + * + * @author Christian Koetteritzsch + * + */ + class SuggestionRetriever + extends SwingWorker<List<? extends EvaluatedDescription>, List<? extends EvaluatedDescription>> { - + private Thread dlLearner; private final DefaultListModel dm = new DefaultListModel(); - + @SuppressWarnings("unchecked") @Override - protected List<? extends EvaluatedDescription> doInBackground() throws Exception { + protected List<? extends EvaluatedDescription> doInBackground() + throws Exception { la = model.getLearningAlgorithm(); timer = new Timer(); - timer.schedule(new TimerTask(){ - + timer.schedule(new TimerTask() { + @Override - public void run() { + public void run() { if (la != null) { - publish(la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts(), view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true)); + publish(la.getCurrentlyBestEvaluatedDescriptions(view + .getPosAndNegSelectPanel().getOptionPanel() + .getNrOfConcepts(), view + .getPosAndNegSelectPanel().getOptionPanel() + .getMinAccuracy(), false)); } } @@ -315,7 +323,7 @@ @Override public void run() { try { - model.run(); + model.run(); } catch (Exception e) { e.printStackTrace(); } @@ -330,8 +338,11 @@ // TODO Auto-generated catch block e.printStackTrace(); } - List<? extends EvaluatedDescription> result = la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts()); - + List<? extends EvaluatedDescription> result = la + .getCurrentlyBestEvaluatedDescriptions(view + .getPosAndNegSelectPanel().getOptionPanel() + .getNrOfConcepts()); + return result; } @@ -353,35 +364,49 @@ } @Override - protected void process(List<List<? extends EvaluatedDescription>> resultLists) { + protected void process( + List<List<? extends EvaluatedDescription>> resultLists) { - for (List<? extends EvaluatedDescription> list : resultLists) { updateList(list); } } - private void updateList(final List<? extends EvaluatedDescription> result) { + private void updateList( + final List<? extends EvaluatedDescription> result) { - Runnable doUpdateList = new Runnable() { - - public void run() { model.setSuggestList(result); dm.clear(); int i = 0; - for(EvaluatedDescription eval : result) { + for (EvaluatedDescription eval : result) { Set<String> ont = model.getOntologyURIString(); - for(String ontology : ont) { - 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)); + for (String ontology : ont) { + 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)); break; } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null), ((EvaluatedDescriptionClass) eval).getAccuracy()*100)); + 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/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -102,10 +102,9 @@ private final JTextArea hint; private boolean isInconsistent; // This is the Panel for more details of the suggested concept - private MoreDetailForSuggestedConceptsPanel detail; + private final MoreDetailForSuggestedConceptsPanel detail; private ReadingOntologyThread readThread; private final OWLEditorKit editorKit; - private final String label; /** * The constructor for the DL-Learner tab in the class description @@ -115,7 +114,6 @@ * @param label String */ public DLLearnerView(String label, OWLEditorKit editor) { - this.label = label; editorKit = editor; model = new DLLearnerModel(editorKit, this); model.setID(label); @@ -129,7 +127,7 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); - run = new JButton(label); + run = new JButton("Suggest " + label + " description"); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); @@ -141,13 +139,15 @@ learner = new JPanel(); advanced.setSize(20, 20); learner.setLayout(null); - learner.setPreferredSize(new Dimension(600, 520)); + //learner.setPreferredSize(new Dimension(600, 520)); + learner.setSize(new Dimension(1024, 768)); accept.setPreferredSize(new Dimension(290, 50)); advanced.setName("Advanced"); posPanel = new PosAndNegSelectPanel(model, action); - addAcceptButtonListener(this.action); - addRunButtonListener(this.action); - addAdvancedButtonListener(this.action); + detail = new MoreDetailForSuggestedConceptsPanel(model); + this.addAcceptButtonListener(this.action); + this.addRunButtonListener(this.action); + this.addAdvancedButtonListener(this.action); } @@ -171,6 +171,9 @@ */ public void makeView() { run.setEnabled(false); + System.out.println("hier"); + detail.unsetPanel(); + detail.setVisible(false); hint.setText("To get suggestions for class descriptions, please click the button above."); isInconsistent = false; readThread = new ReadingOntologyThread(editorKit, this, model); @@ -184,15 +187,16 @@ sugPanel = sugPanel.updateSuggestClassList(); advanced.setSelected(false); sugPanel.setBounds(10, 35, 490, 110); - adv.setBounds(40, 200, 200, 20); + adv.setBounds(40, 505, 200, 20); wikiPane.setBounds(220, 0, 350, 30); addButtonPanel.setBounds(510, 40, 80, 110); run.setBounds(10, 0, 200, 30); - advanced.setBounds(10, 200, 20, 20); + advanced.setBounds(10, 505, 20, 20); + detail.setBounds(10, 195, 600, 300); + detail.setVisible(true); sugPanel.setVisible(true); posPanel.setVisible(false); - posPanel.setBounds(10, 230, 490, 250); - posPanel.getOptionPanel().resetOptions(); + posPanel.setBounds(10, 535, 490, 250); accept.setBounds(510, 40, 80, 110); hint.setBounds(10, 150, 490, 35); errorMessage.setBounds(10, 180, 490, 20); @@ -205,8 +209,9 @@ learner.add(hint); learner.add(errorMessage); learner.add(posPanel); + learner.add(detail); this.renderErrorMessage(""); - detail = new MoreDetailForSuggestedConceptsPanel(model); + } /** * This method sets the right icon for the advanced Panel. @@ -243,6 +248,7 @@ */ public void setExamplePanelVisible(boolean visible) { posPanel.setVisible(visible); + detail.repaint(); } /** @@ -350,7 +356,7 @@ * This method sets the run button enable after learning. */ public void algorithmTerminated() { - String error = "learning succesful"; + String error = "learning successful"; String message = ""; if(isInconsistent) { message = "Class descriptions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -19,6 +19,7 @@ */ package org.dllearner.tools.protege; +import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; @@ -32,24 +33,29 @@ 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 HEIGHT = 150; + private static final int WIDTH = 150; + private static final int ELLIPSE_X_AXIS = 5; + private static final int ELLIPSE_Y_AXIS = 25; private static final int MAX_NUMBER_OF_INDIVIDUAL_POINTS = 20; + private static final int PLUS_SIZE = 5; private static final int GAP = 20; private int shiftXAxis; private int distortionOld; private final Ellipse2D oldConcept; private Ellipse2D newConcept; - private final EvaluatedDescription eval; + private EvaluatedDescription eval; private final DLLearnerModel model; private final String conceptNew; private final Vector<IndividualPoint> posCovIndVector; @@ -57,24 +63,43 @@ private final Vector<IndividualPoint> points; private final GraphicalCoveragePanelHandler handler; private int adjustment; + private int shiftOldConcept; + private int shiftNewConcept; + private int shiftNewConceptX; + private int shiftCovered; + private int coveredIndividualSize; + private int additionalIndividualSize; + private int x1; + private int x2; + private int y1; + private int y2; + private int centerX; + private int centerY; 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 + * + * @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)); - setVisible(true); - setForeground(Color.GREEN); - repaint(); + public GraphicalCoveragePanel(EvaluatedDescription desc, DLLearnerModel m, + String concept, int w, int h, MoreDetailForSuggestedConceptsPanel p) { + this.setPreferredSize(new Dimension(WIDTH, HEIGHT + 100)); + this.setVisible(false); + this.setForeground(Color.GREEN); + this.repaint(); eval = desc; model = m; panel = p; @@ -83,198 +108,416 @@ posNotCovIndVector = new Vector<IndividualPoint>(); 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); + handler = new GraphicalCoveragePanelHandler(this, desc, model); + oldConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + (2 * adjustment), + ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + newConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + shiftXAxis + + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld, HEIGHT + + distortionOld); this.computeIndividualPoints(); this.addMouseMotionListener(handler); - this.addPropertyChangeListener(handler); + this.addMouseListener(handler); + // this.addPropertyChangeListener(handler); } - + @Override protected void paintComponent(Graphics g) { - Graphics2D g2D; - g2D = (Graphics2D) g; - g2D.setColor(Color.GREEN); - g2D.draw(oldConcept); - g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); - g2D.setColor(Color.RED); - g2D.draw(newConcept); - g2D.drawString(conceptNew, 10 + WIDTH, 15); - - - - for(int i = 0; i < posCovIndVector.size(); i++) { + if (eval != null) { + Graphics2D g2D; + g2D = (Graphics2D) g; + + AlphaComposite ac = AlphaComposite.getInstance( + AlphaComposite.SRC_OVER, 0.5f); + g2D.setColor(Color.YELLOW); + g2D.fill(oldConcept); g2D.setColor(Color.BLACK); - g2D.drawString(posCovIndVector.get(i).getPoint(), posCovIndVector.get(i).getXAxis(), posCovIndVector.get(i).getYAxis()); - } - - for(int i = 0; i < posNotCovIndVector.size(); i++) { + g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); g2D.setColor(Color.BLACK); - g2D.drawString(posNotCovIndVector.get(i).getPoint(), posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); + g2D.drawString(conceptNew, 10 + WIDTH, 15); + g2D.setComposite(ac); + g2D.setColor(Color.ORANGE); + g2D.fill(newConcept); + g2D.setColor(Color.BLACK); + + // Plus 1 + if (coveredIndividualSize != model.getReasoner().getIndividuals( + model.getCurrentConcept()).size() + && coveredIndividualSize != 0) { + g2D.drawLine(x1 - 1 - shiftOldConcept, y1 - 1, x2 + 1 + - shiftOldConcept, y1 - 1); + g2D.drawLine(x1 - shiftOldConcept, centerY - 1, x2 + - shiftOldConcept, centerY - 1); + g2D.drawLine(x1 - shiftOldConcept, centerY, x2 + - shiftOldConcept, centerY); + g2D.drawLine(x1 - shiftOldConcept, centerY + 1, x2 + - shiftOldConcept, centerY + 1); + g2D.drawLine(x1 - 1 - shiftOldConcept, y2 + 1, x2 + 1 + - shiftOldConcept, y2 + 1); + + g2D.drawLine(x1 - 1 - shiftOldConcept, y1 - 1, x1 - 1 + - shiftOldConcept, y2 + 1); + g2D.drawLine(centerX - 1 - shiftOldConcept, y1, centerX - 1 + - shiftOldConcept, y2); + g2D.drawLine(centerX - shiftOldConcept, y1, centerX + - shiftOldConcept, y2); + g2D.drawLine(centerX + 1 - shiftOldConcept, y1, centerX + 1 + - shiftOldConcept, y2); + g2D.drawLine(x2 + 1 - shiftOldConcept, y1 - 1, x2 + 1 + - shiftOldConcept, y2 + 1); + } + // Plus 2 + + g2D.drawLine(x1 - 1 + shiftCovered, y1 - 1, x2 + 1 + shiftCovered, + y1 - 1); + g2D.drawLine(x1 + shiftCovered, centerY - 1, x2 + shiftCovered, + centerY - 1); + g2D + .drawLine(x1 + shiftCovered, centerY, x2 + shiftCovered, + centerY); + g2D.drawLine(x1 + shiftCovered, centerY + 1, x2 + shiftCovered, + centerY + 1); + g2D.drawLine(x1 - 1 + shiftCovered, y2 + 1, x2 + 1 + shiftCovered, + y2 + 1); + + g2D.drawLine(x1 - 1 + shiftCovered, y1 - 1, x1 - 1 + shiftCovered, + y2 + 1); + g2D.drawLine(centerX - 1 + shiftCovered, y1, centerX - 1 + + shiftCovered, y2); + g2D + .drawLine(centerX + shiftCovered, y1, centerX + + shiftCovered, y2); + g2D.drawLine(centerX + 1 + shiftCovered, y1, centerX + 1 + + shiftCovered, y2); + g2D.drawLine(x2 + 1 + shiftCovered, y1 - 1, x2 + 1 + shiftCovered, + y2 + 1); + + // Plus 3 + if (coveredIndividualSize != model.getReasoner().getIndividuals( + model.getCurrentConcept()).size()) { + g2D.drawLine(x1 - 1 + shiftNewConcept, y1 - 1, x2 + 1 + + shiftNewConcept, y1 - 1); + g2D.drawLine(x1 + shiftNewConcept, centerY - 1, x2 + + shiftNewConcept, centerY - 1); + g2D.drawLine(x1 + shiftNewConcept, centerY, x2 + + shiftNewConcept, centerY); + g2D.drawLine(x1 + shiftNewConcept, centerY + 1, x2 + + shiftNewConcept, centerY + 1); + g2D.drawLine(x1 - 1 + shiftNewConcept, y2 + 1, x2 + 1 + + shiftNewConcept, y2 + 1); + + g2D.drawLine(x1 - 1 + shiftNewConcept, y1 - 1, x1 - 1 + + shiftNewConcept, y2 + 1); + g2D.drawLine(centerX - 1 + shiftNewConcept, y1, centerX - 1 + + shiftNewConcept, y2); + g2D.drawLine(centerX + shiftNewConcept, y1, centerX + + shiftNewConcept, y2); + g2D.drawLine(centerX + 1 + shiftNewConcept, y1, centerX + 1 + + shiftNewConcept, y2); + g2D.drawLine(x2 + 1 + shiftNewConcept, y1 - 1, x2 + 1 + + shiftNewConcept, y2 + 1); + } + + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0) { + g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY - 1 + + shiftNewConcept, x2 + shiftNewConceptX, centerY - 1 + + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY + shiftNewConcept, + x2 + shiftNewConceptX, centerY + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY + 1 + + shiftNewConcept, x2 + shiftNewConceptX, centerY + 1 + + shiftNewConcept); + g2D.drawLine(x1 - 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + + g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x1 - 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + g2D.drawLine(centerX - 1 + shiftNewConceptX, y1 + + shiftNewConcept, centerX - 1 + shiftNewConceptX, y2 + + shiftNewConcept); + g2D.drawLine(centerX + shiftNewConceptX, y1 + shiftNewConcept, + centerX + shiftNewConceptX, y2 + shiftNewConcept); + g2D.drawLine(centerX + 1 + shiftNewConceptX, y1 + + shiftNewConcept, centerX + 1 + shiftNewConceptX, y2 + + shiftNewConcept); + g2D.drawLine(x2 + 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + } + + for (int i = 0; i < posCovIndVector.size(); i++) { + g2D.setColor(Color.GREEN); + g2D.drawString(posCovIndVector.get(i).getPoint(), + posCovIndVector.get(i).getXAxis(), posCovIndVector.get( + i).getYAxis()); + } + + for (int i = 0; i < posNotCovIndVector.size(); i++) { + g2D.setColor(Color.RED); + g2D.drawString(posNotCovIndVector.get(i).getPoint(), + posNotCovIndVector.get(i).getXAxis(), + posNotCovIndVector.get(i).getYAxis()); + } + this.setVisible(true); + panel.repaint(); } + } + private void computeGraphics() { + if (eval != null) { + this.setVisible(true); + panel.repaint(); + additionalIndividualSize = ((EvaluatedDescriptionClass) eval) + .getAdditionalInstances().size(); + distortionOld = 0; + adjustment = 0; + Ellipse2D old = new Ellipse2D.Float(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, + WIDTH, HEIGHT); + x1 = (int) old.getCenterX() - PLUS_SIZE; + x2 = (int) old.getCenterX() + PLUS_SIZE; + y1 = (int) old.getCenterY() - PLUS_SIZE; + y2 = (int) old.getCenterY() + PLUS_SIZE; + centerX = (int) old.getCenterX(); + centerY = (int) old.getCenterY(); + double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); + shiftXAxis = (int) Math.round(WIDTH * (1 - coverage)); + if (additionalIndividualSize != 0) { + distortionOld = (int) Math.round(WIDTH * 0.3); + newConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + shiftXAxis, + ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + adjustment = (int) Math.round(newConcept.getCenterY() / 4); + } + this.renderPlus(); + } } - - private void computeGraphics(){ - 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)); - if(add != 0) { - distortionOld = (int) Math.round(WIDTH*additional); - newConcept = new Ellipse2D.Float(5+shiftXAxis, 25, WIDTH, HEIGHT); - adjustment = (int) Math.round(newConcept.getCenterY()/4); - + + private void renderPlus() { + if (eval != null) { + coveredIndividualSize = ((EvaluatedDescriptionClass) eval) + .getCoveredInstances().size(); + double newConcept = ((EvaluatedDescriptionClass) eval) + .getAddition(); + double oldConcept = ((EvaluatedDescriptionClass) eval) + .getCoverage(); + shiftNewConcept = 0; + shiftOldConcept = 0; + shiftNewConceptX = 0; + shiftCovered = 0; + if (coveredIndividualSize == 0) { + shiftNewConcept = (int) Math.round((WIDTH / 2.0) * newConcept); + } else if (additionalIndividualSize != coveredIndividualSize) { + shiftNewConcept = (int) Math.round((WIDTH / 2.0) + * (newConcept + (1 - oldConcept))); + shiftOldConcept = (int) Math.round((WIDTH / 2.0) * oldConcept); + shiftCovered = (int) Math.round((WIDTH / 2.0) + * (1 - oldConcept)); + } + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0) { + shiftCovered = (int) Math.round((WIDTH / 2.0) * 0.625); + shiftNewConceptX = shiftCovered; + shiftNewConcept = 2 * shiftNewConceptX; + } } - } - + private void computeIndividualPoints() { - Set<Individual> posInd = ((EvaluatedDescriptionClass) eval).getCoveredInstances(); + if (eval != null) { + Set<Individual> posInd = ((EvaluatedDescriptionClass) eval) + .getCoveredInstances(); + int i = 0; + double x = 100; + double y = 100; + boolean flag = true; + for (Individual ind : posInd) { + flag = true; + if (i < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (x >= oldConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + GAP; + } - int i = 0; - double x = 20; - double y = 20; - boolean flag = true; - for(Individual ind : posInd) { - flag = true; - if(i<MAX_NUMBER_OF_INDIVIDUAL_POINTS) { - while(flag) { - if(x >= oldConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } - - if(y >= oldConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - } - - if(x >= newConcept.getMaxX()) { - x = (int) newConcept.getMinX(); - y = y + GAP; - } - - if(y >= newConcept.getMaxY()) { - y = (int) newConcept.getMinY(); - break; - } - - while(x < newConcept.getMaxX()) { - - if(newConcept.contains(x, y) && oldConcept.contains(x, y)) { - posCovIndVector.add(new IndividualPoint("+", (int) x, (int) y, ind.toString())); - i++; - flag = false; - x = x + GAP; + if (y >= oldConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); + } + + if (x >= newConcept.getMaxX()) { + x = (int) newConcept.getMinX(); + y = y + GAP; + } + + if (y >= newConcept.getMaxY()) { + y = (int) newConcept.getMinY(); break; - } else { - x = x + GAP; } + + while (x < newConcept.getMaxX()) { + + if (newConcept.contains(x, y) + && oldConcept.contains(x, y)) { + posCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + i++; + flag = false; + x = x + GAP; + break; + } else { + x = x + GAP; + } + } } } } - } - - Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval).getAdditionalInstances(); - int j = 0; - x = 20; - y = 20; - for(Individual ind : posNotCovInd) { - flag = true; - if(j<MAX_NUMBER_OF_INDIVIDUAL_POINTS) { - while(flag) { - if(x >= newConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } - - if(y >= newConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - break; - } - - while(x < newConcept.getMaxX()) { - - if(!oldConcept.contains(x, y) && newConcept.contains(x, y)) { - posNotCovIndVector.add(new IndividualPoint("-", (int) x, (int) y, ind.toString())); - j++; - flag = false; - x = x + GAP; + + Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval) + .getAdditionalInstances(); + int j = 0; + x = 100; + y = 100; + for (Individual ind : posNotCovInd) { + flag = true; + if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (x >= newConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + GAP; + } + + if (y >= newConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); break; - } else { - x = x + GAP; } + + while (x < newConcept.getMaxX()) { + + if (!oldConcept.contains(x, y) + && newConcept.contains(x, y)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + j++; + flag = false; + x = x + GAP; + break; + } else { + x = x + GAP; + } + } } } } - } - - Set<Individual> notCovInd = model.getReasoner().getIndividuals(model.getCurrentConcept()); - notCovInd.removeAll(posInd); - int k = 0; - x = 20; - y = 20; - for(Individual ind : notCovInd) { - flag = true; - if(k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { - while(flag) { - if(x >= oldConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } - - if(y >= oldConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - break; - } - - while(x < oldConcept.getMaxX()) { - - if(oldConcept.contains(x, y) && !newConcept.contains(x, y)) { - posNotCovIndVector.add(new IndividualPoint("-", (int) x, (int) y, ind.toString())); - k++; - flag = false; - x = x + GAP; + + Set<Individual> notCovInd = model.getReasoner().getIndividuals( + model.getCurrentConcept()); + notCovInd.removeAll(posInd); + int k = 0; + x = 100; + y = 100; + for (Individual ind : notCovInd) { + flag = true; + if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (x >= oldConcept.getMaxX()) { + x = (int) oldConcept.getMinX(); + y = y + GAP; + } + + if (y >= oldConcept.getMaxY()) { + y = (int) oldConcept.getMinY(); break; - } else { - x = x + GAP; } + + while (x < oldConcept.getMaxX()) { + + if (oldConcept.contains(x, y) + && !newConcept.contains(x, y)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + k++; + flag = false; + x = x + GAP; + break; + } else { + x = x + GAP; + } + } } } } + points.addAll(posCovIndVector); + points.addAll(posNotCovIndVector); } - points.addAll(posCovIndVector); - points.addAll(posNotCovIndVector); } - + /** - * This method returns a Vector of all individuals that are drawn - * in the panel. + * 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; } + + public int getX1() { + return x1; + } + + public int getX2() { + return x2; + } + + public int getY1() { + return y1; + } + + public int getY2() { + return y2; + } + + public int getShiftOldConcept() { + return shiftOldConcept; + } + + public int getShiftCovered() { + return shiftCovered; + } + + public int getShiftNewConcept() { + return shiftNewConcept; + } + + public int getShiftNewConceptX() { + return shiftNewConceptX; + } + + public void unsetPanel() { + this.removeAll(); + eval = null; + } - - + public EvaluatedDescription getEvaluateddescription() { + return eval; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -20,27 +20,46 @@ package org.dllearner.tools.protege; import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import java.util.Set; import java.util.Vector; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import org.dllearner.algorithms.EvaluatedDescriptionClass; +import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.owl.Individual; + /** * This class takes care of all events happening in the GraphicalCoveragePanel. + * * @author Christian Koetteritzsch - * + * */ -public class GraphicalCoveragePanelHandler implements MouseMotionListener, PropertyChangeListener { +public class GraphicalCoveragePanelHandler implements MouseMotionListener, + MouseListener, PropertyChangeListener { private final GraphicalCoveragePanel panel; + private final EvaluatedDescription description; + private final DLLearnerModel model; + private final JPopupMenu popup; /** * This is the constructor for the handler. - * @param p GraphicalCoveragePanel + * + * @param p + * GraphicalCoveragePanel */ - public GraphicalCoveragePanelHandler(GraphicalCoveragePanel p) { + public GraphicalCoveragePanelHandler(GraphicalCoveragePanel p, + EvaluatedDescription eval, DLLearnerModel m) { this.panel = p; + description = eval; + model = m; + popup = new JPopupMenu(); } @Override @@ -51,13 +70,15 @@ @Override public void mouseMoved(MouseEvent m) { + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); Vector<IndividualPoint> v = panel.getIndividualVector(); for (int i = 0; i < v.size(); i++) { if (v.get(i).getXAxis() >= m.getX() - 5 && v.get(i).getXAxis() <= m.getX() + 5 && v.get(i).getYAxis() >= m.getY() - 5 && v.get(i).getYAxis() <= m.getY() + 5) { - panel.getGraphicalCoveragePanel().setToolTipText(v.get(i).getIndividualName()); + panel.getGraphicalCoveragePanel().setToolTipText( + v.get(i).getIndividualName()); } } @@ -66,8 +87,94 @@ @Override public void propertyChange(PropertyChangeEvent arg0) { - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + panel.repaint(); } + @Override + public void mouseClicked(MouseEvent arg0) { + if (panel.getEvaluateddescription() != null) { + if (arg0.getX() >= panel.getX1() + panel.getShiftCovered() + && arg0.getX() <= panel.getX2() + panel.getShiftCovered() + && arg0.getY() >= panel.getY1() + && arg0.getY() <= panel.getY2()) { + popup.removeAll(); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + Set<Individual> covInd = ((EvaluatedDescriptionClass) description) + .getCoveredInstances(); + for (Individual ind : covInd) { + popup.add(new JMenuItem(ind.toString())); + } + popup.show(panel, arg0.getX(), arg0.getY()); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + } + if (arg0.getX() >= panel.getX1() + panel.getShiftNewConcept() + && arg0.getX() <= panel.getX2() + + panel.getShiftNewConcept() + && arg0.getY() >= panel.getY1() + && arg0.getY() <= panel.getY2() + || arg0.getX() >= panel.getX1() + + panel.getShiftNewConceptX() + && arg0.getX() <= panel.getX2() + + panel.getShiftNewConceptX() + && arg0.getY() >= panel.getY1() + + panel.getShiftNewConcept() + && arg0.getY() <= panel.getY2() + + panel.getShiftNewConcept()) { + popup.removeAll(); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + Set<Individual> addInd = ((EvaluatedDescriptionClass) description) + .getAdditionalInstances(); + for (Individual ind : addInd) { + popup.add(new JMenuItem(ind.toString())); + } + popup.show(panel, arg0.getX(), arg0.getY()); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + } + + if (arg0.getX() >= panel.getX1() - panel.getShiftOldConcept() + && arg0.getX() <= panel.getX2() + - panel.getShiftOldConcept() + && arg0.getY() >= panel.getY1() + && arg0.getY() <= panel.getY2()) { + popup.removeAll(); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + Set<Individual> notCovInd = model.getReasoner().getIndividuals( + model.getCurrentConcept()); + notCovInd.removeAll(((EvaluatedDescriptionClass) description) + .getCoveredInstances()); + for (Individual ind : notCovInd) { + popup.add(new JMenuItem(ind.toString())); + } + popup.show(panel, arg0.getX(), arg0.getY()); + panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + } + } + } + + @Override + public void mouseEntered(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseReleased(MouseEvent arg0) { + // TODO Auto-generated method stub + + } + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -18,18 +18,12 @@ * */ package org.dllearner.tools.protege; -import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.util.Set; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JScrollPane; import javax.swing.JTextArea; -import javax.swing.WindowConstants; import org.dllearner.algorithms.EvaluatedDescriptionClass; import org.dllearner.core.EvaluatedDescription; @@ -54,73 +48,22 @@ // Textarea to render the accuracy of the concept - private JTextArea accuracy; - - // Label for the positive examples that are covered by the concept + private final JTextArea accuracy; + - private JLabel coveredPositiveExamples; - - // Label for the negative examples that are covered by the concept - - private JLabel coveredNegativeExamples; - - // Label for the positive examples that are not covered by the concept - - private JLabel notCoveredPositiveExamples; - - // Label for the negative examples that are not covered by the concept - - private JLabel notCoveredNegativeExamples; - - // Pop up panel for the informations of the selected concept - - private JDialog detailPopup; - - // Text area that shows the covered positive examples - - private JTextArea posCoveredText; - - // Text area that shows the positive examples that are not covered by the selected concept - - private JTextArea posNotCoveredText; - - // Text area that shows the covered negative examples - - private JTextArea negCoveredText; - - // Text area that shows the negative examples that are not covered by the selected concept - - private JTextArea negNotCoveredText; - - // Text area that shows the accurcy of the selected concept - - private JTextArea accuracyText; - - // Scroll pane if scroll bar is necessary to show all covered examples - - private JScrollPane posCoveredScroll; - private JScrollPane posNotCoveredScroll; - private JScrollPane negCoveredScroll; - private JScrollPane negNotCoveredScroll; + private final JTextArea accuracyText; // Evaluated description of the selected concept - private JPanel conceptPanel; - private JPanel accuracyPanel; - private JPanel posCoveredPanel; - private JPanel posNotCoveredPanel; - private JPanel negCoveredPanel; - private JPanel negNotCoveredPanel; + private final JPanel conceptPanel; + private EvaluatedDescription eval; - private JTextArea concept; + private final JTextArea concept; private Set<String> ontologiesStrings; - private JTextArea conceptText; - private final Color colorRed = new Color(139, 0, 0); - private final Color colorGreen = new Color(0, 139, 0); + private final JTextArea conceptText; private static final int HEIGHT = 500; private static final int WIDTH = 600; private GraphicalCoveragePanel p; - private final JButton allPositiveIndividuals; - private final JButton allNegativeIndividuals; private final MoreDetailForSuggestedConceptsPanelHandler handler; + /** * This is the constructor for the Panel. * @param model DLLearnerModel @@ -130,145 +73,68 @@ setLayout(null); setPreferredSize(new Dimension(WIDTH, HEIGHT)); this.model = model; - handler = new MoreDetailForSuggestedConceptsPanelHandler(model); - allPositiveIndividuals = new JButton("old"); - allPositiveIndividuals.setBounds(100, 400, 50, 30); - allPositiveIndividuals.addActionListener(handler); - - allNegativeIndividuals = new JButton("new"); - allNegativeIndividuals.setBounds(400, 400, 50, 30); - allNegativeIndividuals.addActionListener(handler); - - - - } - /** - * This method returns the Detail Panel. - * @return DetailPanel - */ - public JDialog getMoreDialog() { - return detailPopup; - } - - /** - * This method renders the output for the detail panel. - * @param desc selected description - */ - public void renderDetailPanel(EvaluatedDescription desc) { - unsetEverything(); - posCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - posCoveredScroll.setBounds(5, 150, 280, 140); - posNotCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - posNotCoveredScroll.setBounds(300, 150, 280, 140); - negCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - negCoveredScroll.setBounds(5, 325, 280, 140); - negNotCoveredScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - negNotCoveredScroll.setBounds(300, 325, 280, 140); - eval = desc; + handler = new MoreDetailForSuggestedConceptsPanelHandler(this); concept = new JTextArea("Class Description:"); concept.setEditable(false); - coveredPositiveExamples = new JLabel("Covered Positive Examples:"); - coveredPositiveExamples.setForeground(colorGreen); - coveredPositiveExamples.setBounds(5, 110, 280, 30); - notCoveredPositiveExamples = new JLabel("Not Covered Positive Examples"); - notCoveredPositiveExamples.setForeground(colorRed); - notCoveredPositiveExamples.setBounds(300, 110, 280, 30); - coveredNegativeExamples = new JLabel("Covered Negative Examples:"); - coveredNegativeExamples.setForeground(colorRed); - coveredNegativeExamples.setBounds(5, 295, 280, 30); - notCoveredNegativeExamples = new JLabel("Not Covered Negative Examples"); - notCoveredNegativeExamples.setForeground(colorGreen); - notCoveredNegativeExamples.setBounds(300, 295, 280, 30); - conceptPanel = new JPanel(new GridLayout(0, 1)); - conceptPanel.setBounds(5, 0, 600, 50); - accuracyPanel = new JPanel(new GridLayout(0, 1)); - accuracyPanel.setBounds(5, 60, 600, 50); + + conceptPanel = new JPanel(new GridLayout(0, 2)); + conceptPanel.setBounds(5, 0, 800, 50); - posCoveredPanel = new JPanel(new GridLayout(0, 1)); - posNotCoveredPanel = new JPanel(new GridLayout(0, 1)); - negCoveredPanel = new JPanel(new GridLayout(0, 1)); - negNotCoveredPanel = new JPanel(new GridLayout(0, 1)); accuracy = new JTextArea("Accuracy:"); accuracy.setEditable(false); conceptText = new JTextArea(); conceptText.setEditable(false); - posCoveredText = new JTextArea(); - posCoveredText.setForeground(colorGreen); - //sets covered positive examples text area not editable - posCoveredText.setEditable(false); - posNotCoveredText = new JTextArea(); - posNotCoveredText.setForeground(colorRed); - //sets not covered positive examples text area not editable - posNotCoveredText.setEditable(false); - negCoveredText = new JTextArea(); - negCoveredText.setForeground(colorRed); - //sets covered negative examples text area not editable - negCoveredText.setEditable(false); - negNotCoveredText = new JTextArea(); - negNotCoveredText.setForeground(colorGreen); - //sets not covered negative examples text area not editable - negNotCoveredText.setEditable(false); + accuracyText = new JTextArea(); //sets accuracy text area not editable accuracyText.setEditable(false); + accuracy.setVisible(false); + accuracyText.setVisible(false); + concept.setVisible(false); + conceptText.setVisible(false); + + } + + /** + * This method renders the output for the detail panel. + * @param desc selected description + */ + public void renderDetailPanel(EvaluatedDescription desc) { + accuracy.setVisible(false); + accuracyText.setVisible(false); + concept.setVisible(false); + conceptText.setVisible(false); + eval = desc; + //panel for the informations of the selected concept //this method adds the informations for the selected concept to the panel - setInformation(); + this.setInformation(); p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), WIDTH, HEIGHT-200, this); - p.setBounds(5, 110, 600, 300); - detailPopup = new JDialog(); - detailPopup.setSize(WIDTH, HEIGHT); - //window will be disposed if the x button is pressed - detailPopup.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); - detailPopup.setVisible(true); - detailPopup.setResizable(false); + p.setBounds(5, 60, 600, 350); //adds all information to the example panel + unsetEverything(); + conceptPanel.removeAll(); conceptPanel.add(concept); + conceptPanel.add(accuracy); conceptPanel.add(conceptText); - - accuracyPanel.add(accuracy); - accuracyPanel.add(accuracyText); - - posCoveredScroll.setViewportView(posCoveredPanel); - posNotCoveredScroll.setViewportView(posNotCoveredPanel); - negCoveredScroll.setViewportView(negCoveredPanel); - negNotCoveredScroll.setViewportView(negNotCoveredPanel); - - add(conceptPanel); - add(accuracyPanel); - add(p); - add(allPositiveIndividuals); - add(allNegativeIndividuals); - handler.setEvaluadtedDescription(eval); - detailPopup.add(this); + conceptPanel.add(accuracyText); + conceptPanel.setVisible(true); + this.add(conceptPanel); + this.add(p); + this.addPropertyChangeListener(handler); + conceptPanel.addPropertyChangeListener(handler); + this.repaint(); } - - /** - * 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; - } + private void unsetEverything() { removeAll(); } /** * This method sets the Informations of the selected description. */ - private void setInformation() { + public void setInformation() { ontologiesStrings = model.getOntologyURIString(); if(eval!=null) { //sets the accuracy of the selected concept @@ -283,5 +149,37 @@ double acc = ((EvaluatedDescriptionClass) eval).getAccuracy()*100; accuracyText.setText(String.valueOf(acc)+"%"); } + accuracy.setVisible(true); + accuracyText.setVisible(true); + concept.setVisible(true); + conceptText.setVisible(true); } - } + + + public GraphicalCoveragePanel getGraphicalCoveragePanel() { + return p; + } + public JPanel getConceptPanel() { + return conceptPanel; + } + public void unsetPanel() { + unsetEverything(); + conceptPanel.removeAll(); + accuracy.setVisible(false); + accuracyText.setVisible(false); + concept.setVisible(false); + conceptText.setVisible(false); + if(p != null) { + p.unsetPanel(); + } + conceptPanel.add(concept); + conceptPanel.add(accuracy); + conceptPanel.add(conceptText); + conceptPanel.add(accuracyText); + conceptPanel.setVisible(false); + this.add(conceptPanel); + + repaint(); + } + +} \ No newline at end of file Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -1,102 +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.util.Set; -import java.util.SortedSet; - -import javax.swing.JOptionPane; - -import org.dllearner.algorithms.EvaluatedDescriptionClass; -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 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; - } - - @Override - public void actionPerformed(ActionEvent a) { - if(a.getActionCommand().equals(OLD_BUTTON_LABEL)) { - String toolTip = "This are the Individuals beloning to " + model.getOldConceptOWLAPI() +":\n\n"; - SortedSet<Individual> ind = model.getReasoner().getIndividuals(model.getCurrentConcept()); - for(Individual i : ind) { - Set<String> ur = model.getOntologyURIString(); - for(String str : ur) { - if(i.toString().contains(str)) { - toolTip = toolTip + i.toManchesterSyntaxString(str, null) + "\n"; - } - } - } - JOptionPane.showMessageDialog(null, toolTip); - } - - if(a.getActionCommand().equals(NEW_BUTTON_LABEL)) { - 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) { - if(eval.getDescription().toString().contains(u)) { - toolTip = toolTip + eval.getDescription().toManchesterSyntaxString(u, null) + ":\n\n"; - } - } - - for(Individual ind : posInd) { - - for(String u : uri) { - if(ind.toString().contains(u)) { - toolTip = toolTip + ind.toManchesterSyntaxString(u, null) + "\n"; - } - } - - } - JOptionPane.showMessageDialog(null, toolTip); - - } - - } - - /** - * 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/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -110,9 +110,4 @@ 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-09 09:58:09 UTC (rev 1647) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-11 16:44:10 UTC (rev 1648) @@ -41,6 +41,7 @@ @Override public JComponent getComponent() { + //super.getOWLEditorKit().getOWLWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null).getEditorComponent().setSize(new Dimension(1024, 768)); return view.getLearnerView(); } @@ -52,6 +53,7 @@ @Override public boolean isValidInput() { view.makeView(); + view.getMoreDetailForSuggestedConceptsPanel().unsetPanel(); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-12 14:51:48
|
Revision: 1650 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1650&view=rev Author: heeroyuy Date: 2009-03-12 14:51:39 +0000 (Thu, 12 Mar 2009) Log Message: ----------- -set tooltip too plus -set scrollPane to the plugin view Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.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/MoreDetailForSuggestedConceptsPanel.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-11 16:44:45 UTC (rev 1649) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-12 14:51:39 UTC (rev 1650) @@ -108,7 +108,7 @@ model.setLearningProblem(); model.setLearningAlgorithm(); view.getRunButton().setEnabled(false); - view.renderErrorMessage("learning started"); + view.renderErrorMessage("learning\nstarted"); retriever = new SuggestionRetriever(); retriever.execute(); // model.setCurrentConcept(null); @@ -144,6 +144,7 @@ if (z.getActionCommand().equals("Why")) { view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel( evaluatedDescription); + view.setGraphicalPanel(); view.getMoreDetailForSuggestedConceptsPanel().repaint(); } } @@ -224,6 +225,7 @@ } view.getMoreDetailForSuggestedConceptsPanel() .renderDetailPanel(evaluatedDescription); + view.setGraphicalPanel(); view.getMoreDetailForSuggestedConceptsPanel().repaint(); } } @@ -310,9 +312,7 @@ if (la != null) { publish(la.getCurrentlyBestEvaluatedDescriptions(view .getPosAndNegSelectPanel().getOptionPanel() - .getNrOfConcepts(), view - .getPosAndNegSelectPanel().getOptionPanel() - .getMinAccuracy(), false)); + .getNrOfConcepts())); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-11 16:44:45 UTC (rev 1649) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-12 14:51:39 UTC (rev 1650) @@ -32,6 +32,7 @@ import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JToggleButton; @@ -105,6 +106,8 @@ private final MoreDetailForSuggestedConceptsPanel detail; private ReadingOntologyThread readThread; private final OWLEditorKit editorKit; + private final JPanel learnerPanel; + private final JScrollPane learnerScroll; /** * The constructor for the DL-Learner tab in the class description @@ -118,6 +121,10 @@ model = new DLLearnerModel(editorKit, this); model.setID(label); sugPanel = new SuggestClassPanel(); + learnerPanel = new JPanel(); + learnerPanel.setLayout(new BorderLayout()); + learnerPanel.setPreferredSize(new Dimension(600, 400)); + learnerScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); 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"); @@ -139,10 +146,9 @@ learner = new JPanel(); advanced.setSize(20, 20); learner.setLayout(null); - //learner.setPreferredSize(new Dimension(600, 520)); - learner.setSize(new Dimension(1024, 768)); accept.setPreferredSize(new Dimension(290, 50)); advanced.setName("Advanced"); + learnerScroll.setPreferredSize(new Dimension(600, 400)); posPanel = new PosAndNegSelectPanel(model, action); detail = new MoreDetailForSuggestedConceptsPanel(model); this.addAcceptButtonListener(this.action); @@ -170,6 +176,7 @@ * This Method renders the view of the plugin. */ public void makeView() { + learner.remove(detail); run.setEnabled(false); System.out.println("hier"); detail.unsetPanel(); @@ -187,19 +194,19 @@ sugPanel = sugPanel.updateSuggestClassList(); advanced.setSelected(false); sugPanel.setBounds(10, 35, 490, 110); - adv.setBounds(40, 505, 200, 20); + adv.setBounds(40, 195, 200, 20); wikiPane.setBounds(220, 0, 350, 30); addButtonPanel.setBounds(510, 40, 80, 110); run.setBounds(10, 0, 200, 30); - advanced.setBounds(10, 505, 20, 20); + advanced.setBounds(10, 195, 20, 20); detail.setBounds(10, 195, 600, 300); detail.setVisible(true); sugPanel.setVisible(true); posPanel.setVisible(false); - posPanel.setBounds(10, 535, 490, 250); + posPanel.setBounds(10, 225, 490, 250); accept.setBounds(510, 40, 80, 110); hint.setBounds(10, 150, 490, 35); - errorMessage.setBounds(10, 180, 490, 20); + errorMessage.setBounds(510, 100, 490, 50); learner.add(run); learner.add(wikiPane); learner.add(adv); @@ -209,7 +216,8 @@ learner.add(hint); learner.add(errorMessage); learner.add(posPanel); - learner.add(detail); + learnerPanel.add(learner); + learnerScroll.setViewportView(learnerPanel); this.renderErrorMessage(""); } @@ -226,6 +234,27 @@ } } + public void setGraphicalPanel() { + learner.remove(posPanel); + learner.remove(advanced); + learner.remove(adv); + learner.repaint(); + posPanel.setBounds(10, 535, 490, 250); + adv.setBounds(40, 505, 200, 20); + advanced.setBounds(10, 505, 20, 20); + detail.setBounds(10, 195, 600, 300); + detail.setVisible(true); + learner.add(adv); + learner.add(advanced); + learner.add(posPanel); + learner.add(detail); + learnerPanel.removeAll(); + learnerPanel.add(learner); + learnerScroll.setViewportView(learnerPanel); + learnerScroll.repaint(); + + + } /** * This Method changes the hint message. * @param message String hintmessage @@ -356,12 +385,12 @@ * This method sets the run button enable after learning. */ public void algorithmTerminated() { - String error = "learning successful"; + String error = "learning\nsuccessful"; String message = ""; if(isInconsistent) { message = "Class descriptions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; } else { - message = "To view details about why a class description was suggested, please doubleclick on it."; + message = "To view details about why a class description was suggested, please click on it."; } run.setEnabled(true); // start the algorithm and print the best concept found @@ -370,7 +399,7 @@ } public JComponent getLearnerView() { - return learner; + return learnerScroll; } public DLLearnerModel getDLLearnerModel() { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-11 16:44:45 UTC (rev 1649) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-12 14:51:39 UTC (rev 1650) @@ -46,7 +46,7 @@ private static final int HEIGHT = 150; private static final int WIDTH = 150; private static final int ELLIPSE_X_AXIS = 5; - private static final int ELLIPSE_Y_AXIS = 25; + private static final int ELLIPSE_Y_AXIS = 5; private static final int MAX_NUMBER_OF_INDIVIDUAL_POINTS = 20; private static final int PLUS_SIZE = 5; private static final int GAP = 20; @@ -87,15 +87,11 @@ * 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) { + String concept, MoreDetailForSuggestedConceptsPanel p) { this.setPreferredSize(new Dimension(WIDTH, HEIGHT + 100)); this.setVisible(false); this.setForeground(Color.GREEN); @@ -117,7 +113,6 @@ this.computeIndividualPoints(); this.addMouseMotionListener(handler); this.addMouseListener(handler); - // this.addPropertyChangeListener(handler); } @Override @@ -130,12 +125,10 @@ AlphaComposite.SRC_OVER, 0.5f); g2D.setColor(Color.YELLOW); g2D.fill(oldConcept); - g2D.setColor(Color.BLACK); - g2D.drawString(model.getOldConceptOWLAPI().toString(), 10, 15); - g2D.setColor(Color.BLACK); - g2D.drawString(conceptNew, 10 + WIDTH, 15); - g2D.setComposite(ac); + g2D.drawString(model.getOldConceptOWLAPI().toString(), 310, 10); g2D.setColor(Color.ORANGE); + g2D.drawString(conceptNew, 310, 30); + g2D.setComposite(ac); g2D.fill(newConcept); g2D.setColor(Color.BLACK); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-11 16:44:45 UTC (rev 1649) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-12 14:51:39 UTC (rev 1650) @@ -71,6 +71,24 @@ @Override public void mouseMoved(MouseEvent m) { panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + if (m.getX() >= panel.getX1() + panel.getShiftCovered() + && m.getX() <= panel.getX2() + panel.getShiftCovered() + && m.getY() >= panel.getY1() && m.getY() <= panel.getY2() + || m.getX() >= panel.getX1() + panel.getShiftNewConcept() + && m.getX() <= panel.getX2() + panel.getShiftNewConcept() + && m.getY() >= panel.getY1() && m.getY() <= panel.getY2() + || m.getX() >= panel.getX1() + panel.getShiftNewConceptX() + && m.getX() <= panel.getX2() + panel.getShiftNewConceptX() + && m.getY() >= panel.getY1() + panel.getShiftNewConcept() + && m.getY() <= panel.getY2() + panel.getShiftNewConcept() + || m.getX() >= panel.getX1() - panel.getShiftOldConcept() + && m.getX() <= panel.getX2() - panel.getShiftOldConcept() + && m.getY() >= panel.getY1() && m.getY() <= panel.getY2()) { + panel.getGraphicalCoveragePanel().setToolTipText( + "To view all Individuals please click on the plus"); + } else { + panel.getGraphicalCoveragePanel().setToolTipText(null); + } Vector<IndividualPoint> v = panel.getIndividualVector(); for (int i = 0; i < v.size(); i++) { if (v.get(i).getXAxis() >= m.getX() - 5 @@ -80,9 +98,7 @@ panel.getGraphicalCoveragePanel().setToolTipText( v.get(i).getIndividualName()); } - } - } @Override Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-03-11 16:44:45 UTC (rev 1649) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-03-12 14:51:39 UTC (rev 1650) @@ -59,7 +59,7 @@ private final JTextArea concept; private Set<String> ontologiesStrings; private final JTextArea conceptText; - private static final int HEIGHT = 500; + private static final int HEIGHT = 350; private static final int WIDTH = 600; private GraphicalCoveragePanel p; private final MoreDetailForSuggestedConceptsPanelHandler handler; @@ -111,8 +111,8 @@ //panel for the informations of the selected concept //this method adds the informations for the selected concept to the panel this.setInformation(); - p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), WIDTH, HEIGHT-200, this); - p.setBounds(5, 60, 600, 350); + p = new GraphicalCoveragePanel(eval, model, conceptText.getText(), this); + p.setBounds(5, 0, 600, 350); //adds all information to the example panel unsetEverything(); conceptPanel.removeAll(); @@ -121,7 +121,7 @@ conceptPanel.add(conceptText); conceptPanel.add(accuracyText); conceptPanel.setVisible(true); - this.add(conceptPanel); + //this.add(conceptPanel); this.add(p); this.addPropertyChangeListener(handler); conceptPanel.addPropertyChangeListener(handler); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-03-11 16:44:45 UTC (rev 1649) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-03-12 14:51:39 UTC (rev 1650) @@ -47,14 +47,13 @@ //Scroll panel if the suggestions are longer than the Panel itself - private JScrollPane suggestScroll; + private final JScrollPane suggestScroll; /** * This is the constructor for the suggest panel. * It creates a new Scroll panel and puts the Suggest List in it. */ public SuggestClassPanel() { super(); - suggestScroll = new JScrollPane(); //renders scroll bars if necessary suggestScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); descriptions = new JList(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-16 10:23:26
|
Revision: 1651 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1651&view=rev Author: heeroyuy Date: 2009-03-16 10:23:18 +0000 (Mon, 16 Mar 2009) Log Message: ----------- -draw points at a random point on graphical panel 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/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-12 14:51:39 UTC (rev 1650) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-16 10:23:18 UTC (rev 1651) @@ -141,12 +141,6 @@ view.setExamplePanelVisible(toggled); } } - if (z.getActionCommand().equals("Why")) { - view.getMoreDetailForSuggestedConceptsPanel().renderDetailPanel( - evaluatedDescription); - view.setGraphicalPanel(); - view.getMoreDetailForSuggestedConceptsPanel().repaint(); - } } /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-12 14:51:39 UTC (rev 1650) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-16 10:23:18 UTC (rev 1651) @@ -184,8 +184,8 @@ sources = new HashSet<KnowledgeSource>(); } - public void setID(String id) { - this.id = id; + public void setID(String d) { + this.id = d; } /** * This method initializes the SimpleSuggestionLearningAlgorithm and adds @@ -521,6 +521,10 @@ public void setInstancesCount(int i) { instancesCount = i; } + + public String getID() { + return id; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-12 14:51:39 UTC (rev 1650) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-16 10:23:18 UTC (rev 1651) @@ -25,6 +25,7 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.geom.Ellipse2D; +import java.util.Random; import java.util.Set; import java.util.Vector; @@ -49,7 +50,8 @@ private static final int ELLIPSE_Y_AXIS = 5; private static final int MAX_NUMBER_OF_INDIVIDUAL_POINTS = 20; private static final int PLUS_SIZE = 5; - private static final int GAP = 20; + private static final String EQUI_STRING = "equivalent class"; + private final String id; private int shiftXAxis; private int distortionOld; private final Ellipse2D oldConcept; @@ -60,6 +62,7 @@ private final String conceptNew; private final Vector<IndividualPoint> posCovIndVector; private final Vector<IndividualPoint> posNotCovIndVector; + private final Vector<IndividualPoint> additionalIndividuals; private final Vector<IndividualPoint> points; private final GraphicalCoveragePanelHandler handler; private int adjustment; @@ -75,6 +78,7 @@ private int y2; private int centerX; private int centerY; + private final Random random; private final MoreDetailForSuggestedConceptsPanel panel; /** @@ -99,9 +103,12 @@ eval = desc; model = m; panel = p; + id = model.getID(); + random = new Random(); conceptNew = concept; posCovIndVector = new Vector<IndividualPoint>(); posNotCovIndVector = new Vector<IndividualPoint>(); + additionalIndividuals = new Vector<IndividualPoint>(); points = new Vector<IndividualPoint>(); this.computeGraphics(); handler = new GraphicalCoveragePanelHandler(this, desc, model); @@ -255,6 +262,13 @@ posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); } + + for (int i = 0; i < additionalIndividuals.size(); i++) { + g2D.setColor(Color.BLACK); + g2D.drawString(additionalIndividuals.get(i).getPoint(), + additionalIndividuals.get(i).getXAxis(), + additionalIndividuals.get(i).getYAxis()); + } this.setVisible(true); panel.repaint(); } @@ -292,22 +306,22 @@ if (eval != null) { coveredIndividualSize = ((EvaluatedDescriptionClass) eval) .getCoveredInstances().size(); - double newConcept = ((EvaluatedDescriptionClass) eval) + double newConcepts = ((EvaluatedDescriptionClass) eval) .getAddition(); - double oldConcept = ((EvaluatedDescriptionClass) eval) + double oldConcepts = ((EvaluatedDescriptionClass) eval) .getCoverage(); shiftNewConcept = 0; shiftOldConcept = 0; shiftNewConceptX = 0; shiftCovered = 0; if (coveredIndividualSize == 0) { - shiftNewConcept = (int) Math.round((WIDTH / 2.0) * newConcept); + shiftNewConcept = (int) Math.round((WIDTH / 2.0) * newConcepts); } else if (additionalIndividualSize != coveredIndividualSize) { shiftNewConcept = (int) Math.round((WIDTH / 2.0) - * (newConcept + (1 - oldConcept))); - shiftOldConcept = (int) Math.round((WIDTH / 2.0) * oldConcept); + * (newConcepts + (1 - oldConcepts))); + shiftOldConcept = (int) Math.round((WIDTH / 2.0) * oldConcepts); shiftCovered = (int) Math.round((WIDTH / 2.0) - * (1 - oldConcept)); + * (1 - oldConcepts)); } if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0) { shiftCovered = (int) Math.round((WIDTH / 2.0) * 0.625); @@ -322,46 +336,33 @@ Set<Individual> posInd = ((EvaluatedDescriptionClass) eval) .getCoveredInstances(); int i = 0; - double x = 100; - double y = 100; + double x = random.nextInt(300); + double y = random.nextInt(300); boolean flag = true; for (Individual ind : posInd) { flag = true; if (i < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (x >= oldConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } + if (newConcept.contains(x, y) + && oldConcept.contains(x, y) + && !(x >= this.getX1() + this.getShiftCovered()-5 + && x <= this.getX2() + + this.getShiftCovered()+5 + && y >= this.getY1()-5 && y <= this + .getY2()+5)) { + posCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + i++; + flag = false; - if (y >= oldConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - } - - if (x >= newConcept.getMaxX()) { - x = (int) newConcept.getMinX(); - y = y + GAP; - } - - if (y >= newConcept.getMaxY()) { - y = (int) newConcept.getMinY(); + x = random.nextInt(300); + y = random.nextInt(300); break; + } else { + x = random.nextInt(300); + y = random.nextInt(300); } - while (x < newConcept.getMaxX()) { - - if (newConcept.contains(x, y) - && oldConcept.contains(x, y)) { - posCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toString())); - i++; - flag = false; - x = x + GAP; - break; - } else { - x = x + GAP; - } - } } } } @@ -369,36 +370,44 @@ Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval) .getAdditionalInstances(); int j = 0; - x = 100; - y = 100; + x = random.nextInt(300); + y = random.nextInt(300); for (Individual ind : posNotCovInd) { flag = true; if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (x >= newConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } - - if (y >= newConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); - break; - } - - while (x < newConcept.getMaxX()) { - - if (!oldConcept.contains(x, y) - && newConcept.contains(x, y)) { + if (!oldConcept.contains(x, y) + && newConcept.contains(x, y) + && !(x >= this.getX1() + + this.getShiftNewConcept()-5 + && x <= this.getX2() + + this.getShiftNewConcept()+5 + && y >= this.getY1()-5 && y <= this + .getY2()+5) && !(x >= this.getX1() + + this.getShiftNewConceptX()-5 + && x <= this.getX2() + + this.getShiftNewConceptX()+5 + && y >= this.getY1() + + this.getShiftNewConcept()-5 && y <= this + .getY2()+5 + + this.getShiftNewConcept())) { + if (id.equals(EQUI_STRING)) { posNotCovIndVector.add(new IndividualPoint("*", (int) x, (int) y, ind.toString())); - j++; - flag = false; - x = x + GAP; - break; } else { - x = x + GAP; + additionalIndividuals.add(new IndividualPoint( + "*", (int) x, (int) y, ind.toString())); } + j++; + flag = false; + x = random.nextInt(300); + y = random.nextInt(300); + break; + } else { + x = random.nextInt(300); + y = random.nextInt(300); } + } } } @@ -407,41 +416,38 @@ model.getCurrentConcept()); notCovInd.removeAll(posInd); int k = 0; - x = 100; - y = 100; + x = random.nextInt(300); + y = random.nextInt(300); for (Individual ind : notCovInd) { flag = true; if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (x >= oldConcept.getMaxX()) { - x = (int) oldConcept.getMinX(); - y = y + GAP; - } - - if (y >= oldConcept.getMaxY()) { - y = (int) oldConcept.getMinY(); + if (oldConcept.contains(x, y) + && !newConcept.contains(x, y) + && !(x >= this.getX1()-5 + - this.getShiftOldConcept() + && x <= this.getX2()+5 + - this.getShiftOldConcept() + && y >= this.getY1()-5 && y <= this + .getY2()+5)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + k++; + flag = false; + x = random.nextInt(300); + y = random.nextInt(300); break; + } else { + x = random.nextInt(300); + y = random.nextInt(300); } - while (x < oldConcept.getMaxX()) { - - if (oldConcept.contains(x, y) - && !newConcept.contains(x, y)) { - posNotCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toString())); - k++; - flag = false; - x = x + GAP; - break; - } else { - x = x + GAP; - } - } } } } points.addAll(posCovIndVector); points.addAll(posNotCovIndVector); + points.addAll(additionalIndividuals); } } @@ -473,43 +479,87 @@ return panel; } + /** + * Returns the min. x value of the plus. + * + * @return int min X Value + */ public int getX1() { return x1; } + /** + * Returns the max. x value of the plus. + * + * @return int max X Value + */ public int getX2() { return x2; } + /** + * Returns the min. y value of the plus. + * + * @return int min Y Value + */ public int getY1() { return y1; } + /** + * Returns the max. y value of the plus. + * + * @return int max Y Value + */ public int getY2() { return y2; } + /** + * + * @return + */ public int getShiftOldConcept() { return shiftOldConcept; } + /** + * + * @return + */ public int getShiftCovered() { return shiftCovered; } + /** + * + * @return + */ public int getShiftNewConcept() { return shiftNewConcept; } + /** + * + * @return + */ public int getShiftNewConceptX() { return shiftNewConceptX; } + /** + * Unsets the panel after plugin is closed. + */ public void unsetPanel() { this.removeAll(); eval = null; } - + + /** + * Returns the currently selected evaluated description. + * + * @return EvaluatedDescription + */ public EvaluatedDescription getEvaluateddescription() { return eval; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-12 14:51:39 UTC (rev 1650) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-16 10:23:18 UTC (rev 1651) @@ -47,12 +47,12 @@ private final EvaluatedDescription description; private final DLLearnerModel model; private final JPopupMenu popup; - + /** * This is the constructor for the handler. - * - * @param p - * GraphicalCoveragePanel + * @param p GraphicalCoveragePanel + * @param eval EvaluatedDescription + * @param m DLLearnerModel */ public GraphicalCoveragePanelHandler(GraphicalCoveragePanel p, EvaluatedDescription eval, DLLearnerModel m) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-03-12 14:51:39 UTC (rev 1650) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanelHandler.java 2009-03-16 10:23:18 UTC (rev 1651) @@ -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.beans.PropertyChangeEvent; @@ -3,6 +22,16 @@ import java.beans.PropertyChangeListener; +/** + * This is the Listener for the MoreDetailForSuggestedConceptsPanel. + * @author Christian Koetteritzsch + * + */ public class MoreDetailForSuggestedConceptsPanelHandler implements PropertyChangeListener{ private final MoreDetailForSuggestedConceptsPanel panel; + + /** + * This is the constructor of the class. + * @param m MoreDetailForSuggestedConceptsPanel + */ public MoreDetailForSuggestedConceptsPanelHandler(MoreDetailForSuggestedConceptsPanel m) { panel = m; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-17 14:56:34
|
Revision: 1653 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1653&view=rev Author: heeroyuy Date: 2009-03-17 14:56:12 +0000 (Tue, 17 Mar 2009) Log Message: ----------- -added scrollbar to the popup menu that shows aqll individuals -split the new concept string on the graphical panel when it is to long -added scrollbar to main window Modified Paths: -------------- 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 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-17 00:07:12 UTC (rev 1652) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-17 14:56:12 UTC (rev 1653) @@ -123,7 +123,7 @@ sugPanel = new SuggestClassPanel(); learnerPanel = new JPanel(); learnerPanel.setLayout(new BorderLayout()); - learnerPanel.setPreferredSize(new Dimension(600, 400)); + learnerPanel.setPreferredSize(new Dimension(585, 350)); learnerScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); 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>"); @@ -146,7 +146,7 @@ learner = new JPanel(); advanced.setSize(20, 20); learner.setLayout(null); - accept.setPreferredSize(new Dimension(290, 50)); + accept.setPreferredSize(new Dimension(260, 50)); advanced.setName("Advanced"); learnerScroll.setPreferredSize(new Dimension(600, 400)); posPanel = new PosAndNegSelectPanel(model, action); @@ -196,7 +196,7 @@ sugPanel.setBounds(10, 35, 490, 110); adv.setBounds(40, 195, 200, 20); wikiPane.setBounds(220, 0, 350, 30); - addButtonPanel.setBounds(510, 40, 80, 110); + addButtonPanel.setBounds(510, 40, 80, 70); run.setBounds(10, 0, 200, 30); advanced.setBounds(10, 195, 20, 20); detail.setBounds(10, 195, 600, 300); @@ -204,7 +204,7 @@ sugPanel.setVisible(true); posPanel.setVisible(false); posPanel.setBounds(10, 225, 490, 250); - accept.setBounds(510, 40, 80, 110); + accept.setBounds(510, 40, 80, 80); hint.setBounds(10, 150, 490, 35); errorMessage.setBounds(510, 100, 490, 50); learner.add(run); @@ -248,6 +248,7 @@ learner.add(advanced); learner.add(posPanel); learner.add(detail); + learnerPanel.setPreferredSize(new Dimension(600, 660)); learnerPanel.removeAll(); learnerPanel.add(learner); learnerScroll.setViewportView(learnerPanel); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-17 00:07:12 UTC (rev 1652) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-17 14:56:12 UTC (rev 1653) @@ -59,11 +59,12 @@ private EvaluatedDescription eval; private final DLLearnerModel model; - private final String conceptNew; + private String conceptNew; private final Vector<IndividualPoint> posCovIndVector; private final Vector<IndividualPoint> posNotCovIndVector; private final Vector<IndividualPoint> additionalIndividuals; private final Vector<IndividualPoint> points; + private final Vector<String> conceptVector; private final GraphicalCoveragePanelHandler handler; private int adjustment; private int shiftOldConcept; @@ -102,10 +103,11 @@ this.repaint(); eval = desc; model = m; - panel = p; + panel = p;; id = model.getID(); random = new Random(); conceptNew = concept; + conceptVector = new Vector<String>(); posCovIndVector = new Vector<IndividualPoint>(); posNotCovIndVector = new Vector<IndividualPoint>(); additionalIndividuals = new Vector<IndividualPoint>(); @@ -134,7 +136,11 @@ g2D.fill(oldConcept); g2D.drawString(model.getOldConceptOWLAPI().toString(), 310, 10); g2D.setColor(Color.ORANGE); - g2D.drawString(conceptNew, 310, 30); + int p = 30; + for (int i = 0; i < conceptVector.size(); i++) { + g2D.drawString(conceptVector.get(i), 310, p); + p = p + 20; + } g2D.setComposite(ac); g2D.fill(newConcept); g2D.setColor(Color.BLACK); @@ -329,6 +335,19 @@ shiftNewConcept = 2 * shiftNewConceptX; } } + + int i = conceptNew.length(); + int z = 0; + while(i > 0) { + if(i >= 39 ) { + z = 39; + } else { + z = conceptNew.length(); + } + conceptVector.add(conceptNew.substring(0, z)); + conceptNew = conceptNew.replace(conceptNew.substring(0, z), ""); + i = conceptNew.length(); + } } private void computeIndividualPoints() { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-17 00:07:12 UTC (rev 1652) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-17 14:56:12 UTC (rev 1653) @@ -27,8 +27,8 @@ import java.util.Set; import java.util.Vector; -import javax.swing.JMenuItem; -import javax.swing.JPopupMenu; +import javax.swing.JComboBox; +import javax.swing.plaf.basic.BasicComboPopup; import org.dllearner.algorithms.EvaluatedDescriptionClass; import org.dllearner.core.EvaluatedDescription; @@ -46,7 +46,9 @@ private final GraphicalCoveragePanel panel; private final EvaluatedDescription description; private final DLLearnerModel model; - private final JPopupMenu popup; + private BasicComboPopup scrollPopup; + private final Vector<String> individualComboBox; + private JComboBox indiBox; /** * This is the constructor for the handler. @@ -59,7 +61,8 @@ this.panel = p; description = eval; model = m; - popup = new JPopupMenu(); + individualComboBox = new Vector<String>(); + } @Override @@ -89,6 +92,7 @@ } else { panel.getGraphicalCoveragePanel().setToolTipText(null); } + Vector<IndividualPoint> v = panel.getIndividualVector(); for (int i = 0; i < v.size(); i++) { if (v.get(i).getXAxis() >= m.getX() - 5 @@ -114,15 +118,19 @@ && arg0.getX() <= panel.getX2() + panel.getShiftCovered() && arg0.getY() >= panel.getY1() && arg0.getY() <= panel.getY2()) { - popup.removeAll(); - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + individualComboBox.clear(); + Set<Individual> covInd = ((EvaluatedDescriptionClass) description) .getCoveredInstances(); for (Individual ind : covInd) { - popup.add(new JMenuItem(ind.toString())); + individualComboBox.add(ind.toString()); } - popup.show(panel, arg0.getX(), arg0.getY()); - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + indiBox = new JComboBox(individualComboBox); + scrollPopup = new BasicComboPopup(indiBox); + scrollPopup.setAutoscrolls(true); + scrollPopup.show(panel, arg0.getX(), arg0.getY()); + //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } if (arg0.getX() >= panel.getX1() + panel.getShiftNewConcept() @@ -138,15 +146,19 @@ + panel.getShiftNewConcept() && arg0.getY() <= panel.getY2() + panel.getShiftNewConcept()) { - popup.removeAll(); - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + individualComboBox.clear(); Set<Individual> addInd = ((EvaluatedDescriptionClass) description) .getAdditionalInstances(); + for (Individual ind : addInd) { - popup.add(new JMenuItem(ind.toString())); + individualComboBox.add(ind.toString()); } - popup.show(panel, arg0.getX(), arg0.getY()); - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + indiBox = new JComboBox(individualComboBox); + scrollPopup = new BasicComboPopup(indiBox); + scrollPopup.setAutoscrolls(true); + scrollPopup.show(panel, arg0.getX(), arg0.getY()); + //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } if (arg0.getX() >= panel.getX1() - panel.getShiftOldConcept() @@ -154,17 +166,20 @@ - panel.getShiftOldConcept() && arg0.getY() >= panel.getY1() && arg0.getY() <= panel.getY2()) { - popup.removeAll(); - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + individualComboBox.clear(); Set<Individual> notCovInd = model.getReasoner().getIndividuals( model.getCurrentConcept()); notCovInd.removeAll(((EvaluatedDescriptionClass) description) .getCoveredInstances()); for (Individual ind : notCovInd) { - popup.add(new JMenuItem(ind.toString())); + individualComboBox.add(ind.toString()); } - popup.show(panel, arg0.getX(), arg0.getY()); - panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + indiBox = new JComboBox(individualComboBox); + scrollPopup = new BasicComboPopup(indiBox); + scrollPopup.setAutoscrolls(true); + scrollPopup.show(panel, arg0.getX(), arg0.getY()); + //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-20 11:21:36
|
Revision: 1655 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1655&view=rev Author: heeroyuy Date: 2009-03-20 11:21:30 +0000 (Fri, 20 Mar 2009) Log Message: ----------- -fixed some bugs -adjust scrollbar on main panel 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/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.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-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -116,7 +116,6 @@ } if (z.getActionCommand().equals("ADD")) { - view.getMoreDetailForSuggestedConceptsPanel().repaint(); if (evaluatedDescription != null) { model .changeDLLearnerDescriptionsToOWLDescriptions(evaluatedDescription @@ -127,7 +126,7 @@ .getSuggestClassPanel().getSuggestList() .getSelectedValue()); } - String message = "class description added"; + String message = "class description\nadded"; view.renderErrorMessage(message); } if (z.getActionCommand().equals("")) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -261,7 +261,6 @@ 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 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -123,7 +123,6 @@ sugPanel = new SuggestClassPanel(); learnerPanel = new JPanel(); learnerPanel.setLayout(new BorderLayout()); - learnerPanel.setPreferredSize(new Dimension(585, 350)); learnerScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); 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>"); @@ -178,10 +177,10 @@ public void makeView() { learner.remove(detail); run.setEnabled(false); - System.out.println("hier"); detail.unsetPanel(); + learnerPanel.setPreferredSize(new Dimension(575, 350)); detail.setVisible(false); - hint.setText("To get suggestions for class descriptions, please click the button above."); + hint.setText(""); isInconsistent = false; readThread = new ReadingOntologyThread(editorKit, this, model); readThread.start(); @@ -193,10 +192,10 @@ sugPanel.setSuggestList(new DefaultListModel()); sugPanel = sugPanel.updateSuggestClassList(); advanced.setSelected(false); - sugPanel.setBounds(10, 35, 490, 110); + sugPanel.setBounds(10, 35, 470, 110); adv.setBounds(40, 195, 200, 20); wikiPane.setBounds(220, 0, 350, 30); - addButtonPanel.setBounds(510, 40, 80, 70); + addButtonPanel.setBounds(485, 40, 80, 70); run.setBounds(10, 0, 200, 30); advanced.setBounds(10, 195, 20, 20); detail.setBounds(10, 195, 600, 300); @@ -206,7 +205,7 @@ posPanel.setBounds(10, 225, 490, 250); accept.setBounds(510, 40, 80, 80); hint.setBounds(10, 150, 490, 35); - errorMessage.setBounds(510, 100, 490, 50); + errorMessage.setBounds(485, 110, 80, 80); learner.add(run); learner.add(wikiPane); learner.add(adv); @@ -239,16 +238,16 @@ learner.remove(advanced); learner.remove(adv); learner.repaint(); - posPanel.setBounds(10, 535, 490, 250); - adv.setBounds(40, 505, 200, 20); - advanced.setBounds(10, 505, 20, 20); - detail.setBounds(10, 195, 600, 300); + posPanel.setBounds(10, 435, 490, 250); + adv.setBounds(40, 405, 200, 20); + advanced.setBounds(10, 405, 20, 20); + detail.setBounds(10, 195, 590, 200); detail.setVisible(true); learner.add(adv); learner.add(advanced); learner.add(posPanel); learner.add(detail); - learnerPanel.setPreferredSize(new Dimension(600, 660)); + learnerPanel.setPreferredSize(new Dimension(575, 560)); learnerPanel.removeAll(); learnerPanel.add(learner); learnerScroll.setViewportView(learnerPanel); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -223,7 +223,7 @@ + shiftNewConcept, y2 + 1); } - if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0) { + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0) { g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + shiftNewConcept, x2 + 1 + shiftNewConceptX, y1 - 1 + shiftNewConcept); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -49,12 +49,16 @@ private BasicComboPopup scrollPopup; private final Vector<String> individualComboBox; private JComboBox indiBox; - + /** * This is the constructor for the handler. - * @param p GraphicalCoveragePanel - * @param eval EvaluatedDescription - * @param m DLLearnerModel + * + * @param p + * GraphicalCoveragePanel + * @param eval + * EvaluatedDescription + * @param m + * DLLearnerModel */ public GraphicalCoveragePanelHandler(GraphicalCoveragePanel p, EvaluatedDescription eval, DLLearnerModel m) { @@ -62,7 +66,7 @@ description = eval; model = m; individualComboBox = new Vector<String>(); - + } @Override @@ -92,7 +96,7 @@ } else { panel.getGraphicalCoveragePanel().setToolTipText(null); } - + Vector<IndividualPoint> v = panel.getIndividualVector(); for (int i = 0; i < v.size(); i++) { if (v.get(i).getXAxis() >= m.getX() - 5 @@ -118,19 +122,23 @@ && arg0.getX() <= panel.getX2() + panel.getShiftCovered() && arg0.getY() >= panel.getY1() && arg0.getY() <= panel.getY2()) { - //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + + // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); individualComboBox.clear(); - + Set<Individual> covInd = ((EvaluatedDescriptionClass) description) .getCoveredInstances(); - for (Individual ind : covInd) { - individualComboBox.add(ind.toString()); + int i = covInd.size(); + if (i > 0) { + for (Individual ind : covInd) { + individualComboBox.add(ind.toString()); + } + indiBox = new JComboBox(individualComboBox); + scrollPopup = new BasicComboPopup(indiBox); + scrollPopup.setAutoscrolls(true); + scrollPopup.show(panel, arg0.getX(), arg0.getY()); + // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } - indiBox = new JComboBox(individualComboBox); - scrollPopup = new BasicComboPopup(indiBox); - scrollPopup.setAutoscrolls(true); - scrollPopup.show(panel, arg0.getX(), arg0.getY()); - //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } if (arg0.getX() >= panel.getX1() + panel.getShiftNewConcept() @@ -146,19 +154,22 @@ + panel.getShiftNewConcept() && arg0.getY() <= panel.getY2() + panel.getShiftNewConcept()) { - //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + + // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); individualComboBox.clear(); Set<Individual> addInd = ((EvaluatedDescriptionClass) description) .getAdditionalInstances(); - - for (Individual ind : addInd) { - individualComboBox.add(ind.toString()); + int i = addInd.size(); + if (i > 0) { + for (Individual ind : addInd) { + individualComboBox.add(ind.toString()); + } + indiBox = new JComboBox(individualComboBox); + scrollPopup = new BasicComboPopup(indiBox); + scrollPopup.setAutoscrolls(true); + scrollPopup.show(panel, arg0.getX(), arg0.getY()); + // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } - indiBox = new JComboBox(individualComboBox); - scrollPopup = new BasicComboPopup(indiBox); - scrollPopup.setAutoscrolls(true); - scrollPopup.show(panel, arg0.getX(), arg0.getY()); - //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } if (arg0.getX() >= panel.getX1() - panel.getShiftOldConcept() @@ -166,20 +177,24 @@ - panel.getShiftOldConcept() && arg0.getY() >= panel.getY1() && arg0.getY() <= panel.getY2()) { - //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); + + // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); individualComboBox.clear(); Set<Individual> notCovInd = model.getReasoner().getIndividuals( model.getCurrentConcept()); notCovInd.removeAll(((EvaluatedDescriptionClass) description) .getCoveredInstances()); - for (Individual ind : notCovInd) { - individualComboBox.add(ind.toString()); + int i = notCovInd.size(); + if (i > 0) { + for (Individual ind : notCovInd) { + individualComboBox.add(ind.toString()); + } + indiBox = new JComboBox(individualComboBox); + scrollPopup = new BasicComboPopup(indiBox); + scrollPopup.setAutoscrolls(true); + scrollPopup.show(panel, arg0.getX(), arg0.getY()); + // panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } - indiBox = new JComboBox(individualComboBox); - scrollPopup = new BasicComboPopup(indiBox); - scrollPopup.setAutoscrolls(true); - scrollPopup.show(panel, arg0.getX(), arg0.getY()); - //panel.getMoreDetailForSuggestedConceptsPanel().repaint(); } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -124,7 +124,7 @@ //this.add(conceptPanel); this.add(p); this.addPropertyChangeListener(handler); - conceptPanel.addPropertyChangeListener(handler); + //conceptPanel.addPropertyChangeListener(handler); this.repaint(); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -61,7 +61,7 @@ minAccuracy.setBounds(160, 0, 200, 40); - maxExecutionTime = new JSlider(2, 20, 5); + maxExecutionTime = new JSlider(2, 20, 8); maxExecutionTime.setPaintTicks(true); maxExecutionTime.setMajorTickSpacing(5); maxExecutionTime.setMinorTickSpacing(1); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -41,7 +41,6 @@ @Override public JComponent getComponent() { - //super.getOWLEditorKit().getOWLWorkspace().getOWLComponentFactory().getOWLClassDescriptionEditor(null).getEditorComponent().setSize(new Dimension(1024, 768)); return view.getLearnerView(); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -115,7 +115,6 @@ } } } else { - System.out.println("hier"); if (reasoner.getIndividuals().size() > 0) { hasIndividuals = true; @@ -172,11 +171,15 @@ this.setPositiveConcept(); if (this.hasIndividuals()) { view.getRunButton().setEnabled(true); + view.getHintPanel().setForeground(Color.BLACK); + view.setHintMessage("To get suggestions for class descriptions, please click the button above."); + } else { view.getRunButton().setEnabled(false); - view.getHintPanel().setVisible(false); - String message ="There are no Instances for available. Please insert some Instances."; - view.renderErrorMessage(message); + view.getHintPanel().setVisible(true); + String message ="There are no Instances for " + current + " available. Please insert some Instances."; + view.getHintPanel().setForeground(Color.RED); + view.setHintMessage(message); } } else { view.getHintPanel().setForeground(Color.RED); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-03-19 17:31:22 UTC (rev 1654) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-03-20 11:21:30 UTC (rev 1655) @@ -61,7 +61,7 @@ suggestPanel = new JPanel(); descriptions.setVisible(true); suggestPanel.add(descriptions); - suggestScroll.setPreferredSize(new Dimension(490, 108)); + suggestScroll.setPreferredSize(new Dimension(460, 108)); suggestScroll.setViewportView(descriptions); descriptions.setCellRenderer(new SuggestListCellRenderer()); add(suggestScroll); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-24 13:59:28
|
Revision: 1662 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1662&view=rev Author: heeroyuy Date: 2009-03-24 13:59:23 +0000 (Tue, 24 Mar 2009) Log Message: ----------- -split concept string on spaces -small changes on option panel -add own method to calculate if point is in ellipse 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/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -102,7 +102,7 @@ */ public void actionPerformed(ActionEvent z) { - if (z.getActionCommand().equals("Suggest " + id +" description")) { + if (z.getActionCommand().equals("suggest class expression")) { model.setKnowledgeSource(); model.setReasoner(); model.setLearningProblem(); @@ -126,7 +126,7 @@ .getSuggestClassPanel().getSuggestList() .getSelectedValue()); } - String message = "class description\nadded"; + String message = "class expression\nadded"; view.renderErrorMessage(message); } if (z.getActionCommand().equals("")) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -290,7 +290,7 @@ e.printStackTrace(); } cm.applyConfigEntry(la, "useNegation", false); - cm.applyConfigEntry(la, "noisePercentage", 5.0); + cm.applyConfigEntry(la, "noisePercentage", view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy()); cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view .getPosAndNegSelectPanel().getOptionPanel() .getMaxExecutionTime()); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -108,6 +108,7 @@ private final OWLEditorKit editorKit; private final JPanel learnerPanel; private final JScrollPane learnerScroll; + private static final int SCROLL_SPPED = 10; /** * The constructor for the DL-Learner tab in the class description @@ -133,7 +134,7 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); - run = new JButton("Suggest " + label + " description"); + run = new JButton("suggest class expression"); accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); @@ -141,13 +142,14 @@ errorMessage.setEditable(false); hint = new JTextArea(); hint.setEditable(false); - hint.setText("To get suggestions for class descriptions, please click the button above."); + hint.setText("To get suggestions for class expression, please click the button above."); learner = new JPanel(); advanced.setSize(20, 20); learner.setLayout(null); accept.setPreferredSize(new Dimension(260, 50)); advanced.setName("Advanced"); learnerScroll.setPreferredSize(new Dimension(600, 400)); + learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPPED); posPanel = new PosAndNegSelectPanel(model, action); detail = new MoreDetailForSuggestedConceptsPanel(model); this.addAcceptButtonListener(this.action); @@ -388,9 +390,9 @@ String error = "learning\nsuccessful"; String message = ""; if(isInconsistent) { - message = "Class descriptions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; + message = "Class expressions marked red will lead to an inconsistent ontology. \nPlease double click on them to view detail information."; } else { - message = "To view details about why a class description was suggested, please click on it."; + message = "To view details about why a class expression was suggested, please click on it."; } run.setEnabled(true); // start the algorithm and print the best concept found Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -50,6 +50,8 @@ private static final int ELLIPSE_Y_AXIS = 5; private static final int MAX_NUMBER_OF_INDIVIDUAL_POINTS = 20; private static final int PLUS_SIZE = 5; + private static final int SUBSTRING_SIZE = 25; + private static final int SPACE_SIZE = 7; private static final String EQUI_STRING = "equivalent class"; private final String id; private int shiftXAxis; @@ -80,6 +82,8 @@ private int centerX; private int centerY; private final Random random; + private final Color darkGreen; + private final Color darkRed; private final MoreDetailForSuggestedConceptsPanel panel; /** @@ -103,8 +107,10 @@ this.repaint(); eval = desc; model = m; - panel = p;; + panel = p; id = model.getID(); + darkGreen = new Color(0, 100, 0); + darkRed = new Color(205, 0, 0); random = new Random(); conceptNew = concept; conceptVector = new Vector<String>(); @@ -132,15 +138,21 @@ AlphaComposite ac = AlphaComposite.getInstance( AlphaComposite.SRC_OVER, 0.5f); - g2D.setColor(Color.YELLOW); - g2D.fill(oldConcept); - g2D.drawString(model.getOldConceptOWLAPI().toString(), 310, 10); + g2D.setColor(Color.BLACK); + g2D.drawString(model.getOldConceptOWLAPI().toString(), 320, 10); g2D.setColor(Color.ORANGE); + g2D.fillOval(310, 20, 9, 9); + g2D.setColor(Color.black); int p = 30; for (int i = 0; i < conceptVector.size(); i++) { - g2D.drawString(conceptVector.get(i), 310, p); + g2D.drawString(conceptVector.get(i), 320, p); p = p + 20; } + + g2D.setColor(Color.YELLOW); + g2D.fill(oldConcept); + g2D.fillOval(310, 0, 9, 9); + g2D.setColor(Color.ORANGE); g2D.setComposite(ac); g2D.fill(newConcept); g2D.setColor(Color.BLACK); @@ -223,7 +235,8 @@ + shiftNewConcept, y2 + 1); } - if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0) { + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 + && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0) { g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + shiftNewConcept, x2 + 1 + shiftNewConceptX, y1 - 1 + shiftNewConcept); @@ -256,14 +269,14 @@ } for (int i = 0; i < posCovIndVector.size(); i++) { - g2D.setColor(Color.GREEN); + g2D.setColor(darkGreen); g2D.drawString(posCovIndVector.get(i).getPoint(), posCovIndVector.get(i).getXAxis(), posCovIndVector.get( i).getYAxis()); } for (int i = 0; i < posNotCovIndVector.size(); i++) { - g2D.setColor(Color.RED); + g2D.setColor(darkRed); g2D.drawString(posNotCovIndVector.get(i).getPoint(), posNotCovIndVector.get(i).getXAxis(), posNotCovIndVector.get(i).getYAxis()); @@ -335,17 +348,37 @@ shiftNewConcept = 2 * shiftNewConceptX; } } - + int i = conceptNew.length(); - int z = 0; - while(i > 0) { - if(i >= 39 ) { - z = 39; - } else { - z = conceptNew.length(); + while (i > 0) { + int sub = conceptNew.indexOf(" "); + String subString = conceptNew.substring(0, sub) + " "; + conceptNew = conceptNew.replace(conceptNew.substring(0, sub+1), ""); + while(sub < SUBSTRING_SIZE) { + if(conceptNew.length() > 0 && conceptNew.contains(" ")) { + sub = conceptNew.indexOf(" "); + if(subString.length() + sub < SUBSTRING_SIZE) { + subString = subString + conceptNew.substring(0, sub) + " "; + conceptNew = conceptNew.replace(conceptNew.substring(0, sub+1), ""); + System.out.println("string: " + subString + " lenght: " + subString.length()); + sub = subString.length(); + } else { + break; + } + } else { + if(subString.length() + conceptNew.length() > SUBSTRING_SIZE + SPACE_SIZE) { + conceptVector.add(subString); + subString = conceptNew; + conceptNew = ""; + break; + } else { + subString = subString + conceptNew; + conceptNew = ""; + break; + } + } } - conceptVector.add(conceptNew.substring(0, z)); - conceptNew = conceptNew.replace(conceptNew.substring(0, z), ""); + conceptVector.add(subString); i = conceptNew.length(); } } @@ -362,13 +395,14 @@ flag = true; if (i < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (newConcept.contains(x, y) - && oldConcept.contains(x, y) - && !(x >= this.getX1() + this.getShiftCovered()-5 + if (this.isInCircle(x, y, newConcept) + && this.isInCircle(x, y, oldConcept) + && !(x >= this.getX1() + this.getShiftCovered() + - 5 && x <= this.getX2() - + this.getShiftCovered()+5 - && y >= this.getY1()-5 && y <= this - .getY2()+5)) { + + this.getShiftCovered() + 5 + && y >= this.getY1() - 5 && y <= this + .getY2() + 5)) { posCovIndVector.add(new IndividualPoint("*", (int) x, (int) y, ind.toString())); i++; @@ -395,21 +429,23 @@ flag = true; if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (!oldConcept.contains(x, y) - && newConcept.contains(x, y) + if (!this.isInCircle(x, y, oldConcept) + && this.isInCircle(x, y, newConcept) && !(x >= this.getX1() - + this.getShiftNewConcept()-5 + + this.getShiftNewConcept() - 5 && x <= this.getX2() - + this.getShiftNewConcept()+5 - && y >= this.getY1()-5 && y <= this - .getY2()+5) && !(x >= this.getX1() - + this.getShiftNewConceptX()-5 + + this.getShiftNewConcept() + 5 + && y >= this.getY1() - 5 && y <= this + .getY2() + 5) + && !(x >= this.getX1() + + this.getShiftNewConceptX() - 5 && x <= this.getX2() - + this.getShiftNewConceptX()+5 + + this.getShiftNewConceptX() + + 5 && y >= this.getY1() - + this.getShiftNewConcept()-5 && y <= this - .getY2()+5 - + this.getShiftNewConcept())) { + + this.getShiftNewConcept() - 5 && y <= this + .getY2() + + 5 + this.getShiftNewConcept())) { if (id.equals(EQUI_STRING)) { posNotCovIndVector.add(new IndividualPoint("*", (int) x, (int) y, ind.toString())); @@ -441,14 +477,14 @@ flag = true; if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (oldConcept.contains(x, y) - && !newConcept.contains(x, y) - && !(x >= this.getX1()-5 + if (this.isInCircle(x, y, oldConcept) + && !this.isInCircle(x, y, newConcept) + && !(x >= this.getX1() - 5 - this.getShiftOldConcept() - && x <= this.getX2()+5 + && x <= this.getX2() + 5 - this.getShiftOldConcept() - && y >= this.getY1()-5 && y <= this - .getY2()+5)) { + && y >= this.getY1() - 5 && y <= this + .getY2() + 5)) { posNotCovIndVector.add(new IndividualPoint("*", (int) x, (int) y, ind.toString())); k++; @@ -582,4 +618,15 @@ public EvaluatedDescription getEvaluateddescription() { return eval; } + + public boolean isInCircle(double x, double y, Ellipse2D ell) { + int r = (WIDTH / 2) * (WIDTH / 2); + int n = (int) ((x - ell.getCenterX()) * (x - ell.getCenterX())) + + (int) ((y - ell.getCenterY()) * (y - ell.getCenterY())); + if (n <= r) { + return true; + } else { + return false; + } + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-24 09:14:51 UTC (rev 1661) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-24 13:59:23 UTC (rev 1662) @@ -53,12 +53,12 @@ nrOfConceptsLabel = new JLabel("maximum number of results"); nrOfConceptsLabel.setBounds(5, 80, 150, 40); - minAccuracy = new JSlider(50, 100, 90); + minAccuracy = new JSlider(0, 50, 5); minAccuracy.setPaintTicks(true); minAccuracy.setMajorTickSpacing(10); minAccuracy.setMinorTickSpacing(1); minAccuracy.setPaintLabels(true); - minAccuracy.setBounds(160, 0, 200, 40); + minAccuracy.setBounds(200, 0, 200, 40); maxExecutionTime = new JSlider(2, 20, 8); @@ -66,7 +66,7 @@ maxExecutionTime.setMajorTickSpacing(5); maxExecutionTime.setMinorTickSpacing(1); maxExecutionTime.setPaintLabels(true); - maxExecutionTime.setBounds(160, 40, 200, 40); + maxExecutionTime.setBounds(200, 40, 200, 40); nrOfConcepts = new JSlider(2, 20, 10); @@ -74,7 +74,7 @@ nrOfConcepts.setMajorTickSpacing(2); nrOfConcepts.setMinorTickSpacing(1); nrOfConcepts.setPaintLabels(true); - nrOfConcepts.setBounds(160, 80, 200, 40); + nrOfConcepts.setBounds(200, 80, 200, 40); add(minAccuracyLabel); add(minAccuracy); @@ -89,7 +89,7 @@ * @return double minAccuracy */ public double getMinAccuracy() { - int acc = minAccuracy.getValue(); + double acc = minAccuracy.getValue(); accuracy = (acc/100.0); return accuracy; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-24 15:55:26
|
Revision: 1663 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1663&view=rev Author: heeroyuy Date: 2009-03-24 15:55:16 +0000 (Tue, 24 Mar 2009) Log Message: ----------- -small changes in option panel and graphical panel Modified Paths: -------------- 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/OptionPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-24 13:59:23 UTC (rev 1662) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-24 15:55:16 UTC (rev 1663) @@ -57,7 +57,7 @@ private int shiftXAxis; private int distortionOld; private final Ellipse2D oldConcept; - private Ellipse2D newConcept; + private final Ellipse2D newConcept; private EvaluatedDescription eval; private final DLLearnerModel model; @@ -120,9 +120,9 @@ points = new Vector<IndividualPoint>(); this.computeGraphics(); handler = new GraphicalCoveragePanelHandler(this, desc, model); - oldConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + (2 * adjustment), + oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment), ELLIPSE_Y_AXIS, WIDTH, HEIGHT); - newConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + shiftXAxis + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld, HEIGHT + distortionOld); this.computeIndividualPoints(); @@ -148,7 +148,15 @@ g2D.drawString(conceptVector.get(i), 320, p); p = p + 20; } - + g2D.setColor(darkGreen); + g2D.drawString("*", 310, p+3); + g2D.setColor(Color.BLACK); + g2D.drawString("positive Example", 320, p); + p = p + 20; + g2D.setColor(darkRed); + g2D.drawString("*", 310, p+3); + g2D.setColor(Color.BLACK); + g2D.drawString("negative Example", 320, p); g2D.setColor(Color.YELLOW); g2D.fill(oldConcept); g2D.fillOval(310, 0, 9, 9); @@ -301,7 +309,7 @@ .getAdditionalInstances().size(); distortionOld = 0; adjustment = 0; - Ellipse2D old = new Ellipse2D.Float(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, + Ellipse2D old = new Ellipse2D.Double(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, WIDTH, HEIGHT); x1 = (int) old.getCenterX() - PLUS_SIZE; x2 = (int) old.getCenterX() + PLUS_SIZE; @@ -313,9 +321,9 @@ shiftXAxis = (int) Math.round(WIDTH * (1 - coverage)); if (additionalIndividualSize != 0) { distortionOld = (int) Math.round(WIDTH * 0.3); - newConcept = new Ellipse2D.Float(ELLIPSE_X_AXIS + shiftXAxis, + Ellipse2D newer = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis, ELLIPSE_Y_AXIS, WIDTH, HEIGHT); - adjustment = (int) Math.round(newConcept.getCenterY() / 4); + adjustment = (int) Math.round(newer.getCenterY() / 4); } this.renderPlus(); } @@ -353,24 +361,27 @@ while (i > 0) { int sub = conceptNew.indexOf(" "); String subString = conceptNew.substring(0, sub) + " "; - conceptNew = conceptNew.replace(conceptNew.substring(0, sub+1), ""); - while(sub < SUBSTRING_SIZE) { - if(conceptNew.length() > 0 && conceptNew.contains(" ")) { - sub = conceptNew.indexOf(" "); - if(subString.length() + sub < SUBSTRING_SIZE) { - subString = subString + conceptNew.substring(0, sub) + " "; - conceptNew = conceptNew.replace(conceptNew.substring(0, sub+1), ""); - System.out.println("string: " + subString + " lenght: " + subString.length()); - sub = subString.length(); + conceptNew = conceptNew.replace(conceptNew.substring(0, sub + 1), + ""); + while (sub < SUBSTRING_SIZE) { + if (conceptNew.length() > 0 && conceptNew.contains(" ")) { + sub = conceptNew.indexOf(" "); + if (subString.length() + sub < SUBSTRING_SIZE) { + subString = subString + conceptNew.substring(0, sub) + + " "; + conceptNew = conceptNew.replace(conceptNew.substring(0, + sub + 1), ""); + sub = subString.length(); + } else { + break; + } } else { - break; - } - } else { - if(subString.length() + conceptNew.length() > SUBSTRING_SIZE + SPACE_SIZE) { - conceptVector.add(subString); - subString = conceptNew; - conceptNew = ""; - break; + if (subString.length() + conceptNew.length() > SUBSTRING_SIZE + + SPACE_SIZE) { + conceptVector.add(subString); + subString = conceptNew; + conceptNew = ""; + break; } else { subString = subString + conceptNew; conceptNew = ""; @@ -395,16 +406,20 @@ flag = true; if (i < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (this.isInCircle(x, y, newConcept) - && this.isInCircle(x, y, oldConcept) + if (newConcept.contains(x, y) + && oldConcept.contains(x, y) && !(x >= this.getX1() + this.getShiftCovered() - - 5 && x <= this.getX2() - + this.getShiftCovered() + 5 - && y >= this.getY1() - 5 && y <= this - .getY2() + 5)) { - posCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toString())); + + this.getShiftCovered() + && y >= this.getY1() && y <= this + .getY2())) { + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + posCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + } + } i++; flag = false; @@ -429,29 +444,38 @@ flag = true; if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (!this.isInCircle(x, y, oldConcept) - && this.isInCircle(x, y, newConcept) + if (!oldConcept.contains(x, y) + && newConcept.contains(x, y) && !(x >= this.getX1() - + this.getShiftNewConcept() - 5 + + this.getShiftNewConcept() && x <= this.getX2() - + this.getShiftNewConcept() + 5 - && y >= this.getY1() - 5 && y <= this - .getY2() + 5) + + this.getShiftNewConcept() + && y >= this.getY1() && y <= this + .getY2()) && !(x >= this.getX1() - + this.getShiftNewConceptX() - 5 + + this.getShiftNewConceptX() && x <= this.getX2() + this.getShiftNewConceptX() - + 5 && y >= this.getY1() - + this.getShiftNewConcept() - 5 && y <= this + + this.getShiftNewConcept() && y <= this .getY2() - + 5 + this.getShiftNewConcept())) { + + this.getShiftNewConcept())) { if (id.equals(EQUI_STRING)) { - posNotCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toString())); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + } + } } else { - additionalIndividuals.add(new IndividualPoint( - "*", (int) x, (int) y, ind.toString())); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + additionalIndividuals.add(new IndividualPoint("*", + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + } + } } j++; flag = false; @@ -477,16 +501,21 @@ flag = true; if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { while (flag) { - if (this.isInCircle(x, y, oldConcept) - && !this.isInCircle(x, y, newConcept) - && !(x >= this.getX1() - 5 + if (oldConcept.contains(x, y) + && !newConcept.contains(x, y) + && !(x >= this.getX1() - this.getShiftOldConcept() - && x <= this.getX2() + 5 + && x <= this.getX2() - this.getShiftOldConcept() - && y >= this.getY1() - 5 && y <= this - .getY2() + 5)) { - posNotCovIndVector.add(new IndividualPoint("*", - (int) x, (int) y, ind.toString())); + && y >= this.getY1() && y <= this + .getY2())) { + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toManchesterSyntaxString(uri, null))); + } + } k++; flag = false; x = random.nextInt(300); @@ -622,7 +651,7 @@ public boolean isInCircle(double x, double y, Ellipse2D ell) { int r = (WIDTH / 2) * (WIDTH / 2); int n = (int) ((x - ell.getCenterX()) * (x - ell.getCenterX())) - + (int) ((y - ell.getCenterY()) * (y - ell.getCenterY())); + + (int) ((y - ell.getCenterY()-5) * (y - ell.getCenterY()-5)); if (n <= r) { return true; } else { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-24 13:59:23 UTC (rev 1662) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanelHandler.java 2009-03-24 15:55:16 UTC (rev 1663) @@ -93,8 +93,6 @@ && m.getY() >= panel.getY1() && m.getY() <= panel.getY2()) { panel.getGraphicalCoveragePanel().setToolTipText( "To view all Individuals please click on the plus"); - } else { - panel.getGraphicalCoveragePanel().setToolTipText(null); } Vector<IndividualPoint> v = panel.getIndividualVector(); @@ -131,7 +129,12 @@ int i = covInd.size(); if (i > 0) { for (Individual ind : covInd) { - individualComboBox.add(ind.toString()); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + } + } } indiBox = new JComboBox(individualComboBox); scrollPopup = new BasicComboPopup(indiBox); @@ -162,7 +165,12 @@ int i = addInd.size(); if (i > 0) { for (Individual ind : addInd) { - individualComboBox.add(ind.toString()); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + } + } } indiBox = new JComboBox(individualComboBox); scrollPopup = new BasicComboPopup(indiBox); @@ -187,7 +195,12 @@ int i = notCovInd.size(); if (i > 0) { for (Individual ind : notCovInd) { - individualComboBox.add(ind.toString()); + Set<String> uriString = model.getOntologyURIString(); + for(String uri : uriString) { + if(ind.toString().contains(uri)) { + individualComboBox.add(ind.toManchesterSyntaxString(uri, null)); + } + } } indiBox = new JComboBox(individualComboBox); scrollPopup = new BasicComboPopup(indiBox); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-24 13:59:23 UTC (rev 1662) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-24 15:55:16 UTC (rev 1663) @@ -50,7 +50,7 @@ minAccuracyLabel.setBounds(5, 0, 150, 40); maxExecutionTimeLabel = new JLabel("maximum execution time"); maxExecutionTimeLabel.setBounds(5, 40, 150, 40); - nrOfConceptsLabel = new JLabel("maximum number of results"); + nrOfConceptsLabel = new JLabel("max. number of results"); nrOfConceptsLabel.setBounds(5, 80, 150, 40); minAccuracy = new JSlider(0, 50, 5); @@ -61,9 +61,9 @@ minAccuracy.setBounds(200, 0, 200, 40); - maxExecutionTime = new JSlider(2, 20, 8); + maxExecutionTime = new JSlider(0, 40, 8); maxExecutionTime.setPaintTicks(true); - maxExecutionTime.setMajorTickSpacing(5); + maxExecutionTime.setMajorTickSpacing(10); maxExecutionTime.setMinorTickSpacing(1); maxExecutionTime.setPaintLabels(true); maxExecutionTime.setBounds(200, 40, 200, 40); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-03-26 14:26:56
|
Revision: 1667 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1667&view=rev Author: heeroyuy Date: 2009-03-26 14:26:46 +0000 (Thu, 26 Mar 2009) Log Message: ----------- -fixed plus misplacing -set more space between slider in the option panel Modified Paths: -------------- 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/IndividualPoint.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-26 11:26:36 UTC (rev 1666) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-03-26 14:26:46 UTC (rev 1667) @@ -229,9 +229,11 @@ public void setIconToggled(boolean toggled) { if (toggled) { advanced.setIcon(toggledIcon); + learnerPanel.setPreferredSize(new Dimension(575, 400)); } if (!toggled) { advanced.setIcon(icon); + learnerPanel.setPreferredSize(new Dimension(575, 350)); } } @@ -249,7 +251,7 @@ learner.add(advanced); learner.add(posPanel); learner.add(detail); - learnerPanel.setPreferredSize(new Dimension(575, 560)); + learnerPanel.setPreferredSize(new Dimension(575, 620)); learnerPanel.removeAll(); learnerPanel.add(learner); learnerScroll.setViewportView(learnerPanel); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-26 11:26:36 UTC (rev 1666) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-03-26 14:26:46 UTC (rev 1667) @@ -151,12 +151,14 @@ g2D.setColor(darkGreen); g2D.drawString("*", 310, p+3); g2D.setColor(Color.BLACK); - g2D.drawString("positive Example", 320, p); + g2D.drawString("individuals covered by the new", 320, p); p = p + 20; + g2D.drawString("class expression", 320, p); + p = p + 20; g2D.setColor(darkRed); g2D.drawString("*", 310, p+3); g2D.setColor(Color.BLACK); - g2D.drawString("negative Example", 320, p); + g2D.drawString("additional or not covered individuals", 320, p); g2D.setColor(Color.YELLOW); g2D.fill(oldConcept); g2D.fillOval(310, 0, 9, 9); @@ -278,23 +280,17 @@ for (int i = 0; i < posCovIndVector.size(); i++) { g2D.setColor(darkGreen); - g2D.drawString(posCovIndVector.get(i).getPoint(), - posCovIndVector.get(i).getXAxis(), posCovIndVector.get( - i).getYAxis()); + g2D.draw(posCovIndVector.get(i).getIndividualPoint()); } for (int i = 0; i < posNotCovIndVector.size(); i++) { g2D.setColor(darkRed); - g2D.drawString(posNotCovIndVector.get(i).getPoint(), - posNotCovIndVector.get(i).getXAxis(), - posNotCovIndVector.get(i).getYAxis()); + g2D.draw(posNotCovIndVector.get(i).getIndividualPoint()); } for (int i = 0; i < additionalIndividuals.size(); i++) { g2D.setColor(Color.BLACK); - g2D.drawString(additionalIndividuals.get(i).getPoint(), - additionalIndividuals.get(i).getXAxis(), - additionalIndividuals.get(i).getYAxis()); + g2D.draw(additionalIndividuals.get(i).getIndividualPoint()); } this.setVisible(true); panel.repaint(); @@ -319,7 +315,8 @@ centerY = (int) old.getCenterY(); double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); shiftXAxis = (int) Math.round(WIDTH * (1 - coverage)); - if (additionalIndividualSize != 0) { + + if (additionalIndividualSize != 0 && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0 && ((EvaluatedDescriptionClass) eval).getAddition() < 1.0) { distortionOld = (int) Math.round(WIDTH * 0.3); Ellipse2D newer = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis, ELLIPSE_Y_AXIS, WIDTH, HEIGHT); @@ -345,12 +342,13 @@ shiftNewConcept = (int) Math.round((WIDTH / 2.0) * newConcepts); } else if (additionalIndividualSize != coveredIndividualSize) { shiftNewConcept = (int) Math.round((WIDTH / 2.0) - * (newConcepts + (1 - oldConcepts))); + * (1.0 + (1.0 - oldConcepts))); shiftOldConcept = (int) Math.round((WIDTH / 2.0) * oldConcepts); shiftCovered = (int) Math.round((WIDTH / 2.0) * (1 - oldConcepts)); } - if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0) { + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 && ((EvaluatedDescriptionClass) eval) + .getCoverage() == 1.0) { shiftCovered = (int) Math.round((WIDTH / 2.0) * 0.625); shiftNewConceptX = shiftCovered; shiftNewConcept = 2 * shiftNewConceptX; @@ -647,15 +645,4 @@ public EvaluatedDescription getEvaluateddescription() { return eval; } - - public boolean isInCircle(double x, double y, Ellipse2D ell) { - int r = (WIDTH / 2) * (WIDTH / 2); - int n = (int) ((x - ell.getCenterX()) * (x - ell.getCenterX())) - + (int) ((y - ell.getCenterY()-5) * (y - ell.getCenterY()-5)); - if (n <= r) { - return true; - } else { - return false; - } - } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-03-26 11:26:36 UTC (rev 1666) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualPoint.java 2009-03-26 14:26:46 UTC (rev 1667) @@ -19,6 +19,8 @@ */ package org.dllearner.tools.protege; +import java.awt.geom.Ellipse2D; + /** * This class is a datastructure for one individual shown in * the GraphicalCoveragePanel. @@ -31,6 +33,7 @@ private int xAxis; private int yAxis; private final String individual; + private final Ellipse2D circlePoint; /** * Constructor of the class. @@ -43,6 +46,7 @@ this.point = p; this.xAxis = x; this.yAxis = y; + this.circlePoint = new Ellipse2D.Double(x - 1, y - 1, 3, 3); this.individual = ind; } @@ -101,5 +105,8 @@ public String getIndividualName() { return individual; } - + + public Ellipse2D getIndividualPoint() { + return circlePoint; + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-26 11:26:36 UTC (rev 1666) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2009-03-26 14:26:46 UTC (rev 1667) @@ -44,14 +44,14 @@ * Constructor for the Option Panel. */ public OptionPanel() { - setPreferredSize(new Dimension(490, 100)); + setPreferredSize(new Dimension(490, 150)); setLayout(null); minAccuracyLabel = new JLabel("noise in %"); minAccuracyLabel.setBounds(5, 0, 150, 40); maxExecutionTimeLabel = new JLabel("maximum execution time"); - maxExecutionTimeLabel.setBounds(5, 40, 150, 40); + maxExecutionTimeLabel.setBounds(5, 60, 150, 40); nrOfConceptsLabel = new JLabel("max. number of results"); - nrOfConceptsLabel.setBounds(5, 80, 150, 40); + nrOfConceptsLabel.setBounds(5, 120, 150, 40); minAccuracy = new JSlider(0, 50, 5); minAccuracy.setPaintTicks(true); @@ -66,7 +66,7 @@ maxExecutionTime.setMajorTickSpacing(10); maxExecutionTime.setMinorTickSpacing(1); maxExecutionTime.setPaintLabels(true); - maxExecutionTime.setBounds(200, 40, 200, 40); + maxExecutionTime.setBounds(200, 60, 200, 40); nrOfConcepts = new JSlider(2, 20, 10); @@ -74,7 +74,7 @@ nrOfConcepts.setMajorTickSpacing(2); nrOfConcepts.setMinorTickSpacing(1); nrOfConcepts.setPaintLabels(true); - nrOfConcepts.setBounds(200, 80, 200, 40); + nrOfConcepts.setBounds(200, 120, 200, 40); add(minAccuracyLabel); add(minAccuracy); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-04-07 09:46:51
|
Revision: 1684 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1684&view=rev Author: heeroyuy Date: 2009-04-07 09:45:11 +0000 (Tue, 07 Apr 2009) Log Message: ----------- -fixed some bugs -started gridbaglayout for dllearnerview -added axiom types when plugin should displayed to plugin.xml (plugin now incompatible to protege beta build 109) 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/EllipseTest.java trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 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-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -60,7 +60,6 @@ // This is the id that checks if the equivalent class or subclass button is // pressed in protege - 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 @@ -86,9 +85,8 @@ * id if it is a subclass or an equivalent class * */ - public ActionHandler(DLLearnerModel m, DLLearnerView view, String i) { + public ActionHandler(DLLearnerModel m, DLLearnerView view) { this.view = view; - this.id = i; this.model = m; toggled = false; @@ -142,13 +140,6 @@ } } - /** - * - * @return id StringID if it is a Subclass or an equivalent class. - */ - public String getID() { - return id; - } /** * select/deselect the Check boxes. @@ -385,7 +376,7 @@ // (ontology, null), // ((EvaluatedDescriptionClass) // eval).getAccuracy()*100)); - if (model.isConsistent(eval)) { + if (((EvaluatedDescriptionClass) eval).isConsistent()) { dm.add(i, new SuggestListItem(colorGreen, eval.getDescription() .toManchesterSyntaxString( Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -39,7 +39,6 @@ import org.dllearner.core.owl.NamedClass; import org.dllearner.kb.OWLAPIOntology; import org.dllearner.learningproblems.ClassLearningProblem; -import org.dllearner.learningproblems.EvaluatedDescriptionClass; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.mindswap.pellet.exceptions.InconsistentOntologyException; @@ -79,7 +78,7 @@ private final ComponentManager cm; 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 SUPER_CLASS_AXIOM_STRING = "super class"; private static final String EQUIVALENT_CLASS_LEARNING = "equivalence"; private static final String SUPER_CLASS_LEARNING = "superClass"; @@ -137,8 +136,6 @@ // The Individuals of the Ontology private Set<Individual> individual; - private int instancesCount; - // The error message which is rendered when an error occured @@ -174,7 +171,6 @@ this.view = view; ontologyConsistent = true; - instancesCount = 0; owlDescription = new HashSet<OWLDescription>(); ComponentManager.setComponentClasses(componenten); cm = ComponentManager.getInstance(); @@ -454,24 +450,6 @@ } /** - * This Method checks if after inserting of this concept the ontology is - * still consistent. - * - * @param eDescription - * EvauatedDescription - * @return isConsistent boolean - */ - public boolean isConsistent(EvaluatedDescription eDescription) { - boolean isConsistent = false; - if (((EvaluatedDescriptionClass) eDescription).getCoveredInstances().size() < instancesCount) { - isConsistent = false; - } else { - isConsistent = true; - } - return isConsistent; - } - - /** * This method sets the suggestion list. * * @param list @@ -513,14 +491,6 @@ return individual; } - /** - * This method sets the number of instances. - * @param i number of instances - */ - public void setInstancesCount(int i) { - instancesCount = i; - } - public String getID() { return id; } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerView.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -22,6 +22,8 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.event.ActionListener; import java.net.URL; import java.util.Set; @@ -108,7 +110,13 @@ private final OWLEditorKit editorKit; private final JPanel learnerPanel; private final JScrollPane learnerScroll; - private static final int SCROLL_SPPED = 10; + private static final int SCROLL_SPEED = 10; + private static final int WIDTH = 575; + private static final int HEIGHT = 350; + private static final int OPTION_HEIGHT = 400; + private static final int SCROLL_WIDTH = 600; + private static final int SCROLL_HEIGHT = 400; + private boolean toogled = false; /** * The constructor for the DL-Learner tab in the class description @@ -117,15 +125,14 @@ * @param editor OWLEditorKit * @param label String */ - public DLLearnerView(String label, OWLEditorKit editor) { + public DLLearnerView(OWLEditorKit editor) { editorKit = editor; model = new DLLearnerModel(editorKit, this); - model.setID(label); sugPanel = new SuggestClassPanel(); learnerPanel = new JPanel(); learnerPanel.setLayout(new BorderLayout()); learnerScroll = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - action = new ActionHandler(model, this, label); + action = new ActionHandler(model, this); 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); @@ -134,7 +141,9 @@ adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); + run = new JButton("suggest class expression"); + accept = new JButton("ADD"); addButtonPanel = new JPanel(new BorderLayout()); sugPanel.addSuggestPanelMouseListener(action); @@ -145,19 +154,20 @@ hint.setText("To get suggestions for class expression, please click the button above."); learner = new JPanel(); advanced.setSize(20, 20); - learner.setLayout(null); - accept.setPreferredSize(new Dimension(260, 50)); + learner.setLayout(new GridBagLayout()); + accept.setPreferredSize(new Dimension(90, 50)); + run.setPreferredSize(new Dimension(130, 30)); advanced.setName("Advanced"); - learnerScroll.setPreferredSize(new Dimension(600, 400)); - learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPPED); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); + learnerScroll.getVerticalScrollBar().setUnitIncrement(SCROLL_SPEED); posPanel = new PosAndNegSelectPanel(model, action); detail = new MoreDetailForSuggestedConceptsPanel(model); this.addAcceptButtonListener(this.action); this.addRunButtonListener(this.action); - this.addAdvancedButtonListener(this.action); - + this.addAdvancedButtonListener(this.action); } + /** * This method returns the SuggestClassPanel. * @return SuggestClassPanel @@ -176,88 +186,132 @@ /** * This Method renders the view of the plugin. */ - public void makeView() { + public void makeView(String label) { + GridBagConstraints c = new GridBagConstraints(); learner.remove(detail); + model.setID(label); + run.setEnabled(false); + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.RELATIVE; + c.anchor = GridBagConstraints.FIRST_LINE_START; + learner.add(run, c); + + c.fill = GridBagConstraints.HORIZONTAL; + c.gridwidth = GridBagConstraints.REMAINDER; + learner.add(wikiPane, c); + + sugPanel.setSuggestList(new DefaultListModel()); + sugPanel = sugPanel.updateSuggestClassList(); + c.gridwidth = GridBagConstraints.RELATIVE; + c.fill = GridBagConstraints.NONE; + learner.add(sugPanel, c); + + accept.setEnabled(false); + addButtonPanel.add("North", accept); + c.gridwidth = GridBagConstraints.REMAINDER; + learner.add(addButtonPanel, c); + + c.fill = GridBagConstraints.HORIZONTAL; + c.gridwidth = GridBagConstraints.REMAINDER; + c.ipady = 20; + learner.add(hint, c); + + + advanced.setIcon(icon); + advanced.setSelected(false); + c.ipady = 0; + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.RELATIVE; + learner.add(advanced, c); + + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.REMAINDER; + c.ipady = 20; + learner.add(adv, c); + + posPanel.setVisible(false); + c.fill = GridBagConstraints.NONE; + c.gridwidth = GridBagConstraints.RELATIVE; + c.gridx = 0; + c.gridy = 4; + c.gridwidth = 3; + c.ipady = 80; + learner.add(posPanel, c); + + detail.unsetPanel(); - learnerPanel.setPreferredSize(new Dimension(575, 350)); + learnerPanel.setPreferredSize(new Dimension(WIDTH, HEIGHT)); detail.setVisible(false); hint.setText(""); 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(new DefaultListModel()); - sugPanel = sugPanel.updateSuggestClassList(); - advanced.setSelected(false); - sugPanel.setBounds(10, 35, 470, 110); - adv.setBounds(40, 195, 200, 20); - wikiPane.setBounds(220, 0, 350, 30); addButtonPanel.setBounds(485, 40, 80, 70); - run.setBounds(10, 0, 200, 30); - advanced.setBounds(10, 195, 20, 20); detail.setBounds(10, 195, 600, 300); detail.setVisible(true); sugPanel.setVisible(true); - posPanel.setVisible(false); - posPanel.setBounds(10, 225, 490, 250); - accept.setBounds(510, 40, 80, 80); - hint.setBounds(10, 150, 490, 35); - errorMessage.setBounds(485, 110, 80, 80); - learner.add(run); - learner.add(wikiPane); - learner.add(adv); - learner.add(advanced); - learner.add(sugPanel); - learner.add(addButtonPanel); - learner.add(hint); - learner.add(errorMessage); - learner.add(posPanel); - learnerPanel.add(learner); - learnerScroll.setViewportView(learnerPanel); + learnerScroll.setViewportView(learner); this.renderErrorMessage(""); } + /** * This method sets the right icon for the advanced Panel. * @param toggled boolean */ public void setIconToggled(boolean toggled) { - if (toggled) { + this.toogled = toggled; + if (this.toogled) { advanced.setIcon(toggledIcon); - learnerPanel.setPreferredSize(new Dimension(575, 400)); + learnerPanel.setPreferredSize(new Dimension(WIDTH, OPTION_HEIGHT)); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); } - if (!toggled) { + if (!this.toogled) { advanced.setIcon(icon); - learnerPanel.setPreferredSize(new Dimension(575, 350)); + learnerPanel.setPreferredSize(new Dimension(WIDTH, HEIGHT)); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); } } public void setGraphicalPanel() { + GridBagConstraints c = new GridBagConstraints(); learner.remove(posPanel); learner.remove(advanced); learner.remove(adv); learner.repaint(); - posPanel.setBounds(10, 435, 490, 250); - adv.setBounds(40, 405, 200, 20); - advanced.setBounds(10, 405, 20, 20); - detail.setBounds(10, 195, 590, 200); detail.setVisible(true); - learner.add(adv); - learner.add(advanced); - learner.add(posPanel); - learner.add(detail); - learnerPanel.setPreferredSize(new Dimension(575, 620)); - learnerPanel.removeAll(); - learnerPanel.add(learner); - learnerScroll.setViewportView(learnerPanel); - learnerScroll.repaint(); + c.fill = GridBagConstraints.NONE; + c.gridx = 0; + c.gridy = 3; + c.gridwidth = 3; + c.ipady = 80; + learner.add(detail, c); + c.fill = GridBagConstraints.HORIZONTAL; + c.gridx = 0; + c.gridy = 4; + c.gridwidth = 1; + learner.add(advanced, c); + + c.fill = GridBagConstraints.HORIZONTAL; + c.gridx = 1; + c.gridy = 4; + c.gridwidth = GridBagConstraints.REMAINDER; + learner.add(adv, c); + + c.fill = GridBagConstraints.NONE; + c.gridx = 0; + c.gridy = 5; + c.gridwidth = 3; + c.ipady = 80; + learner.add(posPanel, c); + learnerScroll.setPreferredSize(new Dimension(SCROLL_WIDTH, SCROLL_HEIGHT)); + learnerScroll.setViewportView(learner); + learnerScroll.repaint(); } /** * This Method changes the hint message. Modified: trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/EllipseTest.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -13,8 +13,8 @@ public class EllipseTest extends JPanel { private static final long serialVersionUID = -5676466024192284648L; - private Ellipse2D te; - private Random random; + private final Ellipse2D te; + private final Random random; public EllipseTest() { te = new Ellipse2D.Double(0, 0, 150, 150); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/GraphicalCoveragePanel.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -56,8 +56,8 @@ private final String id; private int shiftXAxis; private int distortionOld; - private final Ellipse2D oldConcept; - private final Ellipse2D newConcept; + private Ellipse2D oldConcept; + private Ellipse2D newConcept; private EvaluatedDescription eval; private final DLLearnerModel model; @@ -118,14 +118,14 @@ posNotCovIndVector = new Vector<IndividualPoint>(); additionalIndividuals = new Vector<IndividualPoint>(); points = new Vector<IndividualPoint>(); - this.computeGraphics(); + this.computeGraphics(0, 0); handler = new GraphicalCoveragePanelHandler(this, desc, model); oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment), ELLIPSE_Y_AXIS, WIDTH, HEIGHT); newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld, HEIGHT + distortionOld); - this.computeIndividualPoints(); + this.computeIndividualPoints(300); this.addMouseMotionListener(handler); this.addMouseListener(handler); } @@ -149,16 +149,33 @@ p = p + 20; } g2D.setColor(darkGreen); - g2D.drawString("*", 310, p+3); + Ellipse2D circlePoint = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); + g2D.draw(circlePoint); g2D.setColor(Color.BLACK); g2D.drawString("individuals covered by the new", 320, p); p = p + 20; g2D.drawString("class expression", 320, p); p = p + 20; - g2D.setColor(darkRed); - g2D.drawString("*", 310, p+3); - g2D.setColor(Color.BLACK); - g2D.drawString("additional or not covered individuals", 320, p); + if(id.equals(EQUI_STRING)) { + g2D.setColor(darkRed); + Ellipse2D circlePoint2 = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); + g2D.draw(circlePoint2); + g2D.setColor(Color.BLACK); + g2D.drawString("additional or not covered individuals", 320, p); + } else { + g2D.setColor(darkRed); + Ellipse2D circlePoint2 = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); + g2D.draw(circlePoint2); + g2D.setColor(Color.BLACK); + g2D.drawString("not covered individuals", 320, p); + p = p + 20; + g2D.setColor(Color.BLACK); + Ellipse2D circlePoint3 = new Ellipse2D.Double(315 - 1, p - 6, 3, 3); + g2D.draw(circlePoint3); + g2D.setColor(Color.BLACK); + g2D.drawString("additional individuals", 320, p); + } + g2D.setColor(Color.YELLOW); g2D.fill(oldConcept); g2D.fillOval(310, 0, 9, 9); @@ -297,7 +314,7 @@ } } - private void computeGraphics() { + private void computeGraphics(int w, int h) { if (eval != null) { this.setVisible(true); panel.repaint(); @@ -306,7 +323,7 @@ distortionOld = 0; adjustment = 0; Ellipse2D old = new Ellipse2D.Double(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, - WIDTH, HEIGHT); + WIDTH + w, HEIGHT + h); x1 = (int) old.getCenterX() - PLUS_SIZE; x2 = (int) old.getCenterX() + PLUS_SIZE; y1 = (int) old.getCenterY() - PLUS_SIZE; @@ -314,19 +331,19 @@ centerX = (int) old.getCenterX(); centerY = (int) old.getCenterY(); double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); - shiftXAxis = (int) Math.round(WIDTH * (1 - coverage)); + shiftXAxis = (int) Math.round((WIDTH + w) * (1 - coverage)); if (additionalIndividualSize != 0 && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0 && ((EvaluatedDescriptionClass) eval).getAddition() < 1.0) { - distortionOld = (int) Math.round(WIDTH * 0.3); + distortionOld = (int) Math.round((WIDTH + w) * 0.3); Ellipse2D newer = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis, - ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + ELLIPSE_Y_AXIS, (WIDTH + w), HEIGHT + h); adjustment = (int) Math.round(newer.getCenterY() / 4); } - this.renderPlus(); + this.renderPlus(w); } } - private void renderPlus() { + private void renderPlus(int w) { if (eval != null) { coveredIndividualSize = ((EvaluatedDescriptionClass) eval) .getCoveredInstances().size(); @@ -339,17 +356,17 @@ shiftNewConceptX = 0; shiftCovered = 0; if (coveredIndividualSize == 0) { - shiftNewConcept = (int) Math.round((WIDTH / 2.0) * newConcepts); + shiftNewConcept = (int) Math.round(((WIDTH + w) / 2.0) * newConcepts); } else if (additionalIndividualSize != coveredIndividualSize) { - shiftNewConcept = (int) Math.round((WIDTH / 2.0) + shiftNewConcept = (int) Math.round(((WIDTH + w) / 2.0) * (1.0 + (1.0 - oldConcepts))); - shiftOldConcept = (int) Math.round((WIDTH / 2.0) * oldConcepts); - shiftCovered = (int) Math.round((WIDTH / 2.0) + shiftOldConcept = (int) Math.round(((WIDTH + w) / 2.0) * oldConcepts); + shiftCovered = (int) Math.round(((WIDTH + w) / 2.0) * (1 - oldConcepts)); } if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 && ((EvaluatedDescriptionClass) eval) .getCoverage() == 1.0) { - shiftCovered = (int) Math.round((WIDTH / 2.0) * 0.625); + shiftCovered = (int) Math.round(((WIDTH + w) / 2.0) * 0.625); shiftNewConceptX = shiftCovered; shiftNewConcept = 2 * shiftNewConceptX; } @@ -392,13 +409,13 @@ } } - private void computeIndividualPoints() { + private void computeIndividualPoints(int n) { if (eval != null) { Set<Individual> posInd = ((EvaluatedDescriptionClass) eval) .getCoveredInstances(); int i = 0; - double x = random.nextInt(300); - double y = random.nextInt(300); + double x = random.nextInt(n); + double y = random.nextInt(n); boolean flag = true; for (Individual ind : posInd) { flag = true; @@ -421,12 +438,12 @@ i++; flag = false; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); break; } else { - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); } } @@ -436,8 +453,8 @@ Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval) .getAdditionalInstances(); int j = 0; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); for (Individual ind : posNotCovInd) { flag = true; if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { @@ -477,12 +494,12 @@ } j++; flag = false; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); break; } else { - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); } } @@ -493,8 +510,8 @@ model.getCurrentConcept()); notCovInd.removeAll(posInd); int k = 0; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); for (Individual ind : notCovInd) { flag = true; if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { @@ -516,12 +533,12 @@ } k++; flag = false; - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); break; } else { - x = random.nextInt(300); - y = random.nextInt(300); + x = random.nextInt(n); + y = random.nextInt(n); } } @@ -645,4 +662,17 @@ public EvaluatedDescription getEvaluateddescription() { return eval; } + + public void resizePanel(int w, int h) { + this.setPreferredSize(new Dimension(WIDTH + w, HEIGHT + 100 + h)); + this.computeGraphics(w, h); + oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + (2 * adjustment), + ELLIPSE_Y_AXIS, WIDTH + w, HEIGHT + h); + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis + + adjustment, ELLIPSE_Y_AXIS, WIDTH + distortionOld + w, HEIGHT + + distortionOld + h); + this.computeIndividualPoints(300 + w + h); + this.repaint(); + + } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/META-INF/plugin.xml 2009-04-07 09:45:11 UTC (rev 1684) @@ -3,7 +3,9 @@ <extension id="org.dllearner.tools.protege.ProtegePlugin" point="org.protege.editor.owl.ui.editor.description"> <label value="DL-Learner"/> + <axiomTypes value="Equivalent classes axiom,SubClass axiom"/> <class value="org.dllearner.tools.protege.ProtegePlugin"/> + <index value="E"/> </extension> </plugin> \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -37,6 +37,8 @@ public class ProtegePlugin extends AbstractOWLDescriptionEditor { private static final long serialVersionUID = 728362819273927L; private DLLearnerView view; + private static final String EQUIVALENT_CLASS_STRING = "Equivalent classes axiom"; + private static final String SUPERCLASS_STRING = "SubClass axiom"; @Override @@ -51,7 +53,11 @@ @Override public boolean isValidInput() { - view.makeView(); + if(this.getAxiomType().toString().equals(EQUIVALENT_CLASS_STRING)) { + view.makeView("equivalent class"); + } else if(this.getAxiomType().toString().equals(SUPERCLASS_STRING)) { + view.makeView("super class"); + } view.getMoreDetailForSuggestedConceptsPanel().unsetPanel(); return true; } @@ -63,8 +69,12 @@ @Override public void initialise() throws Exception { - view = new DLLearnerView("equivalent class", super.getOWLEditorKit()); - view.makeView(); + view = new DLLearnerView(super.getOWLEditorKit()); + if(this.getAxiomType().toString().equals(EQUIVALENT_CLASS_STRING)) { + view.makeView("equivalent class"); + } else if(this.getAxiomType().toString().equals(SUPERCLASS_STRING)) { + view.makeView("super class"); + } } @Override Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ReadingOntologyThread.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -98,7 +98,6 @@ currentConcept = concept; if (reasoner.getIndividuals(concept) != null) { if (reasoner.getIndividuals(concept).size() > 0) { - model.setInstancesCount(reasoner.getIndividuals(concept).size()); hasIndividuals = true; } individual = reasoner.getIndividuals(concept); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-04-06 12:23:42 UTC (rev 1683) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2009-04-07 09:45:11 UTC (rev 1684) @@ -48,6 +48,8 @@ //Scroll panel if the suggestions are longer than the Panel itself private final JScrollPane suggestScroll; + private static final int WIDTH = 460; + private static final int HEIGHT = 108; /** * This is the constructor for the suggest panel. * It creates a new Scroll panel and puts the Suggest List in it. @@ -61,7 +63,7 @@ suggestPanel = new JPanel(); descriptions.setVisible(true); suggestPanel.add(descriptions); - suggestScroll.setPreferredSize(new Dimension(460, 108)); + suggestScroll.setPreferredSize(new Dimension(WIDTH, HEIGHT)); suggestScroll.setViewportView(descriptions); descriptions.setCellRenderer(new SuggestListCellRenderer()); add(suggestScroll); @@ -102,5 +104,11 @@ } + public void resizePanel(int w, int h) { + suggestScroll.setPreferredSize(new Dimension(WIDTH + w, HEIGHT + h)); + suggestScroll.setViewportView(descriptions); + add(suggestScroll); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |