From: <lor...@us...> - 2009-12-27 16:31:39
|
Revision: 1954 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1954&view=rev Author: lorenz_b Date: 2009-12-27 16:31:29 +0000 (Sun, 27 Dec 2009) Log Message: ----------- Small changes in evaluation script. Fixed some bugs in evaluation GUI. Added 2 serialized examples. Checking execution time in score computation in class ClassLearningProblem. Made DatatypeProperty serializable. Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationComputingScript.java trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationGUI.java trunk/src/dl-learner/org/dllearner/scripts/evaluation/test.ser trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/scripts/evaluation/test2.ser Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2009-12-22 20:17:48 UTC (rev 1953) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2009-12-27 16:31:29 UTC (rev 1954) @@ -19,6 +19,7 @@ */ package org.dllearner.core.owl; +import java.io.Serializable; import java.net.URI; import java.util.Map; @@ -28,8 +29,12 @@ * @author Jens Lehmann * */ -public class DatatypeProperty implements Comparable<DatatypeProperty>, Property, NamedKBElement { +public class DatatypeProperty implements Comparable<DatatypeProperty>, Property, NamedKBElement, Serializable { + /** + * + */ + private static final long serialVersionUID = 8452865438915671952L; protected String name; public DatatypeProperty(String name) { Modified: trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2009-12-22 20:17:48 UTC (rev 1953) +++ trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2009-12-27 16:31:29 UTC (rev 1954) @@ -37,7 +37,6 @@ import org.dllearner.core.options.StringConfigOption; import org.dllearner.core.options.URLConfigOption; import org.dllearner.core.owl.Axiom; -import org.dllearner.core.owl.ClassAssertionAxiom; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.EquivalentClassesAxiom; import org.dllearner.core.owl.Individual; @@ -54,6 +53,9 @@ * */ public class ClassLearningProblem extends LearningProblem { + + private long nanoStartTime; + private static int maxExecutionTimeInSeconds = 20; // TODO: naming needs to be cleaned up for consistency: // coverage => recall @@ -441,6 +443,8 @@ public double getAccuracyOrTooWeakExact(Description description, double noise) { + nanoStartTime = System.nanoTime(); + if(heuristic.equals(HeuristicType.JACCARD)) { // computing R(C) restricted to relevant instances @@ -449,6 +453,9 @@ if(reasoner.hasType(description, ind)) { additionalInstancesSet.add(ind); } + if(terminationTimeExpired()){ + return 0; + } } // computing R(A) @@ -457,6 +464,9 @@ if(reasoner.hasType(description, ind)) { coveredInstancesSet.add(ind); } + if(terminationTimeExpired()){ + return 0; + } } // for Jaccard: covered instances is the intersection of the sets @@ -472,6 +482,9 @@ if(reasoner.hasType(description, ind)) { additionalInstances++; } + if(terminationTimeExpired()){ + return 0; + } } // computing R(A) @@ -480,6 +493,9 @@ if(reasoner.hasType(description, ind)) { coveredInstances++; } + if(terminationTimeExpired()){ + return 0; + } } double recall = coveredInstances/(double)classInstances.size(); @@ -517,6 +533,9 @@ } else if(reasoner.hasType(descriptionNeg, ind)) { icNeg.add(ind); } + if(terminationTimeExpired()){ + return 0; + } } // semantic precision @@ -542,6 +561,10 @@ throw new Error("ClassLearningProblem error: not implemented"); } + private boolean terminationTimeExpired(){ + return ((System.nanoTime() - nanoStartTime) >= (maxExecutionTimeInSeconds*1000000000l)); + } + // @Deprecated // public double getAccuracyOrTooWeakStandard(Description description, double minAccuracy) { // // since we have to perform a retrieval operation anyway, we cannot easily Modified: trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationComputingScript.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2009-12-22 20:17:48 UTC (rev 1953) +++ trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2009-12-27 16:31:29 UTC (rev 1954) @@ -6,6 +6,8 @@ import java.io.ObjectOutputStream; import java.io.OutputStream; import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.text.DecimalFormat; import java.util.HashMap; @@ -30,12 +32,19 @@ import org.dllearner.learningproblems.EvaluatedDescriptionClass; import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; +import org.mindswap.pellet.utils.SetUtils; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; public class EvaluationComputingScript { private ReasonerComponent reasoner; private OWLFile ks; - private ComponentManager cm = ComponentManager.getInstance(); private CELOE celoe; private ClassLearningProblem lp; @@ -54,15 +63,14 @@ private static DecimalFormat df = new DecimalFormat(); - // for performance measurements and development - private static boolean autoMode = false; - private static boolean useFastInstanceChecker = true; private static boolean useApproximations = false; - private static boolean computeApproxDiff = false; - private Set<NamedClass> reducedClassesSet; + private Set<NamedClass> equivalentReducedClassesSet; + private Set<NamedClass> superReducedClassesSet; + private URI ontologyURI; + private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceStandardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>(); private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceFMeasureMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>(); private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalencePredaccMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>(); @@ -92,18 +100,40 @@ private Map<NamedClass, List<EvaluatedDescriptionClass>> defaultEquivalenceMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>(); private Map<NamedClass, List<EvaluatedDescriptionClass>> defaultSuperMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>(); + private Map<NamedClass, Set<OWLDescription>> assertedEquivalentClasses = new HashMap<NamedClass, Set<OWLDescription>>(); + private Map<NamedClass, Set<OWLDescription>> assertedSuperClasses = new HashMap<NamedClass, Set<OWLDescription>>(); - - public EvaluationComputingScript(URL fileURL) throws ComponentInitException, MalformedURLException, LearningProblemUnsupportedException{ + public EvaluationComputingScript(URL fileURL) throws ComponentInitException, MalformedURLException, LearningProblemUnsupportedException, URISyntaxException{ loadOntology(fileURL); computeWithApproximation(); computeSuggestions(); computeGenFMeasureWithoutDefaultNegation(); + getAssertedAxioms(); saveResults(); + } - private void loadOntology(URL fileURL) throws ComponentInitException{ + private void getAssertedAxioms(){ + try { + OWLOntologyManager man = OWLManager.createOWLOntologyManager(); + OWLDataFactory fac = man.getOWLDataFactory(); + OWLOntology ont = man.loadOntology(ontologyURI); + OWLClass cl; + for(NamedClass nc : SetUtils.union(defaultEquivalenceMap.keySet(), defaultSuperMap.keySet())){ + cl = fac.getOWLClass(URI.create(nc.getName())); + assertedEquivalentClasses.put(nc, cl.getEquivalentClasses(ont)); + assertedSuperClasses.put(nc, cl.getSuperClasses(ont)); + } + } catch (OWLOntologyCreationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private void loadOntology(URL fileURL) throws ComponentInitException, URISyntaxException{ + ontologyURI = fileURL.toURI(); ComponentManager cm = ComponentManager.getInstance(); // initialize KnowledgeSource @@ -148,6 +178,12 @@ o.writeObject(defaultEquivalenceMap); o.writeObject(defaultSuperMap); + o.writeObject(baseURI); + o.writeObject(prefixes); + + o.writeObject(assertedEquivalentClasses); + o.writeObject(assertedSuperClasses); + o.flush(); } catch (IOException e) { System.err.println(e); @@ -179,26 +215,31 @@ prefixes = reasoner.getPrefixes(); // loop through all classes - for (NamedClass nc : reducedClassesSet) { - // check whether the class has sufficient instances - int instanceCount = reasoner.getIndividuals(nc).size(); - if (instanceCount < minInstanceCount) { - System.out.println("class " + nc.toManchesterSyntaxString(baseURI, prefixes) + " has only " - + instanceCount + " instances (minimum: " + minInstanceCount + ") - skipping"); - } else { + for (NamedClass nc : SetUtils.union(equivalentReducedClassesSet, superReducedClassesSet)) { System.out.println("\nlearning axioms for class " + nc.toManchesterSyntaxString(baseURI, prefixes) - + " with " + instanceCount + " instances"); - ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); - lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); + ); +// ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); +// lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); for (int j = 0; j <= 1; j++) { if (j == 0) { - lp.getConfigurator().setType("equivalence"); - System.out.println("Learning equivalentClass expressions"); + if(!equivalentReducedClassesSet.contains(nc)){ + continue; + } } else { - lp.getConfigurator().setType("superClass"); - System.out.println("Learning superClass expressions"); + if(!superReducedClassesSet.contains(nc)){ + continue; + } } for (int k = 0; k <= 3; k++) { + ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); + lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); + if (j == 0) { + lp.getConfigurator().setType("equivalence"); + System.out.println("Learning equivalentClass expressions"); + } else { + lp.getConfigurator().setType("superClass"); + System.out.println("Learning superClass expressions"); + } if (k == 0) { lp.getConfigurator().setAccuracyMethod("standard"); System.out.println("Using accuracy method: standard"); @@ -227,25 +268,6 @@ celoe.init(); celoe.start(); - - // test whether a solution above the threshold - // was found - EvaluatedDescription best = celoe.getCurrentlyBestEvaluatedDescription(); - double bestAcc = best.getAccuracy(); - -// if (bestAcc < minAccuracy || (best.getDescription() instanceof Thing)) { -// System.out -// .println("The algorithm did not find a suggestion with an accuracy above the threshold of " -// + (100 * minAccuracy) -// + "% or the best description is not appropriate. (The best one was \"" -// + best.getDescription().toManchesterSyntaxString(baseURI, prefixes) -// + "\" with an accuracy of " + df.format(bestAcc) + ".) - skipping"); -// suggestions = new TreeSet<EvaluatedDescriptionClass>(); -// } else { -// -// suggestions = (TreeSet<EvaluatedDescriptionClass>) celoe -// .getCurrentlyBestEvaluatedDescriptions(); -// } suggestions = (TreeSet<EvaluatedDescriptionClass>) celoe .getCurrentlyBestEvaluatedDescriptions(); List<EvaluatedDescriptionClass> suggestionsList = new LinkedList<EvaluatedDescriptionClass>( @@ -306,11 +328,9 @@ } // } cm.freeComponent(celoe); - // cm.freeComponent(lp); + cm.freeComponent(lp); } } - } - cm.freeComponent(lp); } cm.freeComponent(reasoner); @@ -320,6 +340,7 @@ cm.freeComponent(celoe); } + /** * Computing results for accuracy method 'Generalised F-Measure'. This is done separate because * for FastInstanceChecker option useDefaultNegation is set to 'false'. @@ -347,22 +368,22 @@ baseURI = reasoner.getBaseURI(); prefixes = reasoner.getPrefixes(); - for (NamedClass nc : reducedClassesSet) { - // check whether the class has sufficient instances - int instanceCount = reasoner.getIndividuals(nc).size(); - if (instanceCount < minInstanceCount) { - System.out.println("class " + nc.toManchesterSyntaxString(baseURI, prefixes) + " has only " - + instanceCount + " instances (minimum: " + minInstanceCount + ") - skipping"); - } else { + for (NamedClass nc : SetUtils.union(equivalentReducedClassesSet, superReducedClassesSet)) { System.out.println("\nlearning axioms for class " + nc.toManchesterSyntaxString(baseURI, prefixes) - + " with " + instanceCount + " instances"); + ); ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); lp.getConfigurator().setClassToDescribe(nc.getURI().toURL()); for (int j = 0; j <= 1; j++) { if (j == 0) { + if(!equivalentReducedClassesSet.contains(nc)){ + continue; + } lp.getConfigurator().setType("equivalence"); System.out.println("Learning equivalentClass expressions"); } else { + if(!superReducedClassesSet.contains(nc)){ + continue; + } lp.getConfigurator().setType("superClass"); System.out.println("Learning superClass expressions"); } @@ -381,23 +402,6 @@ celoe.start(); - // test whether a solution above the threshold was found - EvaluatedDescription best = celoe.getCurrentlyBestEvaluatedDescription(); - double bestAcc = best.getAccuracy(); - -// if (bestAcc < minAccuracy || (best.getDescription() instanceof Thing)) { -// System.out -// .println("The algorithm did not find a suggestion with an accuracy above the threshold of " -// + (100 * minAccuracy) -// + "% or the best description is not appropriate. (The best one was \"" -// + best.getDescription().toManchesterSyntaxString(baseURI, prefixes) -// + "\" with an accuracy of " + df.format(bestAcc) + ".) - skipping"); -// suggestions = new TreeSet<EvaluatedDescriptionClass>(); -// } else { -// -// suggestions = (TreeSet<EvaluatedDescriptionClass>) celoe -// .getCurrentlyBestEvaluatedDescriptions(); -// } suggestions = (TreeSet<EvaluatedDescriptionClass>) celoe .getCurrentlyBestEvaluatedDescriptions(); List<EvaluatedDescriptionClass> suggestionsList = new LinkedList<EvaluatedDescriptionClass>( @@ -422,7 +426,6 @@ } cm.freeComponent(celoe); cm.freeComponent(lp); - } } cm.freeComponent(reasoner); } @@ -507,13 +510,13 @@ } } - reducedClassesSet = getShrinkedSet(defaultEquivalenceMap.keySet(), allListsComputingCount); - + equivalentReducedClassesSet = getShrinkedSet(defaultEquivalenceMap.keySet(), allListsComputingCount); + superReducedClassesSet = getShrinkedSet(defaultSuperMap.keySet(), allListsComputingCount); } private Set<NamedClass> getShrinkedSet(Set<NamedClass> set, int count){ Set<NamedClass> reducedSet = new HashSet<NamedClass>(); - int i = count; + int i = 0; for(NamedClass nc : set){ if(i % count == 0){ reducedSet.add(nc); @@ -528,8 +531,9 @@ * @throws MalformedURLException * @throws LearningProblemUnsupportedException * @throws ComponentInitException + * @throws URISyntaxException */ - public static void main(String[] args) throws MalformedURLException, ComponentInitException, LearningProblemUnsupportedException { + public static void main(String[] args) throws MalformedURLException, ComponentInitException, LearningProblemUnsupportedException, URISyntaxException { // Logger.getRootLogger().setLevel(Level.WARN); if (args.length == 0) { System.out.println("You need to give an OWL file as argument."); @@ -541,8 +545,9 @@ } else { fileURL = new File(args[0]).toURI().toURL(); } - + long startTime = System.currentTimeMillis(); new EvaluationComputingScript(fileURL); + System.out.println("Overall computing time: " + (System.currentTimeMillis() - startTime)/1000 +" s"); } } Modified: trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationGUI.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationGUI.java 2009-12-22 20:17:48 UTC (rev 1953) +++ trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationGUI.java 2009-12-27 16:31:29 UTC (rev 1954) @@ -20,13 +20,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.TreeSet; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; -import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -53,6 +53,8 @@ import org.dllearner.tools.ore.ui.MarkableClassesTable; import org.dllearner.tools.ore.ui.ResultTable; import org.dllearner.tools.ore.ui.SelectableClassExpressionsTable; +import org.mindswap.pellet.utils.SetUtils; +import org.semanticweb.owl.model.OWLDescription; public class EvaluationGUI extends JFrame implements ActionListener, ListSelectionListener, MouseMotionListener{ @@ -88,6 +90,9 @@ private JPanel cardPanel; private CardLayout cardLayout; + private ResultTable mouseOverTable; + private int oldRow; + private static String SUPERCLASSTEXT = "Showing suggestions for super class"; private static String EQUIVALENTCLASSTEXT = "Showing suggestions for equivalent class"; @@ -129,6 +134,12 @@ private Map<NamedClass, List<EvaluatedDescriptionClass>> defaultEquivalenceMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>(); private Map<NamedClass, List<EvaluatedDescriptionClass>> defaultSuperMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>(); + private String baseURI; + private Map<String, String> prefixes; + + private Map<NamedClass, Set<OWLDescription>> assertedEquivalentClasses = new HashMap<NamedClass, Set<OWLDescription>>(); + private Map<NamedClass, Set<OWLDescription>> assertedSuperClasses = new HashMap<NamedClass, Set<OWLDescription>>(); + private Map<NamedClass, EvaluatedDescriptionClass> selectedEquivalenceMap = new HashMap<NamedClass, EvaluatedDescriptionClass>(); private Map<NamedClass, EvaluatedDescriptionClass> selectedSuperMap = new HashMap<NamedClass, EvaluatedDescriptionClass>(); @@ -140,9 +151,16 @@ createUI(); createCoverageWindow(); classesTable.setSelectedClass(currentClassIndex); + graphPanel.initManchesterSyntax(baseURI, prefixes); + graphPanel2.initManchesterSyntax(baseURI, prefixes); graphPanel.setConcept(classesTable.getSelectedClass(currentClassIndex)); graphPanel2.setConcept(classesTable.getSelectedClass(currentClassIndex)); - showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex)); + if(classesTable.getSelectedClass(currentClassIndex) != null){ + showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex)); + } else { + showSuperSuggestions(classesTable.getSelectedClass(currentClassIndex)); + } + cardLayout.last(cardPanel); pack(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -153,9 +171,10 @@ private void createUI(){ setLayout(new BorderLayout()); - + System.out.println(assertedEquivalentClasses); + System.out.println(assertedSuperClasses); classesTable = new MarkableClassesTable(); - classesTable.addClasses(new TreeSet<NamedClass>(defaultEquivalenceMap.keySet())); + classesTable.addClasses(new TreeSet<NamedClass>(SetUtils.union(defaultEquivalenceMap.keySet(), defaultSuperMap.keySet()))); JScrollPane classesScroll = new JScrollPane(classesTable); classesTable.addMouseMotionListener(this); add(classesScroll, BorderLayout.WEST); @@ -262,16 +281,6 @@ return tablesHolderPanel; } - private JPanel createSelectablePanel(ResultTable table){ - JPanel panel = new JPanel(new BorderLayout()); - panel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); - JCheckBox box = new JCheckBox(); - panel.add(table, BorderLayout.CENTER); -// panel.add(box, BorderLayout.EAST); - panel.add(new RatingPanel(), BorderLayout.EAST); - return panel; - } - private void showSingleTable(){ defaultTab.clearSelection(); graphPanel.clear(); @@ -288,6 +297,8 @@ messageLabel.setText(EQUIVALENTCLASSTEXT); if(owlEquivalenceStandardMap.get(nc) != null){ + + tab1.addResults(owlEquivalenceStandardMap.get(nc)); tab2.addResults(owlEquivalenceFMeasureMap.get(nc)); tab3.addResults(owlEquivalencePredaccMap.get(nc)); @@ -300,9 +311,9 @@ tab9.addResults(fastEquivalenceJaccardMap.get(nc)); tab10.addResults(fastEquivalenceGenFMeasureMap.get(nc)); } + defaultTab.addResults(defaultEquivalenceMap.get(nc)); - defaultTab.addResults(defaultEquivalenceMap.get(nc)); showingEquivalentSuggestions = true; } @@ -311,6 +322,7 @@ messageLabel.setText(SUPERCLASSTEXT); if(owlSuperStandardMap.get(nc) != null){ + tab1.addResults(owlSuperStandardMap.get(nc)); tab2.addResults(owlSuperFMeasureMap.get(nc)); tab3.addResults(owlSuperPredaccMap.get(nc)); @@ -324,9 +336,9 @@ tab10.addResults(fastSuperGenFMeasureMap.get(nc)); } - defaultTab.addResults(defaultSuperMap.get(nc)); + showingEquivalentSuggestions = false; } @@ -373,6 +385,12 @@ defaultEquivalenceMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject(); defaultSuperMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject(); + baseURI = (String)o.readObject(); + prefixes = (Map<String, String>)o.readObject(); + + assertedEquivalentClasses = (Map<NamedClass, Set<OWLDescription>>) o.readObject(); + assertedSuperClasses = (Map<NamedClass, Set<OWLDescription>>) o.readObject(); + } catch (IOException e) { @@ -393,8 +411,17 @@ } - private void showCoveragePanel(boolean visible){ - coverageWindow.setVisible(visible); + private void showCoveragePanel(boolean show){ + final boolean visible = show; + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + coverageWindow.setVisible(visible); + + } + }); + } private void setCoverageLocationRelativeTo(Component component){ @@ -415,34 +442,53 @@ if(e.getActionCommand().equals("next")){ NamedClass nc = classesTable.getSelectedClass(currentClassIndex); if(showingMultiTables && showingEquivalentSuggestions){ - showSuperSuggestions(nc); - showSingleTable(); + if(defaultSuperMap.get(nc) != null){ + showSuperSuggestions(nc); + showSingleTable(); + } else { + currentClassIndex++; + classesTable.setSelectedClass(currentClassIndex); + graphPanel.setConcept(classesTable.getSelectedClass(currentClassIndex)); + + showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex)); + showSingleTable(); + } + } else if(!showingMultiTables && showingEquivalentSuggestions){ if(owlEquivalenceStandardMap.get(nc) != null){ showMultiTables(); - } else { + } else if(defaultSuperMap.get(nc) != null){ showSuperSuggestions(nc); showSingleTable(); if(currentClassIndex + 1 >= defaultEquivalenceMap.keySet().size()){ nextFinishButton.setText("Finish"); nextFinishButton.setActionCommand("finish"); } + } else { + currentClassIndex++; + classesTable.setSelectedClass(currentClassIndex); + graphPanel.setConcept(classesTable.getSelectedClass(currentClassIndex)); + + showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex)); + showSingleTable(); } } else if(!showingMultiTables && !showingEquivalentSuggestions){ if(owlEquivalenceStandardMap.get(nc) != null){ showMultiTables(); - if(currentClassIndex + 1 >= defaultEquivalenceMap.keySet().size()){ - nextFinishButton.setText("Finish"); - nextFinishButton.setActionCommand("finish"); - } + } else { currentClassIndex++; classesTable.setSelectedClass(currentClassIndex); - graphPanel.setConcept(classesTable.getSelectedClass(currentClassIndex)); + NamedClass newNc = classesTable.getSelectedClass(currentClassIndex); + graphPanel.setConcept(newNc); + if(defaultEquivalenceMap.get(newNc) != null){ + showEquivalentSuggestions(newNc); + } else { + showSuperSuggestions(newNc); + } - showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex)); showSingleTable(); } @@ -456,6 +502,7 @@ showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex)); showSingleTable(); } + setFinished(); } else if(e.getActionCommand().equals("finish")){ @@ -464,6 +511,22 @@ } + private void setFinished(){ + NamedClass nc = classesTable.getSelectedClass(currentClassIndex); + if(currentClassIndex == SetUtils.union(defaultEquivalenceMap.keySet(),defaultSuperMap.keySet()).size()){ + if(showingEquivalentSuggestions && owlEquivalenceStandardMap.get(nc) == null && defaultSuperMap.get(nc) == null || + showingEquivalentSuggestions && showingMultiTables && defaultSuperMap.get(nc) == null|| + !showingEquivalentSuggestions && owlSuperStandardMap.get(nc) == null || + !showingEquivalentSuggestions && showingMultiTables){ + nextFinishButton.setText("Finish"); + nextFinishButton.setActionCommand("finish"); + } + + + + } + } + @Override public void valueChanged(ListSelectionEvent e) { if(!e.getValueIsAdjusting() && defaultTab.getSelectedRow() >= 0){ @@ -529,13 +592,18 @@ int column = result.columnAtPoint(e.getPoint()); int row = result.rowAtPoint(e.getPoint()); - if(column == 0 && row >=0 && row <= 9){ - EvaluatedDescriptionClass ec = result.getValueAtRow(row); - graphPanel2.clear(); - graphPanel2.setNewClassDescription(ec); - setCoverageLocationRelativeTo(result); - showCoveragePanel(true); - + if(column == 0 && row >=0){ + if(mouseOverTable != result || row != oldRow){ + mouseOverTable = result; + oldRow = row; + EvaluatedDescriptionClass ec = result.getValueAtRow(row); + graphPanel2.clear(); + graphPanel2.setNewClassDescription(ec); + setCoverageLocationRelativeTo(result); + showCoveragePanel(true); + } else { + showCoveragePanel(true); + } } else { showCoveragePanel(false); } Modified: trunk/src/dl-learner/org/dllearner/scripts/evaluation/test.ser =================================================================== (Binary files differ) Added: trunk/src/dl-learner/org/dllearner/scripts/evaluation/test2.ser =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/scripts/evaluation/test2.ser ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java 2009-12-22 20:17:48 UTC (rev 1953) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java 2009-12-27 16:31:29 UTC (rev 1954) @@ -27,6 +27,7 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.awt.geom.Ellipse2D; +import java.util.Map; import java.util.Random; import java.util.Set; import java.util.Vector; @@ -71,6 +72,9 @@ private NamedClass concept; + private String baseURI; + private Map<String, String> prefixes; + private String conceptNew; private final Vector<IndividualPoint> posCovIndVector; private final Vector<IndividualPoint> posNotCovIndVector; @@ -138,10 +142,16 @@ // this.computeIndividualPoints(); } + + public void initManchesterSyntax(String baseURI, Map<String, String> prefixes){ + this.baseURI = baseURI; + this.prefixes = prefixes; + } @Override protected void paintComponent(Graphics g) { - + g.clearRect(0, 0, 400, 400); + g.clearRect(320, 130, 320, 50); Graphics2D g2D; g2D = (Graphics2D) g; // Composite original = g2D.getComposite(); @@ -152,7 +162,7 @@ g2D.drawString(ManchesterSyntaxRenderer.renderSimple(OREManager.getInstance().getCurrentClass2Learn()) , 320, 10); } else if(concept!= null){ - g2D.drawString(concept.getName(), 320, 10); + g2D.drawString(concept.toManchesterSyntaxString(baseURI, prefixes), 320, 10); } // g2D.setColor(Color.ORANGE); @@ -383,6 +393,8 @@ // } // getParent().repaint(); } + + @SuppressWarnings(value = { "unused" }) private void renderPlus() { if (eval != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |