From: <lor...@us...> - 2008-09-22 16:41:29
|
Revision: 1237 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1237&view=rev Author: lorenz_b Date: 2008-09-22 16:41:09 +0000 (Mon, 22 Sep 2008) Log Message: ----------- checkstyle Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/Main.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/StatsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/Wizard.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardController.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardModel.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardPanelNotFoundException.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -42,10 +42,10 @@ private static final long serialVersionUID = -934113184795465461L; /** - * Constructor - * @param label - * @param changes - * @param mL + * Constructor. + * @param label labelname + * @param changes ontology changes + * @param mL mouse listener */ public ChangePanel(String label, List<OWLOntologyChange> changes, MouseListener mL){ super(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -37,6 +37,9 @@ private static final long serialVersionUID = -7538532926820669891L; + /** + * Constructor. + */ public ChangesPanel(){ super(); setLayout(new GridLayout(0, 1)); @@ -48,7 +51,7 @@ /** * Refresh the actual panel. - * @param cont + * @param cont gui container for changes */ public void updatePanel(Container cont){ remove(cont); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -53,6 +53,9 @@ private JXBusyLabel loadingLabel; private JLabel statusLabel; + /** + * Constructor. + */ @SuppressWarnings("unchecked") public ClassPanelOWL() { @@ -102,25 +105,43 @@ return contentPanel1; } + /** + * Returns list model for owl-classes. + * @return the list model + */ public DefaultListModel getModel(){ return model; } - + /** + * Adds list selection listener to atomic classes list. + * @param l the default list selection listener + */ public void addSelectionListener(ListSelectionListener l){ conceptList.addListSelectionListener(l); } - + + /** + * Returns the list where atomic owl classes are the list elements. + * @return instance of JList + */ public JList getList(){ return conceptList; } - + /** + * Returns the label which reports the loading status. + * @return instance of JLabel + */ public JLabel getStatusLabel() { return statusLabel; } + /** + * Returns the animated label for loading action. + * @return instance of JXBusyLabel + */ public JXBusyLabel getLoadingLabel() { return loadingLabel; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -21,8 +21,8 @@ package org.dllearner.tools.ore; import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; + import org.dllearner.core.owl.NamedClass; @@ -33,14 +33,23 @@ * @author Lorenz Buehmann * */ -public class ClassPanelOWLDescriptor extends WizardPanelDescriptor implements ListSelectionListener{ +public class ClassPanelOWLDescriptor extends WizardPanelDescriptor implements javax.swing.event.ListSelectionListener{ + /** + * Identification string for class choose panel. + */ public static final String IDENTIFIER = "CLASS_CHOOSE_OWL_PANEL"; - public static final String INFORMATION = "In this panel all atomic classes in the ontology are shown in the list above. " + - "Select one of them which should be (re)learned from, then press \"Next-Button\""; + /** + * Information string for class choose panel. + */ + public static final String INFORMATION = "In this panel all atomic classes in the ontology are shown in the list above. " + + "Select one of them which should be (re)learned from, then press \"Next-Button\""; private ClassPanelOWL owlClassPanel; + /** + * Constructor creates new panel and adds listener to list. + */ public ClassPanelOWLDescriptor() { owlClassPanel = new ClassPanelOWL(); owlClassPanel.addSelectionListener(this); @@ -66,12 +75,15 @@ setNextButtonAccordingToConceptSelected(); } - + /** + * Method is called when other element in list is selected, and sets next button enabled. + * @param e ListSelectionEvent + */ public void valueChanged(ListSelectionEvent e) { setNextButtonAccordingToConceptSelected(); - if (!e.getValueIsAdjusting()) - getWizardModel().getOre().setClassToLearn((NamedClass)owlClassPanel.getList().getSelectedValue()); - + if (!e.getValueIsAdjusting()) { + getWizardModel().getOre().setClassToLearn((NamedClass) owlClassPanel.getList().getSelectedValue()); + } } private void setNextButtonAccordingToConceptSelected() { @@ -83,7 +95,11 @@ } } - + + /** + * Returns the JPanel with the GUI elements. + * @return extended JPanel + */ public ClassPanelOWL getOwlClassPanel() { return owlClassPanel; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -56,15 +56,15 @@ statusLabel = new JLabel(); - loadingLabel = new JXBusyLabel(new Dimension(15,15)); + loadingLabel = new JXBusyLabel(new Dimension(15, 15)); BusyPainter painter = new BusyPainter( - new RoundRectangle2D.Float(0, 0,6.0f,2.6f,10.0f,10.0f), - new Ellipse2D.Float(2.0f,2.0f,11.0f,11.0f)); + new RoundRectangle2D.Float(0, 0, 6.0f, 2.6f, 10.0f, 10.0f), + new Ellipse2D.Float(2.0f, 2.0f, 11.0f, 11.0f)); painter.setTrailLength(2); painter.setPoints(7); painter.setFrame(-1); - loadingLabel.setPreferredSize(new Dimension(15,15)); - loadingLabel.setIcon(new EmptyIcon(15,15)); + loadingLabel.setPreferredSize(new Dimension(15, 15)); + loadingLabel.setIcon(new EmptyIcon(15, 15)); loadingLabel.setBusyPainter(painter); @@ -74,7 +74,7 @@ contentPanel = getContentPanel(); setLayout(new java.awt.BorderLayout()); - add(contentPanel,BorderLayout.CENTER); + add(contentPanel, BorderLayout.CENTER); add(labelPanel, BorderLayout.SOUTH); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -48,11 +48,11 @@ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - if(value instanceof NamedClass) - setText(((NamedClass)value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - else if(value instanceof Individual) - setText(((Individual)value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - + if(value instanceof NamedClass){ + setText(((NamedClass) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + } else if(value instanceof Individual){ + setText(((Individual) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + } Color background; Color foreground; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -61,11 +61,11 @@ desc.setText(((EvaluatedDescription) value).getDescription().toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); //round accuracy to 2 digits double accuracy = ((EvaluatedDescription) value).getAccuracy(); - BigDecimal roundedAccuracy = new BigDecimal( accuracy * 100 ); - roundedAccuracy = roundedAccuracy.setScale( 2, BigDecimal.ROUND_HALF_UP ); + BigDecimal roundedAccuracy = new BigDecimal(accuracy * 100); + roundedAccuracy = roundedAccuracy.setScale(2, BigDecimal.ROUND_HALF_UP); cor.setText(roundedAccuracy.toString()); - add(cor,new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.WEST); - add(desc,new GridBagConstraints(1, 0, 1, 1, 0.8, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.EAST); + add(cor, new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.WEST); + add(desc, new GridBagConstraints(1, 0, 1, 1, 0.8, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.EAST); Color background; Color foreground; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -95,7 +95,7 @@ baseURI = ore.getBaseURI(); prefixes = ore.getPrefixes(); - setText(((Description)desc).toManchesterSyntaxString(ore.getBaseURI(),ore.getPrefixes())); + setText(((Description) desc).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); menu = new JPopupMenu(); ToolTipManager.sharedInstance().setDismissDelay(7000); //negative example solutions @@ -103,22 +103,23 @@ if(!(desc instanceof Negation)){ if(desc instanceof NamedClass){ //1. description is a named class descriptionLabel = desc.toManchesterSyntaxString(baseURI, prefixes); - menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc) ); //1.a remove class assertion + menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc)); //1.a remove class assertion JMenu dme = new JMenu("move class assertion " + descriptionLabel + " to ..."); //1.b move individual for(NamedClass nc : ore.getpossibleClassesMoveTo(ind)){ - DescriptionMenuItem move = new DescriptionMenuItem(MOVE_TO_CLASS, nc.toManchesterSyntaxString(baseURI, prefixes), (NamedClass)desc); + DescriptionMenuItem move = new DescriptionMenuItem(MOVE_TO_CLASS, nc.toManchesterSyntaxString(baseURI, prefixes), (NamedClass) desc); move.setName(nc.toString()); dme.add(move); Set<NamedClass> complements = ore.getComplements(nc, ind); //check for complement error - if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(desc.toString())) ) ){ + if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(desc.toString())))){ move.setEnabled(false); StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " + - "is still asserted to its complements:<br><BLOCKQUOTE>"); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); - for(NamedClass n: complements) + for(NamedClass n: complements){ strBuf.append("<br><b>" + n + "</b>"); + } strBuf.append("</BLOCKQUOTE></html>"); @@ -126,27 +127,25 @@ } } menu.add(dme); - } - else if(desc instanceof ObjectSomeRestriction){ //2. description is a object some restriction - String propertyName = ((ObjectSomeRestriction)desc).getRole().toString(baseURI, prefixes); - String propertyRange = ((ObjectSomeRestriction)desc).getChild(0).toManchesterSyntaxString(baseURI, prefixes); + } else if(desc instanceof ObjectSomeRestriction){ //2. description is a object some restriction + String propertyName = ((ObjectSomeRestriction) desc).getRole().toString(baseURI, prefixes); + String propertyRange = ((ObjectSomeRestriction) desc).getChild(0).toManchesterSyntaxString(baseURI, prefixes); menu.add(new DescriptionMenuItem(DELETE_PROPERTY, propertyName , desc)); //2.a remove all property assertions - if (!(desc.getChild(0) instanceof Thing)) - menu.add(new DescriptionMenuItem(REMOVE_RANGE_PROPERTY,propertyRange , desc)); //2.b remove property assertions with objects in range - - } - else if(desc instanceof ObjectAllRestriction){ //3. description is a object all restriction + if (!(desc.getChild(0) instanceof Thing)){ + menu.add(new DescriptionMenuItem(REMOVE_RANGE_PROPERTY, propertyRange, desc)); //2.b remove property assertions with objects in range + } + } else if(desc instanceof ObjectAllRestriction){ //3. description is a object all restriction if (!(desc.getChild(0) instanceof Thing)) { JMenu dme = new JMenu("add property assertion " + ((ObjectAllRestriction) desc).getRole().toKBSyntaxString(baseURI, prefixes) //3.a add property assertion with object not in range + " with object ..."); - for (Individual i : ore.getIndividualsNotInPropertyRange((ObjectAllRestriction) desc, ind)) - dme.add(new DescriptionMenuItem(ADD_PROPERTY,i.toManchesterSyntaxString(baseURI, prefixes), desc)); - menu.add(dme); + for (Individual i : ore.getIndividualsNotInPropertyRange((ObjectAllRestriction) desc, ind)){ + dme.add(new DescriptionMenuItem(ADD_PROPERTY, i.toManchesterSyntaxString(baseURI, prefixes), desc)); + } + menu.add(dme); } } - } - else if(desc instanceof Negation){ + } else if(desc instanceof Negation){ if(desc.getChild(0) instanceof NamedClass){ //4. description is a negated named class DescriptionMenuItem addItem = new DescriptionMenuItem(ADD_CLASS, desc.getChild(0).toManchesterSyntaxString(baseURI, prefixes), desc.getChild(0)); menu.add(addItem); //4.a add class assertion @@ -154,11 +153,12 @@ if(!complements.isEmpty()){ addItem.setEnabled(false); StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " + - "is still asserted to its complements:<br><BLOCKQUOTE>"); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); - for(NamedClass n: complements) + for(NamedClass n: complements){ strBuf.append("<br><b>" + n + "</b>"); + } strBuf.append("</BLOCKQUOTE></html>"); @@ -166,9 +166,7 @@ } } } - } - //positive example solutions - else if(mode.equals("pos")){ + } else if(mode.equals("pos")){//positive example solutions if(!(desc instanceof Negation)){ if(desc instanceof NamedClass){ DescriptionMenuItem add = new DescriptionMenuItem(ADD_CLASS, desc.toManchesterSyntaxString(baseURI, prefixes), desc); @@ -176,11 +174,12 @@ if(!(complements.isEmpty())){ add.setEnabled(false); StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " + - "is still asserted to its complements:<br><BLOCKQUOTE>"); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); - for(NamedClass n: complements) + for(NamedClass n: complements){ strBuf.append("<br><b>" + n + "</b>"); + } strBuf.append("</BLOCKQUOTE></html>"); @@ -192,18 +191,19 @@ if(moveClasses.size() > 0){ JMenu move = new JMenu("move to " + desc.toManchesterSyntaxString(baseURI, prefixes) + " from ..."); for (NamedClass m : moveClasses){System.out.println("hier" + m); - DescriptionMenuItem item = new DescriptionMenuItem(MOVE_FROM_CLASS,m.toManchesterSyntaxString(baseURI, prefixes), desc); + DescriptionMenuItem item = new DescriptionMenuItem(MOVE_FROM_CLASS, m.toManchesterSyntaxString(baseURI, prefixes), desc); item.setName(m.toString()); move.add(item); if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(m.toString())))){ move.setEnabled(false); StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>moving class is not possible because individual<br> " + - "is still asserted to its complements:<br><BLOCKQUOTE>"); + strBuf.append("<html>moving class is not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); - for(NamedClass n: complements) + for(NamedClass n: complements){ strBuf.append("<br><b>" + n + "</b>"); + } strBuf.append("</BLOCKQUOTE></html>"); @@ -215,31 +215,28 @@ } - } - else if(desc instanceof ObjectSomeRestriction){ + } else if(desc instanceof ObjectSomeRestriction){ JMenu dme = new JMenu("add property assertion " + ((ObjectSomeRestriction) desc).getRole() + " with object ..."); - for (Individual i : ore.getIndividualsInPropertyRange((ObjectSomeRestriction) desc, ind)) - dme.add(new DescriptionMenuItem(ADD_PROPERTY,i.toManchesterSyntaxString(baseURI, prefixes), desc)); - menu.add(dme); + for (Individual i : ore.getIndividualsInPropertyRange((ObjectSomeRestriction) desc, ind)){ + dme.add(new DescriptionMenuItem(ADD_PROPERTY, i.toManchesterSyntaxString(baseURI, prefixes), desc)); + } + menu.add(dme); - } - else if(desc instanceof ObjectAllRestriction){ + } else if(desc instanceof ObjectAllRestriction){ if (!(desc.getChild(0) instanceof Thing)) { - menu.add(new DescriptionMenuItem(REMOVE_NOT_RANGE_PROPERTY,((ObjectAllRestriction) desc).getChild(0).toString(baseURI, prefixes), desc)); - menu.add(new DescriptionMenuItem(DELETE_PROPERTY,((ObjectAllRestriction) desc).getRole().toString(baseURI, prefixes), desc)); + menu.add(new DescriptionMenuItem(REMOVE_NOT_RANGE_PROPERTY, ((ObjectAllRestriction) desc).getChild(0).toString(baseURI, prefixes), desc)); + menu.add(new DescriptionMenuItem(DELETE_PROPERTY, ((ObjectAllRestriction) desc).getRole().toString(baseURI, prefixes), desc)); } } } - } - - else if(desc instanceof Negation){ + } else if(desc instanceof Negation){ if(desc.getChild(0) instanceof NamedClass){ descriptionLabel = desc.toManchesterSyntaxString(baseURI, prefixes); - menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc) ); + menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc)); } } } @@ -247,6 +244,7 @@ /** * returns actual description. + * @return desc Description */ public Description getDescription(){ return desc; @@ -254,15 +252,17 @@ /** * adds action listeners to menu items. - * @param aL + * @param aL ActionListener */ public void addActionListeners(ActionListener aL){ for(Component c : menu.getComponents()){ - if(c instanceof DescriptionMenuItem) - ((DescriptionMenuItem)c).addActionListener(aL); - else if(c instanceof JMenu) - for( int i = 0; i < ((JMenu)c).getItemCount(); i++) - ((JMenu)c).getItem(i).addActionListener(aL); + if(c instanceof DescriptionMenuItem){ + ((DescriptionMenuItem) c).addActionListener(aL); + } else if(c instanceof JMenu){ + for(int i = 0; i < ((JMenu) c).getItemCount(); i++){ + ((JMenu) c).getItem(i).addActionListener(aL); + } + } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -41,22 +41,23 @@ public DescriptionMenuItem(int action, String text, Description d){ super(); - if(action == 3) + if(action == 3){ setText("remove class assertion to " + text); - else if(action == 0) + } else if(action == 0){ setText(text); - else if(action == 2) + } else if(action == 2){ setText("add class assertion to " + text); - else if(action == 4) + } else if(action == 4){ setText(text); - else if(action == 6) + } else if(action == 6){ setText("delete complete property " + text); - else if(action == 5) + }else if(action == 5){ setText("remove all property assertions to " + text); - else if(action == 7) + } else if(action == 7){ setText("remove all property assertions with range not in " + text); - else if(action == 1) + } else if(action == 1){ setText(text); + } this.desc = d; this.action = action; Modified: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -66,22 +66,21 @@ add(jL); if(jL instanceof DescriptionLabel){ - ((DescriptionLabel)jL).setIndOre(ore, ind); - ((DescriptionLabel)jL).init(); - ((DescriptionLabel)jL).addActionListeners(aL); + ((DescriptionLabel) jL).setIndOre(ore, ind); + ((DescriptionLabel) jL).init(); + ((DescriptionLabel) jL).addActionListeners(aL); } } - } - else if(mode.equals("pos")){ + } else if(mode.equals("pos")){ for(JLabel jL : ore.descriptionToJLabelPos(ind, newClassDescription)){ add(jL); if(jL instanceof DescriptionLabel){ - ((DescriptionLabel)jL).setIndOre(ore, ind); - ((DescriptionLabel)jL).init(); - ((DescriptionLabel)jL).addActionListeners(aL); + ((DescriptionLabel) jL).setIndOre(ore, ind); + ((DescriptionLabel) jL).init(); + ((DescriptionLabel) jL).addActionListeners(aL); } @@ -93,10 +92,11 @@ * Updates the panel. */ public void updatePanel(){ - for(Component c : getComponents()) - if(c instanceof JLabel) + for(Component c : getComponents()){ + if(c instanceof JLabel){ remove(c); - + } + } ore.updateReasoner(); correct = true; if (mode.equals("neg")) { @@ -110,8 +110,7 @@ } } - } - else if(mode.equals("pos")){ + } else if(mode.equals("pos")){ for (JLabel jL : ore.descriptionToJLabelPos(ind, newClassDescription)) { add(jL); if (jL instanceof DescriptionLabel) { Modified: trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -84,12 +84,12 @@ instructionsField.setEditable(false); instructionsField.setLineWrap(true); instructionsField.setRows(5); - instructionsField.setFont(new Font("Serif",Font.PLAIN,14)); - instructionsField.setText("This is an test of a wizard dialog, which allows a knowledge engineer to select " + - "a class of an ontology which should be (re)learned.\n" + - "On the next page, choose a OWL file or a SPARQL-URL, that contains an ontology. After that " + - "you might be able to select a class in the ontology to learn. When the class you selected is learned" + - ", you are able to add the axiom to the ontology and after all you might be able to repair if necessary. " ); + instructionsField.setFont(new Font("Serif", Font.PLAIN, 14)); + instructionsField.setText("This is an test of a wizard dialog, which allows a knowledge engineer to select " + + "a class of an ontology which should be (re)learned.\n" + + "On the next page, choose a OWL file or a SPARQL-URL, that contains an ontology. After that " + + "you might be able to select a class in the ontology to learn. When the class you selected is learned" + + ", you are able to add the axiom to the ontology and after all you might be able to repair if necessary. "); instructionsField.setWrapStyleWord(true); jScrollPane1.setViewportView(instructionsField); @@ -99,7 +99,7 @@ welcomeTitle.setText("Welcome to the DL-Learner ORE-Tool!"); contentPanel1.add(welcomeTitle, java.awt.BorderLayout.NORTH); - jPanel1.setLayout(new java.awt.GridLayout(0, 1,0,0)); + jPanel1.setLayout(new java.awt.GridLayout(0, 1, 0, 0)); jPanel1.add(jScrollPane1); contentPanel1.add(jPanel1, java.awt.BorderLayout.CENTER); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -151,7 +151,7 @@ .addComponent(sparqlMessage)); - contentPanel1.setLayout(new GridLayout(0,1)); + contentPanel1.setLayout(new GridLayout(0, 1)); contentPanel1.add(buttonPanel); contentPanel1.add(owlPanel); contentPanel1.add(sparqlPanel); @@ -177,28 +177,33 @@ filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY); String choosenPath = fileURL.getText(); - if(!choosenPath.equals("") && (new File(choosenPath)).exists()) + if(!choosenPath.equals("") && (new File(choosenPath)).exists()){ filechooser.setCurrentDirectory(new File(fileURL.getText())); + } filechooser.addChoosableFileFilter(new FileFilter() { @Override public boolean accept(File f) { - if (f.isDirectory()) return true; + if(f.isDirectory()){ + return true; + } return f.getName().toLowerCase().endsWith(".owl"); } @Override - public String getDescription () { return "OWLs"; } + public String getDescription(){ + return "OWLs"; + } }); - int status = filechooser.showOpenDialog( null ); + int status = filechooser.showOpenDialog(null); - if ( status == JFileChooser.APPROVE_OPTION ){ + if (status == JFileChooser.APPROVE_OPTION){ String strURL = filechooser.getSelectedFile().getAbsolutePath(); fileURL.setText(strURL); - }else{ - System.out.println( "Auswahl abgebrochen" ); + } else{ + System.out.println("Auswahl abgebrochen"); } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -52,10 +52,11 @@ @Override public Object getNextPanelDescriptor() { - if(getWizard().getKnowledgeSourceType() == 0) + if(getWizard().getKnowledgeSourceType() == 0){ return ClassPanelOWLDescriptor.IDENTIFIER; - else + } else{ return ClassPanelSparqlDescriptor.IDENTIFIER; + } } @Override @@ -72,6 +73,7 @@ /** * Actions for buttons. + * @param e ActionListener */ public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -86,15 +86,15 @@ JPanel statusPanel = new JPanel(); statusLabel = new JLabel(); - loadingLabel = new JXBusyLabel(new Dimension(15,15)); + loadingLabel = new JXBusyLabel(new Dimension(15, 15)); BusyPainter<Object> painter = new BusyPainter<Object>( - new RoundRectangle2D.Float(0, 0,6.0f,2.6f,10.0f,10.0f), - new Ellipse2D.Float(2.0f,2.0f,11.0f,11.0f)); + new RoundRectangle2D.Float(0, 0, 6.0f, 2.6f, 10.0f, 10.0f), + new Ellipse2D.Float(2.0f, 2.0f, 11.0f, 11.0f)); painter.setTrailLength(2); painter.setPoints(7); painter.setFrame(-1); - loadingLabel.setPreferredSize(new Dimension(15,15)); - loadingLabel.setIcon(new EmptyIcon(15,15)); + loadingLabel.setPreferredSize(new Dimension(15, 15)); + loadingLabel.setIcon(new EmptyIcon(15, 15)); loadingLabel.setBusyPainter(painter); statusPanel.add(loadingLabel); statusPanel.add(statusLabel); @@ -102,7 +102,7 @@ contentPanel = getContentPanel(); setLayout(new java.awt.BorderLayout()); - add(contentPanel,BorderLayout.CENTER); + add(contentPanel, BorderLayout.CENTER); add(statusPanel, BorderLayout.SOUTH); { buttonSliderPanel = new JPanel(); @@ -145,10 +145,10 @@ noiseSlider.setMajorTickSpacing(10); noiseSlider.setMinorTickSpacing(5); Dictionary<Integer, JLabel> map = new Hashtable<Integer, JLabel>(); - map.put( new Integer(0), new JLabel("0%") ); - map.put( new Integer(50), new JLabel("50%") ); - map.put( new Integer(100),new JLabel("100%") ); - noiseSlider.setLabelTable( map ); + map.put(new Integer(0), new JLabel("0%")); + map.put(new Integer(50), new JLabel("50%")); + map.put(new Integer(100), new JLabel("100%")); + noiseSlider.setLabelTable(map); noiseSlider.setPaintLabels(true); noisePanel.add(noiseSlider); } @@ -162,7 +162,7 @@ listPanel = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.0, 0.5}; - jPanel1Layout.rowHeights = new int[] {16,400}; + jPanel1Layout.rowHeights = new int[] {16, 400}; jPanel1Layout.columnWeights = new double[] {0.0, 0.5}; jPanel1Layout.columnWidths = new int[] {50, 700}; listPanel.setLayout(jPanel1Layout); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -46,8 +46,8 @@ public class LearningPanelDescriptor extends WizardPanelDescriptor implements ActionListener, ListSelectionListener{ public static final String IDENTIFIER = "LEARNING_PANEL"; - public static final String INFORMATION = "In this panel you can start the learning algorithm. While it ist running, " + - "temporary results are shown in the list above. Select one of them and press Next"; + public static final String INFORMATION = "In this panel you can start the learning algorithm. While it ist running, " + + "temporary results are shown in the list above. Select one of them and press Next"; private LearningPanel learnPanel; private LearnSwingWorker worker; @@ -105,6 +105,7 @@ /** * Actions for pressing start- or stop-button. + * @param event */ public void actionPerformed(ActionEvent event) { if(event.getActionCommand().equals("Start")){ @@ -113,8 +114,7 @@ learnPanel.getStopButton().setEnabled(true); worker = new LearnSwingWorker(); worker.execute(); - } - else{ + } else{ learnPanel.getStopButton().setEnabled(false); la.stop(); @@ -177,7 +177,7 @@ */ class LearnSwingWorker extends SwingWorker<List<EvaluatedDescription>, List<EvaluatedDescription>> { - Thread t; + private Thread t; @SuppressWarnings("unchecked") @Override @@ -255,7 +255,7 @@ } } - void updateList(final List<EvaluatedDescription> result) { + private void updateList(final List<EvaluatedDescription> result) { Runnable doUpdateList = new Runnable() { @@ -275,9 +275,7 @@ SwingUtilities.invokeLater(doUpdateList); } - + - - } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -38,13 +38,17 @@ private static final long serialVersionUID = -1205252523136710091L; private JLabel[] jLabel; + /** + * Constructor instantiating JLabels with wizard step names. + * @param i step number printed bold + */ public LeftPanel(int i){ jLabel = new JLabel[6]; setBackground(new java.awt.Color(255, 255, 255)); JPanel panel2 = new JPanel(); panel2.setBackground(new java.awt.Color(255, 255, 255)); - panel2.setLayout(new GridLayout(5,1,0,10)); + panel2.setLayout(new GridLayout(5, 1, 0, 10)); jLabel[0] = new JLabel("1. Introduction"); jLabel[1] = new JLabel("2. Knowledge Source"); jLabel[2] = new JLabel("3. Choose Class"); @@ -53,10 +57,11 @@ jLabel[5] = new JLabel("6. Save/Exit"); jLabel[i].setFont(jLabel[i].getFont().deriveFont(Font.BOLD)); - for(JLabel current : jLabel) - panel2.add(current); + for(JLabel current : jLabel){ + panel2.add(current); + } setLayout(new BorderLayout()); - setPreferredSize(new Dimension(140,500)); + setPreferredSize(new Dimension(140, 500)); add(panel2, BorderLayout.NORTH); } @@ -71,7 +76,7 @@ setBackground(new java.awt.Color(255, 255, 255)); JPanel panel2 = new JPanel(); panel2.setBackground(new java.awt.Color(255, 255, 255)); - panel2.setLayout(new GridLayout(6,1,0,10)); + panel2.setLayout(new GridLayout(6, 1, 0, 10)); jLabel[0] = new JLabel("1. Introduction"); jLabel[1] = new JLabel("2. Knowledge Source"); jLabel[2] = new JLabel("3. Choose Class"); @@ -81,8 +86,9 @@ jLabel[i].setFont(jLabel[i].getFont().deriveFont(Font.BOLD)); - for(JLabel current : jLabel) - panel2.add(current); + for(JLabel current : jLabel){ + panel2.add(current); + } setLayout(new BorderLayout()); add(panel2, BorderLayout.NORTH); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/Main.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/Main.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/Main.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -80,10 +80,10 @@ WizardPanelDescriptor descriptor7 = new SavePanelDescriptor(); wizard.registerWizardPanel(SavePanelDescriptor.IDENTIFIER, descriptor7); - if ( !(args.length == 1)){ + if (!(args.length == 1)){ wizard.setCurrentPanel(IntroductionPanelDescriptor.IDENTIFIER); - }else{ - ((KnowledgeSourcePanelDescriptor)descriptor2).getPanel().setFileURL(args[0]); + } else{ + ((KnowledgeSourcePanelDescriptor) descriptor2).getPanel().setFileURL(args[0]); wizard.setCurrentPanel(KnowledgeSourcePanelDescriptor.IDENTIFIER); wizard.setLeftPanel(1); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -281,7 +281,7 @@ /** - * retrieves description parts that might cause inconsistency - for negative examples only + * Retrieves description parts that might cause inconsistency - for negative examples only. * @param ind * @param desc * @return @@ -296,18 +296,19 @@ if(children.size() >= 2){ if(desc instanceof Intersection){ - for(Description d: children) + for(Description d: children){ criticals.addAll(getNegCriticalDescriptions(ind, d)); - - } - else if(desc instanceof Union){ - for(Description d: children) - if(owlReasoner.instanceCheck(d, ind)) + } + } else if(desc instanceof Union){ + for(Description d: children){ + if(owlReasoner.instanceCheck(d, ind)){ criticals.addAll(getNegCriticalDescriptions(ind, d)); + } + } } - } - else + } else{ criticals.add(desc); + } } return criticals; @@ -337,36 +338,32 @@ } criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(children.size()-1))); criticals.add(new JLabel(")")); - } - else if(desc instanceof Union){ + } else if(desc instanceof Union){ criticals.add(new JLabel("(")); for(int i = 0; i<children.size()-1; i++){ if(fastReasoner.instanceCheck(desc.getChild(i), ind)){ criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(i))); - } - else{ + } else{ criticals.add(new JLabel(desc.getChild(i).toManchesterSyntaxString(baseURI, prefixes))); } criticals.add(new JLabel("or")); } if(fastReasoner.instanceCheck(desc.getChild(children.size()-1), ind)){ criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(children.size()-1))); - } - else{ + } else{ criticals.add(new JLabel(desc.getChild(children.size()-1).toManchesterSyntaxString(baseURI, prefixes))); } criticals.add(new JLabel(")")); } - } - else{ + } else{ criticals.add(new DescriptionLabel(desc, "neg")); } - } - else + } else{ criticals.add(new JLabel(desc.toManchesterSyntaxString(baseURI, prefixes))); + } } catch (ReasoningMethodUnsupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -399,36 +396,29 @@ } criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(children.size()-1))); criticals.add(new JLabel(")")); - } - else if(desc instanceof Intersection){ + } else if(desc instanceof Intersection){ criticals.add(new JLabel("(")); for(int i = 0; i<children.size()-1; i++){ if(!fastReasoner.instanceCheck(desc.getChild(i), ind)){ criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(i))); - } - else{ + } else{ criticals.add(new JLabel(desc.getChild(i).toManchesterSyntaxString(baseURI, prefixes))); } criticals.add(new JLabel("and")); } if(!fastReasoner.instanceCheck(desc.getChild(children.size()-1), ind)){ criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(children.size()-1))); - } - else{ + } else{ criticals.add(new JLabel(desc.getChild(children.size()-1).toManchesterSyntaxString(baseURI, prefixes))); } criticals.add(new JLabel(")")); - - } - } - else{ - + } else{ criticals.add(new DescriptionLabel(desc, "pos")); } - } - else + } else{ criticals.add(new JLabel(desc.toManchesterSyntaxString(baseURI, prefixes))); + } } catch (ReasoningMethodUnsupportedException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -523,7 +513,7 @@ // TODO Auto-generated catch block e.printStackTrace(); } - owlReasoner = cm.reasoner(OWLAPIReasoner.class,new OWLAPIOntology(modifier.getOntology())); + owlReasoner = cm.reasoner(OWLAPIReasoner.class, new OWLAPIOntology(modifier.getOntology())); try { owlReasoner.init(); @@ -552,6 +542,7 @@ } } } + System.out.println(complements); return complements; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -189,7 +189,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); OWLEntityRemover remover = new OWLEntityRemover(manager, Collections.singleton(ontology)); @@ -219,7 +219,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); OWLDescription owlDesc = OWLAPIDescriptionConvertVisitor.getOWLDescription(desc); OWLClassAssertionAxiom owlCl = factory.getOWLClassAssertionAxiom(individualOWLAPI, owlDesc); @@ -249,7 +249,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); OWLDescription owlDesc = OWLAPIDescriptionConvertVisitor.getOWLDescription(desc); OWLClassAssertionAxiom owlCl = factory.getOWLClassAssertionAxiom(individualOWLAPI, owlDesc); @@ -283,7 +283,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); //Loeschen OWLDescription oldDesc = OWLAPIDescriptionConvertVisitor.getOWLDescription(oldClass); @@ -300,7 +300,8 @@ try { - manager.applyChanges(changes);saveOntology(); + manager.applyChanges(changes); + saveOntology(); return changes; } catch (OWLOntologyChangeException e) { @@ -322,7 +323,7 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual individualOWLAPI = factory.getOWLIndividual( URI.create(ind.getName())); + OWLIndividual individualOWLAPI = factory.getOWLIndividual(URI.create(ind.getName())); OWLObjectProperty propertyOWLAPI = factory.getOWLObjectProperty(URI.create(objSome.getRole().getName())); Set<OWLObjectPropertyAssertionAxiom> properties = ontology.getObjectPropertyAssertionAxioms(individualOWLAPI); @@ -333,8 +334,7 @@ for(OWLInverseObjectPropertiesAxiom inv : invProperties){ if(propertyOWLAPI.equals(inv.getSecondProperty())){ invProperty = inv.getFirstProperty(); - } - else{ + } else{ invProperty = inv.getSecondProperty(); } } @@ -343,7 +343,7 @@ List<RemoveAxiom> removeList = new LinkedList<RemoveAxiom>(); for(OWLObjectPropertyAssertionAxiom o :properties){ - if( (o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(individualOWLAPI))){ + if((o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(individualOWLAPI))){ removeList.add(new RemoveAxiom(ontology, o)); } if(invProperty != null){ @@ -382,16 +382,19 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual subjectOWLAPI = factory.getOWLIndividual( URI.create(subject.getName())); - OWLIndividual objectOWLAPI = factory.getOWLIndividual( URI.create(object.getName())); + OWLIndividual subjectOWLAPI = factory.getOWLIndividual(URI.create(subject.getName())); + OWLIndividual objectOWLAPI = factory.getOWLIndividual(URI.create(object.getName())); OWLObjectProperty propertyOWLAPI = factory.getOWLObjectProperty(URI.create(objSome.getRole().getName())); Set<OWLObjectPropertyAssertionAxiom> properties = ontology.getObjectPropertyAssertionAxioms(subjectOWLAPI); RemoveAxiom remove = null; - for(OWLObjectPropertyAssertionAxiom o :properties) - if( (o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(subjectOWLAPI)) && (o.getObject().equals(objectOWLAPI))) + for(OWLObjectPropertyAssertionAxiom o :properties){ + if((o.getProperty().equals(propertyOWLAPI)) && (o.getSubject().equals(subjectOWLAPI)) && (o.getObject().equals(objectOWLAPI))){ remove = new RemoveAxiom(ontology, o); + } + } + changes.add(remove); @@ -422,8 +425,8 @@ List<OWLOntologyChange> changes = new LinkedList<OWLOntologyChange>(); - OWLIndividual subjectOWLAPI = factory.getOWLIndividual( URI.create(subInd.getName())); - OWLIndividual objectOWLAPI = factory.getOWLIndividual( URI.create(objInd.getName())); + OWLIndividual subjectOWLAPI = factory.getOWLIndividual(URI.create(subInd.getName())); + OWLIndividual objectOWLAPI = factory.getOWLIndividual(URI.create(objInd.getName())); OWLObjectProperty propertyOWLAPI = factory.getOWLObjectProperty(URI.create(objSome.getRole().getName())); OWLObjectPropertyAssertionAxiom objAssertion = factory.getOWLObjectPropertyAssertionAxiom(subjectOWLAPI, propertyOWLAPI, objectOWLAPI); @@ -443,7 +446,7 @@ /** - * undo changes of type {@link OWLOntologyChange} + * undo changes of type {@link OWLOntologyChange}. * @param changes */ public void undoChanges(Collection<OWLOntologyChange> changes){ @@ -457,8 +460,7 @@ } catch (OWLOntologyChangeException e) { e.printStackTrace(); } - } - else if(change instanceof AddAxiom){ + } else if(change instanceof AddAxiom){ RemoveAxiom remove = new RemoveAxiom(ontology, change.getAxiom()); try { manager.applyChange(remove); @@ -508,7 +510,7 @@ for(OWLDescription o2 : superClasses2){ // System.out.println(o1 + " " + o2); OWLDescription negO2 = OWLAPIDescriptionConvertVisitor.getOWLDescription(new Negation(new NamedClass(o2.toString()))); - System.out.println(factory.getOWLDisjointClassesAxiom(o1, o2)); +// System.out.println(factory.getOWLDisjointClassesAxiom(o1, o2)); if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o1, o2).toString())){ return true; }else if(ax.toString().equals(factory.getOWLDisjointClassesAxiom(o2, o1).toString())){ @@ -530,7 +532,7 @@ } /** - * returns object properties for an individual + * Returns object properties for an individual. * @param ind * @return */ @@ -549,7 +551,7 @@ } /** - * returns the actual ontology + * Returns the actual ontology. * @return ontology */ public OWLOntology getOntology() { @@ -558,7 +560,7 @@ /** - * prints reasons for inconsistent classes + * Prints reasons for inconsistent classes. */ public void reason(){ // reasoner.getInconsistencyReasons(ontology); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java 2008-09-22 14:50:35 UTC (rev 1236) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java 2008-09-22 16:41:09 UTC (rev 1237) @@ -76,8 +76,8 @@ private StatsPanel statsPanel; private DescriptionPanel descPanel; - private JPanel ok_cancelPanel; - private JPanel action_stats_Panel; + private JPanel okCancelPanel; + private JPanel actionStatsPanel; private ChangesPanel changesPanel; private JScrollPane changesScroll; @@ -103,7 +103,7 @@ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { - if(allChanges.size() > 0 ){ + if(allChanges.size() > 0){ if (JOptionPane.showConfirmDialog(dialogd, "All changes will be lost!", "Warning!", JOptionPane.YES_NO_OPTION) @@ -116,8 +116,7 @@ setVisible(false); dispose(); } - } - else{ + } else{ returncode = CANCEL_RETURN_CODE; setVisible(false); dispose(); @@ -143,10 +142,11 @@ public int showDialog(){ baseURI = ore.getBaseURI(); prefixes = ore.getPrefixes(); - if(mode.equals("neg")) + if(mode.equals("neg")){ this.setTitle("Repair negative example"); - else if(mode.equals("pos")) + } else if(mode.equals("pos")){ this.setTitle("Repair positive example"); + } this.setSize(700, 700); this.setLayout(new BorderLayout()); @@ -164,43 +164,43 @@ changesScroll = new JScrollPane(); changesScroll.setViewportView(changesPanel); - action_stats_Panel = new JPanel(); + actionStatsPanel = new JPanel(); GridBagLayout gbl = new GridBagLayout(); gbl.rowWeights = new double[] {0.0, 0.1, 0.1}; gbl.rowHeights = new int[] {64, 7, 7}; gbl.columnWeights = new double[] {0.1}; gbl.columnWidths = new int[] {7}; - action_stats_Panel.setLayout(gbl); + actionStatsPanel.setLayout(gbl); - action_stats_Panel.add(descScroll, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); - action_stats_Panel.add(statsScroll, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); - action_stats_Panel.add(changesScroll, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); + actionStatsPanel.add(descScroll, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); + actionStatsPanel.add(statsScroll, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); + actionStatsPanel.add(changesScroll, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); JSeparator separator = new JSeparator(); Box buttonBox = new Box(BoxLayout.X_AXIS); - ok_cancelPanel = new JPanel(); - ok_cancelPanel.setLayout(new BorderLayout()); - ok_cancelPanel.add(separator, BorderLayout.NORTH); + okCancelPanel = new JPanel(); + okCancelPanel.setLayout(new BorderLayout()); + okCancelPanel.add(separator, BorderLayout.NORTH); okButton = new JButton("Ok"); okButton.addActionListener(this); cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); - getContentPane().add(action_stats_Panel, java.awt.BorderLayout.CENTER); + getContentPane().add(actionStatsPanel, java.awt.BorderLayout.CENTER); buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10))); buttonBox.add(okButton); buttonBox.add(Box.createHorizontalStrut(10)); buttonBox.add(cancelButton); - ok_cancelPanel.add(buttonBox, BorderLayout.EAST); + okCancelPanel.add(buttonBox, BorderLayout.EAST); - getContentPane().add(ok_cancelPanel, BorderLayout.SOUTH); + getContentPane().add(okCancelPanel, BorderLayout.SOUTH); this.setModal(true); @@ -216,24 +216,23 @@ public void actionPerformed(ActionEvent e) { if(e.getSource() instanceof DescriptionMenuItem){ - DescriptionMenuItem item =(DescriptionMenuItem)e.getSource(); + DescriptionMenuItem item =(DescriptionMenuItem) e.getSource(); actualDesc = item.getDescription(); int action = item.getActionID(); if(action == 4){ Individual obj = new Individual(e.getActionCommand()); - List<OWLOntologyChange> changes = modifier.addObjectProperty(ind, (ObjectQuantorRestriction)actualDesc, obj); + List<OWLOntologyChange> changes = modifier.addObjectProperty(ind, (ObjectQuantorRestriction) actualDesc, obj); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("added property assertion " + ((ObjectQuantorRestriction)actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + changesPanel.add(new ChangePanel("added property assertion " + ((ObjectQuantorRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + " to " + obj.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 5){ - ObjectQuantorRestriction property = (ObjectQuantorRestriction)actualDesc; + } else if(action == 5){ + ObjectQuantorRestriction property = (ObjectQuantorRestriction) actualDesc; List<OWLOntologyChange> changes = null; for(Individual i : ore.getIndividualsInPropertyRange(property, ind)){ changes = modifier.removeObjectPropertyAssertion(ind, property, i); @@ -242,47 +241,42 @@ descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("removed property assertions " + - ((ObjectSomeRestriction)actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + - " to range " + ((ObjectSomeRestriction)actualDesc).getChild(0).toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesPanel.add(new ChangePanel("removed property assertions " + + ((ObjectSomeRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + + " to range " + ((ObjectSomeRestriction) actualDesc).getChild(0).toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 6){ - List<OWLOntologyChange> changes = modifier.deleteObjectProperty(ind, (ObjectQuantorRestriction)actualDesc); + } else if(action == 6){ + List<OWLOntologyChange> changes = modifier.deleteObjectProperty(ind, (ObjectQuantorRestriction) actualDesc); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("deleted property " + ((ObjectQuantorRestriction)actualDesc).getRole().toKBSyntaxString(baseURI, prefixes), changes, this)); + changesPanel.add(new ChangePanel("deleted property " + ((ObjectQuantorRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 0){ + } else if(action == 0){ newDesc = new NamedClass(item.getName()); List<OWLOntologyChange> changes = modifier.moveIndividual(ind, actualDesc, newDesc); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("moved class assertion from " + actualDesc.toManchesterSyntaxString(baseURI, prefixes) + - " to " + newDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesPanel.add(new ChangePanel("moved class assertion from " + actualDesc.toManchesterSyntaxString(baseURI, prefixes) + + " to " + newDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 3){ + } else if(action == 3){ List<OWLOntologyChange> changes = modifier.removeClassAssertion(ind, actualDesc); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); changesPanel.add(new ChangePanel("removed class assertion to " + actualDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 2){ + } else if(action == 2){ List<OWLOntologyChange> changes = modifier.addClassAssertion(ind, actualDesc); allChanges.addAll(changes); descPanel.updatePanel(); statsPanel.updatePanel(); changesPanel.add(new ChangePanel("added class assertion to " + actualDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 7){ - ObjectQuantorRestriction property = (ObjectQuantorRestriction)actualDesc; + } else if(action == 7){ + ObjectQuantorRestriction property = (ObjectQuantorRestriction) actualDesc; List<OWLOntologyChange> changes = null; for(Individual i : ore.getIndividualsNotInPropertyRange(property, ind)){ changes = modifier.removeObjectPropertyAssertion(ind, property, i); @@ -292,39 +286,30 @@ descPanel.updatePanel(); statsPanel.updatePanel(); - changesPanel.add(new ChangePanel("removed property assertion " + property.getRole().toKBSyntaxString(baseURI, prefixes) + - " to " + ind.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesPanel.add(new ChangePanel("removed property assertion " + property.getRole().toKBSyntaxString(baseURI, prefixes) + + " to " + ind.toManchesterSyntaxString(baseURI, prefixes), changes, this)); changesScroll.updateUI(); - } - else if(action == 1){ + } else if(action == 1){ Description oldDesc = new NamedClass(item.getName()); List<OWLO... [truncated message content] |