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