|
From: <jen...@us...> - 2010-02-18 10:00:50
|
Revision: 2062
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2062&view=rev
Author: jenslehmann
Date: 2010-02-18 10:00:44 +0000 (Thu, 18 Feb 2010)
Log Message:
-----------
added sanity checks for class lerning
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java
trunk/src/dl-learner/org/dllearner/cli/Start.java
trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java
Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2010-02-18 09:16:11 UTC (rev 2061)
+++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2010-02-18 10:00:44 UTC (rev 2062)
@@ -429,7 +429,7 @@
// returns true if node was added and false otherwise
private boolean addNode(Description description, OENode parentNode) {
-// System.out.println(description);
+ System.out.println(description);
// redundancy check (return if redundant)
boolean nonRedundant = descriptions.add(description);
@@ -445,6 +445,12 @@
// System.out.println("Test " + new Date());
// quality of description (return if too weak)
double accuracy = learningProblem.getAccuracyOrTooWeak(description, noise);
+ // issue a warning if accuracy is not between 0 and 1 or -1 (too weak)
+ if(accuracy > 1 || (accuracy < 0 || accuracy != -1)) {
+ logger.warn("Invalid accuracy value " + accuracy + " for description " + description + ". This could be caused by a bug in the heuristic measure and should be reported to the DL-Learner bug tracker.");
+ System.exit(0);
+ }
+
// System.out.println("Test2 " + new Date());
expressionTests++;
// System.out.println("acc: " + accuracy);
@@ -507,6 +513,8 @@
if(!shorterDescriptionExists) {
if(!filterFollowsFromKB || !((ClassLearningProblem)learningProblem).followsFromKB(niceDescription)) {
bestEvaluatedDescriptions.add(niceDescription, accuracy, learningProblem);
+// System.out.println("acc: " + accuracy);
+// System.out.println(bestEvaluatedDescriptions);
}
}
@@ -659,6 +667,7 @@
str += current + ": " + descriptionToString(ed.getDescription()) + " (pred. acc.: " + dfPercent.format(((PosNegLPStandard)learningProblem).getPredAccuracyOrTooWeakExact(ed.getDescription(),1)) + ", F-measure: "+ dfPercent.format(((PosNegLPStandard)learningProblem).getFMeasureOrTooWeakExact(ed.getDescription(),1)) + ")\n";
} else {
str += current + ": " + descriptionToString(ed.getDescription()) + " " + dfPercent.format(ed.getAccuracy()) + "\n";
+ System.out.println(ed);
}
current++;
}
Modified: trunk/src/dl-learner/org/dllearner/cli/Start.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/cli/Start.java 2010-02-18 09:16:11 UTC (rev 2061)
+++ trunk/src/dl-learner/org/dllearner/cli/Start.java 2010-02-18 10:00:44 UTC (rev 2062)
@@ -193,15 +193,15 @@
try {
start = new Start(file);
} catch (FileNotFoundException e) {
- System.out.println("The specified file " + file + " does not exist. See stack trace below.");
+ System.out.println("The specified file " + file + " does not exist. See stack trace.");
e.printStackTrace();
System.exit(0);
} catch (ComponentInitException e) {
- System.out.println("A component could not be initialised. See stack trace below.");
+ System.out.println("A component could not be initialised. See stack trace.");
e.printStackTrace();
System.exit(0);
} catch (ParseException e) {
- System.out.println("The specified file " + file + " is not a valid conf file. See stack trace below.");
+ System.out.println("The specified file " + file + " is not a valid conf file. See stack trace.");
e.printStackTrace();
System.exit(0);
}
Modified: trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2010-02-18 09:16:11 UTC (rev 2061)
+++ trunk/src/dl-learner/org/dllearner/learningproblems/ClassLearningProblem.java 2010-02-18 10:00:44 UTC (rev 2062)
@@ -29,6 +29,7 @@
import org.apache.log4j.Logger;
import org.dllearner.core.ComponentInitException;
+import org.dllearner.core.ComponentManager;
import org.dllearner.core.LearningProblem;
import org.dllearner.core.ReasonerComponent;
import org.dllearner.core.configurators.ClassLearningProblemConfigurator;
@@ -153,6 +154,11 @@
}
classInstances = new LinkedList<Individual>(reasoner.getIndividuals(classToDescribe));
+ // sanity check
+ if(classInstances.size() == 0) {
+ throw new ComponentInitException("Class " + classToDescribe + " has 0 instances according to \"" + ComponentManager.getInstance().getComponentName(reasoner.getClass()) + "\". Cannot perform class learning with 0 instances.");
+ }
+
classInstancesSet = new TreeSet<Individual>(classInstances);
equivalence = (configurator.getType().equals("equivalence"));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-02-18 11:16:21
|
Revision: 2063
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2063&view=rev
Author: jenslehmann
Date: 2010-02-18 11:16:14 +0000 (Thu, 18 Feb 2010)
Log Message:
-----------
fixed bug which caused problems when loading CELOE conf files in GUI
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java
trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java
trunk/src/dl-learner/org/dllearner/gui/Config.java
trunk/src/dl-learner/org/dllearner/gui/RunPanel.java
trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java
trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java
Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2010-02-18 10:00:44 UTC (rev 2062)
+++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2010-02-18 11:16:14 UTC (rev 2063)
@@ -313,6 +313,8 @@
@Override
public void start() {
+// System.out.println(configurator.getMaxExecutionTimeInSeconds());
+
stop = false;
isRunning = true;
reset();
@@ -367,6 +369,7 @@
// System.out.println("addNode finished" + " " + new Date());
}
+// System.out.println(" refinement queue length: " + refinements.size());
}
updateMinMaxHorizExp(nextNode);
@@ -391,6 +394,7 @@
// System.out.println(startNode.toTreeString(baseURI));
isRunning = false;
+// System.out.println("isRunning: " + isRunning);
}
private OENode getNextNodeToExpand() {
@@ -429,7 +433,7 @@
// returns true if node was added and false otherwise
private boolean addNode(Description description, OENode parentNode) {
- System.out.println(description);
+// System.out.println(description);
// redundancy check (return if redundant)
boolean nonRedundant = descriptions.add(description);
@@ -446,7 +450,7 @@
// quality of description (return if too weak)
double accuracy = learningProblem.getAccuracyOrTooWeak(description, noise);
// issue a warning if accuracy is not between 0 and 1 or -1 (too weak)
- if(accuracy > 1 || (accuracy < 0 || accuracy != -1)) {
+ if(accuracy > 1.0 || (accuracy < 0.0 && accuracy != -1)) {
logger.warn("Invalid accuracy value " + accuracy + " for description " + description + ". This could be caused by a bug in the heuristic measure and should be reported to the DL-Learner bug tracker.");
System.exit(0);
}
@@ -667,7 +671,7 @@
str += current + ": " + descriptionToString(ed.getDescription()) + " (pred. acc.: " + dfPercent.format(((PosNegLPStandard)learningProblem).getPredAccuracyOrTooWeakExact(ed.getDescription(),1)) + ", F-measure: "+ dfPercent.format(((PosNegLPStandard)learningProblem).getFMeasureOrTooWeakExact(ed.getDescription(),1)) + ")\n";
} else {
str += current + ": " + descriptionToString(ed.getDescription()) + " " + dfPercent.format(ed.getAccuracy()) + "\n";
- System.out.println(ed);
+// System.out.println(ed);
}
current++;
}
Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java 2010-02-18 10:00:44 UTC (rev 2062)
+++ trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ROLComponent2.java 2010-02-18 11:16:14 UTC (rev 2063)
@@ -188,8 +188,8 @@
// allowed/ignored concepts/roles could also be a reasoner option (?)
options.add(CommonConfigOptions.allowedConcepts());
options.add(CommonConfigOptions.ignoredConcepts());
- options.add(CommonConfigOptions.allowedRoles());
- options.add(CommonConfigOptions.ignoredRoles());
+// options.add(CommonConfigOptions.allowedRoles());
+// options.add(CommonConfigOptions.ignoredRoles());
options.add(CommonConfigOptions.useAllConstructor());
options.add(CommonConfigOptions.useExistsConstructor());
options.add(CommonConfigOptions.useHasValueConstructor());
Modified: trunk/src/dl-learner/org/dllearner/gui/Config.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/Config.java 2010-02-18 10:00:44 UTC (rev 2062)
+++ trunk/src/dl-learner/org/dllearner/gui/Config.java 2010-02-18 11:16:14 UTC (rev 2063)
@@ -151,6 +151,7 @@
reasoner = start.getReasonerComponent();
// rs = start.getReasonerComponent();
lp = start.getLearningProblem();
+// System.out.println(lp);
la = start.getLearningAlgorithm();
// all components initialised and enabled
Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2010-02-18 10:00:44 UTC (rev 2062)
+++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2010-02-18 11:16:14 UTC (rev 2063)
@@ -322,12 +322,12 @@
private String makeTime(Long nanoSeconds) {
if (nanoSeconds == null)
return null;
- Long hours = 0L, minutes = 0L, seconds = 0L, millis = 0L, mikros = 0L, nanos = 0L;
+ Long hours = 0L, minutes = 0L, seconds = 0L, millis = 0L; //, mikros = 0L, nanos = 0L;
String timeStr = "";
- nanos = nanoSeconds % 1000;
+// nanos = nanoSeconds % 1000;
nanoSeconds /= 1000;
- mikros = nanoSeconds % 1000;
+// mikros = nanoSeconds % 1000;
nanoSeconds /= 1000;
millis = nanoSeconds % 1000;
nanoSeconds /= 1000;
@@ -345,10 +345,10 @@
timeStr += seconds + "s ";
if (millis > 0)
timeStr += millis + "ms ";
- if (false)
- timeStr += mikros + "�s ";
- if (false)
- timeStr += nanos + "ns ";
+// if (false)
+// timeStr += mikros + "�s ";
+// if (false)
+// timeStr += nanos + "ns ";
return timeStr;
}
Modified: trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java 2010-02-18 10:00:44 UTC (rev 2062)
+++ trunk/src/dl-learner/org/dllearner/gui/StatisticsThread.java 2010-02-18 11:16:14 UTC (rev 2063)
@@ -52,8 +52,11 @@
sleep(2000);
}
// show final stats
+// System.out.println("terminated");
+// System.exit(0);
runPanel.showStats();
runPanel.algorithmTerminated();
+
} catch (InterruptedException e) {
e.printStackTrace();
}
Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java 2010-02-18 10:00:44 UTC (rev 2062)
+++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java 2010-02-18 11:16:14 UTC (rev 2063)
@@ -125,7 +125,8 @@
// get current value of this option for the given component
value = config.getConfigOptionValue(component, configOption);
-
+// System.out.println(configOption + " " + value);
+
// if the option value is an OWL class, we offer a dropdown box
if(((URLConfigOption) configOption).refersToOWLClass()) {
comboBox = new JComboBox();
@@ -137,7 +138,10 @@
comboBox.addItem(clazz.toManchesterSyntaxString(baseURI, prefixes));
}
comboBox.addActionListener(this);
- comboBox.setSelectedIndex(0);
+ // selecting index 0 causes incorrect class to load !
+// comboBox.setSelectedIndex(0);
+ NamedClass valueNc = new NamedClass(value.toString());
+ comboBox.setSelectedItem(valueNc.toManchesterSyntaxString(baseURI, prefixes));
add(comboBox);
} else {
// text field for strings
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-02-18 12:41:15
|
Revision: 2064
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2064&view=rev
Author: jenslehmann
Date: 2010-02-18 12:40:38 +0000 (Thu, 18 Feb 2010)
Log Message:
-----------
graphical tree display for CELOE algorithm in GUI (feature request #2952829)
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java
trunk/src/dl-learner/org/dllearner/algorithms/celoe/OENode.java
trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ExampleBasedNode.java
trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java
trunk/src/dl-learner/org/dllearner/gui/RunPanel.java
trunk/src/dl-learner/org/dllearner/gui/SearchTree.java
trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/algorithms/SearchTreeNode.java
trunk/src/dl-learner/org/dllearner/gui/SearchTreeNodeCmpWrapper.java
Added: trunk/src/dl-learner/org/dllearner/algorithms/SearchTreeNode.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/SearchTreeNode.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/algorithms/SearchTreeNode.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -0,0 +1,45 @@
+/**
+ * Copyright (C) 2007-2010, 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.algorithms;
+
+import java.util.Collection;
+
+import org.dllearner.core.owl.Description;
+
+/**
+ * Interface for search tree nodes, which are used in various algorithms.
+ *
+ * @author Jens Lehmann
+ *
+ */
+public interface SearchTreeNode {
+
+ /**
+ * Gets the OWL 2 class expression at this search tree node.
+ * @return The expression at this node.
+ */
+ public Description getExpression();
+
+ /**
+ * The children of this node.
+ * @return The children of this node.
+ */
+ public Collection<? extends SearchTreeNode> getChildren();
+}
Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java 2010-02-18 11:16:14 UTC (rev 2063)
+++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -21,6 +21,7 @@
import java.util.Comparator;
+import org.dllearner.algorithms.SearchTreeNode;
import org.dllearner.utilities.owl.ConceptComparator;
/**
Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/OENode.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/celoe/OENode.java 2010-02-18 11:16:14 UTC (rev 2063)
+++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/OENode.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -23,6 +23,7 @@
import java.util.LinkedList;
import java.util.List;
+import org.dllearner.algorithms.SearchTreeNode;
import org.dllearner.core.owl.Description;
/**
@@ -40,7 +41,7 @@
* @author Jens Lehmann
*
*/
-public class OENode {
+public class OENode implements SearchTreeNode {
private Description description;
@@ -84,6 +85,10 @@
return description;
}
+ public Description getExpression() {
+ return getDescription();
+ }
+
/**
* @return the accuracy
*/
Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ExampleBasedNode.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ExampleBasedNode.java 2010-02-18 11:16:14 UTC (rev 2063)
+++ trunk/src/dl-learner/org/dllearner/algorithms/refinement2/ExampleBasedNode.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -25,6 +25,7 @@
import java.util.SortedSet;
import java.util.TreeSet;
+import org.dllearner.algorithms.SearchTreeNode;
import org.dllearner.core.configurators.ROLComponent2Configurator;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.Individual;
@@ -40,7 +41,7 @@
* @author Jens Lehmann
*
*/
-public class ExampleBasedNode {
+public class ExampleBasedNode implements SearchTreeNode {
// public static long exampleMemoryCounter = 0;
@@ -268,6 +269,10 @@
return concept;
}
+ public Description getExpression() {
+ return getConcept();
+ }
+
public QualityEvaluationMethod getQualityEvaluationMethod() {
return qualityEvaluationMethod;
}
Modified: trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java 2010-02-18 11:16:14 UTC (rev 2063)
+++ trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -19,17 +19,20 @@
*/
package org.dllearner.gui;
+import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeMap;
+import java.util.TreeSet;
import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
+import org.dllearner.algorithms.SearchTreeNode;
import org.dllearner.algorithms.refinement2.ExampleBasedNode;
import org.dllearner.algorithms.refinement2.NodeComparatorStable;
@@ -45,20 +48,26 @@
public class EBNodeTreeModel implements TreeModel {
// root of the search tree
- private ExampleBasedNode rootNode;
+ private SearchTreeNode rootNode;
// a mapping from nodes to their children;
// the main problem is that example based nodes use sets instead
// of lists, so we need to convert these sets to lists and store
// them here
- private Map<ExampleBasedNode, List<ExampleBasedNode>> childrenMap = new TreeMap<ExampleBasedNode, List<ExampleBasedNode>>(
- new NodeComparatorStable());
+ private Map<SearchTreeNode, List<SearchTreeNode>> childrenMap;
+ // = new TreeMap<SearchTreeNode, List<SearchTreeNode>>(
+ // new NodeComparatorStable());
+ private Comparator<SearchTreeNode> nodeComparator;
+
// listeners for this model
private List<TreeModelListener> treeModelListeners = new LinkedList<TreeModelListener>();
- public EBNodeTreeModel(ExampleBasedNode rootNode) {
+ public EBNodeTreeModel(SearchTreeNode rootNode, Comparator<SearchTreeNode> comparator) {
this.rootNode = rootNode;
+ this.nodeComparator = comparator;
+ childrenMap = new TreeMap<SearchTreeNode, List<SearchTreeNode>>(comparator);
+ // new NodeComparatorStable());
}
public void addTreeModelListener(TreeModelListener l) {
@@ -66,15 +75,15 @@
}
public Object getChild(Object parent, int index) {
- return getChildren((ExampleBasedNode) parent).get(index);
+ return getChildren((SearchTreeNode) parent).get(index);
}
public int getChildCount(Object parent) {
- return ((ExampleBasedNode) parent).getChildren().size();
+ return ((SearchTreeNode) parent).getChildren().size();
}
public int getIndexOfChild(Object parent, Object child) {
- return getChildren((ExampleBasedNode) parent).indexOf(child);
+ return getChildren((SearchTreeNode) parent).indexOf(child);
}
public Object getRoot() {
@@ -102,15 +111,16 @@
}
// convert the set of children to a list and store it in this model
- private List<ExampleBasedNode> getChildren(ExampleBasedNode node) {
+ private List<SearchTreeNode> getChildren(SearchTreeNode node) {
// System.out.println("asking for children of " + node);
- List<ExampleBasedNode> children = childrenMap.get(node);
+ List<SearchTreeNode> children = childrenMap.get(node);
// if the children have not been cached or the list is outdated
// (node has more children now) we do an update
if (children == null || children.size() != node.getChildren().size()) {
- SortedSet<ExampleBasedNode> childrenSet = node.getChildren();
- children = new LinkedList<ExampleBasedNode>(childrenSet);
+ SortedSet<SearchTreeNode> childrenSet = new TreeSet<SearchTreeNode>(nodeComparator);
+ childrenSet.addAll(node.getChildren());
+ children = new LinkedList<SearchTreeNode>(childrenSet);
// we need to ensure that the children are sorted correctly
// children = new LinkedList<ExampleBasedNode>();
Modified: trunk/src/dl-learner/org/dllearner/gui/RunPanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2010-02-18 11:16:14 UTC (rev 2063)
+++ trunk/src/dl-learner/org/dllearner/gui/RunPanel.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -52,6 +52,7 @@
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
+import org.dllearner.algorithms.celoe.CELOE;
import org.dllearner.algorithms.refinement2.ROLComponent2;
import org.dllearner.core.EvaluatedDescription;
import org.dllearner.learningproblems.PosNegLPStandard;
@@ -419,8 +420,9 @@
// System.out.println("TEST");
// enable tree button
- if((config.getLearningAlgorithm() instanceof ROLComponent2)
- && (config.getLearningProblem() instanceof PosNegLPStandard)) {
+ if(((config.getLearningAlgorithm() instanceof ROLComponent2)
+ && (config.getLearningProblem() instanceof PosNegLPStandard))
+ || (config.getLearningAlgorithm() instanceof CELOE )) {
treeButton.setEnabled(true);
}
}
Modified: trunk/src/dl-learner/org/dllearner/gui/SearchTree.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/SearchTree.java 2010-02-18 11:16:14 UTC (rev 2063)
+++ trunk/src/dl-learner/org/dllearner/gui/SearchTree.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -21,6 +21,7 @@
import javax.swing.JTree;
+import org.dllearner.algorithms.celoe.OENode;
import org.dllearner.algorithms.refinement2.ExampleBasedNode;
/**
@@ -37,6 +38,13 @@
private int nrOfPositiveExamples;
private String baseURI;
+ // CELOE constructor
+ public SearchTree(EBNodeTreeModel model, String baseURI) {
+ super(model);
+ this.baseURI = baseURI;
+ }
+
+ // OCEL constructor
public SearchTree(EBNodeTreeModel model, int nrOfPositiveExamples, int nrOfNegativeExamples, String baseURI) {
super(model);
this.nrOfPositiveExamples = nrOfPositiveExamples;
@@ -52,8 +60,11 @@
boolean leaf,
int row,
boolean hasFocus) {
- ExampleBasedNode node = (ExampleBasedNode) value;
- return node.getShortDescriptionHTML(nrOfPositiveExamples, nrOfNegativeExamples, baseURI);
-// return node.toString();
+ if(value instanceof OENode) {
+ return ((OENode)value).getShortDescription(baseURI);
+ } else {
+ ExampleBasedNode node = (ExampleBasedNode) value;
+ return node.getShortDescriptionHTML(nrOfPositiveExamples, nrOfNegativeExamples, baseURI);
+ }
}
}
Added: trunk/src/dl-learner/org/dllearner/gui/SearchTreeNodeCmpWrapper.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/SearchTreeNodeCmpWrapper.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/gui/SearchTreeNodeCmpWrapper.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2007-2010, 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.gui;
+
+import java.util.Comparator;
+
+import org.dllearner.algorithms.SearchTreeNode;
+
+/**
+ * Takes a comparator for a specific search tree node type and generalises
+ * it to a comparator for all search tree nodes.
+ *
+ * @author Jens Lehmann
+ *
+ */
+public class SearchTreeNodeCmpWrapper implements Comparator<SearchTreeNode> {
+
+ private Comparator<SearchTreeNode> cmp;
+
+ @SuppressWarnings("unchecked")
+ public SearchTreeNodeCmpWrapper(Comparator<? extends SearchTreeNode> cmp) {
+ this.cmp = (Comparator<SearchTreeNode>) cmp;
+ }
+
+ @Override
+ public int compare(SearchTreeNode o1, SearchTreeNode o2) {
+ return cmp.compare(o1, o2);
+ }
+
+}
Modified: trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java 2010-02-18 11:16:14 UTC (rev 2063)
+++ trunk/src/dl-learner/org/dllearner/gui/TreeWindow.java 2010-02-18 12:40:38 UTC (rev 2064)
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2007-2008, Jens Lehmann
+ * Copyright (C) 2007-2010, Jens Lehmann
*
* This file is part of DL-Learner.
*
@@ -19,6 +19,7 @@
*/
package org.dllearner.gui;
+import java.util.Comparator;
import java.util.Set;
import javax.swing.JFrame;
@@ -28,14 +29,18 @@
import javax.swing.event.TreeWillExpandListener;
import javax.swing.tree.ExpandVetoException;
-import org.dllearner.algorithms.refinement2.ExampleBasedNode;
+import org.dllearner.algorithms.SearchTreeNode;
+import org.dllearner.algorithms.celoe.CELOE;
+import org.dllearner.algorithms.celoe.OEHeuristicRuntime;
+import org.dllearner.algorithms.refinement2.NodeComparatorStable;
import org.dllearner.algorithms.refinement2.ROLComponent2;
import org.dllearner.learningproblems.PosNegLPStandard;
/**
- * TreeWindow
+ * Window, which displays the search tree.
*
* @author Tilo Hielscher
+ * @author Jens Lehmann
*/
public class TreeWindow extends JFrame implements TreeWillExpandListener {
@@ -43,16 +48,18 @@
@SuppressWarnings("unused")
private Config config;
+
private EBNodeTreeModel ebNodeModel;
- private ExampleBasedNode rootNode;
+
+ private SearchTreeNode rootNode;
+
private JTree tree;
-
- @SuppressWarnings("unchecked")
+
public TreeWindow(Config config) {
this.config = config;
this.setTitle("DL-Learner Tree");
this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
-// this.setLocationByPlatform(true);
+ // this.setLocationByPlatform(true);
this.setSize(800, 600);
// set icon
@@ -61,49 +68,59 @@
this.getClass().getResource("icon.gif")));
// tree model
+ Comparator<SearchTreeNode> cmp = null;
if (config.getLearningAlgorithm() instanceof ROLComponent2) {
- ROLComponent2 ebrol = (ROLComponent2) config
- .getLearningAlgorithm();
+ ROLComponent2 ebrol = (ROLComponent2) config.getLearningAlgorithm();
this.rootNode = ebrol.getStartNode();
+ cmp = new SearchTreeNodeCmpWrapper(new NodeComparatorStable());
+ } else {
+ CELOE celoe = (CELOE) config.getLearningAlgorithm();
+ this.rootNode = celoe.getSearchTreeRoot();
+ cmp = new SearchTreeNodeCmpWrapper(new OEHeuristicRuntime());
+ }
+ this.ebNodeModel = new EBNodeTreeModel(rootNode, cmp);
-// System.out.println("childs1: " + rootNode.getChildren());
+ // childrens to treeModel
+ // Object first = ebNodeModel.getChild(rootNode, 0);
+ // System.out.println("getIndexOfChild: " +
+ // ebNodeModel.getIndexOfChild(rootNode, first));
- this.ebNodeModel = new EBNodeTreeModel(rootNode);
+ // System.out.println("childs2: " +
+ // ebNodeModel.getChildren((ExampleBasedNode) first));
- // childrens to treeModel
-// Object first = ebNodeModel.getChild(rootNode, 0);
-// System.out.println("getIndexOfChild: " + ebNodeModel.getIndexOfChild(rootNode, first));
-
- // System.out.println("childs2: " +
- // ebNodeModel.getChildren((ExampleBasedNode) first));
-
+ String baseURI = config.getReasoner().getBaseURI();
+ if (config.getLearningAlgorithm() instanceof ROLComponent2) {
// collect some helper values for display and accuracy calculations
PosNegLPStandard lp = (PosNegLPStandard) config.getLearningProblem();
Set<String> posExamples = lp.getConfigurator().getPositiveExamples();
Set<String> negExamples = lp.getConfigurator().getNegativeExamples();
- String baseURI = config.getReasoner().getBaseURI();
int nrOfPositiveExamples = posExamples.size();
int nrOfNegativeExamples = negExamples.size();
-
+
tree = new SearchTree(ebNodeModel, nrOfPositiveExamples, nrOfNegativeExamples, baseURI);
- // we need to call this, otherwise the width of the elements below the root node
- // corresponds to that of the toString() method on ExampleBasedNode, although we
- // use a different method to create a string representation of a node
- tree.updateUI();
-// ebNodeModel.nodeChanged(rootNode);
-// tree.addTreeWillExpandListener(this);
- this.add(new JScrollPane(tree));
+ } else {
+ tree = new SearchTree(ebNodeModel, baseURI);
}
+
+ // we need to call this, otherwise the width of the elements below the
+ // root node
+ // corresponds to that of the toString() method on ExampleBasedNode,
+ // although we
+ // use a different method to create a string representation of a node
+ tree.updateUI();
+ // ebNodeModel.nodeChanged(rootNode);
+ // tree.addTreeWillExpandListener(this);
+ this.add(new JScrollPane(tree));
- // }
-// this.repaint();
setVisible(true);
}
/*
* (non-Javadoc)
*
- * @see javax.swing.event.TreeWillExpandListener#treeWillCollapse(javax.swing.event.TreeExpansionEvent)
+ * @see
+ * javax.swing.event.TreeWillExpandListener#treeWillCollapse(javax.swing
+ * .event.TreeExpansionEvent)
*/
// @Override
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
@@ -112,7 +129,9 @@
/*
* (non-Javadoc)
*
- * @see javax.swing.event.TreeWillExpandListener#treeWillExpand(javax.swing.event.TreeExpansionEvent)
+ * @see
+ * javax.swing.event.TreeWillExpandListener#treeWillExpand(javax.swing.event
+ * .TreeExpansionEvent)
*/
// @Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-02-18 13:05:50
|
Revision: 2065
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2065&view=rev
Author: jenslehmann
Date: 2010-02-18 13:05:44 +0000 (Thu, 18 Feb 2010)
Log Message:
-----------
fix for bug #2952828 (NullPointerException when using CELOE in GUI in GeoSkills)
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java
trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java
Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2010-02-18 12:40:38 UTC (rev 2064)
+++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2010-02-18 13:05:44 UTC (rev 2065)
@@ -293,7 +293,8 @@
@Override
public Description getCurrentlyBestDescription() {
- return getCurrentlyBestEvaluatedDescription().getDescription();
+ EvaluatedDescription ed = getCurrentlyBestEvaluatedDescription();
+ return ed == null ? null : ed.getDescription();
}
@Override
Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java 2010-02-18 12:40:38 UTC (rev 2064)
+++ trunk/src/dl-learner/org/dllearner/gui/widgets/WidgetPanelURL.java 2010-02-18 13:05:44 UTC (rev 2065)
@@ -139,9 +139,13 @@
}
comboBox.addActionListener(this);
// selecting index 0 causes incorrect class to load !
-// comboBox.setSelectedIndex(0);
- NamedClass valueNc = new NamedClass(value.toString());
- comboBox.setSelectedItem(valueNc.toManchesterSyntaxString(baseURI, prefixes));
+ if(value == null) {
+ comboBox.setSelectedIndex(0);
+ } else {
+ NamedClass valueNc = new NamedClass(value.toString());
+ comboBox.setSelectedItem(valueNc.toManchesterSyntaxString(baseURI, prefixes));
+
+ }
add(comboBox);
} else {
// text field for strings
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2010-02-18 17:54:34
|
Revision: 2066
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2066&view=rev
Author: kurzum
Date: 2010-02-18 17:54:25 +0000 (Thu, 18 Feb 2010)
Log Message:
-----------
-added new method in learningalgorithms
-added string value to owlapi
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java
trunk/src/dl-learner/org/dllearner/scripts/tiger/IteratedConfig.java
trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java
trunk/src/dl-learner/org/dllearner/scripts/tiger/TestQueries.java
trunk/src/dl-learner/org/dllearner/utilities/datastructures/DescriptionSubsumptionTree.java
trunk/src/dl-learner/org/dllearner/utilities/experiments/ExperimentConfiguration.java
trunk/src/dl-learner/org/dllearner/utilities/experiments/Jamon.java
trunk/src/dl-learner/org/dllearner/utilities/experiments/TableRowColumn.java
trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIDescriptionConvertVisitor.java
Modified: trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -25,6 +25,7 @@
import java.util.TreeSet;
import org.dllearner.core.owl.Description;
+import org.dllearner.utilities.datastructures.DescriptionSubsumptionTree;
import org.dllearner.utilities.owl.ConceptTransformation;
/**
@@ -284,6 +285,13 @@
public synchronized List<? extends EvaluatedDescription> getCurrentlyBestEvaluatedDescriptions(double accuracyThreshold) {
return getCurrentlyBestEvaluatedDescriptions(Integer.MAX_VALUE, accuracyThreshold, false);
}
+
+ public synchronized List<? extends EvaluatedDescription> getCurrentlyBestMostGeneralEvaluatedDescriptions() {
+ List<? extends EvaluatedDescription> l = getCurrentlyBestEvaluatedDescriptions(getCurrentlyBestEvaluatedDescriptions().last().getAccuracy());
+ DescriptionSubsumptionTree t = new DescriptionSubsumptionTree(reasoner);
+ t.insert(l);
+ return t.getMostGeneralDescriptions(true);
+ }
/**
* Returns all learning problems supported by this component. This can be used to indicate that, e.g.
Modified: trunk/src/dl-learner/org/dllearner/scripts/tiger/IteratedConfig.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/tiger/IteratedConfig.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/scripts/tiger/IteratedConfig.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -15,13 +15,14 @@
public int negativeSplitAdd = 0;
public boolean useStartClass = true;
- public boolean searchTree = false;
- public int noise = 5;
- public int noiseIterationFactor = 1;
+ public boolean searchTree = true;
+ public int noise = 0;
+ public int noiseIterationFactor = 0;
//sets ValueFrequency treshold and maxExecution time
- public boolean adaptMaxRuntime = true;
- public int maxExecutionTime = 20;
- public double factor = 2.0d ;//1.5d;
+ public boolean adaptMaxRuntime = false;
+ public int maxExecutionTime = 30;
+// public int maxExecutionTimeMinimum = 20;
+ public double maxExecutionTimeFactor = 2.0d ;//1.5d;
public boolean useDataHasValue = true;
Modified: trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -17,7 +17,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.dllearner.algorithms.celoe.CELOE;
import org.dllearner.algorithms.refinement2.ROLComponent2;
import org.dllearner.algorithms.refinement2.ROLearner2;
import org.dllearner.core.ComponentManager;
@@ -37,6 +36,7 @@
import org.dllearner.learningproblems.PosNegLPStandard;
import org.dllearner.reasoning.FastInstanceChecker;
import org.dllearner.refinementoperators.RhoDRDown;
+import org.dllearner.utilities.Files;
import org.dllearner.utilities.Helper;
import org.dllearner.utilities.JamonMonitorLogger;
import org.dllearner.utilities.examples.ExampleDataCollector;
@@ -44,9 +44,12 @@
import org.dllearner.utilities.experiments.ExMakerFixedSize;
import org.dllearner.utilities.experiments.ExMakerRandomizer;
import org.dllearner.utilities.experiments.Examples;
-import org.dllearner.utilities.experiments.Jamon;
import org.dllearner.utilities.experiments.Table;
+import com.hp.hpl.jena.query.QuerySolution;
+import com.hp.hpl.jena.query.ResultSetRewindable;
+import com.hp.hpl.jena.rdf.model.Literal;
+import com.hp.hpl.jena.rdf.model.Resource;
import com.jamonapi.MonKeyImp;
import com.jamonapi.Monitor;
@@ -56,10 +59,10 @@
static DecimalFormat df = new DecimalFormat("00.###%");
public static DecimalFormat dftime = new DecimalFormat("#####.#");
- public static boolean newTiger = true;
+ public static boolean newTiger = false;
// static String backgroundXML = "files/tiger.noSchema.noImports.rdf";
- static String backgroundXML = (newTiger)?"files/VirtuosoSyntaxSchema.rdf":"files/tiger_trimmed_toPOS.rdf";
+ static String backgroundXML = "files/VirtuosoSyntaxSchema.rdf";
static String sparqlEndpointURL ="http://db0.aksw.org:8893/sparql";
static String graph = (newTiger)?"http://nlp2rdf.org/tigerFull":"http://nlp2rdf.org/tiger";
static String rulegraph = (newTiger)?"http://nlp2rdf.org/schemaFull/rules1":"http://nlp2rdf.org/schema/rules1";
@@ -81,19 +84,19 @@
- static MonKeyImp logFMeasure = new MonKeyImp("F-Measure", Jamon.PERCENTAGE);
- static MonKeyImp logPrecision = new MonKeyImp("Precision", Jamon.PERCENTAGE);
- static MonKeyImp logRecall = new MonKeyImp("Recall", Jamon.PERCENTAGE);
- static MonKeyImp logAccuracy = new MonKeyImp("Accuracy", Jamon.PERCENTAGE);
+ static MonKeyImp logFMeasure = new MonKeyImp("F-Measure", JamonMonitorLogger.PERCENTAGE);
+ static MonKeyImp logPrecision = new MonKeyImp("Precision", JamonMonitorLogger.PERCENTAGE);
+ static MonKeyImp logRecall = new MonKeyImp("Recall", JamonMonitorLogger.PERCENTAGE);
+ static MonKeyImp logAccuracy = new MonKeyImp("Accuracy", JamonMonitorLogger.PERCENTAGE);
- static MonKeyImp logLearningTime = new MonKeyImp("Learning Time", Jamon.MS);
- static MonKeyImp logIterationTime = new MonKeyImp("Iteration Time", Jamon.MS);
- static MonKeyImp nrOfRetrievedInstances = new MonKeyImp("Nr of retrieved Instances", Jamon.COUNT);
+ static MonKeyImp logLearningTime = new MonKeyImp("Learning Time", JamonMonitorLogger.MS);
+ static MonKeyImp logIterationTime = new MonKeyImp("Iteration Time", JamonMonitorLogger.MS);
+ static MonKeyImp nrOfRetrievedInstances = new MonKeyImp("Nr of retrieved Instances", JamonMonitorLogger.COUNT);
static List<MonKeyImp> mks = new ArrayList<MonKeyImp>(Arrays.asList(new MonKeyImp[] { logPrecision,
logRecall, logFMeasure, logAccuracy, logLearningTime, logIterationTime, nrOfRetrievedInstances}));
- static int iterations = 7;
+ static int iterations = 5;
static int folds = 10;
static int printSentences = 3;
@@ -118,11 +121,12 @@
}
- // folds = 2;
- // iterations = 2;
+
+ folds = 2;
+ iterations = 1;
long n = System.currentTimeMillis();
-// passiveNoZU();
- passiveWithZu();
+ passiveNoZU();
+// passiveWithZu();
String a="\n";
for(String s: concepts){
@@ -240,28 +244,23 @@
List<IteratedConfig> l = new ArrayList<IteratedConfig>();
IteratedConfig baseline = new IteratedConfig("baseline", iterations);
- baseline.initialsplits = 10;
- baseline.noise = 0;
- baseline.searchTree = true;
- baseline.factor = 10.0d;
-
+
IteratedConfig reducedExamples = new IteratedConfig("reducedExamples", iterations);
reducedExamples.initialsplits = 2;
reducedExamples.splits = 2;
- reducedExamples.factor = 6.0d;
- IteratedConfig fixRuntime = new IteratedConfig("fixRuntime", iterations);
- fixRuntime.adaptMaxRuntime = false;
- fixRuntime.maxExecutionTime = 20;
+ IteratedConfig adaptRuntime = new IteratedConfig("adaptRuntime3t", iterations);
+ adaptRuntime.adaptMaxRuntime = true;
+ adaptRuntime.maxExecutionTimeFactor = 3.0d;
IteratedConfig useLemma = new IteratedConfig("noLemma", iterations);
useLemma.useDataHasValue = false;
- l.add(baseline);
+// l.add(baseline);
l.add(reducedExamples);
- l.add(fixRuntime);
- l.add(useLemma);
+// l.add(adaptRuntime);
+// l.add(useLemma);
return l;
}
@@ -269,26 +268,24 @@
List<IteratedConfig> l = new ArrayList<IteratedConfig>();
IteratedConfig baseline = new IteratedConfig("baseline", iterations);
- baseline.noiseIterationFactor = 0;
- baseline.noise = 0;
- baseline.searchTree = true;
+
+
IteratedConfig increasedNegativeExamples = new IteratedConfig("increasedNegativeExamples", iterations);
increasedNegativeExamples.negativeSplitAdd = 10;
- IteratedConfig noNoise = new IteratedConfig("noNoise", iterations);
- noNoise.factor = 4.0d;
- noNoise.noise = 0;
- noNoise.noiseIterationFactor = 0;
+ IteratedConfig increasedNegativeExamples3t = new IteratedConfig("increasedNegativeExamples3t", iterations);
+ increasedNegativeExamples3t.negativeSplitAdd = 10;
+ increasedNegativeExamples3t.adaptMaxRuntime = true;
+ increasedNegativeExamples3t.maxExecutionTimeFactor = 3.0d;
+
-
-
IteratedConfig useLemma = new IteratedConfig("noLemma", iterations);
useLemma.useDataHasValue = false;
l.add(baseline);
l.add(increasedNegativeExamples);
- l.add(noNoise);
+ l.add(increasedNegativeExamples3t);
l.add(useLemma);
return l;
@@ -332,11 +329,8 @@
lastConcept = PrefixMap.toKBSyntaxString(ed.getDescription());
concepts.add(ed.getDescription().toKBSyntaxString(null,null));
logger.debug("USING CONCEPT: " + lastConcept);
+ logger.debug(PrefixMap.toManchesterSyntaxString(ed.getDescription()));
- if (true) {
- System.exit(0);
- }
-
/* RETRIEVING */
Monitor queryTime = JamonMonitorLogger.getTimeMonitor(TestIterativeLearning.class, "queryTime")
.start();
@@ -535,10 +529,14 @@
la.start();
learningTime.stop();
+// System.out.println(result = la.getCurrentlyBestEvaluatedDescription());
+// for (EvaluatedDescription edd : la.getCurrentlyBestMostGeneralEvaluatedDescriptions()) {
+// System.out.println(edd);
+// }
+
result = la.getCurrentlyBestEvaluatedDescription();
- logger.trace(PrefixMap.toKBSyntaxString(result.getDescription()));
- logger.trace(PrefixMap.toManchesterSyntaxString(result.getDescription()));
+
ComponentManager.getInstance().freeAllComponents();
} catch (Exception e) {
@@ -573,7 +571,7 @@
}
sparqlQueryGood = " \n define input:inference \"" + rulegraph + "\" \n" + "" + sparqlQueryGood;
- logger.trace(sparqlQueryGood);
+ logger.debug(sparqlQueryGood);
result.addAll(sparqlTasks.queryAsSet(sparqlQueryGood, "subject"));
m.stop();
@@ -618,7 +616,7 @@
int valueFrequencyThreshold = ex.getPosTrain().size();
int noise = config.noise + (config.noiseIterationFactor * iteration);
if (config.adaptMaxRuntime) {
- maxExecutionTime = (int) Math.floor(config.factor * (double) ex.sizeOfTrainingSets());
+ maxExecutionTime = (int) Math.floor(config.maxExecutionTimeFactor * (double) ex.sizeOfTrainingSets());
// valueFrequencyThreshold = (int)
// Math.floor(0.8d*((double)ex.getPosTrain().size()));
}
@@ -633,50 +631,15 @@
la.getConfigurator().setUseHasValueConstructor(false);
la.getConfigurator().setUseDataHasValueConstructor(config.useDataHasValue);
la.getConfigurator().setValueFrequencyThreshold(valueFrequencyThreshold);
+// la.getConfigurator().setInstanceBasedDisjoints(true);
-// if(config.ignorePOSFeatures){
-// la.getConfigurator().setIgnoredConcepts(VocabFilter.posClasses);
-// la.getConfigurator().setIgnoredRoles(VocabFilter.posProperties);
-// }
+// la.getConfigurator().setIgnoredConcepts(
+// new HashSet<String>(Arrays.asList(new String[] {
+// "http://nlp2rdf.org/ontology/sentencefinalpunctuation_tag",
+// "http://nlp2rdf.org/ontology/comma_tag",
+// "http://nachhalt.sfb632.uni-potsdam.de/owl/stts.owl#SentenceFinalPunctuation",
+// "http://nlp2rdf.org/ontology/generalsentenceinternalpunctuation_tag" })));
- SortedSet<String> inv = new TreeSet<String>();
- for(String s : VocabFilter.syntaxProperies){
- if(s.toLowerCase().endsWith("inv")){
- inv.add(s);
- }
- }
- inv.add("http://nlp2rdf.org/ontology/hasToken");
- inv.add("http://nlp2rdf.org/ontology/firstToken");
-// System.out.println(inv);
-// if (true) {
-// System.exit(0);
-// }
- SortedSet<String> all = new TreeSet<String>(Helper.difference(VocabFilter.syntaxProperies, inv));
- all.addAll(VocabFilter.posProperties);
- la.getConfigurator().setAllowedRoles(all);
-// if(config.ignoreSyntaxFeatures){
-// la.getConfigurator().setIgnoredConcepts(VocabFilter.syntaxClasses);
-// la.getConfigurator().setIgnoredRoles(VocabFilter.syntaxProperies);
-// }else{
-// la.getConfigurator().setAllowedRoles(all);
-// }
-
-
-
-
-
-// la.getConfigurator().setInstanceBasedDisjoints(false);
-
-
-
-
- la.getConfigurator().setIgnoredConcepts(
- new HashSet<String>(Arrays.asList(new String[] {
- "http://nlp2rdf.org/ontology/sentencefinalpunctuation_tag",
- "http://nlp2rdf.org/ontology/comma_tag",
- "http://nachhalt.sfb632.uni-potsdam.de/owl/stts.owl#SentenceFinalPunctuation",
- "http://nlp2rdf.org/ontology/generalsentenceinternalpunctuation_tag" })));
-
la.getConfigurator().setNoisePercentage(noise);
la.getConfigurator().setTerminateOnNoiseReached(true);
la.getConfigurator().setMaxExecutionTimeInSeconds(maxExecutionTime);
@@ -690,7 +653,37 @@
la.getConfigurator().setReplaceSearchTree(true);
return la;
}
+
+// if(config.ignorePOSFeatures){
+// la.getConfigurator().setIgnoredConcepts(VocabFilter.posClasses);
+// la.getConfigurator().setIgnoredRoles(VocabFilter.posProperties);
+//}
+//SortedSet<String> inv = new TreeSet<String>();
+//for(String s : VocabFilter.syntaxProperies){
+// if(s.toLowerCase().endsWith("inv")){
+// inv.add(s);
+// }
+//}
+//inv.add("http://nlp2rdf.org/ontology/hasToken");
+//inv.add("http://nlp2rdf.org/ontology/firstToken");
+//System.out.println(inv);
+//if (true) {
+// System.exit(0);
+//}
+//SortedSet<String> all = new TreeSet<String>(Helper.difference(VocabFilter.syntaxProperies, inv));
+//all.addAll(VocabFilter.posProperties);
+//la.getConfigurator().setAllowedRoles(all);
+//if(config.ignoreSyntaxFeatures){
+// la.getConfigurator().setIgnoredConcepts(VocabFilter.syntaxClasses);
+// la.getConfigurator().setIgnoredRoles(VocabFilter.syntaxProperies);
+//}else{
+// la.getConfigurator().setAllowedRoles(all);
+//}
+//la.getConfigurator().setInstanceBasedDisjoints(false);
+
+
+
public static SortedSet<String> read(String f) {
SortedSet<String> result = new TreeSet<String>();
BufferedReader in = null;
Modified: trunk/src/dl-learner/org/dllearner/scripts/tiger/TestQueries.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/tiger/TestQueries.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/scripts/tiger/TestQueries.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -27,7 +27,7 @@
import org.dllearner.parser.ParseException;
import org.dllearner.refinementoperators.RhoDRDown;
import org.dllearner.utilities.Files;
-import org.dllearner.utilities.experiments.Jamon;
+import org.dllearner.utilities.JamonMonitorLogger;
import org.dllearner.utilities.experiments.Table;
import org.dllearner.utilities.experiments.TableRowColumn;
import org.dllearner.utilities.experiments.TableRowColumn.Display;
@@ -64,9 +64,9 @@
static String graph = "http://nlp2rdf.org/tiger";
static String rulegraph = "http://nlp2rdf.org/schema/rules1";
- static MonKeyImp queryTime = new MonKeyImp("Query Time", Jamon.MS);
- static MonKeyImp length = new MonKeyImp("length", Jamon.COUNT);
- static MonKeyImp hits = new MonKeyImp("hits", Jamon.COUNT);
+ static MonKeyImp queryTime = new MonKeyImp("Query Time", JamonMonitorLogger.MS);
+ static MonKeyImp length = new MonKeyImp("length", JamonMonitorLogger.COUNT);
+ static MonKeyImp hits = new MonKeyImp("hits", JamonMonitorLogger.COUNT);
static List<MonKeyImp> mks = new ArrayList<MonKeyImp>(Arrays.asList(new MonKeyImp[] { queryTime}));
@@ -116,7 +116,7 @@
String label1 = "Time "+d.getLength();
String label2 = "Length "+d.getLength();
Monitor m1 = MonitorFactory.getTimeMonitor(label1).start();
- Monitor m2 = MonitorFactory.getMonitor(label2, Jamon.COUNT);
+ Monitor m2 = MonitorFactory.getMonitor(label2, JamonMonitorLogger.COUNT);
m2.add(d.getLength());
sparqlTasks.queryAsResultSet(q);
Modified: trunk/src/dl-learner/org/dllearner/utilities/datastructures/DescriptionSubsumptionTree.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/datastructures/DescriptionSubsumptionTree.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/utilities/datastructures/DescriptionSubsumptionTree.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -178,6 +178,32 @@
}
return ret.toString();
}
+
+ public List<EvaluatedDescription> getOrderedBySubsumptionAndAccuracy(boolean distinct){
+ List<EvaluatedDescription> l = new ArrayList<EvaluatedDescription>();
+ for(Node subs:subClasses){
+ l.add(subs.getEvalDesc());
+ }
+
+ for(Node subs:subClasses){
+ if(distinct){
+ for(EvaluatedDescription subsubs : subs.getOrderedBySubsumptionAndAccuracy(distinct)){
+ if(!l.contains(subsubs)){
+ l.add(subsubs);
+ }
+ }
+ }else{
+ l.addAll(subs.getOrderedBySubsumptionAndAccuracy(distinct));
+ }
+
+ }
+ return l;
+
+ }
+
+ public double getAccuracy() {
+ return accuracy;
+ }
@Override
public int compareTo(Node node) {
@@ -228,8 +254,13 @@
public Node getRootNode(){
return rootNode;
}
+
+ public List<EvaluatedDescription> getMostGeneralDescriptions(boolean distinct){
+ return rootNode.getOrderedBySubsumptionAndAccuracy(distinct);
+
+ }
- public void insert(Collection<EvaluatedDescription> evaluatedDescriptions) {
+ public void insert(Collection<? extends EvaluatedDescription> evaluatedDescriptions) {
for (EvaluatedDescription evaluatedDescription : evaluatedDescriptions) {
logger.warn("Next to insert: " + evaluatedDescription.toString());
Node n = new Node(evaluatedDescription);
@@ -273,4 +304,9 @@
return rootNode._toString("");
}
+// public void insert(List<? extends EvaluatedDescription> currentlyBestEvaluatedDescriptions) {
+// insert(currentlyBestEvaluatedDescriptions);
+//
+// }
+
}
Modified: trunk/src/dl-learner/org/dllearner/utilities/experiments/ExperimentConfiguration.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/experiments/ExperimentConfiguration.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/utilities/experiments/ExperimentConfiguration.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -25,6 +25,7 @@
import java.util.Map;
import org.apache.log4j.Logger;
+import org.dllearner.utilities.JamonMonitorLogger;
import com.jamonapi.MonKeyImp;
import com.jamonapi.Monitor;
@@ -113,7 +114,7 @@
Monitor[] marr = new Monitor[sizeOfResultVector];
for (int i = 0; i < sizeOfResultVector; i++) {
MonKeyImp newMonKey = mon(oldMonkey, i);
- if (newMonKey.getUnits().equals(Jamon.MS)) {
+ if (newMonKey.getUnits().equals(JamonMonitorLogger.MS)) {
marr[i] = MonitorFactory.getTimeMonitor(newMonKey);
} else {
marr[i] = MonitorFactory.getMonitor(newMonKey);
Modified: trunk/src/dl-learner/org/dllearner/utilities/experiments/Jamon.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/experiments/Jamon.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/utilities/experiments/Jamon.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -3,11 +3,11 @@
public class Jamon {
- public static final String MS = "ms.";
- public static final String SECONDS = "sec.";
- public static final String COUNT = "count";
- public static final String DOUBLE = "double";
- public static final String PERCENTAGE = "%";
+// public static final String MS = "ms.";
+// public static final String SECONDS = "sec.";
+// public static final String COUNT = "count";
+// public static final String DOUBLE = "double";
+// public static final String PERCENTAGE = "%";
Modified: trunk/src/dl-learner/org/dllearner/utilities/experiments/TableRowColumn.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/experiments/TableRowColumn.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/utilities/experiments/TableRowColumn.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -17,6 +17,8 @@
public enum Display {
AVG, HITS, TOTAL
}
+
+ public static boolean useStdDevWithPercentageUnit = true;
public static String latexSep = "\t&\t";
public static String latexEnd = "\\\\";
@@ -111,8 +113,21 @@
}
public String getLatexEntry(int i) {
- return latexFormat(monitors[i], getValue(i)) + " "+ (useStdDev ? "(\\pm"+latexFormat(monitors[i], monitors[i].getStdDev()) + ") " : "");
+ return latexFormat(monitors[i], getValue(i)) + " "+getLatexStdDev(i) ;
}
+ private String getLatexStdDev(int i){
+ String tex = "(\\pm"+latexFormat(monitors[i], monitors[i].getStdDev()) + ") ";
+ if(useStdDev){
+ return tex;
+ }
+
+ if(useStdDevWithPercentageUnit && monitors[i].getUnits().equals(JamonMonitorLogger.PERCENTAGE)){
+ return tex;
+ }
+
+ return "";
+
+ }
public String getGnuPlotEntry(int i) {
return dfGnuPlotDefault.format(getValue(i)) + "";
Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIDescriptionConvertVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIDescriptionConvertVisitor.java 2010-02-18 13:05:44 UTC (rev 2065)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIDescriptionConvertVisitor.java 2010-02-18 17:54:25 UTC (rev 2066)
@@ -338,8 +338,10 @@
return factory.getOWLDataType(Datatype.INT.getURI());
else if(datatype.equals(Datatype.DOUBLE))
return factory.getOWLDataType(Datatype.DOUBLE.getURI());
+// else if(datatype.equals(Datatype.STRING))
+// return factory.getOWLDataType(Datatype.STRING.getURI());
- throw new Error("OWLAPIDescriptionConverter: datatype not implemented");
+ throw new Error("OWLAPIDescriptionConverter: datatype "+datatype+" not implemented");
}
private OWLConstant convertConstant(Constant constant) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2010-02-18 21:07:18
|
Revision: 2068
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2068&view=rev
Author: kurzum
Date: 2010-02-18 21:07:08 +0000 (Thu, 18 Feb 2010)
Log Message:
-----------
new transitive option for virtuoso
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java
trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2010-02-18 18:13:57 UTC (rev 2067)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2010-02-18 21:07:08 UTC (rev 2068)
@@ -30,8 +30,6 @@
import org.apache.log4j.Logger;
import org.dllearner.algorithms.gp.ADC;
import org.dllearner.core.ComponentManager;
-import org.dllearner.core.owl.Constant;
-import org.dllearner.core.owl.Datatype;
import org.dllearner.core.owl.DatatypeExactCardinalityRestriction;
import org.dllearner.core.owl.DatatypeMaxCardinalityRestriction;
import org.dllearner.core.owl.DatatypeMinCardinalityRestriction;
@@ -54,7 +52,6 @@
import org.dllearner.core.owl.ObjectValueRestriction;
import org.dllearner.core.owl.StringValueRestriction;
import org.dllearner.core.owl.Thing;
-import org.dllearner.core.owl.TypedConstant;
import org.dllearner.core.owl.Union;
import org.dllearner.parser.KBParser;
import org.dllearner.parser.ParseException;
@@ -75,6 +72,11 @@
private int limit = 5;
private boolean labels = false;
private boolean distinct = false;
+ private SortedSet<String> transitiveProperties =null;
+ public void setTransitiveProperties(SortedSet<String> transitiveProperties) {
+ this.transitiveProperties = transitiveProperties;
+ }
+
private Map<String,String> classToSubclassesVirtuoso = null;
private Stack<String> stack = new Stack<String>();
@@ -318,7 +320,11 @@
*/
public void visit(ObjectSomeRestriction description) {
logger.trace("ObjectSomeRestriction");
- query += "\n?" + stack.peek() + " <" + description.getRole() + "> ?object" + currentObject + ". ";
+ String option = "";
+ if(transitiveProperties!= null && transitiveProperties.contains(description.getRole().toString()) ){
+ option =" OPTION (TRANSITIVE , t_in(?" + stack.peek()+"), t_out(?object" + currentObject + "), T_MIN(0), T_MAX(6), T_DIRECTION 1 , T_NO_CYCLES) ";
+ }
+ query += "\n?" + stack.peek() + " <" + description.getRole() + "> ?object" + currentObject + option + ". ";
stack.push("object" + currentObject);
currentObject++;
description.getChild(0).accept(this);
Modified: trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java 2010-02-18 18:13:57 UTC (rev 2067)
+++ trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java 2010-02-18 21:07:08 UTC (rev 2068)
@@ -34,9 +34,9 @@
import org.dllearner.kb.sparql.SparqlQuery;
import org.dllearner.kb.sparql.SparqlQueryDescriptionConvertVisitor;
import org.dllearner.learningproblems.PosNegLPStandard;
+import org.dllearner.parser.ParseException;
import org.dllearner.reasoning.FastInstanceChecker;
import org.dllearner.refinementoperators.RhoDRDown;
-import org.dllearner.utilities.Files;
import org.dllearner.utilities.Helper;
import org.dllearner.utilities.JamonMonitorLogger;
import org.dllearner.utilities.examples.ExampleDataCollector;
@@ -46,10 +46,6 @@
import org.dllearner.utilities.experiments.Examples;
import org.dllearner.utilities.experiments.Table;
-import com.hp.hpl.jena.query.QuerySolution;
-import com.hp.hpl.jena.query.ResultSetRewindable;
-import com.hp.hpl.jena.rdf.model.Literal;
-import com.hp.hpl.jena.rdf.model.Resource;
import com.jamonapi.MonKeyImp;
import com.jamonapi.Monitor;
@@ -96,7 +92,7 @@
static List<MonKeyImp> mks = new ArrayList<MonKeyImp>(Arrays.asList(new MonKeyImp[] { logPrecision,
logRecall, logFMeasure, logAccuracy, logLearningTime, logIterationTime, nrOfRetrievedInstances}));
- static int iterations = 5;
+ static int iterations = 4;
static int folds = 10;
static int printSentences = 3;
@@ -121,12 +117,9 @@
}
-
- folds = 2;
- iterations = 1;
long n = System.currentTimeMillis();
passiveNoZU();
-// passiveWithZu();
+ passiveWithZu();
String a="\n";
for(String s: concepts){
@@ -334,6 +327,7 @@
/* RETRIEVING */
Monitor queryTime = JamonMonitorLogger.getTimeMonitor(TestIterativeLearning.class, "queryTime")
.start();
+
retrieved = getSentences(ed, config.resultLimit);
config.add(nrOfRetrievedInstances, i, retrieved.size());
logger.debug("retrieved: "+retrieved.size());
@@ -573,8 +567,23 @@
sparqlQueryGood = " \n define input:inference \"" + rulegraph + "\" \n" + "" + sparqlQueryGood;
logger.debug(sparqlQueryGood);
-
- result.addAll(sparqlTasks.queryAsSet(sparqlQueryGood, "subject"));
+ try{
+ result.addAll(sparqlTasks.queryAsSet(sparqlQueryGood, "subject"));
+ }catch (Exception e) {
+ e.printStackTrace();
+ logger.warn("Virtuoso error trying this:");
+ SortedSet<String> s = new TreeSet<String> (Arrays.asList(new String[]{"http://nlp2rdf.org/ontology/nextToken", "http://nlp2rdf.org/ontology/previousToken"}));
+ visit.setTransitiveProperties(s);
+ try {
+ sparqlQueryGood = " \n define input:inference \"" + rulegraph + "\" \n" + "" + visit.getSparqlQuery(ed.getDescription().toKBSyntaxString());
+ logger.warn(sparqlQueryGood);
+ result.addAll(sparqlTasks.queryAsSet(sparqlQueryGood, "subject"));
+
+ } catch (ParseException e1) {
+ e1.printStackTrace();
+ }
+ }
+
m.stop();
logger.debug("query avg: " + ((double) m.getAvg() / (double) 1000) + " seconds (last: "
+ ((double) m.getLastValue() / (double) 1000) + ")");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2010-02-19 19:49:29
|
Revision: 2072
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2072&view=rev
Author: kurzum
Date: 2010-02-19 19:49:23 +0000 (Fri, 19 Feb 2010)
Log Message:
-----------
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java
trunk/src/dl-learner/org/dllearner/utilities/experiments/ExMakerRandomizer.java
Modified: trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java 2010-02-19 19:20:13 UTC (rev 2071)
+++ trunk/src/dl-learner/org/dllearner/scripts/tiger/TestIterativeLearning.java 2010-02-19 19:49:23 UTC (rev 2072)
@@ -136,6 +136,8 @@
SortedSet<String> positives = read(passiveNoZU);
SortedSet<String> negatives = read(active);
+
+
// removing overlap
positives.removeAll(negatives);
negatives.removeAll(positives);
@@ -180,10 +182,14 @@
public static void passiveWithZu() {
SortedSet<String> positives = read(passiveWithZu);
SortedSet<String> negatives = read(active);
+ negatives.addAll(read(passiveNoZU));
+ SortedSet<String> positivesTMP = new TreeSet<String>();
+ positivesTMP.addAll(positives);
+
// removing overlap
positives.removeAll(negatives);
- negatives.removeAll(positives);
+ negatives.removeAll(positivesTMP);
Examples allExamples = new Examples();
allExamples.addPosTrain(positives);
@@ -205,6 +211,7 @@
//
/*CLEANUP*/
positives = null;
+ positivesTMP = null;
negatives = null;
allExamples = null;
Modified: trunk/src/dl-learner/org/dllearner/utilities/experiments/ExMakerRandomizer.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/experiments/ExMakerRandomizer.java 2010-02-19 19:20:13 UTC (rev 2071)
+++ trunk/src/dl-learner/org/dllearner/utilities/experiments/ExMakerRandomizer.java 2010-02-19 19:49:23 UTC (rev 2072)
@@ -67,6 +67,11 @@
int sizeOfPosTestSet = examples.sizeTotalOfPositives()-sizeOfPosTrainingSet;
int sizeOfNegTestSet = examples.sizeTotalOfNegatives()-sizeOfNegTrainingSet;
+// System.out.println(sizeOfPosTrainingSet);
+// System.out.println(sizeOfNegTrainingSet);
+// System.out.println(sizeOfPosTestSet);
+// System.out.println(sizeOfNegTestSet);
+
List<String> posRemaining = new ArrayList<String>(examples.getPositiveExamples());
List<String> negRemaining = new ArrayList<String>(examples.getNegativeExamples());
@@ -75,11 +80,11 @@
for (int i = 0; i < posRemaining.size(); i++) {
String one = posRemaining.get(i);
if(ret.getPosTrain().size()>sizeOfPosTrainingSet){
- ret.addPosTrain(one);
+ ret.addPosTest(one);
continue;
}
if(ret.getPosTest().size()>sizeOfPosTestSet){
- ret.addPosTest(one);
+ ret.addPosTrain(one);
continue;
}
@@ -93,11 +98,11 @@
for (int i = 0; i < negRemaining.size(); i++) {
String one = negRemaining.get(i);
if(ret.getNegTrain().size()>sizeOfNegTrainingSet){
- ret.addNegTrain(one);
+ ret.addNegTest(one);
continue;
}
if(ret.getNegTest().size()>sizeOfNegTestSet){
- ret.addNegTest(one);
+ ret.addNegTrain(one);
continue;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2010-02-25 17:04:51
|
Revision: 2076
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2076&view=rev
Author: kurzum
Date: 2010-02-25 17:04:34 +0000 (Thu, 25 Feb 2010)
Log Message:
-----------
changed getResource to correct ClassLoader
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/Info.java
trunk/src/dl-learner/org/dllearner/core/ComponentManager.java
Modified: trunk/src/dl-learner/org/dllearner/Info.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/Info.java 2010-02-25 14:38:46 UTC (rev 2075)
+++ trunk/src/dl-learner/org/dllearner/Info.java 2010-02-25 17:04:34 UTC (rev 2076)
@@ -3,6 +3,6 @@
package org.dllearner;
public class Info {
- public static final String build = "2010-01-04";
+ public static final String build = "2010-02-25";
}
\ No newline at end of file
Modified: trunk/src/dl-learner/org/dllearner/core/ComponentManager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2010-02-25 14:38:46 UTC (rev 2075)
+++ trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2010-02-25 17:04:34 UTC (rev 2076)
@@ -23,6 +23,7 @@
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -203,8 +204,9 @@
List<String> componentStrings = new LinkedList<String>();
try {
-
- DataInputStream in = new DataInputStream(ClassLoader.getSystemResourceAsStream(componentsFile));
+
+ InputStream is = ComponentManager.class.getClassLoader().getResourceAsStream(componentsFile);
+ DataInputStream in = new DataInputStream(is);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-03-03 14:00:16
|
Revision: 2083
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2083&view=rev
Author: jenslehmann
Date: 2010-03-03 14:00:10 +0000 (Wed, 03 Mar 2010)
Log Message:
-----------
added tracing to some reasoner queries
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java
trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java
Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2010-03-03 13:22:07 UTC (rev 2082)
+++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2010-03-03 14:00:10 UTC (rev 2083)
@@ -19,6 +19,7 @@
*/
package org.dllearner.core;
+import java.text.DecimalFormat;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@@ -45,6 +46,7 @@
import org.dllearner.core.owl.ClassHierarchy;
import org.dllearner.core.owl.Thing;
import org.dllearner.reasoning.ReasonerType;
+import org.dllearner.utilities.Helper;
import org.dllearner.utilities.datastructures.SortedSetTuple;
import org.dllearner.utilities.owl.ConceptComparator;
import org.dllearner.utilities.owl.OWLVocabulary;
@@ -234,6 +236,9 @@
reasoningDurationTmp = System.nanoTime() - reasoningStartTimeTmp;
subsumptionReasoningTimeNs += reasoningDurationTmp;
overallReasoningTimeNs += reasoningDurationTmp;
+ if(logger.isTraceEnabled()) {
+ logger.trace("reasoner query isSuperClassOf: " + superClass + " " + subClass + " " + result);
+ }
return result;
}
@@ -255,6 +260,9 @@
reasoningDurationTmp = System.nanoTime() - reasoningStartTimeTmp;
subsumptionReasoningTimeNs += reasoningDurationTmp;
overallReasoningTimeNs += reasoningDurationTmp;
+ if(logger.isTraceEnabled()) {
+ logger.trace("reasoner query isEquivalentClass: " + class1 + " " + class2 + " " + result);
+ }
return result;
}
@@ -340,6 +348,9 @@
reasoningDurationTmp = System.nanoTime() - reasoningStartTimeTmp;
retrievalReasoningTimeNs += reasoningDurationTmp;
overallReasoningTimeNs += reasoningDurationTmp;
+ if(logger.isTraceEnabled()) {
+ logger.trace("reasoner query getIndividuals: " + concept + " " + result);
+ }
return result;
}
@@ -1168,4 +1179,39 @@
return nrOfMultiInstanceChecks;
}
+ @Override
+ public String toString() {
+ String str = "";
+ if (nrOfRetrievals > 0) {
+ str += "number of retrievals: " + nrOfRetrievals + "\n";
+ str += "retrieval reasoning time: "
+ + Helper.prettyPrintNanoSeconds(retrievalReasoningTimeNs)
+ + " ( " + Helper.prettyPrintNanoSeconds(getTimePerRetrievalNs())
+ + " per retrieval)" + "\n";
+ }
+ if (nrOfInstanceChecks > 0) {
+ str += "number of instance checks: " + nrOfInstanceChecks + " ("
+ + nrOfMultiInstanceChecks + " multiple)\n";
+ str += "instance check reasoning time: "
+ + Helper.prettyPrintNanoSeconds(instanceCheckReasoningTimeNs) + " ( "
+ + Helper.prettyPrintNanoSeconds(getTimePerInstanceCheckNs())
+ + " per instance check)\n";
+ }
+ if (nrOfSubsumptionHierarchyQueries > 0) {
+ str += "subsumption hierarchy queries: "
+ + nrOfSubsumptionHierarchyQueries + "\n";
+ }
+ if (nrOfSubsumptionChecks > 0) {
+ str += "(complex) subsumption checks: " + nrOfSubsumptionChecks
+ + " (" + nrOfMultiSubsumptionChecks + " multiple)\n";
+ str += "subsumption reasoning time: "
+ + Helper.prettyPrintNanoSeconds(subsumptionReasoningTimeNs) + " ( "
+ + Helper.prettyPrintNanoSeconds(getTimePerSubsumptionCheckNs())
+ + " per subsumption check)\n";
+ }
+ str += "overall reasoning time: "
+ + Helper.prettyPrintNanoSeconds(overallReasoningTimeNs) + "\n";
+ return str;
+ }
+
}
Modified: trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2010-03-03 13:22:07 UTC (rev 2082)
+++ trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2010-03-03 14:00:10 UTC (rev 2083)
@@ -26,6 +26,8 @@
import java.util.Set;
import java.util.TreeSet;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
import org.dllearner.algorithms.refinement2.ROLComponent2;
import org.dllearner.core.ComponentInitException;
import org.dllearner.core.ComponentManager;
@@ -219,6 +221,7 @@
@Test
public void rhoDownTestPellet() {
+ Logger.getRootLogger().setLevel(Level.TRACE);
ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.FATHER);
RhoDRDown rho = new RhoDRDown(rs);
NamedClass nc = new NamedClass("http://example.com/father#male");
@@ -235,6 +238,7 @@
// (male AND male AND male)
// (male AND (NOT female))
// (male AND EXISTS hasChild.TOP)
+ System.out.println(rs);
assertTrue(refinements.size()==8);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-03-03 21:19:33
|
Revision: 2084
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2084&view=rev
Author: jenslehmann
Date: 2010-03-03 21:19:27 +0000 (Wed, 03 Mar 2010)
Log Message:
-----------
Pellet problem finally detected and fixed (introduction of top and bottom role in sub/super property reasoner requests Pellet 2.0.1)
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java
trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java
trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java
Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2010-03-03 14:00:10 UTC (rev 2083)
+++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2010-03-03 21:19:27 UTC (rev 2084)
@@ -19,7 +19,6 @@
*/
package org.dllearner.core;
-import java.text.DecimalFormat;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
@@ -32,6 +31,7 @@
import org.apache.log4j.Logger;
import org.dllearner.core.owl.Axiom;
+import org.dllearner.core.owl.ClassHierarchy;
import org.dllearner.core.owl.Constant;
import org.dllearner.core.owl.DataRange;
import org.dllearner.core.owl.DatatypeProperty;
@@ -43,7 +43,6 @@
import org.dllearner.core.owl.Nothing;
import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.core.owl.ObjectPropertyHierarchy;
-import org.dllearner.core.owl.ClassHierarchy;
import org.dllearner.core.owl.Thing;
import org.dllearner.reasoning.ReasonerType;
import org.dllearner.utilities.Helper;
Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java 2010-03-03 14:00:10 UTC (rev 2083)
+++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java 2010-03-03 21:19:27 UTC (rev 2084)
@@ -40,15 +40,20 @@
TreeSet<ObjectProperty> mostGeneralRoles = new TreeSet<ObjectProperty>(rc);
TreeSet<ObjectProperty> mostSpecialRoles = new TreeSet<ObjectProperty>(rc);
+ ObjectProperty topRole = new ObjectProperty("http://www.w3.org/2002/07/owl#topObjectProperty");
+ ObjectProperty botRole = new ObjectProperty("http://www.w3.org/2002/07/owl#bottomObjectProperty");
+
public ObjectPropertyHierarchy(Set<ObjectProperty> atomicRoles, TreeMap<ObjectProperty,SortedSet<ObjectProperty>> roleHierarchyUp , TreeMap<ObjectProperty,SortedSet<ObjectProperty>> roleHierarchyDown) {
this.roleHierarchyUp = roleHierarchyUp;
this.roleHierarchyDown = roleHierarchyDown;
// find most general and most special roles
for(ObjectProperty role : atomicRoles) {
- if(getMoreGeneralRoles(role).size()==0)
+ SortedSet<ObjectProperty> moreGen = getMoreGeneralRoles(role);
+ SortedSet<ObjectProperty> moreSpec = getMoreSpecialRoles(role);
+ if(moreGen.size()==0 || (moreGen.size()==1 && moreGen.first().equals(topRole)))
mostGeneralRoles.add(role);
- if(getMoreSpecialRoles(role).size()==0)
+ if(moreSpec.size()==0 || (moreSpec.size()==1 && moreSpec.first().equals(botRole)))
mostSpecialRoles.add(role);
}
}
Modified: trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2010-03-03 14:00:10 UTC (rev 2083)
+++ trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2010-03-03 21:19:27 UTC (rev 2084)
@@ -238,7 +238,9 @@
// (male AND male AND male)
// (male AND (NOT female))
// (male AND EXISTS hasChild.TOP)
- System.out.println(rs);
+// System.out.println(rs);
+// System.out.println("most general properties: " + rs.getMostGeneralProperties());
+// System.out.println(rs.getObjectPropertyHierarchy());
assertTrue(refinements.size()==8);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-03-04 10:46:39
|
Revision: 2087
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2087&view=rev
Author: jenslehmann
Date: 2010-03-04 10:46:32 +0000 (Thu, 04 Mar 2010)
Log Message:
-----------
fixed further Pellet 2 problems related to top/bottom object/data property
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyChecker.java
trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java
Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2010-03-03 22:14:34 UTC (rev 2086)
+++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2010-03-04 10:46:32 UTC (rev 2087)
@@ -395,6 +395,9 @@
individuals.add(new Individual(owlIndividual.getURI().toString()));
}
+ // remove top and bottom properties (for backwards compatibility)
+// atomicRoles.remove(new ObjectProperty("http://www.w3.org/2002/07/owl#bottomObjectProperty"));
+// atomicRoles.remove(new ObjectProperty("http://www.w3.org/2002/07/owl#topObjectProperty"));
}
/* (non-Javadoc)
@@ -569,6 +572,8 @@
e.printStackTrace();
throw new Error("OWL API classification error.");
}
+ // removed for backwards compatibility
+// properties.remove(factory.getOWLBottomObjectProperty(URI.create("bottomObjectProperty")));
return getFirstObjectProperties(properties);
}
@@ -898,6 +903,9 @@
OWLObjectProperty property = innerSet.iterator().next();
roles.add(new ObjectProperty(property.getURI().toString()));
}
+ // TODO: after switching to OWL API 3, remove top/bottom directly in getSuper/SubProperties
+ roles.remove(new ObjectProperty("http://www.w3.org/2002/07/owl#topObjectProperty"));
+ roles.remove(new ObjectProperty("http://www.w3.org/2002/07/owl#bottomObjectProperty"));
return roles;
}
@@ -907,6 +915,9 @@
OWLDataProperty property = innerSet.iterator().next();
roles.add(new DatatypeProperty(property.getURI().toString()));
}
+ // TODO: after switching to OWL API 3, remove top/bottom directly in getSuper/SubProperties
+ roles.remove(new DatatypeProperty("http://www.w3.org/2002/07/owl#topDataProperty"));
+ roles.remove(new DatatypeProperty("http://www.w3.org/2002/07/owl#bottomDataProperty"));
return roles;
}
Modified: trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyChecker.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyChecker.java 2010-03-03 22:14:34 UTC (rev 2086)
+++ trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyChecker.java 2010-03-04 10:46:32 UTC (rev 2087)
@@ -53,6 +53,8 @@
private static int minInstanceCount = 5;
private static boolean displayClasses = true;
private static boolean displayInstances = true;
+ // set to Integer.MAX_VALUE for displaying all instances
+ private static int maxInstances = 10;
public static void main(String[] args) throws ComponentInitException, MalformedURLException {
Map<String, Integer> ontologyRelClassCountMap = new HashMap<String, Integer>();
@@ -101,8 +103,14 @@
classCount++;
tmp.append(" " + cl.getURI() + "\n");
if(displayInstances) {
+ int indCount = 0;
for(OWLIndividual ind : inds) {
tmp.append(" " + ind.toString() + "\n");
+ indCount++;
+ if(indCount >= maxInstances) {
+ tmp.append(" ... " + inds.size() + " more\n");
+ break;
+ }
}
}
}
Modified: trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2010-03-03 22:14:34 UTC (rev 2086)
+++ trunk/src/dl-learner/org/dllearner/test/junit/RefinementOperatorTests.java 2010-03-04 10:46:32 UTC (rev 2087)
@@ -240,7 +240,7 @@
// (male AND EXISTS hasChild.TOP)
// System.out.println(rs);
// System.out.println("most general properties: " + rs.getMostGeneralProperties());
-// System.out.println(rs.getObjectPropertyHierarchy());
+ System.out.println(rs.getObjectPropertyHierarchy());
assertTrue(refinements.size()==8);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lor...@us...> - 2010-03-07 19:12:01
|
Revision: 2095
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2095&view=rev
Author: lorenz_b
Date: 2010-03-07 19:11:53 +0000 (Sun, 07 Mar 2010)
Log Message:
-----------
Continued axiom editing component - still problems with the OWLAPI-parser.
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java
trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLClassAxiomEditor.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxObjectRenderer.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterSyntaxRenderer.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLAxiomEditor.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLObjectPropertyAxiomChecker.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLObjectPropertyAxiomEditor.java
Modified: trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java 2010-03-07 10:25:59 UTC (rev 2094)
+++ trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -1563,6 +1563,10 @@
return factory;
}
+ public boolean isSatisfiable(OWLDescription d){
+ return reasoner.isSatisfiable(d);
+ }
+
/**
* Returns asserted class definitions of given class
* @param nc the class
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java 2010-03-07 10:25:59 UTC (rev 2094)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -1,5 +1,6 @@
package org.dllearner.tools.ore;
+import java.awt.Color;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URI;
@@ -37,6 +38,7 @@
import org.dllearner.tools.ore.cache.OWLObjectRenderingCache;
import org.dllearner.tools.ore.ui.DescriptionLabel;
import org.dllearner.tools.ore.ui.editor.OWLEntityFinder;
+import org.dllearner.tools.ore.ui.rendering.KeywordColorMap;
import org.dllearner.tools.ore.ui.rendering.ManchesterOWLSyntaxOWLObjectRendererImpl;
import org.dllearner.tools.ore.ui.rendering.OWLEntityRenderer;
import org.dllearner.utilities.owl.OWLAPIConverter;
@@ -87,7 +89,7 @@
private OWLObjectRenderer owlObjectRenderer;
private OWLEntityRenderer owlEntityRenderer;
private OWLEntityFinder owlEntityFinder;
-
+ private Map<String, Color> keywordColorMap;
private List<OREManagerListener> listeners;
@@ -104,6 +106,7 @@
owlObjectRenderer = new ManchesterOWLSyntaxOWLObjectRendererImpl();
owlObjectRenderer.setShortFormProvider(new SimpleShortFormProvider());
owlEntityRenderer = new OWLEntityRenderer();
+ keywordColorMap = new KeywordColorMap();
}
public static synchronized OREManager getInstance() {
@@ -295,6 +298,10 @@
}
return owlEntityFinder;
}
+
+ public Map<String, Color> getKeywordColorMap(){
+ return keywordColorMap;
+ }
private URL getClass2LearnAsURL(){
URL classURL = null;
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2010-03-07 10:25:59 UTC (rev 2094)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -9,7 +9,6 @@
import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.List;
@@ -37,7 +36,9 @@
import org.dllearner.tools.ore.RepairManagerListener;
import org.dllearner.tools.ore.explanation.Explanation;
import org.dllearner.tools.ore.ui.editor.InputVerificationStatusChangedListener;
+import org.dllearner.tools.ore.ui.editor.OWLAxiomEditor;
import org.dllearner.tools.ore.ui.editor.OWLClassAxiomEditor;
+import org.dllearner.tools.ore.ui.editor.OWLObjectPropertyAxiomEditor;
import org.dllearner.tools.ore.ui.editor.VerifiedInputEditor;
import org.dllearner.tools.ore.ui.editor.VerifyingOptionPane;
import org.dllearner.tools.ore.ui.rendering.TextAreaRenderer;
@@ -49,6 +50,7 @@
import org.semanticweb.owl.model.OWLClass;
import org.semanticweb.owl.model.OWLClassAxiom;
import org.semanticweb.owl.model.OWLObject;
+import org.semanticweb.owl.model.OWLObjectPropertyAxiom;
import org.semanticweb.owl.model.OWLOntologyChange;
import uk.ac.manchester.cs.owl.dlsyntax.DLSyntaxObjectRenderer;
@@ -65,9 +67,9 @@
protected String[] columnToolTips = {
null,
- "The number of already computed explanations where the axiom occurs.",
- "TODO",
- "TODO",
+ "The number of already computed explanations wherein the axiom occurs.",
+ "The sum of all axioms, in which the entities of the current axiom are contained.",
+ "",
"If checked, the axiom is selected to remove from the ontology.",
"Edit the axiom."
};
@@ -93,6 +95,7 @@
setRowHeight(20);
getColumn(0).setCellRenderer(new TextAreaRenderer());
+// getColumn(0).setCellRenderer(new OWLTableCellRenderer(OREManager.getInstance()));
getColumn(1).setMaxWidth(60);
getColumn(2).setMaxWidth(60);
getColumn(3).setMaxWidth(60);
@@ -147,20 +150,6 @@
}
});
- addMouseListener(new MouseAdapter() {
-
- final ExplanationTable table;
- {
- table = ExplanationTable.this;
- }
-
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
- System.out.println(getValueAt(table
- .rowAtPoint(e.getPoint()), 0));
- }
- }
- });
}
@Override
@@ -241,6 +230,7 @@
JTable table;
JButton editButton;
String text;
+ int row;
public ButtonCellEditor() {
@@ -257,6 +247,7 @@
Object value, boolean isSelected, int row, int column) {
text = (value == null) ? "" : value.toString();
editButton.setText("");
+ this.row = row;
return editButton;
}
@@ -268,12 +259,17 @@
@Override
public void actionPerformed(ActionEvent e) {
fireEditingStopped();
- OWLClassAxiomEditor editor = new OWLClassAxiomEditor(OREManager.getInstance());
- OWLAxiom ax = ((ExplanationTableModel)getModel()).getOWLAxiomAtRow(2);
+ OWLAxiom ax = ((ExplanationTableModel)getModel()).getOWLAxiomAtRow(row);
if(ax instanceof OWLClassAxiom){
+ OWLClassAxiomEditor editor = new OWLClassAxiomEditor(OREManager.getInstance());
editor.setEditedObject((OWLClassAxiom) ax);
+ showEditorDialog(editor, ax);
+ } else if(ax instanceof OWLObjectPropertyAxiom){
+ OWLObjectPropertyAxiomEditor editor = new OWLObjectPropertyAxiomEditor(OREManager.getInstance());
+ editor.setEditedObject((OWLObjectPropertyAxiom) ax);
+ showEditorDialog(editor, ax);
}
- showEditorDialog(editor, ax);
+
}
}
@@ -310,7 +306,7 @@
repMan.removeListener(this);
}
- private void showEditorDialog(final OWLClassAxiomEditor editor, OWLObject value) {
+ private void showEditorDialog(final OWLAxiomEditor editor, OWLObject value) {
if (editor == null) {
return;
}
@@ -366,7 +362,7 @@
dlg.setVisible(true);
}
- void handleEditFinished(OWLClassAxiomEditor editor){
+ void handleEditFinished(OWLAxiomEditor editor){
System.out.println(editor.getEditedObject());
}
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2010-03-07 10:25:59 UTC (rev 2094)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -59,7 +59,7 @@
if(strikeOutIrrelevantParts){
return ManchesterSyntaxRenderer.render(ax, impMan.isSelected(ax), depth2Root, laconicExplanation);
} else {
-// return new ManchesterRenderer(OREManager.getInstance().getReasoner().getOWLOntologyManager()).render(ax, null);
+// return OREManager.getInstance().getRendering(ax);
return ManchesterSyntaxRenderer.render(ax, impMan.isSelected(ax), depth2Root);
}
} else if(columnIndex == 1){
Added: trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLAxiomEditor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLAxiomEditor.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLAxiomEditor.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -0,0 +1,9 @@
+package org.dllearner.tools.ore.ui.editor;
+
+import javax.swing.JComponent;
+
+
+public interface OWLAxiomEditor<T> {
+ JComponent getEditorComponent();
+ T getEditedObject();
+}
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLClassAxiomEditor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLClassAxiomEditor.java 2010-03-07 10:25:59 UTC (rev 2094)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLClassAxiomEditor.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -10,7 +10,7 @@
import org.semanticweb.owl.model.OWLClassAxiom;
import org.semanticweb.owl.model.OWLException;
-public class OWLClassAxiomEditor implements VerifiedInputEditor{
+public class OWLClassAxiomEditor implements VerifiedInputEditor, OWLAxiomEditor<OWLClassAxiom>{
private ExpressionEditor<OWLClassAxiom> editor;
Added: trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLObjectPropertyAxiomChecker.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLObjectPropertyAxiomChecker.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLObjectPropertyAxiomChecker.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -0,0 +1,33 @@
+package org.dllearner.tools.ore.ui.editor;
+
+import org.coode.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser;
+import org.dllearner.tools.ore.OREManager;
+import org.semanticweb.owl.expression.ParserException;
+import org.semanticweb.owl.model.OWLObjectPropertyAxiom;
+
+public class OWLObjectPropertyAxiomChecker implements OWLExpressionChecker<OWLObjectPropertyAxiom>{
+ private OREManager mngr;
+
+
+ public OWLObjectPropertyAxiomChecker(OREManager mngr) {
+ this.mngr = mngr;
+ }
+
+
+ public void check(String text) throws OWLExpressionParserException {
+ createObject(text);
+ }
+
+
+ public OWLObjectPropertyAxiom createObject(String text) throws OWLExpressionParserException {
+ ManchesterOWLSyntaxEditorParser parser = new ManchesterOWLSyntaxEditorParser(mngr.getOWLDataFactory(), text);
+ parser.setOWLEntityChecker(new OREOWLEntityChecker(mngr.getOWLEntityFinder()));
+ try {System.out.println(parser.parseObjectPropertyAxiom());
+ return parser.parseObjectPropertyAxiom();
+ }
+ catch (ParserException e) {
+
+ throw ParserUtil.convertException(e);
+ }
+ }
+}
Added: trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLObjectPropertyAxiomEditor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLObjectPropertyAxiomEditor.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLObjectPropertyAxiomEditor.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -0,0 +1,104 @@
+package org.dllearner.tools.ore.ui.editor;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+
+import org.dllearner.tools.ore.OREManager;
+import org.semanticweb.owl.model.OWLException;
+import org.semanticweb.owl.model.OWLObjectPropertyAxiom;
+
+public class OWLObjectPropertyAxiomEditor implements VerifiedInputEditor, OWLAxiomEditor<OWLObjectPropertyAxiom>{
+
+ private ExpressionEditor<OWLObjectPropertyAxiom> editor;
+
+ private JComponent editingComponent;
+
+ private OREManager oreManager;
+
+
+ public OWLObjectPropertyAxiomEditor(OREManager oreManager) {
+ this.oreManager = oreManager;
+ editor = new ExpressionEditor<OWLObjectPropertyAxiom>(oreManager, new OWLObjectPropertyAxiomChecker(oreManager));
+
+ editingComponent = new JPanel(new BorderLayout());
+ editingComponent.add(editor);
+ editingComponent.setPreferredSize(new Dimension(400, 200));
+ }
+
+
+ public boolean setEditedObject(OWLObjectPropertyAxiom axiom) {
+ if (axiom == null){
+ editor.setText("");
+ }
+ else{
+ editor.setText(oreManager.getRendering(axiom));
+ }
+ return true;
+ }
+
+
+ public JComponent getInlineEditorComponent() {
+ // Same as general editor component
+ return editingComponent;
+ }
+
+
+ public String getEditorTypeName() {
+ return "Object Property Axiom";
+ }
+
+
+ public boolean canEdit(Object object) {
+ return object instanceof OWLObjectPropertyAxiom;
+ }
+
+
+ /**
+ * 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;
+ }
+
+
+ /**
+ * Gets the object that has been edited.
+ * @return The edited object
+ */
+ public OWLObjectPropertyAxiom getEditedObject() {
+ try {
+ if (editor.isWellFormed()) {
+ return editor.createObject();
+ }
+ else {
+ return null;
+ }
+ }
+ catch (OWLException e) {
+ return null;
+ }
+ }
+
+
+ public void dispose() {
+ }
+
+ public final void clear(){
+ setEditedObject(null);
+ }
+
+
+ public void addStatusChangedListener(InputVerificationStatusChangedListener listener) {
+ editor.addStatusChangedListener(listener);
+ }
+
+
+ public void removeStatusChangedListener(InputVerificationStatusChangedListener listener) {
+ editor.removeStatusChangedListener(listener);
+ }
+}
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxObjectRenderer.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxObjectRenderer.java 2010-03-07 10:25:59 UTC (rev 2094)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxObjectRenderer.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -149,7 +149,7 @@
public static final int LINE_LENGTH = 70;
- private boolean wrap = true;
+ private boolean wrap = false;
private DescriptionComparator descriptionComparator;
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterSyntaxRenderer.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterSyntaxRenderer.java 2010-03-07 10:25:59 UTC (rev 2094)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterSyntaxRenderer.java 2010-03-07 19:11:53 UTC (rev 2095)
@@ -1,5 +1,6 @@
package org.dllearner.tools.ore.ui.rendering;
+import java.awt.Color;
import java.util.StringTokenizer;
import org.dllearner.core.owl.Description;
@@ -51,6 +52,7 @@
}
public static String render(OWLAxiom value, boolean removed, int depth){
+// String renderedString = OREManager.getInstance().getRendering(value);
String renderedString = renderer.render(value, null);
StringTokenizer st = new StringTokenizer(renderedString);
StringBuffer bf = new StringBuffer();
@@ -88,10 +90,16 @@
}
boolean isReserved = false;
+// Color c = OREManager.getInstance().getKeywordColorMap().get(token);
+// if(c != null){
+// color = c.
+// isReserved = true;
+// }
for(Keyword key : Keyword.values()){
if(token.equals(key.getLabel())){
color = key.getColor();
- isReserved = true;break;
+ isReserved = true;
+ break;
}
}
if(isReserved || unsatClass){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lor...@us...> - 2010-03-09 10:29:41
|
Revision: 2100
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2100&view=rev
Author: lorenz_b
Date: 2010-03-09 10:29:35 +0000 (Tue, 09 Mar 2010)
Log Message:
-----------
Removed lib reference
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/Info.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/ParserException.java
Modified: trunk/src/dl-learner/org/dllearner/Info.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/Info.java 2010-03-09 09:04:25 UTC (rev 2099)
+++ trunk/src/dl-learner/org/dllearner/Info.java 2010-03-09 10:29:35 UTC (rev 2100)
@@ -1,8 +1,8 @@
-// File is updated automatically when a new version is created
-package org.dllearner;
+ // File is updated automatically when a new version is created
+ package org.dllearner;
-public class Info {
- public static final String build = "2010-02-25";
-}
-
\ No newline at end of file
+ public class Info {
+ public static final String build = "2010-03-09";
+ }
+
\ No newline at end of file
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/ParserException.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/ParserException.java 2010-03-09 09:04:25 UTC (rev 2099)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/ParserException.java 2010-03-09 10:29:35 UTC (rev 2100)
@@ -28,7 +28,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-import org.semanticweb.owlapi.util.CollectionFactory;
/**
@@ -252,7 +251,7 @@
individualNameExpected,
datatypeNameExpected,
annotationPropertyExpected,
- CollectionFactory.createSet(keywords));
+ createSet(keywords));
}
@@ -266,4 +265,12 @@
public ParserException(List<String> tokenSequence, int startPos, int lineNumber, int columnNumber, String ... keywords) {
this(tokenSequence, startPos, lineNumber, columnNumber, false, false, false, false, false, false, keywords);
}
+
+ private static Set<String> createSet(String ... keywords){
+ Set<String> result = new HashSet<String>();
+ for(String k : keywords) {
+ result.add(k);
+ }
+ return result;
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2010-03-11 15:18:41
|
Revision: 2114
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2114&view=rev
Author: kurzum
Date: 2010-03-11 15:18:34 +0000 (Thu, 11 Mar 2010)
Log Message:
-----------
implemented better subclass resolution in sparql converter
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java
trunk/src/dl-learner/org/dllearner/utilities/experiments/Examples.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2010-03-11 15:12:28 UTC (rev 2113)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2010-03-11 15:18:34 UTC (rev 2114)
@@ -20,9 +20,12 @@
package org.dllearner.kb.sparql;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.TreeSet;
@@ -73,11 +76,7 @@
private boolean labels = false;
private boolean distinct = false;
private SortedSet<String> transitiveProperties =null;
- public void setTransitiveProperties(SortedSet<String> transitiveProperties) {
- this.transitiveProperties = transitiveProperties;
- }
-
- private Map<String,String> classToSubclassesVirtuoso = null;
+ private Map<String,Set<String>> subclassMap = null;
private Stack<String> stack = new Stack<String>();
private String query = "";
@@ -110,41 +109,50 @@
}
private void expandSubclasses(){
- if(classToSubclassesVirtuoso == null){
+ if(subclassMap == null){
return;
}
int counter = 0;
int index = 0;
- String filter = "";
String var = "";
String uri = "";
StringBuffer tmp ;
+ StringBuffer filter = new StringBuffer() ;
+ Set<String> subClasses;
for(String nc: foundNamedClasses){
index = query.indexOf("<"+nc+">");
- filter = classToSubclassesVirtuoso.get(nc);
+ subClasses = subclassMap.get(nc);
if(index == -1){
- logger.warn("named class found before, but not in query?? "+nc);
- }else if(filter != null){
+ logger.error("named class was found before, but is not in query any more?? "+nc);
+ }else if(subClasses != null){
var = "?expanded"+counter;
uri = "<"+nc+">";
tmp = new StringBuffer();
tmp.append(query.substring(0, index));
tmp.append(var);
tmp.append(query.substring(index+(uri.length())));
- tmp.append("\nFILTER ( " +var+ " in (" +filter+ ") ). ");
query = tmp.toString();
-// = query.substring(0, index)+var+query.substring(index+(uri.length()));
-
-// query += "\nFILTER (?expanded" +counter+
-// " in (" +filter+
-// ") ). ";
+ filter.append(makeFilter(var, subClasses));
}else{
logger.debug("no mapping found ("+nc+") "+this.getClass().getSimpleName());
}
+
counter++;
}
+ query += filter.toString();
}
+ private String makeFilter(String var, Set<String> classes){
+ StringBuffer buf = new StringBuffer("\nFILTER ( "+var+" IN ( ");
+ int i = 0;
+ for (String string : classes) {
+ buf.append((i==0)?"<"+string+">":",<"+string+">");
+ i++;
+ }
+ buf.append(" ) ). ");
+ return buf.toString();
+ }
+
private String limit() {
return (limit > 0) ? " LIMIT " + limit + " " : "";
}
@@ -171,10 +179,15 @@
this.distinct = distinct;
}
- public void setClassToSubclassesVirtuoso(Map<String,String> classToSubclassesVirtuoso) {
- this.classToSubclassesVirtuoso = classToSubclassesVirtuoso;
+ public void setTransitiveProperties(SortedSet<String> transitiveProperties) {
+ this.transitiveProperties = transitiveProperties;
}
+
+ public void setSubclassMap(Map<String, Set<String>> subclassMap) {
+ this.subclassMap = subclassMap;
+ }
+
public static String getSparqlQuery(String descriptionKBSyntax, int limit, boolean labels, boolean distinct) throws ParseException {
Description d = KBParser.parseConcept(descriptionKBSyntax);
return getSparqlQuery(d, limit, labels, distinct);
@@ -256,8 +269,11 @@
System.out.println(outer.toKBSyntaxString(null,null));
System.out.println(test);
+ Map<String, Set<String>> testMap = new HashMap<String, Set<String>>();
+ testMap.put(prefix+"Sentence", new HashSet<String>(Arrays.asList(new String[]{"whatever","loser"})));
// s.add(outer.toKBSyntaxString(null,null));
SparqlQueryDescriptionConvertVisitor testVisitor = new SparqlQueryDescriptionConvertVisitor();
+ testVisitor.setSubclassMap(testMap);
String q = testVisitor.getSparqlQuery(outer.toKBSyntaxString());
System.out.println(q);
if (true) {
Modified: trunk/src/dl-learner/org/dllearner/utilities/experiments/Examples.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/experiments/Examples.java 2010-03-11 15:12:28 UTC (rev 2113)
+++ trunk/src/dl-learner/org/dllearner/utilities/experiments/Examples.java 2010-03-11 15:18:34 UTC (rev 2114)
@@ -213,6 +213,12 @@
return posTest.size()+negTest.size();
}
+ public SortedSet<String> getAllExamples() {
+ SortedSet<String> total = new TreeSet<String>();
+ total.addAll(getPositiveExamples());
+ total.addAll(getNegativeExamples());
+ return total;
+ }
public SortedSet<String> getPositiveExamples() {
SortedSet<String> total = new TreeSet<String>();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2010-03-11 17:20:32
|
Revision: 2116
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2116&view=rev
Author: kurzum
Date: 2010-03-11 17:20:23 +0000 (Thu, 11 Mar 2010)
Log Message:
-----------
added datatype integer
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java
trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java
Modified: trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2010-03-11 16:20:48 UTC (rev 2115)
+++ trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2010-03-11 17:20:23 UTC (rev 2116)
@@ -30,6 +30,7 @@
DOUBLE ("http://www.w3.org/2001/XMLSchema#double"),
INT ("http://www.w3.org/2001/XMLSchema#int"),
+ INTEGER ("http://www.w3.org/2001/XMLSchema#integer"),
BOOLEAN ("http://www.w3.org/2001/XMLSchema#boolean"),
STRING ("http://www.w3.org/2001/XMLSchema#string"),
DATE ("http://www.w3.org/2001/XMLSchema#date");
Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java 2010-03-11 16:20:48 UTC (rev 2115)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java 2010-03-11 17:20:23 UTC (rev 2116)
@@ -50,7 +50,6 @@
import org.semanticweb.owl.model.OWLObjectProperty;
import org.semanticweb.owl.model.OWLTypedConstant;
import org.semanticweb.owl.model.OWLUntypedConstant;
-import org.semanticweb.owl.vocab.OWLDatatypeVocabulary;
/**
* A collection of methods for exchanging objects between OWL API and
@@ -176,6 +175,8 @@
return Datatype.DOUBLE;
else if(uri.equals(Datatype.INT.getURI()))
return Datatype.INT;
+ else if(uri.equals(Datatype.INTEGER.getURI()))
+ return Datatype.INTEGER;
else if(uri.equals(Datatype.STRING.getURI()))
return Datatype.STRING;
else if(uri.equals(Datatype.DATE.getURI())){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lor...@us...> - 2010-03-13 12:08:06
|
Revision: 2117
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2117&view=rev
Author: lorenz_b
Date: 2010-03-13 12:07:58 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
Some small layout changes.
Some changes in workflow.
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/Info.java
trunk/src/dl-learner/org/dllearner/tools/ore/LearningManager.java
trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/MarkableClassExpressionsTableModel.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTable.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/SelectableClassExpressionsTableModel.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsTable.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsTableModel.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardController.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassChoosePanelDescriptor.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ManualLearnPanelDescriptor.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/RepairPanelDescriptor.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassChoosePanel.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPanel.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/SavePanel.java
Modified: trunk/src/dl-learner/org/dllearner/Info.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/Info.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/Info.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -3,6 +3,6 @@
package org.dllearner;
public class Info {
- public static final String build = "2010-03-10";
+ public static final String build = "2010-03-13";
}
\ No newline at end of file
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LearningManager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/LearningManager.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/LearningManager.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -3,51 +3,57 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.TreeSet;
import org.dllearner.algorithms.celoe.CELOE;
import org.dllearner.core.ComponentInitException;
import org.dllearner.core.ComponentManager;
+import org.dllearner.core.EvaluatedDescription;
import org.dllearner.core.LearningProblemUnsupportedException;
import org.dllearner.core.ReasonerComponent;
import org.dllearner.core.owl.NamedClass;
import org.dllearner.learningproblems.ClassLearningProblem;
import org.dllearner.learningproblems.EvaluatedDescriptionClass;
+import org.mindswap.pellet.utils.progress.ProgressMonitor;
public class LearningManager {
private static LearningManager instance;
- public enum LearningMode {AUTO, MANUAL};
+ public enum LearningMode {AUTO, MANUAL, OFF};
public enum LearningType { EQUIVALENT, SUPER };
private List<LearningManagerListener> listeners;
- public static final int AUTO_LEARN_MODE = 0;
- public static final int MANUAL_LEARN_MODE = 1;
-
- private ComponentManager cm;
-
private LearningMode learningMode = LearningMode.AUTO;
private LearningType learningType = LearningType.EQUIVALENT;
+ private ComponentManager cm;
private ClassLearningProblem lp;
private CELOE la;
+ private ReasonerComponent reasoner;
private NamedClass currentClass2Describe;
private int maxExecutionTimeInSeconds;
private double noisePercentage;
+ private double threshold;
private int maxNrOfResults;
- private ReasonerComponent reasoner;
-
private List<EvaluatedDescriptionClass> newDescriptions;
private List<EvaluatedDescriptionClass> equivalentDescriptions;
private List<EvaluatedDescriptionClass> superDescriptions;
private int currentDescriptionIndex = 0;
+
+ private boolean learningInProgress = false;
+
+ private ProgressMonitor progressMonitor;
public static synchronized LearningManager getInstance(){
if(instance == null){
@@ -61,6 +67,7 @@
reasoner = OREManager.getInstance().getReasoner();
listeners = new ArrayList<LearningManagerListener>();
newDescriptions = new ArrayList<EvaluatedDescriptionClass>();
+ progressMonitor = TaskManager.getInstance().getStatusBar();
}
public void setLearningMode(LearningMode learningMode){
@@ -71,11 +78,16 @@
this.learningType = learningType;
}
+ public LearningType getLearningType(){
+ return learningType;
+ }
+
public void initLearningProblem(){
+ reasoner = OREManager.getInstance().getReasoner();
lp = cm.learningProblem(ClassLearningProblem.class, reasoner);
try {
if(learningType.equals(LearningType.EQUIVALENT)){
- cm.applyConfigEntry(lp, "type", "equivalent");
+ cm.applyConfigEntry(lp, "type", "equivalence");
} else {
cm.applyConfigEntry(lp, "type", "superClass");
}
@@ -110,6 +122,54 @@
}
}
+ public boolean learnAsynchronously() {
+ if (learningInProgress) {
+ return false;
+ }
+ initLearningProblem();
+ initLearningAlgorithm();
+ learningInProgress = true;
+ progressMonitor.setProgressLength(maxExecutionTimeInSeconds);
+ String learnType = "";
+ if(learningType == LearningType.EQUIVALENT){
+ learnType = "equivalent";
+ } else {
+ learnType = "superclass";
+ }
+ progressMonitor.setProgressMessage("Learning " + learnType + " expressions");
+
+ Thread currentLearningThread = new Thread(new LearningRunner(), "Learning Thread");
+ currentLearningThread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
+ public void uncaughtException(Thread thread, Throwable throwable) {
+
+ }
+ });
+ currentLearningThread.start();
+ return true;
+ }
+
+ public boolean stopLearning() {
+ if (!learningInProgress) {
+ return false;
+ }
+ la.stop();
+ learningInProgress = false;
+ progressMonitor.setProgressLength(0);
+
+ return true;
+ }
+
+ public synchronized List<EvaluatedDescriptionClass> getCurrentlyLearnedDescriptions(){
+ List<EvaluatedDescriptionClass> result;
+ if(la != null){
+ result = Collections.unmodifiableList((List<EvaluatedDescriptionClass>)la.getCurrentlyBestEvaluatedDescriptions
+ (maxNrOfResults, threshold, true));
+ } else {
+ result = Collections.emptyList();
+ }
+ return result;
+ }
+
public boolean isManualLearningMode(){
return learningMode.equals(LearningMode.MANUAL);
}
@@ -142,6 +202,10 @@
this.maxNrOfResults = maxNrOfResults;
}
+ public void setThreshold(double threshold) {
+ this.threshold = threshold;
+ }
+
public void setNewDescriptions(List<List<EvaluatedDescriptionClass>> descriptions) {
newDescriptions.clear();
newDescriptions.addAll(descriptions.get(0));
@@ -211,5 +275,24 @@
listener.newDescriptionSelected(index);
}
}
+
+ private class LearningRunner implements Runnable{
+ @Override
+ public void run() {
+ try{
+ la.start();
+ } finally{
+ learningInProgress = false;
+ fireLearningFinished();
+ progressMonitor.setProgressMessage("Done");
+ }
+ }
+ }
+
+
+ public void fireLearningFinished(){
+
+ }
+
}
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -55,6 +55,7 @@
import org.semanticweb.owl.model.OWLOntologyChange;
import org.semanticweb.owl.model.OWLOntologyChangeException;
import org.semanticweb.owl.model.OWLOntologyManager;
+import org.semanticweb.owl.model.OWLSubClassAxiom;
import org.semanticweb.owl.model.RemoveAxiom;
import org.semanticweb.owl.util.OWLEntityRemover;
@@ -115,7 +116,7 @@
}
- public void addNewClassDescription(NamedClass old, Description newDesc){
+ public void addEquivalentClassDescription(NamedClass old, Description newDesc){
OWLDescription oldOWLAPIDesc = OWLAPIConverter.getOWLAPIDescription(old);
OWLDescription newOWLAPIDesc = OWLAPIConverter.getOWLAPIDescription(newDesc);
OWLEquivalentClassesAxiom equivAxiom = factory.getOWLEquivalentClassesAxiom(oldOWLAPIDesc, newOWLAPIDesc);
@@ -129,6 +130,20 @@
}
}
+ public void addSuperClassDescription(NamedClass old, Description newDesc){
+ OWLDescription subClass = OWLAPIConverter.getOWLAPIDescription(old);
+ OWLDescription superClass = OWLAPIConverter.getOWLAPIDescription(newDesc);
+ OWLSubClassAxiom subAxiom = factory.getOWLSubClassAxiom(subClass, superClass);
+ AddAxiom add = new AddAxiom(ontology, subAxiom);
+ try {
+ manager.applyChange(add);
+ globalChanges.add(add);
+ } catch (OWLOntologyChangeException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
/**
* Rewrite ontology by replacing old class with new learned class description.
* @param newDesc
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/MarkableClassExpressionsTableModel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/MarkableClassExpressionsTableModel.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/MarkableClassExpressionsTableModel.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -78,7 +78,7 @@
public void setSelectedDescription(int rowIndex){
int oldRowIndex = selectedRowIndex;
selectedRowIndex = rowIndex;
- fireTableRowsUpdated(oldRowIndex, selectedRowIndex);
+ fireTableDataChanged();
}
@Override
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -154,6 +154,8 @@
descScroll.setViewportView(descPanel);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
+ splitPane.setDividerLocation(0.7);
+ splitPane.setResizeWeight(0.7);
statsPanel = new StatsPanel(ind);
statsPanel.init();
@@ -176,7 +178,6 @@
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(splitPane, 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));
okCancelPanel = new JPanel();
okCancelPanel.setLayout(new BorderLayout());
@@ -193,9 +194,6 @@
buttonBox.add(cancelButton);
okCancelPanel.add(buttonBox, BorderLayout.EAST);
-// getContentPane().add(actionStatsPanel, java.awt.BorderLayout.CENTER);
-// getContentPane().add(okCancelPanel, BorderLayout.SOUTH);
-
add(descScroll, BorderLayout.NORTH);
add(splitPane, BorderLayout.CENTER);
add(okCancelPanel, BorderLayout.SOUTH);
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -3,6 +3,7 @@
import java.awt.Color;
import java.awt.Component;
import java.awt.Cursor;
+import java.awt.Graphics;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
@@ -140,4 +141,6 @@
getSelectionModel().clearSelection();
}
+
+
}
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTable.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTable.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTable.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -8,6 +8,7 @@
import org.dllearner.learningproblems.EvaluatedDescriptionClass;
import org.dllearner.tools.ore.ui.rendering.ManchesterSyntaxTableCellRenderer;
import org.dllearner.tools.ore.ui.rendering.ProgressBarTableCellRenderer;
+import org.dllearner.tools.protege.SuggestionsTableModel;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.HighlighterFactory;
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/SelectableClassExpressionsTableModel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/SelectableClassExpressionsTableModel.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/SelectableClassExpressionsTableModel.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -55,17 +55,8 @@
@Override
public void setValueAt(Object value, int rowIndex, int columnIndex) {
- if(!selectionList.get(rowIndex).booleanValue()){
- selectedClassExpression = resultList.get(rowIndex);
- for(int i = 0; i < selectionList.size(); i++){
- selectionList.set(i, Boolean.FALSE);
- }
- selectionList.set(rowIndex, (Boolean)value);
-
- super.fireTableCellUpdated(rowIndex, columnIndex);
- }
-
-
+ selectionList.set(rowIndex, !selectionList.get(rowIndex));
+ fireTableCellUpdated(rowIndex, columnIndex);
}
@Override
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsTable.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsTable.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsTable.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -20,12 +20,9 @@
setModel(new StatsTableModel());
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
setEditable(false);
- setTableHeader(null);
setGridColor(Color.LIGHT_GRAY);
setRowHeight(getRowHeight() + 4);
getColumn(0).setMaxWidth(100);
- setShowGrid(false);
-// getColumn(1).setCellRenderer(new ManchesterSyntaxTableCellRenderer());
setRowSelectionAllowed(false);
setCellSelectionEnabled(false);
setColumnSelectionAllowed(false);
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsTableModel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsTableModel.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatsTableModel.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -44,6 +44,17 @@
}
}
+ @Override
+ public String getColumnName(int column) {
+ if(column == 0){
+ return "Action";
+ } else if(column == 1){
+ return "Axiom";
+ } else {
+ return "";
+ }
+ }
+
public void setChanges(List<OWLOntologyChange> changes){
this.changes.clear();
this.changes.addAll(changes);
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardController.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardController.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardController.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -29,6 +29,7 @@
import org.dllearner.learningproblems.EvaluatedDescriptionClass;
import org.dllearner.tools.ore.LearningManager;
import org.dllearner.tools.ore.OREManager;
+import org.dllearner.tools.ore.LearningManager.LearningType;
import org.dllearner.tools.ore.ui.wizard.descriptors.AutoLearnPanelDescriptor;
import org.dllearner.tools.ore.ui.wizard.descriptors.ClassChoosePanelDescriptor;
import org.dllearner.tools.ore.ui.wizard.descriptors.InconsistencyExplanationPanelDescriptor;
@@ -177,11 +178,24 @@
if(!SetUtils.union(descriptions.get(0), descriptions.get(1)).isEmpty()){
LearningManager.getInstance().setNewDescriptions(descriptions);
}
+ OREManager oreMan = OREManager.getInstance();
+ for(EvaluatedDescriptionClass e : descriptions.get(0)){
+ oreMan.getModifier().addEquivalentClassDescription(oreMan.getCurrentClass2Learn(), e.getDescription());
+ }
+ for(EvaluatedDescriptionClass e : descriptions.get(1)){
+ oreMan.getModifier().addSuperClassDescription(oreMan.getCurrentClass2Learn(), e.getDescription());
+ }
} else if(currentPanelDescriptor.getPanelDescriptorIdentifier().equals(ManualLearnPanelDescriptor.IDENTIFIER)){
OREManager oreMan = OREManager.getInstance();
- oreMan.getModifier().addNewClassDescription(oreMan.getCurrentClass2Learn(),
- oreMan.getNewClassDescription().getDescription());
+ if(LearningManager.getInstance().getLearningType() == LearningType.SUPER){
+ oreMan.getModifier().addSuperClassDescription(oreMan.getCurrentClass2Learn(),
+ oreMan.getNewClassDescription().getDescription());
+ } else {
+ oreMan.getModifier().addEquivalentClassDescription(oreMan.getCurrentClass2Learn(),
+ oreMan.getNewClassDescription().getDescription());
+ }
+
}
else if(nextPanelDescriptor.equals(RepairPanelDescriptor.IDENTIFIER)){
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassChoosePanelDescriptor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassChoosePanelDescriptor.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassChoosePanelDescriptor.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -71,6 +71,12 @@
+ "Select one of them for which you want to learn equivalent class or superclass expressions," +
" then press <Next>";
+ public static final String SKIP_LEARN_INFORMATION = "Choose one of the learning modes above, or press "+
+ " <Next> to finish the wizard.";
+
+ public static final String NO_LEARNING_SUPPORTED_INFORMATION = "LEarning is not supported because the currently loaded ontology contains no individuals. "+
+ "Please choose another ontology or press <Next> to finish the wizard.";
+
private ClassChoosePanel classChoosePanel;
private Map<Integer, Set<NamedClass>> instanceCountToClasses;
@@ -93,10 +99,13 @@
@Override
public Object getNextPanelDescriptor() {
- if(isAutoLearningMode()){
+ LearningMode mode = LearningManager.getInstance().getLearningMode();
+ if(mode == LearningMode.AUTO){
return AutoLearnPanelDescriptor.IDENTIFIER;
+ } else if(mode == LearningMode.MANUAL){
+ return ManualLearnPanelDescriptor.IDENTIFIER;
} else {
- return ManualLearnPanelDescriptor.IDENTIFIER;
+ return SavePanelDescriptor.IDENTIFIER;
}
}
@@ -106,16 +115,27 @@
return KnowledgeSourcePanelDescriptor.IDENTIFIER;
}
- @Override
+ @Override
public void aboutToDisplayPanel() {
- if(isAutoLearningMode()){
- getWizard().getInformationField().setText(AUTO_LEARN_INFORMATION);
- } else {
- getWizard().getInformationField().setText(MANUAL_LEARN_INFORMATION);
- }
-
- setNextButtonAccordingToConceptSelected();
- }
+ if (OREManager.getInstance().getReasoner().getIndividuals().size() == 0) {
+ LearningManager.getInstance().setLearningMode(LearningMode.OFF);
+ classChoosePanel.setLearningSupported(false);
+ classChoosePanel.refreshLearningPanel();
+ getWizard().getInformationField().setText(NO_LEARNING_SUPPORTED_INFORMATION);
+ } else {
+ classChoosePanel.setLearningSupported(true);
+
+ LearningMode mode = LearningManager.getInstance().getLearningMode();
+ if (mode == LearningMode.AUTO) {
+ getWizard().getInformationField().setText(AUTO_LEARN_INFORMATION);
+ } else if (mode == LearningMode.MANUAL) {
+ getWizard().getInformationField().setText(MANUAL_LEARN_INFORMATION);
+ } else {
+ getWizard().getInformationField().setText(SKIP_LEARN_INFORMATION);
+ }
+ }
+ setNextButtonAccordingToConceptSelected();
+ }
/**
* Method is called when other element in list is selected, and sets next button enabled.
@@ -125,6 +145,8 @@
setNextButtonAccordingToConceptSelected();
if (!e.getValueIsAdjusting() && classChoosePanel.getClassesTable().getSelectedRow() >= 0) {
OREManager.getInstance().setCurrentClass2Learn((NamedClass) classChoosePanel.getClassesTable().getSelectedValue());
+ LearningManager.getInstance().setCurrentClass2Describe(classChoosePanel.getClassesTable().getSelectedValue());
+
}
}
@@ -135,8 +157,10 @@
}
private void setNextButtonAccordingToConceptSelected() {
-
- if (classChoosePanel.getClassesTable().getSelectedRow() >= 0 || classChoosePanel.isAutoLearnMode()){
+ LearningManager man = LearningManager.getInstance();
+ if (classChoosePanel.getClassesTable().getSelectedRow() >= 0
+ || classChoosePanel.isAutoLearnMode()
+ || man.getLearningMode() == LearningMode.OFF){
getWizard().setNextFinishButtonEnabled(true);
}else{
getWizard().setNextFinishButtonEnabled(false);
@@ -218,23 +242,31 @@
@Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("auto")){
- classChoosePanel.setAutoLearningPanel(true);
- getWizard().getInformationField().setText(AUTO_LEARN_INFORMATION);
LearningManager.getInstance().setLearningMode(LearningMode.AUTO);
- } else {
- classChoosePanel.setAutoLearningPanel(false);
- getWizard().getInformationField().setText(MANUAL_LEARN_INFORMATION);
+ } else if(e.getActionCommand().equals("manual")){
LearningManager.getInstance().setLearningMode(LearningMode.MANUAL);
retrieveClasses();
+ } else {
+ LearningManager.getInstance().setLearningMode(LearningMode.OFF);
}
+ updateWizardInformation();
+ classChoosePanel.refreshLearningPanel();
setNextButtonAccordingToConceptSelected();
}
- public boolean isAutoLearningMode(){
- return classChoosePanel.isAutoLearnMode();
+ private void updateWizardInformation(){
+ LearningMode mode = LearningManager.getInstance().getLearningMode();
+ if(mode == LearningMode.AUTO){
+ getWizard().getInformationField().setText(AUTO_LEARN_INFORMATION);
+ } else if(mode == LearningMode.MANUAL){
+ getWizard().getInformationField().setText(MANUAL_LEARN_INFORMATION);
+ } else {
+ getWizard().getInformationField().setText(SKIP_LEARN_INFORMATION);
+ }
}
+
public void setAutoLearningOptions(){
classChoosePanel.setLearningOptions();
}
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ManualLearnPanelDescriptor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ManualLearnPanelDescriptor.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ManualLearnPanelDescriptor.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -27,6 +27,7 @@
import java.util.Timer;
import java.util.TimerTask;
+import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
@@ -35,9 +36,11 @@
import org.dllearner.core.EvaluatedDescription;
import org.dllearner.core.LearningAlgorithm;
import org.dllearner.learningproblems.EvaluatedDescriptionClass;
+import org.dllearner.tools.ore.LearningManager;
import org.dllearner.tools.ore.OREManager;
import org.dllearner.tools.ore.OREManagerListener;
import org.dllearner.tools.ore.TaskManager;
+import org.dllearner.tools.ore.LearningManager.LearningType;
import org.dllearner.tools.ore.ui.wizard.WizardPanelDescriptor;
import org.dllearner.tools.ore.ui.wizard.panels.ManualLearnPanel;
@@ -107,8 +110,7 @@
// range);
// Description de = new NamedClass("http://example.com/father#male");
- if (!e.getValueIsAdjusting() && learnPanel.getResultTable().getSelectedRow() >= 0 &&
- (learningTask.isDone() || learningTask.isCancelled())){
+ if (!e.getValueIsAdjusting() && learnPanel.getResultTable().getSelectedRow() >= 0){
EvaluatedDescriptionClass selectedClassExpression = learnPanel.getResultTable().getSelectedValue();
learnPanel.showInconsistencyWarning(!selectedClassExpression.isConsistent());
OREManager.getInstance().setNewClassDescription(selectedClassExpression);
@@ -124,26 +126,51 @@
*/
public void actionPerformed(ActionEvent event) {
if(event.getActionCommand().equals("Start")){
+ learnPanel.getStartButton().setEnabled(false);
+ learnPanel.getStopButton().setEnabled(true);
+
String learningType = "";
+
+ LearningManager.getInstance().setNoisePercentage(learnPanel.getOptionsPanel().getMinAccuracy());
+ LearningManager.getInstance().setMaxExecutionTimeInSeconds(learnPanel.getOptionsPanel().getMaxExecutionTime());
+ LearningManager.getInstance().setMaxNrOfResults(learnPanel.getOptionsPanel().getNrOfConcepts());
+ LearningManager.getInstance().setThreshold(learnPanel.getOptionsPanel().getThreshold());
+
if(learnPanel.isEquivalentClassesTypeSelected()){
OREManager.getInstance().setLearningType("equivalence");
+ LearningManager.getInstance().setLearningType(LearningType.EQUIVALENT);
+
learningType = "equivalent";
} else {
learningType = "super";
OREManager.getInstance().setLearningType("superClass");
+ LearningManager.getInstance().setLearningType(LearningType.SUPER);
}
-// TaskManager.getInstance().setTaskStarted("Learning " + learningType + " class expressions...");
+
TaskManager.getInstance().getStatusBar().setMessage("Learning " + learningType + " class expressions...");
getWizard().getDialog().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- learnPanel.getStartButton().setEnabled(false);
- learnPanel.getStopButton().setEnabled(true);
+
OREManager.getInstance().setNoisePercentage(learnPanel.getOptionsPanel().getMinAccuracy());
OREManager.getInstance().setMaxExecutionTimeInSeconds(learnPanel.getOptionsPanel().getMaxExecutionTime());
OREManager.getInstance().setMaxNrOfResults(learnPanel.getOptionsPanel().getNrOfConcepts());
OREManager.getInstance().setThreshold(learnPanel.getOptionsPanel().getThreshold());
learnPanel.reset();
+
+// TaskManager.getInstance().setTaskStarted("Learning " + learningType + " class expressions...");
+// Timer timer = new Timer();
+// timer.schedule(new TimerTask() {
+// int progress = 0;
+//
+// @Override
+// public void run() {
+// progress++;
+// fillTable(LearningManager.getInstance().getCurrentlyLearnedDescriptions());
+// TaskManager.getInstance().getStatusBar().setProgress(progress);
+//
+// }
+// }, 1000, 1000);
+// LearningManager.getInstance().learnAsynchronously();
-
learningTask = new LearningTask();
learningTask.addPropertyChangeListener(TaskManager.getInstance().getStatusBar());
learningTask.execute();
@@ -159,6 +186,21 @@
}
}
+
+ private void fillTable(final List<EvaluatedDescriptionClass> result){
+ Runnable r = new Runnable() {
+ @Override
+ public void run() {
+ learnPanel.getResultTable().addResults(result);
+ }
+ };
+ if(SwingUtilities.isEventDispatchThread()){
+ r.run();
+ } else {
+ SwingUtilities.invokeLater(r);
+ }
+
+ }
private void setNextButtonAccordingToConceptSelected() {
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/RepairPanelDescriptor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/RepairPanelDescriptor.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/RepairPanelDescriptor.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -96,6 +96,8 @@
@Override
public void aboutToDisplayPanel() {
getWizard().getInformationField().setText(INFORMATION);
+ OREManager oreMan = OREManager.getInstance();
+ repairPanel.setClassToDescribe(oreMan.getManchesterSyntaxRendering(oreMan.getCurrentClass2Learn()));
}
/**
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -29,6 +29,7 @@
import org.dllearner.tools.ore.LearningManager;
import org.dllearner.tools.ore.OREManager;
+import org.dllearner.tools.ore.LearningManager.LearningMode;
import org.dllearner.tools.ore.ui.OverrideFileChooser;
import org.dllearner.tools.ore.ui.wizard.WizardPanelDescriptor;
import org.dllearner.tools.ore.ui.wizard.panels.SavePanel;
@@ -86,15 +87,17 @@
@Override
public Object getBackPanelDescriptor() {
-
- if(LearningManager.getInstance().isManualLearningMode()){
+ LearningMode mode = LearningManager.getInstance().getLearningMode();
+ if(mode == LearningMode.MANUAL){
if(OREManager.getInstance().getNewClassDescription().getAccuracy() == 1.0){
return ManualLearnPanelDescriptor.IDENTIFIER;
} else {
return RepairPanelDescriptor.IDENTIFIER;
}
+ } else if(mode == LearningMode.AUTO){
+ return AutoLearnPanelDescriptor.IDENTIFIER;
} else {
- return AutoLearnPanelDescriptor.IDENTIFIER;
+ return ClassChoosePanelDescriptor.IDENTIFIER;
}
}
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassChoosePanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassChoosePanel.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassChoosePanel.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -20,6 +20,7 @@
package org.dllearner.tools.ore.ui.wizard.panels;
+import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
@@ -39,7 +40,9 @@
import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionListener;
+import org.dllearner.tools.ore.LearningManager;
import org.dllearner.tools.ore.OREManager;
+import org.dllearner.tools.ore.LearningManager.LearningMode;
import org.dllearner.tools.ore.ui.ClassesTable;
import org.dllearner.tools.ore.ui.HelpablePanel;
import org.dllearner.tools.ore.ui.LearningOptionsPanel;
@@ -57,6 +60,7 @@
private JSpinner minInstanceCountSpinner;
private JRadioButton autoLearnButton;
private JRadioButton manualLearnButton;
+ private JRadioButton noLearningButton;
private JPanel currentPanel;
private JPanel manualLearnPanel;
@@ -77,7 +81,7 @@
}
private void createUI(){
- setLayout(new GridBagLayout());
+ setLayout(new BorderLayout());
GridBagConstraints c = new GridBagConstraints();
JPanel optionsPanel = new JPanel(new GridLayout(0, 1));
@@ -88,18 +92,24 @@
manualLearnButton = new JRadioButton("Manual learning mode");
manualLearnButton.setActionCommand("manual");
+ noLearningButton = new JRadioButton("Skip learning");
+ noLearningButton.setActionCommand("skip");
+
+
ButtonGroup learningType = new ButtonGroup();
learningType.add(manualLearnButton);
learningType.add(autoLearnButton);
+ learningType.add(noLearningButton);
autoLearnButton.setSelected(true);
optionsPanel.add(autoLearnButton);
optionsPanel.add(manualLearnButton);
+ optionsPanel.add(noLearningButton);
HelpablePanel optionsHelpPanel = new HelpablePanel(optionsPanel);
optionsHelpPanel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
optionsHelpPanel.setHelpText(HELP_TEXT);
c.gridwidth = GridBagConstraints.REMAINDER;
- add(optionsHelpPanel, c);
+ add(optionsHelpPanel, BorderLayout.NORTH);
createAutoLearnPanel();
createManualLearnPanel();
@@ -109,7 +119,7 @@
manualLearnPanel.setPreferredSize(size);
currentPanel = autoLearnPanel;
- add(currentPanel, c);
+ add(currentPanel, BorderLayout.CENTER);
}
@@ -174,15 +184,20 @@
public void addActionsListeners(ActionListener aL){
autoLearnButton.addActionListener(aL);
manualLearnButton.addActionListener(aL);
+ noLearningButton.addActionListener(aL);
}
- public void setAutoLearningPanel(boolean value){
- if(value){
+ public void refreshLearningPanel(){
+ LearningMode mode = LearningManager.getInstance().getLearningMode();
+ if(mode == LearningMode.AUTO){
remove(manualLearnPanel);
add(autoLearnPanel);
+ } else if(mode == LearningMode.MANUAL){
+ remove(autoLearnPanel);
+ add(manualLearnPanel);
} else {
remove(autoLearnPanel);
- add(manualLearnPanel);
+ remove(manualLearnPanel);
}
validate();
repaint();
@@ -200,13 +215,25 @@
classesTable.clear();
minInstanceCountSpinner.setValue(Integer.valueOf(3));
autoLearnButton.setSelected(true);
- setAutoLearningPanel(true);
+ LearningManager.getInstance().setLearningMode(LearningMode.AUTO);
+ refreshLearningPanel();
}
public boolean isAutoLearnMode(){
return autoLearnButton.isSelected();
}
+ public void setLearningSupported(boolean value){
+ if(!value){
+ autoLearnButton.setEnabled(false);
+ manualLearnButton.setEnabled(false);
+ noLearningButton.setSelected(true);
+ } else {
+ autoLearnButton.setEnabled(true);
+ manualLearnButton.setEnabled(true);
+ }
+ }
+
public void setLearningOptions(){
OREManager.getInstance().setMaxExecutionTimeInSeconds(learningOptionsPanel.getMaxExecutionTime());
OREManager.getInstance().setMaxNrOfResults(learningOptionsPanel.getNrOfConcepts());
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPanel.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPanel.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -21,8 +21,7 @@
package org.dllearner.tools.ore.ui.wizard.panels;
import java.awt.BorderLayout;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
+import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;
@@ -30,14 +29,16 @@
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
+import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
import javax.swing.border.MatteBorder;
-import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionListener;
import org.dllearner.tools.ore.ui.IndividualsTable;
import org.dllearner.tools.ore.ui.MarkableClassExpressionsTable;
+import org.jdesktop.swingx.JXTitledPanel;
/**
* JPanel for repairing action.
@@ -59,99 +60,53 @@
private JButton negAddButton;
private JButton nextButton;
+ private JLabel classToDescribeLabel;
private MarkableClassExpressionsTable descriptionsTable;
public RepairPanel() {
- setLayout(new GridBagLayout());
-// createAutoUI();
createUI();
}
private void createUI(){
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weighty = 0.3;
- c.weightx = 1.0;
- c.gridx = 0;
- c.gridy = 0;
-// c.gridwidth = GridBagConstraints.REMAINDER;
- add(createDescriptionsPanel(), c);
+ setLayout(new BorderLayout());
+ JSplitPane mainSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
- c.fill = GridBagConstraints.NONE;
- c.gridx = 1;
- c.gridy = 0;
- nextButton = new JButton("Next suggestion");
- nextButton.setActionCommand("next");
- add(nextButton, c);
- c.fill = GridBagConstraints.BOTH;
- c.gridwidth = 1;
- c.gridy = 1;
- c.gridx = 0;
- c.weightx = 0.5;
- c.weighty = 0.5;
- add(createPosPanel(), c);
- c.gridx = 1;
- add(createNegPanel(), c);
- }
-
- private void createAutoUI(){
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weighty = 0.3;
- c.weightx = 1.0;
- c.gridx = 0;
- c.gridy = 0;
-// c.gridwidth = GridBagConstraints.REMAINDER;
- add(createDescriptionsPanel(), c);
-
- c.fill = GridBagConstraints.NONE;
- c.gridx = 1;
- c.gridy = 0;
+ JPanel descriptionPanel = new JPanel(new BorderLayout());
+ descriptionPanel.add(createDescriptionsPanel(), BorderLayout.CENTER);
nextButton = new JButton("Next suggestion");
nextButton.setActionCommand("next");
- add(nextButton, c);
+ JPanel buttonPanel = new JPanel(new BorderLayout());
+ buttonPanel.add(nextButton, BorderLayout.NORTH);
+ descriptionPanel.add(buttonPanel, BorderLayout.EAST);
- c.fill = GridBagConstraints.BOTH;
- c.gridwidth = 1;
- c.gridy = 1;
- c.gridx = 0;
- c.weightx = 0.5;
- c.weighty = 0.5;
- add(createPosPanel(), c);
- c.gridx = 1;
- add(createNegPanel(), c);
+ JSplitPane examplesSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
+ examplesSplitPane.setLeftComponent(createPosPanel());
+ examplesSplitPane.setRightComponent(createNegPanel());
+ examplesSplitPane.setDividerLocation(0.5);
+ examplesSplitPane.setResizeWeight(0.5);
+ examplesSplitPane.setOneTouchExpandable(true);
- }
-
- private void createManualUI(){
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.gridx = 0;
- c.gridy = 0;
- c.gridwidth = GridBagConstraints.REMAINDER;
- add(createDescriptionsPanel(), c);
+ mainSplitPane.setTopComponent(descriptionPanel);
+ mainSplitPane.setBottomComponent(examplesSplitPane);
+ mainSplitPane.setDividerLocation(0.3);
+ mainSplitPane.setOneTouchExpandable(true);
- c.gridwidth = 1;
- c.gridy = 1;
- c.gridx = 0;
- c.weightx = 0.5;
- c.weighty = 0.5;
- add(createPosPanel(), c);
- c.gridx = 1;
- add(createNegPanel(), c);
-
- c.gridy = 2;
- nextButton = new JButton("Next");
- nextButton.setActionCommand("next");
-// add(nextButton, c);
+ add(mainSplitPane);
}
+
private JComponent createDescriptionsPanel(){
JPanel panel = new JPanel(new BorderLayout());
+ JPanel classToDescribePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ classToDescribePanel.add(new JLabel("Class to describe:"));
+ classToDescribeLabel = new JLabel();
+ classToDescribePanel.add(classToDescribeLabel);
+ panel.add(classToDescribePanel, BorderLayout.NORTH);
+
descriptionsTable = new MarkableClassExpressionsTable();
JScrollPane scroll = new JScrollPane(descriptionsTable);
scroll.setBorder(new MatteBorder(null));
@@ -160,13 +115,10 @@
}
private JComponent createPosPanel(){
- JPanel posPanel = new JPanel();
+ JXTitledPanel posPanel = new JXTitledPanel("Positive examples");
+ posPanel.getContentContainer().setLayout(new BorderLayout());
posPanel.setName("positive");
- posPanel.setLayout(new GridBagLayout());
- posPanel.setBorder(new TitledBorder("Positive examples"));
- GridBagConstraints gbc = new GridBagConstraints();
-
JPanel buttonPanel = new JPanel();
buttonPanel.setName("positive");
buttonPanel.setLayout(new GridLayout(0, 1));
@@ -179,32 +131,21 @@
posRepairButton = new JButton("Repair");
posRepairButton.setActionCommand("posRepair");
buttonPanel.add(posRepairButton);
- gbc.anchor = GridBagConstraints.NORTH;
- posPanel.add(buttonPanel, gbc);
+ JPanel buttonPanelHolder = new JPanel(new BorderLayout());
+ buttonPanelHolder.add(buttonPanel, BorderLayout.NORTH);
+ posPanel.getContentContainer().add(buttonPanelHolder, BorderLayout.EAST);
posTable = new IndividualsTable();
- gbc.fill = GridBagConstraints.BOTH;
- gbc.weightx = 1;
- gbc.weighty = 1;
- posPanel.add(new JScrollPane(posTable), gbc);
+ posPanel.getContentContainer().add(new JScrollPane(posTable), BorderLayout.CENTER);
return posPanel;
}
private JComponent createNegPanel(){
- JPanel negPanel = new JPanel();
+ JXTitledPanel negPanel = new JXTitledPanel("Negative examples");
+ negPanel.getContentContainer().setLayout(new BorderLayout());
negPanel.setName("negative");
- negPanel.setLayout(new GridBagLayout());
- negPanel.setBorder(new TitledBorder("Negative examples"));
- GridBagConstraints gbc = new GridBagConstraints();
-
- negTable = new IndividualsTable();
- gbc.fill = GridBagConstraints.BOTH;
- gbc.weightx = 1;
- gbc.weighty = 1;
- negPanel.add(new JScrollPane(negTable), gbc);
-
JPanel buttonPanel = new JPanel();
buttonPanel.setName("negative");
buttonPanel.setLayout(new GridLayout(0, 1));
@@ -217,12 +158,13 @@
negRepairButton = new JButton("Repair");
negRepairButton.setActionCommand("negRepair");
buttonPanel.add(negRepairButton);
- gbc.fill = GridBagConstraints.NONE;
- gbc.weightx = 0;
- gbc.weighty = 0;
- gbc.anchor = GridBagConstraints.NORTH;
- negPanel.add(buttonPanel, gbc);
+ JPanel buttonPanelHolder = new JPanel(new BorderLayout());
+ buttonPanelHolder.add(buttonPanel, BorderLayout.NORTH);
+ negPanel.getContentContainer().add(buttonPanelHolder, BorderLayout.EAST);
+ negTable = new IndividualsTable();
+ negPanel.getContentContainer().add(new JScrollPane(negTable), BorderLayout.CENTER);
+
return negPanel;
}
@@ -247,12 +189,9 @@
}
public void setManualStyle(boolean value){
-// removeAll();
if(value){
-// createManualUI();
nextButton.setVisible(false);
} else {
-// createAutoUI();
nextButton.setVisible(true);
}
repaint();
@@ -292,6 +231,10 @@
negTable.addMouseListener(mL);
}
+ public void setClassToDescribe(String classToDescribeString){
+ classToDescribeLabel.setText(classToDescribeString);
+ }
+
public static void main(String[] args){
JFrame frame = new JFrame();
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/SavePanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/SavePanel.java 2010-03-11 17:20:23 UTC (rev 2116)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/SavePanel.java 2010-03-13 12:07:58 UTC (rev 2117)
@@ -20,7 +20,7 @@
package org.dllearner.tools.ore.ui.wizard.panels;
-import java.awt.GridBagConstraints;
+import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event.ActionListener;
@@ -32,6 +32,7 @@
import org.dllearner.tools.ore.OREManager;
import org.dllearner.tools.ore.ui.StatsTable;
+import org.jdesktop.swingx.JXTitledPanel;
/**
* JPanel where to buttons are added to save and go back to class choose panel.
@@ -50,22 +51,21 @@
public SavePanel(){
setLayout(new GridLayout(0,1));
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.weightx = 1.0;
- c.weighty = 1.0;
+
+ JXTitledPanel changesPanel = new JXTitledPanel("Ontology changes");
+ changesPanel.getContentContainer().setLayout(new BorderLayout());
changesTable = new StatsTable();
- add(new JScrollPane(changesTable), c);
+ changesPanel.getContentContainer().add(new JScrollPane(changesTable), BorderLayout.CENTER);
+ add(changesPanel);
+
JPanel buttonHolderPanel = new JPanel();
buttonHolderPanel.setLayout(new BoxLayout(buttonHolderPanel, BoxLayout.X_AXIS));
-
saveExit = new JButton("Save and Exit");
buttonHolderPanel.add(saveExit);
-
saveGoBack = new JButton("Save and go to class choose panel");
buttonHolderPanel.add(saveGoBack);
- add(buttonHolderPanel, c);
+ add(buttonHolderPanel);
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2010-03-15 09:01:52
|
Revision: 2120
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2120&view=rev
Author: kurzum
Date: 2010-03-15 09:01:40 +0000 (Mon, 15 Mar 2010)
Log Message:
-----------
added limit and offset and count to sparql description converter
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java
trunk/src/dl-learner/org/dllearner/utilities/experiments/Examples.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2010-03-14 10:50:12 UTC (rev 2119)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2010-03-15 09:01:40 UTC (rev 2120)
@@ -28,6 +28,7 @@
import org.dllearner.utilities.datastructures.StringTuple;
import org.dllearner.utilities.owl.OWLVocabulary;
+import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.query.ResultSetFactory;
import com.hp.hpl.jena.query.ResultSetFormatter;
@@ -489,6 +490,31 @@
}
/**
+ * variable mus be ?count
+ * @param sparqlQueryString
+ * @return -1 on failure count on success
+ */
+ public int queryAsCount(String sparqlQueryString) {
+ SparqlQuery sq = new SparqlQuery(sparqlQueryString, sparqlEndpoint);
+ ResultSetRewindable rsw = null;
+ if(cache == null) {
+ rsw = sq.send();
+ } else {
+ // get JSON from cache and convert to result set
+ String json = cache.executeSparqlQuery(sq);
+ rsw = SparqlQuery.convertJSONtoResultSet(json);
+ }
+ int ret = -1;
+ while(rsw.hasNext()){
+ QuerySolution qs = rsw.nextSolution();
+ ret = qs.getLiteral("count").getInt();
+
+ }
+ return ret;
+
+ }
+
+ /**
* low level, executes query returns JSON.
*
* @param sparqlQueryString
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2010-03-14 10:50:12 UTC (rev 2119)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2010-03-15 09:01:40 UTC (rev 2120)
@@ -73,8 +73,11 @@
private static Logger logger = Logger.getLogger(ComponentManager.class);
private int limit = 5;
+ private int offset = -1;
private boolean labels = false;
private boolean distinct = false;
+ private boolean count = false;
+
private SortedSet<String> transitiveProperties =null;
private Map<String,Set<String>> subclassMap = null;
@@ -103,7 +106,12 @@
public String getSparqlQuery( Description description) {
description.accept(this);
expandSubclasses();
- String ret = "SELECT "+distinct()+"?subject "+((labels)?"?label":"")+" { "+labels()+ query + " \n } " + limit();
+ String ret = "";
+ if(count){
+ ret = "SELECT count(distinct(?subject)) as ?count { "+ query + " \n } " ;
+ }else{
+ ret = "SELECT "+distinct()+"?subject "+((labels)?"?label":"")+" { "+labels()+ query + " \n } " + limit();
+ }
reset();
return ret;
}
@@ -154,7 +162,13 @@
}
private String limit() {
- return (limit > 0) ? " LIMIT " + limit + " " : "";
+ if (limit > 0 && offset > 0){
+ return " LIMIT " + limit + " OFFSET "+offset+" ";
+ }else if(limit > 0 ){
+ return " LIMIT " + limit + " ";
+ }else {
+ return "";
+ }
}
private String labels() {
return (labels)?"\n?subject rdfs:label ?label . ":"";
@@ -187,6 +201,14 @@
public void setSubclassMap(Map<String, Set<String>> subclassMap) {
this.subclassMap = subclassMap;
}
+
+ public void setCount(boolean count) {
+ this.count = count;
+ }
+
+ public void setOffset(int offset) {
+ this.offset = offset;
+ }
public static String getSparqlQuery(String descriptionKBSyntax, int limit, boolean labels, boolean distinct) throws ParseException {
Description d = KBParser.parseConcept(descriptionKBSyntax);
Modified: trunk/src/dl-learner/org/dllearner/utilities/experiments/Examples.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/experiments/Examples.java 2010-03-14 10:50:12 UTC (rev 2119)
+++ trunk/src/dl-learner/org/dllearner/utilities/experiments/Examples.java 2010-03-15 09:01:40 UTC (rev 2120)
@@ -58,6 +58,17 @@
this.addNegTest(negTest);
}
+ public static Examples getInstance(Collection<String> pos, Collection<String> neg){
+ Examples ex = new Examples();
+ for (String p : pos) {
+ ex.addPosTrain(p);
+ }
+ for (String n : neg) {
+ ex.addNegTrain(n);
+ }
+ return ex;
+ }
+
/**
* calculates precision based on the test set
* @param retrieved
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ku...@us...> - 2010-03-16 09:01:50
|
Revision: 2122
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2122&view=rev
Author: kurzum
Date: 2010-03-16 09:01:43 +0000 (Tue, 16 Mar 2010)
Log Message:
-----------
minor
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java
trunk/src/dl-learner/org/dllearner/utilities/analyse/CountInstances.java
trunk/src/dl-learner/org/dllearner/utilities/analyse/ScriptDoAll.java
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2010-03-15 20:57:30 UTC (rev 2121)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SPARQLTasks.java 2010-03-16 09:01:43 UTC (rev 2122)
@@ -490,7 +490,7 @@
}
/**
- * variable mus be ?count
+ * variable must be ?count
* @param sparqlQueryString
* @return -1 on failure count on success
*/
Modified: trunk/src/dl-learner/org/dllearner/utilities/analyse/CountInstances.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/analyse/CountInstances.java 2010-03-15 20:57:30 UTC (rev 2121)
+++ trunk/src/dl-learner/org/dllearner/utilities/analyse/CountInstances.java 2010-03-16 09:01:43 UTC (rev 2122)
@@ -78,6 +78,7 @@
ret.add(new Count(res, lit.getInt()));
}
+ System.out.println("retrieved: "+ret.size());
return ret;
}
}
Modified: trunk/src/dl-learner/org/dllearner/utilities/analyse/ScriptDoAll.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/analyse/ScriptDoAll.java 2010-03-15 20:57:30 UTC (rev 2121)
+++ trunk/src/dl-learner/org/dllearner/utilities/analyse/ScriptDoAll.java 2010-03-16 09:01:43 UTC (rev 2122)
@@ -32,8 +32,8 @@
String yagoFile = "yagoclasses_links.nt";
String categoryFile = "skoscategories_en.nt";
-// doIt(dbpediaFile, "RDF/XML", subclassof, rdftype, dbns);
-// doIt(yagoFile, "N-TRIPLES", subclassof, rdftype, yagons);
+// doIt(dbpediaFile, "RDF/XML", subclassof, rdftype, dbns,false);
+// doIt(yagoFile, "N-TRIPLES", subclassof, rdftype, yagons,false);
doIt(categoryFile, "N-TRIPLES", broader, subject, catns, true);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-03-23 16:26:17
|
Revision: 2128
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2128&view=rev
Author: jenslehmann
Date: 2010-03-23 16:26:07 +0000 (Tue, 23 Mar 2010)
Log Message:
-----------
implemented option "useDatabaseCache" in SPARQL component
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/configurators/CELOEConfigurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java
trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java
trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/CELOEConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/CELOEConfigurator.java 2010-03-23 14:32:33 UTC (rev 2127)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/CELOEConfigurator.java 2010-03-23 16:26:07 UTC (rev 2128)
@@ -202,7 +202,7 @@
return (Boolean) ComponentManager.getInstance().getConfigOptionValue(cELOE, "instanceBasedDisjoints") ;
}
/**
-* filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base..
+* filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base. Be careful, since this requires a potentially expensive consistency check for candidate solutions..
* mandatory: false| reinit necessary: true
* default value: false
* @return boolean
@@ -365,7 +365,7 @@
reinitNecessary = true;
}
/**
-* @param filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base..
+* @param filterDescriptionsFollowingFromKB If true, then the results will not contain suggestions, which already follow logically from the knowledge base. Be careful, since this requires a potentially expensive consistency check for candidate solutions..
* mandatory: false| reinit necessary: true
* default value: false
**/
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java 2010-03-23 14:32:33 UTC (rev 2127)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/ROLComponent2Configurator.java 2010-03-23 16:26:07 UTC (rev 2128)
@@ -178,26 +178,6 @@
return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(rOLComponent2, "ignoredConcepts") ;
}
/**
-* allowedRoles roles the algorithm is allowed to use.
-* mandatory: false| reinit necessary: true
-* default value: null
-* @return Set(String)
-**/
-@SuppressWarnings("unchecked")
-public Set<String> getAllowedRoles() {
-return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(rOLComponent2, "allowedRoles") ;
-}
-/**
-* ignoredRoles roles the algorithm must ignore.
-* mandatory: false| reinit necessary: true
-* default value: null
-* @return Set(String)
-**/
-@SuppressWarnings("unchecked")
-public Set<String> getIgnoredRoles() {
-return (Set<String>) ComponentManager.getInstance().getConfigOptionValue(rOLComponent2, "ignoredRoles") ;
-}
-/**
* useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm.
* mandatory: false| reinit necessary: true
* default value: true
@@ -550,24 +530,6 @@
reinitNecessary = true;
}
/**
-* @param allowedRoles roles the algorithm is allowed to use.
-* mandatory: false| reinit necessary: true
-* default value: null
-**/
-public void setAllowedRoles(Set<String> allowedRoles) {
-ComponentManager.getInstance().applyConfigEntry(rOLComponent2, "allowedRoles", allowedRoles);
-reinitNecessary = true;
-}
-/**
-* @param ignoredRoles roles the algorithm must ignore.
-* mandatory: false| reinit necessary: true
-* default value: null
-**/
-public void setIgnoredRoles(Set<String> ignoredRoles) {
-ComponentManager.getInstance().applyConfigEntry(rOLComponent2, "ignoredRoles", ignoredRoles);
-reinitNecessary = true;
-}
-/**
* @param useAllConstructor specifies whether the universal concept constructor is used in the learning algorithm.
* mandatory: false| reinit necessary: true
* default value: true
Modified: trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2010-03-23 14:32:33 UTC (rev 2127)
+++ trunk/src/dl-learner/org/dllearner/core/configurators/SparqlKnowledgeSourceConfigurator.java 2010-03-23 16:26:07 UTC (rev 2128)
@@ -85,6 +85,15 @@
return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useCache") ;
}
/**
+* useCacheDatabase If true, H2 database is used, otherwise one file per query is written..
+* mandatory: false| reinit necessary: true
+* default value: false
+* @return boolean
+**/
+public boolean getUseCacheDatabase() {
+return (Boolean) ComponentManager.getInstance().getConfigOptionValue(sparqlKnowledgeSource, "useCacheDatabase") ;
+}
+/**
* instances relevant instances e.g. positive and negative examples in a learning problem.
* mandatory: true| reinit necessary: true
* default value: null
@@ -300,6 +309,15 @@
reinitNecessary = true;
}
/**
+* @param useCacheDatabase If true, H2 database is used, otherwise one file per query is written..
+* mandatory: false| reinit necessary: true
+* default value: false
+**/
+public void setUseCacheDatabase(boolean useCacheDatabase) {
+ComponentManager.getInstance().applyConfigEntry(sparqlKnowledgeSource, "useCacheDatabase", useCacheDatabase);
+reinitNecessary = true;
+}
+/**
* @param instances relevant instances e.g. positive and negative examples in a learning problem.
* mandatory: true| reinit necessary: true
* default value: null
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2010-03-23 14:32:33 UTC (rev 2127)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/Cache.java 2010-03-23 16:26:07 UTC (rev 2128)
@@ -129,7 +129,10 @@
* Where the base path to the cache is .
*/
public Cache(String cacheDir) {
-
+ this(cacheDir, false);
+ }
+
+ public Cache(String cacheDir, boolean useDatabase) {
this.cacheDir = cacheDir + File.separator;
if (!new File(cacheDir).exists()) {
Files.mkdir(cacheDir);
@@ -138,9 +141,9 @@
if(useDatabase) {
h2 = new ExtractionDBCache();
- }
+ }
}
-
+
// compute md5-hash
private String getHash(String string) {
Monitor hashTime = JamonMonitorLogger.getTimeMonitor(Cache.class, "HashTime").start();
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2010-03-23 14:32:33 UTC (rev 2127)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2010-03-23 16:26:07 UTC (rev 2128)
@@ -142,6 +142,7 @@
false, true));
options.add(new BooleanConfigOption("useCache",
"If true a Cache is used", true, false, true));
+ options.add(new BooleanConfigOption("useCacheDatabase", "If true, H2 database is used, otherwise one file per query is written.", false));
options
.add(new StringSetConfigOption(
"instances",
@@ -414,7 +415,7 @@
// get Options for endpoints
if (configurator.getUseCache()){
- return new SPARQLTasks(new Cache(configurator.getCacheDir()),
+ return new SPARQLTasks(new Cache(configurator.getCacheDir(), configurator.getUseCacheDatabase()),
getSparqlEndpoint());
}else {
return new SPARQLTasks(getSparqlEndpoint());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-03-24 09:04:00
|
Revision: 2133
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2133&view=rev
Author: jenslehmann
Date: 2010-03-24 09:03:52 +0000 (Wed, 24 Mar 2010)
Log Message:
-----------
convenience Manchester Syntax parsing method
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/utilities/owl/ManchesterOWLSyntaxParser.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java
Added: trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java 2010-03-24 09:03:52 UTC (rev 2133)
@@ -0,0 +1,45 @@
+/**
+ * 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.test.junit;
+
+import org.dllearner.core.owl.Description;
+import org.dllearner.utilities.owl.ManchesterOWLSyntaxParser;
+import org.junit.Test;
+import org.semanticweb.owl.expression.ParserException;
+
+/**
+ *
+ * OWL API specific tests.
+ *
+ * @author Jens Lehmann
+ *
+ */
+public class OWLAPITests {
+
+ @Test
+ public void testManchesterSyntaxParser() throws ParserException {
+// String s = "BIGPROP SOME smallclass";
+// String s = "http://test.de/prop some http://test.de/Class";
+ String s = "http://test.de/Class";
+ Description d = ManchesterOWLSyntaxParser.getDescription(s);
+ System.out.println(d);
+ }
+
+}
Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/ManchesterOWLSyntaxParser.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/ManchesterOWLSyntaxParser.java 2010-03-23 20:13:28 UTC (rev 2132)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/ManchesterOWLSyntaxParser.java 2010-03-24 09:03:52 UTC (rev 2133)
@@ -20,6 +20,7 @@
package org.dllearner.utilities.owl;
import org.coode.manchesterowlsyntax.ManchesterOWLSyntaxEditorParser;
+import org.dllearner.core.owl.Description;
import org.semanticweb.owl.apibinding.OWLManager;
import org.semanticweb.owl.expression.ParserException;
import org.semanticweb.owl.model.OWLDescription;
@@ -27,22 +28,22 @@
/**
* Parser for Manchester Syntax strings (interface to OWL API parser).
- * TODO: Currently, this outputs an OWL API OWLDescription, but there
- * is no converter from OWL API descriptions to DL-Learner descriptions
- * at the moment.
*
* @author Jens Lehmann
*
*/
public class ManchesterOWLSyntaxParser {
- public OWLDescription getDescription(String manchesterSyntaxDescription) throws ParserException {
+ public static OWLDescription getOWLAPIDescription(String manchesterSyntaxDescription) throws ParserException {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
-
ManchesterOWLSyntaxEditorParser parser = new
ManchesterOWLSyntaxEditorParser(manager.getOWLDataFactory(), manchesterSyntaxDescription);
-
return parser.parseDescription();
}
+
+ public static Description getDescription(String manchesterSyntaxDescription) throws ParserException {
+ OWLDescription d = getOWLAPIDescription(manchesterSyntaxDescription);
+ return DLLearnerDescriptionConvertVisitor.getDLLearnerDescription(d);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lor...@us...> - 2010-03-24 15:20:20
|
Revision: 2136
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2136&view=rev
Author: lorenz_b
Date: 2010-03-24 15:20:13 +0000 (Wed, 24 Mar 2010)
Log Message:
-----------
Added new OWL construct ObjectOneOf.
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java
trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java
trunk/src/dl-learner/org/dllearner/utilities/owl/DLLearnerDescriptionConvertVisitor.java
trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java
trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIDescriptionConvertVisitor.java
Added Paths:
-----------
trunk/src/dl-learner/org/dllearner/core/owl/ObjectOneOf.java
Modified: trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java 2010-03-24 14:22:45 UTC (rev 2135)
+++ trunk/src/dl-learner/org/dllearner/core/owl/DescriptionVisitor.java 2010-03-24 15:20:13 UTC (rev 2136)
@@ -51,6 +51,8 @@
public void visit(Union description);
+ public void visit(ObjectOneOf description);
+
public void visit(ObjectMinCardinalityRestriction description);
public void visit(ObjectExactCardinalityRestriction description);
Added: trunk/src/dl-learner/org/dllearner/core/owl/ObjectOneOf.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/owl/ObjectOneOf.java (rev 0)
+++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectOneOf.java 2010-03-24 15:20:13 UTC (rev 2136)
@@ -0,0 +1,92 @@
+package org.dllearner.core.owl;
+
+import java.util.Map;
+import java.util.Set;
+
+public class ObjectOneOf extends Description{
+
+ private static final long serialVersionUID = 5494347630962268139L;
+
+ private Set<Individual> individuals;
+
+
+ public ObjectOneOf(Set<Individual> individuals){
+ this.individuals = individuals;
+ }
+
+ public Set<Individual> getIndividuals(){
+ return individuals;
+ }
+
+ @Override
+ public void accept(DescriptionVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ @Override
+ public int getArity() {
+ return 0;
+ }
+
+ @Override
+ public String toManchesterSyntaxString(String baseURI, Map<String, String> prefixes) {
+ StringBuffer sb = new StringBuffer();
+ int count = 1;
+ sb.append("{");
+ for(Individual ind : individuals){
+ sb.append(ind.toString(baseURI, prefixes));
+ if(count < individuals.size()){
+ sb.append(",");
+ count++;
+ }
+ }
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+ @Override
+ public void accept(KBElementVisitor visitor) {
+ visitor.visit(this);
+ }
+
+ @Override
+ public int getLength() {
+ return 1;
+ }
+
+ @Override
+ public String toKBSyntaxString(String baseURI, Map<String, String> prefixes) {
+ StringBuffer sb = new StringBuffer();
+ int count = 1;
+ sb.append("{");
+ for(Individual ind : individuals){
+ sb.append(ind.toKBSyntaxString(baseURI, prefixes));
+ if(count < individuals.size()){
+ sb.append(",");
+ count++;
+ }
+ }
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+ @Override
+ public String toString(String baseURI, Map<String, String> prefixes) {
+ StringBuffer sb = new StringBuffer();
+ int count = 1;
+ sb.append("{");
+ for(Individual ind : individuals){
+ sb.append(ind.toString(baseURI, prefixes));
+ if(count < individuals.size()){
+ sb.append(", ");
+ count++;
+ }
+ }
+ sb.append("}");
+
+ return sb.toString();
+ }
+
+}
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java 2010-03-24 14:22:45 UTC (rev 2135)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/NaturalLanguageDescriptionConvertVisitor.java 2010-03-24 15:20:13 UTC (rev 2136)
@@ -24,6 +24,7 @@
import org.dllearner.core.owl.ObjectExactCardinalityRestriction;
import org.dllearner.core.owl.ObjectMaxCardinalityRestriction;
import org.dllearner.core.owl.ObjectMinCardinalityRestriction;
+import org.dllearner.core.owl.ObjectOneOf;
import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.core.owl.ObjectSomeRestriction;
import org.dllearner.core.owl.ObjectValueRestriction;
@@ -344,4 +345,12 @@
public void visit(DatatypeSomeRestriction description) {
logger.trace("DatatypeSomeRestriction");
}
+
+ /* (non-Javadoc)
+ * @see org.dllearner.core.owl.DescriptionVisitor#visit(org.dllearner.core.owl.ObjectOneOf)
+ */
+ @Override
+ public void visit(ObjectOneOf description) {
+ logger.trace("ObjectOneOf");
+ }
}
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2010-03-24 14:22:45 UTC (rev 2135)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryDescriptionConvertVisitor.java 2010-03-24 15:20:13 UTC (rev 2136)
@@ -50,6 +50,7 @@
import org.dllearner.core.owl.ObjectExactCardinalityRestriction;
import org.dllearner.core.owl.ObjectMaxCardinalityRestriction;
import org.dllearner.core.owl.ObjectMinCardinalityRestriction;
+import org.dllearner.core.owl.ObjectOneOf;
import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.core.owl.ObjectSomeRestriction;
import org.dllearner.core.owl.ObjectValueRestriction;
@@ -625,6 +626,12 @@
logger.trace("DatatypeSomeRestriction");
}
+ @Override
+ public void visit(ObjectOneOf description) {
+ logger.trace("ObjectOneOf");
+
+ }
+
}
Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/DLLearnerDescriptionConvertVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/DLLearnerDescriptionConvertVisitor.java 2010-03-24 14:22:45 UTC (rev 2135)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/DLLearnerDescriptionConvertVisitor.java 2010-03-24 15:20:13 UTC (rev 2136)
@@ -19,6 +19,7 @@
import org.dllearner.core.owl.ObjectExactCardinalityRestriction;
import org.dllearner.core.owl.ObjectMaxCardinalityRestriction;
import org.dllearner.core.owl.ObjectMinCardinalityRestriction;
+import org.dllearner.core.owl.ObjectOneOf;
import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.core.owl.ObjectPropertyExpression;
import org.dllearner.core.owl.ObjectSomeRestriction;
@@ -163,8 +164,7 @@
@Override
public void visit(OWLObjectOneOf description) {
- // TODO Auto-generated method stub
-
+ stack.push(new ObjectOneOf(OWLAPIConverter.convertIndividuals(description.getIndividuals())));
}
@Override
Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java 2010-03-24 14:22:45 UTC (rev 2135)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java 2010-03-24 15:20:13 UTC (rev 2136)
@@ -88,6 +88,14 @@
return staticFactory.getOWLIndividual(URI.create(individual.getName()));
}
+ public static Set<OWLIndividual> getOWLAPIIndividuals(Set<Individual> individuals) {
+ Set<OWLIndividual> inds = new TreeSet<OWLIndividual>();
+ for(Individual individual : individuals) {
+ inds.add(getOWLAPIIndividual(individual));
+ }
+ return inds;
+ }
+
public static OWLObjectProperty getOWLAPIObjectProperty(ObjectProperty role) {
return staticFactory.getOWLObjectProperty(URI.create(role.getName()));
}
Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIDescriptionConvertVisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIDescriptionConvertVisitor.java 2010-03-24 14:22:45 UTC (rev 2135)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIDescriptionConvertVisitor.java 2010-03-24 15:20:13 UTC (rev 2136)
@@ -44,6 +44,7 @@
import org.dllearner.core.owl.ObjectExactCardinalityRestriction;
import org.dllearner.core.owl.ObjectMaxCardinalityRestriction;
import org.dllearner.core.owl.ObjectMinCardinalityRestriction;
+import org.dllearner.core.owl.ObjectOneOf;
import org.dllearner.core.owl.ObjectProperty;
import org.dllearner.core.owl.ObjectSomeRestriction;
import org.dllearner.core.owl.ObjectValueRestriction;
@@ -360,4 +361,10 @@
}
return owlConstant;
}
+
+ @Override
+ public void visit(ObjectOneOf description) {
+ stack.push(factory.getOWLObjectOneOf(OWLAPIConverter.getOWLAPIIndividuals(description.getIndividuals())));
+
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jen...@us...> - 2010-03-25 16:25:34
|
Revision: 2138
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2138&view=rev
Author: jenslehmann
Date: 2010-03-25 16:25:28 +0000 (Thu, 25 Mar 2010)
Log Message:
-----------
hasValue support for KB syntax parser
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java
trunk/src/dl-learner/org/dllearner/parser/KBParser.java
trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java
trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java
trunk/src/dl-learner/org/dllearner/parser/kb.jj
trunk/src/dl-learner/org/dllearner/test/junit/ParserTest.java
Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2010-03-25 08:41:30 UTC (rev 2137)
+++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectValueRestriction.java 2010-03-25 16:25:28 UTC (rev 2138)
@@ -73,7 +73,7 @@
}
public String toKBSyntaxString(String baseURI, Map<String, String> prefixes) {
- return restrictedPropertyExpression.toKBSyntaxString(baseURI, prefixes) + " hasValue " + value.toKBSyntaxString(baseURI, prefixes);
+ return "(" + restrictedPropertyExpression.toKBSyntaxString(baseURI, prefixes) + " HASVALUE " + value.toKBSyntaxString(baseURI, prefixes) + ")";
}
public Individual getIndividual() {
Modified: trunk/src/dl-learner/org/dllearner/parser/KBParser.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2010-03-25 08:41:30 UTC (rev 2137)
+++ trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2010-03-25 16:25:28 UTC (rev 2138)
@@ -418,7 +418,9 @@
NamedClass ac;
ObjectProperty ar;
DatatypeProperty dp;
+ ObjectProperty op;
String s;
+ Individual ind;
int i;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case TOP:
@@ -501,12 +503,19 @@
jj_consume_token(49);
jj_consume_token(23);
{if (true) return new BooleanValueRestriction(dp, false);}
+ } else if (jj_2_10(4)) {
+ jj_consume_token(22);
+ op = ObjectProperty();
+ jj_consume_token(50);
+ ind = Individual();
+ jj_consume_token(23);
+ {if (true) return new ObjectValueRestriction(op, ind);}
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 22:
jj_consume_token(22);
dp = DatatypeProperty();
- jj_consume_token(50);
+ jj_consume_token(51);
s = String();
jj_consume_token(23);
{if (true) return new StringValueRestriction(dp, s);}
@@ -730,24 +739,13 @@
finally { jj_save(8, xla); }
}
- private boolean jj_3_7() {
- if (jj_scan_token(22)) return true;
- if (jj_3R_2()) return true;
- if (jj_scan_token(15)) return true;
- return false;
+ private boolean jj_2_10(int xla) {
+ jj_la = xla; jj_lastpos = jj_scanpos = token;
+ try { return !jj_3_10(); }
+ catch(LookaheadSuccess ls) { return true; }
+ finally { jj_save(9, xla); }
}
- private boolean jj_3R_13() {
- if (jj_scan_token(18)) return true;
- if (jj_3R_2()) return true;
- return false;
- }
-
- private boolean jj_3R_25() {
- if (jj_scan_token(NUMBER)) return true;
- return false;
- }
-
private boolean jj_3_6() {
if (jj_scan_token(22)) return true;
if (jj_3R_2()) return true;
@@ -780,6 +778,15 @@
return false;
}
+ private boolean jj_3R_9() {
+ if (jj_scan_token(22)) return true;
+ if (jj_3R_2()) return true;
+ if (jj_scan_token(14)) return true;
+ if (jj_3R_2()) return true;
+ if (jj_scan_token(23)) return true;
+ return false;
+ }
+
private boolean jj_3_4() {
if (jj_3R_2()) return true;
Token xsp;
@@ -791,12 +798,8 @@
return false;
}
- private boolean jj_3R_9() {
- if (jj_scan_token(22)) return true;
- if (jj_3R_2()) return true;
- if (jj_scan_token(14)) return true;
- if (jj_3R_2()) return true;
- if (jj_scan_token(23)) return true;
+ private boolean jj_3R_18() {
+ if (jj_3R_26()) return true;
return false;
}
@@ -806,11 +809,6 @@
return false;
}
- private boolean jj_3R_18() {
- if (jj_3R_26()) return true;
- return false;
- }
-
private boolean jj_3_5() {
if (jj_3R_5()) return true;
return false;
@@ -853,6 +851,8 @@
jj_scanpos = xsp;
if (jj_3_9()) {
jj_scanpos = xsp;
+ if (jj_3_10()) {
+ jj_scanpos = xsp;
if (jj_3R_16()) return true;
}
}
@@ -866,6 +866,7 @@
}
}
}
+ }
return false;
}
@@ -894,6 +895,11 @@
return false;
}
+ private boolean jj_3R_24() {
+ if (jj_3R_26()) return true;
+ return false;
+ }
+
private boolean jj_3_2() {
Token xsp;
xsp = jj_scanpos;
@@ -905,20 +911,6 @@
return false;
}
- private boolean jj_3_1() {
- if (jj_3R_2()) return true;
- if (jj_scan_token(22)) return true;
- if (jj_3R_3()) return true;
- if (jj_scan_token(23)) return true;
- if (jj_scan_token(COMMAND_END)) return true;
- return false;
- }
-
- private boolean jj_3R_24() {
- if (jj_3R_26()) return true;
- return false;
- }
-
private boolean jj_3R_19() {
if (jj_3R_27()) return true;
return false;
@@ -934,6 +926,15 @@
return false;
}
+ private boolean jj_3_1() {
+ if (jj_3R_2()) return true;
+ if (jj_scan_token(22)) return true;
+ if (jj_3R_3()) return true;
+ if (jj_scan_token(23)) return true;
+ if (jj_scan_token(COMMAND_END)) return true;
+ return false;
+ }
+
private boolean jj_3R_22() {
if (jj_3R_26()) return true;
return false;
@@ -977,12 +978,21 @@
private boolean jj_3R_16() {
if (jj_scan_token(22)) return true;
if (jj_3R_6()) return true;
- if (jj_scan_token(50)) return true;
+ if (jj_scan_token(51)) return true;
if (jj_3R_26()) return true;
if (jj_scan_token(23)) return true;
return false;
}
+ private boolean jj_3_10() {
+ if (jj_scan_token(22)) return true;
+ if (jj_3R_4()) return true;
+ if (jj_scan_token(50)) return true;
+ if (jj_3R_3()) return true;
+ if (jj_scan_token(23)) return true;
+ return false;
+ }
+
private boolean jj_3_9() {
if (jj_scan_token(22)) return true;
if (jj_3R_6()) return true;
@@ -1019,6 +1029,24 @@
return false;
}
+ private boolean jj_3R_25() {
+ if (jj_scan_token(NUMBER)) return true;
+ return false;
+ }
+
+ private boolean jj_3_7() {
+ if (jj_scan_token(22)) return true;
+ if (jj_3R_2()) return true;
+ if (jj_scan_token(15)) return true;
+ return false;
+ }
+
+ private boolean jj_3R_13() {
+ if (jj_scan_token(18)) return true;
+ if (jj_3R_2()) return true;
+ return false;
+ }
+
/** Generated Token Manager. */
public KBParserTokenManager token_source;
SimpleCharStream jj_input_stream;
@@ -1043,7 +1071,7 @@
private static void jj_la1_init_1() {
jj_la1_1 = new int[] {0xffd,0xffd,0x0,0x2,0x1c,0x60,0x380,0xc00,0x7000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,};
}
- final private JJCalls[] jj_2_rtns = new JJCalls[9];
+ final private JJCalls[] jj_2_rtns = new JJCalls[10];
private boolean jj_rescan = false;
private int jj_gc = 0;
@@ -1227,7 +1255,7 @@
/** Generate ParseException. */
public ParseException generateParseException() {
jj_expentries.clear();
- boolean[] la1tokens = new boolean[51];
+ boolean[] la1tokens = new boolean[52];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
@@ -1244,7 +1272,7 @@
}
}
}
- for (int i = 0; i < 51; i++) {
+ for (int i = 0; i < 52; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
@@ -1271,7 +1299,7 @@
private void jj_rescan_token() {
jj_rescan = true;
- for (int i = 0; i < 9; i++) {
+ for (int i = 0; i < 10; i++) {
try {
JJCalls p = jj_2_rtns[i];
do {
@@ -1287,6 +1315,7 @@
case 6: jj_3_7(); break;
case 7: jj_3_8(); break;
case 8: jj_3_9(); break;
+ case 9: jj_3_10(); break;
}
}
p = p.next;
Modified: trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java 2010-03-25 08:41:30 UTC (rev 2137)
+++ trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java 2010-03-25 16:25:28 UTC (rev 2138)
@@ -101,6 +101,7 @@
"\"IS\"",
"\"TRUE\"",
"\"FALSE\"",
+ "\"HASVALUE\"",
"\"STRINGVALUE\"",
};
Modified: trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java 2010-03-25 08:41:30 UTC (rev 2137)
+++ trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java 2010-03-25 16:25:28 UTC (rev 2138)
@@ -18,7 +18,7 @@
switch (pos)
{
case 0:
- if ((active0 & 0x400034c000000L) != 0L)
+ if ((active0 & 0x800034c000000L) != 0L)
return 10;
if ((active0 & 0x2000020000000L) != 0L)
return 18;
@@ -65,6 +65,8 @@
return jjMoveStringLiteralDfa1_0(0x1c6400000000L);
case 70:
return jjMoveStringLiteralDfa1_0(0x2000020000000L);
+ case 72:
+ return jjMoveStringLiteralDfa1_0(0x4000000000000L);
case 73:
return jjMoveStringLiteralDfa1_0(0xc00080000000L);
case 79:
@@ -72,7 +74,7 @@
case 82:
return jjMoveStringLiteralDfa1_0(0x8000000000L);
case 83:
- return jjMoveStringLiteralDfa1_0(0x400034c000000L);
+ return jjMoveStringLiteralDfa1_0(0x800034c000000L);
case 84:
return jjMoveStringLiteralDfa1_0(0x1000010001000L);
default :
@@ -95,7 +97,7 @@
return jjStopAtPos(1, 20);
break;
case 65:
- return jjMoveStringLiteralDfa2_0(active0, 0x208c000000000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x608c000000000L);
case 66:
return jjMoveStringLiteralDfa2_0(active0, 0x21000000000L);
case 78:
@@ -113,7 +115,7 @@
return jjStopAtPos(1, 47);
break;
case 84:
- return jjMoveStringLiteralDfa2_0(active0, 0x4000000000000L);
+ return jjMoveStringLiteralDfa2_0(active0, 0x8000000000000L);
case 85:
return jjMoveStringLiteralDfa2_0(active0, 0x20c000000L);
case 110:
@@ -166,7 +168,9 @@
return jjStopAtPos(2, 12);
break;
case 82:
- return jjMoveStringLiteralDfa3_0(active0, 0x4050000000000L);
+ return jjMoveStringLiteralDfa3_0(active0, 0x8050000000000L);
+ case 83:
+ return jjMoveStringLiteralDfa3_0(active0, 0x4000000000000L);
case 84:
return jjMoveStringLiteralDfa3_0(active0, 0x484000002000L);
case 85:
@@ -210,7 +214,7 @@
case 71:
return jjMoveStringLiteralDfa4_0(active0, 0x8000000000L);
case 73:
- return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L);
+ return jjMoveStringLiteralDfa4_0(active0, 0x8000000000000L);
case 76:
return jjMoveStringLiteralDfa4_0(active0, 0x200000000000L);
case 79:
@@ -219,6 +223,8 @@
return jjMoveStringLiteralDfa4_0(active0, 0x2000000000000L);
case 84:
return jjMoveStringLiteralDfa4_0(active0, 0x2000L);
+ case 86:
+ return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L);
case 99:
return jjMoveStringLiteralDfa4_0(active0, 0x20000000L);
case 101:
@@ -245,6 +251,8 @@
}
switch(curChar)
{
+ case 65:
+ return jjMoveStringLiteralDfa5_0(active0, 0x4000000000000L);
case 67:
return jjMoveStringLiteralDfa5_0(active0, 0x21000000000L);
case 69:
@@ -262,7 +270,7 @@
case 77:
return jjMoveStringLiteralDfa5_0(active0, 0x2800000000L);
case 78:
- return jjMoveStringLiteralDfa5_0(active0, 0x4050000000000L);
+ return jjMoveStringLiteralDfa5_0(active0, 0x8050000000000L);
case 79:
return jjMoveStringLiteralDfa5_0(active0, 0x200002000L);
case 84:
@@ -300,7 +308,9 @@
return jjStopAtPos(5, 44);
return jjMoveStringLiteralDfa6_0(active0, 0x400000000000L);
case 71:
- return jjMoveStringLiteralDfa6_0(active0, 0x4050000000000L);
+ return jjMoveStringLiteralDfa6_0(active0, 0x8050000000000L);
+ case 76:
+ return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L);
case 77:
if ((active0 & 0x2000L) != 0L)
return jjStopAtPos(5, 13);
@@ -359,8 +369,10 @@
break;
case 83:
return jjMoveStringLiteralDfa7_0(active0, 0x4000000L);
+ case 85:
+ return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L);
case 86:
- return jjMoveStringLiteralDfa7_0(active0, 0x4000000000000L);
+ return jjMoveStringLiteralDfa7_0(active0, 0x8000000000000L);
case 101:
if ((active0 & 0x80000000L) != 0L)
return jjStopAtPos(6, 31);
@@ -390,8 +402,10 @@
switch(curChar)
{
case 65:
- return jjMoveStringLiteralDfa8_0(active0, 0x4000000000000L);
+ return jjMoveStringLiteralDfa8_0(active0, 0x8000000000000L);
case 69:
+ if ((active0 & 0x4000000000000L) != 0L)
+ return jjStopAtPos(7, 50);
return jjMoveStringLiteralDfa8_0(active0, 0x84200000000L);
case 78:
if ((active0 & 0x800000000L) != 0L)
@@ -424,7 +438,7 @@
switch(curChar)
{
case 76:
- return jjMoveStringLiteralDfa9_0(active0, 0x4000000000000L);
+ return jjMoveStringLiteralDfa9_0(active0, 0x8000000000000L);
case 79:
return jjMoveStringLiteralDfa9_0(active0, 0x21004000000L);
case 80:
@@ -464,7 +478,7 @@
case 84:
return jjMoveStringLiteralDfa10_0(active0, 0x200000000L);
case 85:
- return jjMoveStringLiteralDfa10_0(active0, 0x4000000000000L);
+ return jjMoveStringLiteralDfa10_0(active0, 0x8000000000000L);
case 101:
if ((active0 & 0x10000000L) != 0L)
return jjStopAtPos(9, 28);
@@ -490,8 +504,8 @@
switch(curChar)
{
case 69:
- if ((active0 & 0x4000000000000L) != 0L)
- return jjStopAtPos(10, 50);
+ if ((active0 & 0x8000000000000L) != 0L)
+ return jjStopAtPos(10, 51);
return jjMoveStringLiteralDfa11_0(active0, 0x21000000000L);
case 79:
return jjMoveStringLiteralDfa11_0(active0, 0x84200000000L);
@@ -1139,14 +1153,14 @@
"\117\102\112\105\103\124\120\122\117\120\105\122\124\131\122\101\116\107\105", "\104\120\122\101\116\107\105",
"\104\101\124\101\124\131\120\105\120\122\117\120\105\122\124\131\122\101\116\107\105", "\104\117\125\102\114\105", "\102\117\117\114\105\101\116",
"\111\116\124\105\107\105\122", "\111\123", "\124\122\125\105", "\106\101\114\123\105",
-"\123\124\122\111\116\107\126\101\114\125\105", };
+"\110\101\123\126\101\114\125\105", "\123\124\122\111\116\107\126\101\114\125\105", };
/** Lexer state names. */
public static final String[] lexStateNames = {
"DEFAULT",
};
static final long[] jjtoToken = {
- 0x7ffffffffff01L,
+ 0xfffffffffff01L,
};
static final long[] jjtoSkip = {
0xfeL,
Modified: trunk/src/dl-learner/org/dllearner/parser/kb.jj
===================================================================
--- trunk/src/dl-learner/org/dllearner/parser/kb.jj 2010-03-25 08:41:30 UTC (rev 2137)
+++ trunk/src/dl-learner/org/dllearner/parser/kb.jj 2010-03-25 16:25:28 UTC (rev 2138)
@@ -253,7 +253,9 @@
NamedClass ac;
ObjectProperty ar;
DatatypeProperty dp;
+ ObjectProperty op;
String s;
+ Individual ind;
int i;
}
{
@@ -288,6 +290,7 @@
{return new ObjectMaxCardinalityRestriction(i,ar,c);}
| LOOKAHEAD(4) "(" dp=DatatypeProperty() "IS" "TRUE" ")" { return new BooleanValueRestriction(dp, true); }
| LOOKAHEAD(4) "(" dp=DatatypeProperty() "IS" "FALSE" ")" { return new BooleanValueRestriction(dp, false); }
+ | LOOKAHEAD(4) "(" op=ObjectProperty() "HASVALUE" ind=Individual() ")" { return new ObjectValueRestriction(op, ind); }
| "(" dp=DatatypeProperty() "STRINGVALUE" s=String() ")" { return new StringValueRestriction(dp, s); }
}
Modified: trunk/src/dl-learner/org/dllearner/test/junit/ParserTest.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/test/junit/ParserTest.java 2010-03-25 08:41:30 UTC (rev 2137)
+++ trunk/src/dl-learner/org/dllearner/test/junit/ParserTest.java 2010-03-25 16:25:28 UTC (rev 2138)
@@ -35,7 +35,8 @@
@Test
public void KBParserTest() throws ParseException {
- String test = "(\"Sentence\" AND (EXISTS \"syntaxTreeHasPart\".\"VVPP\" AND EXISTS \"syntaxTreeHasPart\".(\"stts:AuxilliaryVerb\" AND (\"hasLemma\" STRINGVALUE \"werden\"))))";
+// String test = "(\"Sentence\" AND (EXISTS \"syntaxTreeHasPart\".\"VVPP\" AND EXISTS \"syntaxTreeHasPart\".(\"stts:AuxilliaryVerb\" AND (\"hasLemma\" STRINGVALUE \"werden\"))))";
+ String test = "(someproperty HASVALUE someindividual)";
Description d = KBParser.parseConcept(test);
System.out.println(d.toKBSyntaxString("http://localhost/foo#", null));
Description d2 = KBParser.parseConcept(d.toKBSyntaxString());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lor...@us...> - 2010-05-27 16:45:45
|
Revision: 2155
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2155&view=rev
Author: lorenz_b
Date: 2010-05-27 16:45:38 +0000 (Thu, 27 May 2010)
Log Message:
-----------
Added option in evaluation script to skip classes which have already a perfect definition in the underlying ontology.
Added new datatype xsd:dateTime and converting option.
Started removing compiler warnings.
Removed 1 JUnit test.
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java
trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationComputingScript.java
trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java
trunk/src/dl-learner/org/dllearner/tools/evaluationplugin/EvaluationPlugin.java
trunk/src/dl-learner/org/dllearner/tools/evaluationplugin/GraphicalCoveragePanel.java
trunk/src/dl-learner/org/dllearner/tools/ore/LearningManager.java
trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java
trunk/src/dl-learner/org/dllearner/tools/ore/cache/ManchesterSyntaxRenderingCache.java
trunk/src/dl-learner/org/dllearner/tools/ore/cache/OWLEntityRenderingCache.java
trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java
trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java
trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/RelevanceBasedGenerator.java
trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SimpleSelectionFunction.java
trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SyntacticRelevanceBasedExplanationGenerator.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxOWLObjectRendererImpl.java
trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java
trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java
trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java
trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java
Modified: trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/core/owl/Datatype.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -33,8 +33,9 @@
INTEGER ("http://www.w3.org/2001/XMLSchema#integer"),
BOOLEAN ("http://www.w3.org/2001/XMLSchema#boolean"),
STRING ("http://www.w3.org/2001/XMLSchema#string"),
- DATE ("http://www.w3.org/2001/XMLSchema#date");
-
+ DATE ("http://www.w3.org/2001/XMLSchema#date"),
+ DATETIME ("http://www.w3.org/2001/XMLSchema#dateTime");
+
private URI uri;
private Datatype(String uriString) {
Modified: trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationComputingScript.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationComputingScript.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -26,6 +26,7 @@
import org.dllearner.core.ReasonerComponent;
import org.dllearner.core.configurators.CELOEConfigurator;
import org.dllearner.core.owl.Axiom;
+import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.EquivalentClassesAxiom;
import org.dllearner.core.owl.NamedClass;
import org.dllearner.core.owl.Thing;
@@ -39,10 +40,6 @@
public class EvaluationComputingScript {
- private static enum ThreeValuedLogic{
- True, False, Both
- }
-
private ReasonerComponent reasoner;
private OWLFile ks;
@@ -65,6 +62,7 @@
private static boolean reuseExistingDescription = false;
private static boolean filterDescriptionsFollowingFromKB = false;
+ private static boolean checkExistingDefinitions = true;
private final ConceptComparator comparator = new ConceptComparator();
private URI ontologyURI;
@@ -82,42 +80,7 @@
private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceJaccardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
private Map<NamedClass, List<EvaluatedDescriptionClass>> defaultEquivalenceMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceStandardMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceFMeasureMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalencePredaccMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceGenFMeasureMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceJaccardMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceStandardMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceFMeasureMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalencePredaccMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceGenFMeasureMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceJaccardMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> defaultEquivalenceMapWithReuse = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceStandardMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceFMeasureMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalencePredaccMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceGenFMeasureMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceJaccardMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceStandardMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceFMeasureMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalencePredaccMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceGenFMeasureMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceJaccardMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> defaultEquivalenceMapWithFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
-
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceStandardMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceFMeasureMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalencePredaccMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceGenFMeasureMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceJaccardMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceStandardMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceFMeasureMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalencePredaccMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceGenFMeasureMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceJaccardMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> defaultEquivalenceMapWithReuseAndFilter = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
-
public EvaluationComputingScript(URI ontologyURI) throws ComponentInitException, MalformedURLException, LearningProblemUnsupportedException, URISyntaxException{
new EvaluationComputingScript(ontologyURI, false, false);
}
@@ -256,6 +219,7 @@
}
}
+ @SuppressWarnings("unchecked")
private void computeSuggestions() throws ComponentInitException, MalformedURLException,
LearningProblemUnsupportedException {
ComponentManager cm = ComponentManager.getInstance();
@@ -383,6 +347,7 @@
* @throws MalformedURLException
* @throws LearningProblemUnsupportedException
*/
+ @SuppressWarnings("unchecked")
private void computeGenFMeasureWithoutDefaultNegation() throws ComponentInitException, MalformedURLException,
LearningProblemUnsupportedException {
ComponentManager cm = ComponentManager.getInstance();
@@ -462,6 +427,7 @@
cm.freeComponent(celoe);
}
+ @SuppressWarnings("unchecked")
private void computeWithApproximation() throws ComponentInitException, MalformedURLException, LearningProblemUnsupportedException {
ComponentManager cm = ComponentManager.getInstance();
TreeSet<EvaluatedDescriptionClass> suggestions;
@@ -518,11 +484,22 @@
celoe.init();
celoe.start();
+
+ //check if perfect definition already exists in knowledgebase
+ boolean perfectDefinitionExists = false;
+ if(checkExistingDefinitions){
+ for(Description def : reasoner.getAssertedDefinitions(nc)){
+ if(lp.computeScore(def).getAccuracy() == 1.0){
+ perfectDefinitionExists = true;
+ break;
+ }
+ }
+ }
// 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 "
@@ -530,6 +507,12 @@
+ "% or the best description is not appropriate. (The best one was \""
+ best.getDescription().toManchesterSyntaxString(baseURI, prefixes)
+ "\" with an accuracy of " + df.format(bestAcc) + ".) - skipping");
+ } else if(perfectDefinitionExists){
+ System.out.println("It does already exists a perfect definition.\n "
+ +"(The best computed was \""
+ + best.getDescription().toManchesterSyntaxString(baseURI, prefixes)
+ + "\" with an accuracy of " + df.format(bestAcc) + ") - skipping ");
+
} else {
suggestions = (TreeSet<EvaluatedDescriptionClass>) celoe
Modified: trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/test/junit/OWLAPITests.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -21,7 +21,6 @@
import org.dllearner.core.owl.Description;
import org.dllearner.utilities.owl.ManchesterOWLSyntaxParser;
-import org.junit.Test;
import org.semanticweb.owlapi.expression.ParserException;
/**
@@ -33,7 +32,7 @@
*/
public class OWLAPITests {
- @Test
+// @Test
public void testManchesterSyntaxParser() throws ParserException {
// String s = "BIGPROP SOME smallclass";
// String s = "<http://test.de/prop> some <http://test.de/Class>";
Modified: trunk/src/dl-learner/org/dllearner/tools/evaluationplugin/EvaluationPlugin.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/evaluationplugin/EvaluationPlugin.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/evaluationplugin/EvaluationPlugin.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -77,7 +77,8 @@
+ "(Often, suggestions leading to an inconsistency should still be added. They help to detect problems in "
+ "the ontology elsewhere.<br>"
+ " See http://dl-learner.org/files/screencast/protege/screencast.htm .)</html>";
- private static final String FOLLOWS_FROM_KB_WARNING = "<html>Selected class expressions follows already logically from ontology.</html>";
+ //TODO Add label
+// private static final String FOLLOWS_FROM_KB_WARNING = "<html>Selected class expressions follows already logically from ontology.</html>";
private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceStandardMap;
private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceFMeasureMap;
Modified: trunk/src/dl-learner/org/dllearner/tools/evaluationplugin/GraphicalCoveragePanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/evaluationplugin/GraphicalCoveragePanel.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/evaluationplugin/GraphicalCoveragePanel.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -470,7 +470,7 @@
.getY2())) {
posCovIndVector.add(new IndividualPoint("*",
- (int) x, (int) y, ind.toString()));
+ (int) x, (int) y, ind.toString(), ind, ""));
i++;
flag = false;
@@ -515,7 +515,7 @@
posNotCovIndVector.add(new IndividualPoint("*",
- (int) x, (int) y, ind.toString()));
+ (int) x, (int) y, ind.toString(), ind, ""));
j++;
@@ -553,7 +553,7 @@
.getY2())) {
posNotCovIndVector.add(new IndividualPoint("*",
- (int) x, (int) y, ind.toString()));
+ (int) x, (int) y, ind.toString(), ind, ""));
k++;
flag = false;
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/LearningManager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/LearningManager.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/LearningManager.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -194,6 +194,7 @@
return la.isRunning();
}
+ @SuppressWarnings("unchecked")
public synchronized List<EvaluatedDescriptionClass> getCurrentlyLearnedDescriptions() {
List<EvaluatedDescriptionClass> result;
if (la != null) {
@@ -334,8 +335,8 @@
}
public void fireLearningFinished() {
- for(LearningManagerListener l : listeners){
- }
+// for(LearningManagerListener l : listeners){
+// }
}
}
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -10,33 +10,24 @@
import org.semanticweb.owlapi.model.AddAxiom;
import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLOntologyChange;
-import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.model.RemoveAxiom;
-import com.clarkparsia.pellet.owlapiv3.PelletReasoner;
-
public class RepairManager implements OREManagerListener{
private static RepairManager instance;
private List<RepairManagerListener> listeners;
- private OWLOntologyManager manager;
- private PelletReasoner reasoner;
private Set<OWLOntologyChange> repairPlan;
private Stack<List<OWLOntologyChange>> undoStack;
private Stack<List<OWLOntologyChange>> redoStack;
- private Set<OWLAxiom> selectedAxioms;
-
private Set<OWLAxiom> scheduled2Remove;
private Set<OWLAxiom> scheduled2Add;
private RepairManager(OREManager oreMan){
- this.reasoner = oreMan.getReasoner().getReasoner();
- this.manager = reasoner.getManager();
listeners = new ArrayList<RepairManagerListener>();
@@ -45,8 +36,6 @@
repairPlan = new LinkedHashSet<OWLOntologyChange>();
- selectedAxioms = new HashSet<OWLAxiom>();
-
scheduled2Remove = new HashSet<OWLAxiom>();
scheduled2Add = new HashSet<OWLAxiom>();
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/cache/ManchesterSyntaxRenderingCache.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/cache/ManchesterSyntaxRenderingCache.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/cache/ManchesterSyntaxRenderingCache.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -12,7 +12,6 @@
import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor;
import org.semanticweb.owlapi.io.OWLObjectRenderer;
import org.semanticweb.owlapi.model.OWLObject;
-import org.semanticweb.owlapi.util.SimpleShortFormProvider;
public class ManchesterSyntaxRenderingCache {
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/cache/OWLEntityRenderingCache.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/cache/OWLEntityRenderingCache.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/cache/OWLEntityRenderingCache.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -2,16 +2,13 @@
import java.util.HashMap;
import java.util.HashSet;
-import java.util.List;
import java.util.Map;
import java.util.Set;
-import org.apache.log4j.Logger;
import org.dllearner.tools.ore.OREManager;
import org.dllearner.tools.ore.OREManagerListener;
import org.dllearner.tools.ore.ui.rendering.OWLEntityRenderer;
import org.semanticweb.owlapi.model.OWLAnnotationProperty;
-import org.semanticweb.owlapi.model.OWLAxiomChange;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDataProperty;
import org.semanticweb.owlapi.model.OWLDatatype;
@@ -20,14 +17,10 @@
import org.semanticweb.owlapi.model.OWLNamedIndividual;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLOntology;
-import org.semanticweb.owlapi.model.OWLOntologyChange;
-import org.semanticweb.owlapi.model.OWLOntologyChangeListener;
public class OWLEntityRenderingCache{
- private static final Logger logger = Logger.getLogger(OWLEntityRenderingCache.class);
-
private Map<String, OWLClass> owlClassMap = new HashMap<String, OWLClass>();
private Map<String, OWLObjectProperty> owlObjectPropertyMap = new HashMap<String, OWLObjectProperty>();
@@ -44,12 +37,23 @@
private OREManager oreManager;
- private OWLOntologyChangeListener listener = new OWLOntologyChangeListener() {
- public void ontologiesChanged(List<? extends OWLOntologyChange> changes) {
- processChanges(changes);
- }
- };
+// private OWLOntologyChangeListener listener = new OWLOntologyChangeListener() {
+// public void ontologiesChanged(List<? extends OWLOntologyChange> changes) {
+// processChanges(changes);
+// }
+// };
+// private void processChanges(List<? extends OWLOntologyChange> changes) {
+// for (OWLOntologyChange change : changes) {
+// if (change instanceof OWLAxiomChange) {
+// OWLAxiomChange chg = (OWLAxiomChange) change;
+// for (OWLEntity ent : chg.getEntities()) {
+// updateRendering(ent);
+// }
+// }
+// }
+// }
+
private OREManagerListener oreManagerListener = new OREManagerListener() {
@Override
@@ -66,16 +70,7 @@
}
- private void processChanges(List<? extends OWLOntologyChange> changes) {
- for (OWLOntologyChange change : changes) {
- if (change instanceof OWLAxiomChange) {
- OWLAxiomChange chg = (OWLAxiomChange) change;
- for (OWLEntity ent : chg.getEntities()) {
- updateRendering(ent);
- }
- }
- }
- }
+
public void rebuild() {
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -18,7 +18,6 @@
import org.semanticweb.owlapi.model.OWLOntologyCreationException;
import org.semanticweb.owlapi.model.OWLOntologyManager;
import org.semanticweb.owlapi.model.OWLSubClassOfAxiom;
-import org.semanticweb.owlapi.reasoner.OWLReasoner;
import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
import com.clarkparsia.owlapi.explanation.PelletExplanation;
@@ -104,7 +103,7 @@
Set<Explanation> explanations = expGen
.getExplanations(unsatAxiom);
t1.stop();
-// System.out.println(explanations);
+ System.out.println(explanations);
t2.start();
// Set<org.semanticweb.owl.explanation.api.Explanation<OWLAxiom>> expl = copy.getExplanations(unsatAxiom);
t2.stop();
@@ -143,29 +142,23 @@
factory.getOWLObjectIntersectionOf(d, factory.getOWLObjectComplementOf(d), e));
OWLOntology ontology = manager.createOntology(Collections.singleton(axiom));
OWLReasonerFactory resonerFact = new PelletReasonerFactory();
- OWLReasoner reasoner = resonerFact.createReasoner(ontology);
OWLSubClassOfAxiom unsatAxiom = factory.getOWLSubClassOfAxiom(c, factory.getOWLNothing());
LaconicExplanationGenerator expGen = new LaconicExplanationGenerator(manager,
resonerFact, ontology);
Set<Explanation> preciseJusts = expGen.getExplanations(unsatAxiom);
+ System.out.println(preciseJusts);
// renderer.render(unsatAxiom, preciseJusts);
renderer.endRendering();
} catch (OWLOntologyCreationException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
} catch (OWLOntologyChangeException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
} catch (ExplanationException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
- } catch (OWLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
}
@@ -186,7 +179,6 @@
OWLReasonerFactory resonerFact = new PelletReasonerFactory();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
- OWLReasoner reasoner = resonerFact.createReasoner(ontology);
OWLSubClassOfAxiom axiom = dataFactory
.getOWLSubClassOfAxiom(
@@ -203,10 +195,12 @@
Set<Explanation> regularJusts = expGen.getRegularExplanations(axiom);
System.out.println("Regular explanations:");
+ System.out.println(regularJusts);
// renderer.render(axiom, regularJusts);
Set<Explanation> preciseJusts = expGen.getExplanations(axiom);
System.out.println("Precise explanations:");
+ System.out.println(preciseJusts);
// renderer.render(axiom, preciseJusts);
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -16,7 +16,6 @@
import org.semanticweb.owlapi.model.AddAxiom;
import org.semanticweb.owlapi.model.AxiomType;
import org.semanticweb.owlapi.model.IRI;
-import org.semanticweb.owlapi.model.OWLAxiom;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassExpression;
import org.semanticweb.owlapi.model.OWLClassExpressionVisitor;
@@ -82,7 +81,7 @@
private Map<OWLClass, Set<OWLClass>> child2Parents;
private Map<OWLClass, Set<OWLClass>> parent2Children;
- private Map<OWLClass, Map<OWLAxiom, Set<OWLClass>>> class2Dependency;
+// private Map<OWLClass, Map<OWLAxiom, Set<OWLClass>>> class2Dependency;
public RootFinder(){
@@ -107,7 +106,7 @@
child2Parents = new HashMap<OWLClass, Set<OWLClass>>();
parent2Children = new HashMap<OWLClass, Set<OWLClass>>();
- class2Dependency = new HashMap<OWLClass, Map<OWLAxiom, Set<OWLClass>>>();
+// class2Dependency = new HashMap<OWLClass, Map<OWLAxiom, Set<OWLClass>>>();
OREManager.getInstance().addListener(this);
RepairManager.getInstance(OREManager.getInstance()).addListener(this);
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/RelevanceBasedGenerator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/RelevanceBasedGenerator.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/RelevanceBasedGenerator.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -29,6 +29,7 @@
import com.clarkparsia.pellet.owlapiv3.PelletReasoner;
import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory;
+@SuppressWarnings("unused")
public class RelevanceBasedGenerator {
static{
setup();
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SimpleSelectionFunction.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SimpleSelectionFunction.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SimpleSelectionFunction.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -50,6 +50,7 @@
return relatedAxioms;
}
+ @SuppressWarnings("unchecked")
public Vector<OWLAxiom> getAllRelatedAxioms(OWLEntity concept) {
Vector<OWLAxiom> allRelated = new Vector<OWLAxiom>();
Set<OWLAxiom> relatedAxioms = new HashSet<OWLAxiom>();
@@ -85,6 +86,7 @@
return relatedAxioms;
}
+ @SuppressWarnings("unchecked")
public Vector<OWLAxiom> getAllRelatedAxioms(Set<OWLAxiom> originalAxioms_in) {
Vector<OWLAxiom> allRelated = new Vector<OWLAxiom>();
Set<OWLAxiom> relatedAxioms = new HashSet<OWLAxiom>();
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SyntacticRelevanceBasedExplanationGenerator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SyntacticRelevanceBasedExplanationGenerator.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SyntacticRelevanceBasedExplanationGenerator.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -34,6 +34,7 @@
import com.clarkparsia.pellet.owlapiv3.PelletReasoner;
import com.clarkparsia.pellet.owlapiv3.PelletReasonerFactory;
+@SuppressWarnings("unused")
public class SyntacticRelevanceBasedExplanationGenerator {
private PelletReasoner reasoner;
@@ -88,6 +89,7 @@
return rel_all_just(factory.getOWLSubClassOfAxiom(unsat, factory.getOWLNothing()));
}
+ @SuppressWarnings("unchecked")
private Set<Set<OWLAxiom>> computeRelevantJustifications(OWLClass unsat) {
OWLOntology ont = null;
@@ -337,9 +339,6 @@
} catch (OWLOntologyChangeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- } catch (OWLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
}
return justifications;
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -313,7 +313,7 @@
repMan.removeListener(this);
}
- private void showEditorDialog(final OWLAxiomEditor editor, final OWLObject value) {
+ private void showEditorDialog(final OWLAxiomEditor<OWLAxiom> editor, final OWLObject value) {
if (editor == null) {
return;
}
@@ -324,6 +324,11 @@
final VerifyingOptionPane optionPane = new VerifyingOptionPane(
editorComponent) {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1277678457457723435L;
+
public void selectInitialValue() {
// This is overriden so that the option pane dialog default
// button
@@ -368,7 +373,7 @@
dlg.setVisible(true);
}
- void handleEditFinished(OWLAxiomEditor editor, OWLObject value){
+ void handleEditFinished(OWLAxiomEditor<OWLAxiom> editor, OWLObject value){
ImpactManager.getInstance(OREManager.getInstance()).addSelection((OWLAxiom)value);
List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
for(OWLOntology ont : OREManager.getInstance().getOWLOntologiesForOWLAxiom((OWLAxiom)value)){
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -552,7 +552,7 @@
.getY2())) {
posCovIndVector.add(new IndividualPoint("*",
- (int) x, (int) y, ind.toString()));
+ (int) x, (int) y, ind.toString(), ind, ""));
i++;
flag = false;
@@ -597,7 +597,7 @@
posNotCovIndVector.add(new IndividualPoint("*",
- (int) x, (int) y, ind.toString()));
+ (int) x, (int) y, ind.toString(), ind, ""));
j++;
@@ -635,7 +635,7 @@
.getY2())) {
posNotCovIndVector.add(new IndividualPoint("*",
- (int) x, (int) y, ind.toString()));
+ (int) x, (int) y, ind.toString(), ind, ""));
k++;
flag = false;
Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxOWLObjectRendererImpl.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxOWLObjectRendererImpl.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxOWLObjectRendererImpl.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -1,37 +1,14 @@
package org.dllearner.tools.ore.ui.rendering;
-import org.semanticweb.owlapi.io.OWLObjectRenderer;
-import org.semanticweb.owlapi.model.OWLObject;
-import org.semanticweb.owlapi.util.ShortFormProvider;
-import org.semanticweb.owlapi.util.SimpleShortFormProvider;
-
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
-/*
- * Copyright (C) 2007, University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate. Authorship
- * of the modifications may be determined from the ChangeLog placed at
- * the end of this file.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * This library 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
- * Lesser General Public License for more details.
+import org.semanticweb.owlapi.io.OWLObjectRenderer;
+import org.semanticweb.owlapi.model.OWLObject;
+import org.semanticweb.owlapi.util.ShortFormProvider;
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
/**
* Author: Matthew Horridge<br>
* The University Of Manchester<br>
Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -29,7 +29,6 @@
import java.util.TimerTask;
import java.util.concurrent.ExecutionException;
-import javax.swing.DefaultListModel;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
@@ -62,8 +61,8 @@
private LearningAlgorithm la;
private SuggestionRetriever retriever;
private HelpTextPanel helpPanel;
- 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);
private final DLLearnerView view;
private static final String HELP_BUTTON_STRING = "help";
private static final String ADD_BUTTON_STRING = "<html>ADD</html>";
@@ -188,8 +187,6 @@
SwingWorker<List<? extends EvaluatedDescription>, List<? extends EvaluatedDescription>> {
private Thread dlLearner;
- private final DefaultListModel dm = new DefaultListModel();
- private boolean isFinished;
@SuppressWarnings("unchecked")
@Override
@@ -202,7 +199,6 @@
view.getPosAndNegSelectPanel().getOptionPanel()
.getMaxExecutionTime());
timer = new Timer();
- isFinished = false;
timer.schedule(new TimerTask() {
int progress = 0;
@@ -210,10 +206,6 @@
public void run() {
progress += 1;
setProgress(progress);
- if(progress == view.getPosAndNegSelectPanel().getOptionPanel()
- .getMaxExecutionTime() - 1) {
- isFinished = true;
- }
if (la != null) {
publish(la.getCurrentlyBestEvaluatedDescriptions(view
.getPosAndNegSelectPanel().getOptionPanel()
Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -30,7 +30,6 @@
import org.dllearner.core.EvaluatedDescription;
import org.dllearner.learningproblems.EvaluatedDescriptionClass;
-import org.dllearner.tools.evaluationplugin.EvaluationTable;
/**
* This class is the panel for the suggest list. It shows the descriptions made
@@ -49,12 +48,6 @@
private final SuggestionsTable suggestionTable;
- // Panel for the description list
-
- private final JPanel suggestPanel;
-
- // Scroll panel if the suggestions are longer than the Panel itself
-
private final JScrollPane suggestScroll;
private DefaultListModel suggestModel;
private DLLearnerModel model;
@@ -78,7 +71,6 @@
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
descriptions = new JList(suggestModel);
descriptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- suggestPanel = new JPanel();
// descriptions.setVisible(true);
// descriptions.setVisibleRowCount(6);
// descriptions.getPreferredScrollableViewportSize();
@@ -103,6 +95,7 @@
}
+ @SuppressWarnings("unchecked")
public void addSuggestions(List<? extends EvaluatedDescription> result){
suggestionTable.setSuggestions((List<EvaluatedDescriptionClass>)result);
}
Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanelHandler.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -30,7 +30,7 @@
*/
public class SuggestClassPanelHandler implements ListSelectionListener{
private DLLearnerView view;
- private DLLearnerModel model;
+// private DLLearnerModel model;
private ActionHandler action;
private EvaluatedDescription evaluatedDescription;
@@ -41,7 +41,7 @@
*/
public SuggestClassPanelHandler(DLLearnerView v, DLLearnerModel m, ActionHandler a) {
this.view = v;
- this.model = m;
+// this.model = m;
this.action = a;
}
Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java 2010-05-27 09:35:50 UTC (rev 2154)
+++ trunk/src/dl-learner/org/dllearner/utilities/owl/OWLAPIConverter.java 2010-05-27 16:45:38 UTC (rev 2155)
@@ -189,9 +189,10 @@
return Datatype.INTEGER;
else if(uri.equals(Datatype.STRING.getURI()))
return Datatype.STRING;
- else if(uri.equals(Datatype.DATE.getURI())){
+ else if(uri.equals(Datatype.DATE.getURI()))
return Datatype.DATE;
- }
+ else if(uri.equals(Datatype.DATETIME.getURI()))
+ return Datatype.DATETIME;
throw new Error("Unsupported datatype " + dataType + ". Please inform a DL-Learner developer to add it.");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lor...@us...> - 2010-05-31 13:19:50
|
Revision: 2156
http://dl-learner.svn.sourceforge.net/dl-learner/?rev=2156&view=rev
Author: lorenz_b
Date: 2010-05-31 13:19:41 +0000 (Mon, 31 May 2010)
Log Message:
-----------
Removed some unused classes.
Removed most of the compiler warnings.
Modified Paths:
--------------
trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java
trunk/src/dl-learner/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java
trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java
trunk/src/dl-learner/org/dllearner/algorithms/isle/ISLE.java
trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java
trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java
trunk/src/dl-learner/org/dllearner/examples/KRK.java
trunk/src/dl-learner/org/dllearner/examples/KRKOntologyTBox.java
trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java
trunk/src/dl-learner/org/dllearner/gui/widgets/AbstractWidgetPanel.java
trunk/src/dl-learner/org/dllearner/kb/KBFile.java
trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java
trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java
trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitorImproved.java
trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java
trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java
trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java
trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java
trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyChecker.java
trunk/src/dl-learner/org/dllearner/scripts/evaluation/StatsGenerator.java
trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/ConceptSelector.java
trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java
trunk/src/dl-learner/org/dllearner/scripts/matching/Mcollect.java
trunk/src/dl-learner/org/dllearner/scripts/tiger/LogHelper.java
trunk/src/dl-learner/org/dllearner/test/SparqlExtractionTest.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/ExpressionEditor.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/ManchesterOWLSyntaxParser.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLAutoCompleter.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/VerifyingOptionPane.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/KeywordColorMap.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/ManchesterOWLSyntaxObjectRenderer.java
Removed Paths:
-------------
trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationGUI.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/OWLExpressionParserException.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/ParserException.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/editor/ParserUtil.java
trunk/src/dl-learner/org/dllearner/tools/ore/ui/rendering/OWLTableCellRenderer.java
Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/CELOE.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -21,7 +21,6 @@
import java.text.DecimalFormat;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
Modified: trunk/src/dl-learner/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/algorithms/celoe/OEHeuristicRuntime.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -21,7 +21,6 @@
import java.util.Comparator;
-import org.dllearner.algorithms.SearchTreeNode;
import org.dllearner.utilities.owl.ConceptComparator;
/**
Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -34,7 +34,6 @@
import org.dllearner.core.configurators.ELLearningAlgorithmConfigurator;
import org.dllearner.core.options.CommonConfigOptions;
import org.dllearner.core.options.ConfigOption;
-import org.dllearner.core.options.StringConfigOption;
import org.dllearner.core.owl.Description;
import org.dllearner.core.owl.Thing;
import org.dllearner.learningproblems.EvaluatedDescriptionPosNeg;
Modified: trunk/src/dl-learner/org/dllearner/algorithms/isle/ISLE.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/isle/ISLE.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/algorithms/isle/ISLE.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -31,15 +31,12 @@
import org.apache.log4j.Logger;
import org.dllearner.algorithms.celoe.CELOE;
-import org.dllearner.algorithms.celoe.OEHeuristicRuntime;
import org.dllearner.algorithms.celoe.OENode;
import org.dllearner.core.ComponentInitException;
import org.dllearner.core.EvaluatedDescription;
import org.dllearner.core.LearningAlgorithm;
import org.dllearner.core.LearningProblem;
import org.dllearner.core.ReasonerComponent;
-import org.dllearner.core.configurators.CELOEConfigurator;
-import org.dllearner.core.configurators.Configurator;
import org.dllearner.core.configurators.ISLEConfigurator;
import org.dllearner.core.options.BooleanConfigOption;
import org.dllearner.core.options.CommonConfigOptions;
Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -377,7 +377,6 @@
// Kernalgorithmus
@Override
- @SuppressWarnings("unchecked")
public void start() {
isRunning = true;
runtime=System.currentTimeMillis();
Modified: trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/examples/Carcinogenesis.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -537,7 +537,6 @@
return new DoubleDatatypePropertyAssertion(dp, ind, value);
}
- @SuppressWarnings({"unused"})
private static DisjointClassesAxiom getDisjointClassesAxiom(Set<String> classes) {
Set<Description> descriptions = new HashSet<Description>();
for(String namedClass : classes)
Modified: trunk/src/dl-learner/org/dllearner/examples/KRK.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/examples/KRK.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/examples/KRK.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -707,7 +707,6 @@
return new ObjectProperty(ontologyIRI + "#" + name);
}
- @SuppressWarnings("unused")
protected static DatatypeProperty getDatatypeProperty(String name) {
return new DatatypeProperty(ontologyIRI + "#" + name);
}
@@ -716,12 +715,10 @@
return new NamedClass(ontologyIRI + "#" + name);
}
- @SuppressWarnings("unused")
protected static String getURI(String name) {
return ontologyIRI + "#" + name;
}
- @SuppressWarnings("unused")
protected static ClassAssertionAxiom getConceptAssertion(String concept,
String i) {
Individual ind = getIndividual(i);
@@ -729,7 +726,6 @@
return new ClassAssertionAxiom(c, ind);
}
- @SuppressWarnings("unused")
protected static ObjectPropertyAssertion getRoleAssertion(String role,
String i1, String i2) {
Individual ind1 = getIndividual(i1);
Modified: trunk/src/dl-learner/org/dllearner/examples/KRKOntologyTBox.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/examples/KRKOntologyTBox.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/examples/KRKOntologyTBox.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -215,7 +215,6 @@
return new ObjectProperty(ontologyURI + "#" + name);
}
- @SuppressWarnings("unused")
protected static DatatypeProperty getDatatypeProperty(String name) {
return new DatatypeProperty(ontologyURI + "#" + name);
}
@@ -224,12 +223,10 @@
return new NamedClass(ontologyURI + "#" + name);
}
- @SuppressWarnings("unused")
protected static String getURI(String name) {
return ontologyURI + "#" + name;
}
- @SuppressWarnings("unused")
protected static ClassAssertionAxiom getConceptAssertion(String concept,
String instance) {
Individual ind = getIndividual(instance);
@@ -237,7 +234,6 @@
return new ClassAssertionAxiom(c, ind);
}
- @SuppressWarnings("unused")
protected static ObjectPropertyAssertion getRoleAssertion(String role,
String i1, String i2) {
Individual ind1 = getIndividual(i1);
Modified: trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/gui/EBNodeTreeModel.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -34,7 +34,6 @@
import org.dllearner.algorithms.SearchTreeNode;
import org.dllearner.algorithms.refinement2.ExampleBasedNode;
-import org.dllearner.algorithms.refinement2.NodeComparatorStable;
/**
* A tree model used for displaying example based nodes. A search tree can
Modified: trunk/src/dl-learner/org/dllearner/gui/widgets/AbstractWidgetPanel.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/gui/widgets/AbstractWidgetPanel.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/gui/widgets/AbstractWidgetPanel.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -39,6 +39,11 @@
public abstract class AbstractWidgetPanel<T> extends JPanel {
/**
+ *
+ */
+ private static final long serialVersionUID = 3631056807739752782L;
+
+ /**
* The configuration option configured by this widget.
*/
protected ConfigOption<T> configOption;
Modified: trunk/src/dl-learner/org/dllearner/kb/KBFile.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/kb/KBFile.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -49,7 +49,6 @@
*/
public class KBFile extends KnowledgeSource {
- @SuppressWarnings("unused")
private static Logger logger = Logger.getLogger(KBFile.class);
private KB kb;
Modified: trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/kb/OWLAPIOntology.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -13,7 +13,6 @@
import org.dllearner.core.owl.KB;
import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLDataProperty;
-import org.semanticweb.owlapi.model.OWLIndividual;
import org.semanticweb.owlapi.model.OWLNamedIndividual;
import org.semanticweb.owlapi.model.OWLObjectProperty;
import org.semanticweb.owlapi.model.OWLOntology;
Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitor.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -46,7 +46,6 @@
public class SparqlTupleAquisitor extends TupleAquisitor {
- @SuppressWarnings("unused")
private static Logger logger = Logger.getLogger(SparqlTupleAquisitor.class);
protected static final String PREDICATE = "predicate";
protected static final String OBJECT = "object";
Modified: trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitorImproved.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitorImproved.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/kb/aquisitors/SparqlTupleAquisitorImproved.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -43,7 +43,6 @@
*/
public class SparqlTupleAquisitorImproved extends SparqlTupleAquisitor {
- @SuppressWarnings("unused")
private static Logger logger = Logger.getLogger(SparqlTupleAquisitorImproved.class);
private Map<String,SortedSet<RDFNodeTuple>> resources = new HashMap<String, SortedSet<RDFNodeTuple>>();
int recursionDepth;
Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/kb/extraction/ClassNode.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -43,7 +43,6 @@
*/
public class ClassNode extends Node {
- @SuppressWarnings("unused")
private static Logger logger = Logger
.getLogger(ClassNode.class);
Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/kb/extraction/InstanceNode.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -49,7 +49,6 @@
*/
public class InstanceNode extends Node {
- @SuppressWarnings("unused")
private static Logger logger = Logger
.getLogger(InstanceNode.class);
Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -215,7 +215,6 @@
* @see org.dllearner.core.Component#applyConfigEntry(org.dllearner.core.ConfigEntry)
*/
@Override
- @SuppressWarnings({ "unchecked" })
public <T> void applyConfigEntry(ConfigEntry<T> entry)
throws InvalidConfigOptionValueException {
//TODO remove this function
Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -835,6 +835,9 @@
private TreeSet<ObjectProperty> getFirstObjectProperties(NodeSet<OWLObjectProperty> nodeSet) {
TreeSet<ObjectProperty> roles = new TreeSet<ObjectProperty>(roleComparator);
for(Node<OWLObjectProperty> node : nodeSet) {
+ if(node.isBottomNode() || node.isTopNode()){
+ continue;
+ }
// take one element from the set and ignore the rest
// (TODO: we need to make sure we always ignore the same concepts)
OWLObjectProperty property = node.getRepresentativeElement();
@@ -848,6 +851,9 @@
private TreeSet<DatatypeProperty> getFirstDatatypeProperties(NodeSet<OWLDataProperty> nodeSet) {
TreeSet<DatatypeProperty> roles = new TreeSet<DatatypeProperty>(roleComparator);
for(Node<OWLDataProperty> node : nodeSet) {
+ if(node.isBottomNode() || node.isTopNode()){
+ continue;
+ }
OWLDataProperty property = node.getRepresentativeElement();
roles.add(new DatatypeProperty(property.toStringID()));
}
Modified: trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -1484,6 +1484,9 @@
private TreeSet<ObjectProperty> getFirstObjectProperties(NodeSet<OWLObjectProperty> setOfSets) {
TreeSet<ObjectProperty> roles = new TreeSet<ObjectProperty>(roleComparator);
for(Node<OWLObjectProperty> innerSet : setOfSets) {
+ if(innerSet.isBottomNode() || innerSet.isTopNode()){
+ continue;
+ }
// take one element from the set and ignore the rest
// (TODO: we need to make sure we always ignore the same concepts)
OWLObjectProperty property = innerSet.iterator().next();
Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -1433,6 +1433,7 @@
}*/
// we need to test whether NOT A AND B is equivalent to BOTTOM
+ @SuppressWarnings("unused")
private boolean isNotADisjoint(NamedClass a, NamedClass b) {
// Map<NamedClass,Boolean> tmp = notABDisjoint.get(a);
// Boolean tmp2 = null;
@@ -1452,6 +1453,7 @@
// we need to test whether NOT A AND B = B
// (if not then NOT A is not meaningful in the sense that it does
// not semantically add anything to B)
+ @SuppressWarnings("unused")
private boolean isNotAMeaningful(NamedClass a, NamedClass b) {
Description notA = new Negation(a);
Description d = new Intersection(notA, b);
Modified: trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/scripts/SemanticBible.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -165,7 +165,6 @@
}
- @SuppressWarnings("unchecked")
private static void learnOriginal(NamedClass target, SortedSet<Individual> posExamples, SortedSet<Individual> negExamples) {
List<? extends EvaluatedDescription> conceptresults = new ArrayList<EvaluatedDescriptionPosNeg>();
System.out.println("Starting to learn original");
Deleted: trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationGUI.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationGUI.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/scripts/evaluation/EvaluationGUI.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -1,1076 +0,0 @@
-package org.dllearner.scripts.evaluation;
-
-import java.awt.BorderLayout;
-import java.awt.CardLayout;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.GridBagConstraints;
-import java.awt.GridBagLayout;
-import java.awt.GridLayout;
-import java.awt.Insets;
-import java.awt.Point;
-import java.awt.SystemColor;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseMotionListener;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.TreeSet;
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.BoxLayout;
-import javax.swing.ButtonGroup;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JCheckBox;
-import javax.swing.JFrame;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JRadioButton;
-import javax.swing.JScrollPane;
-import javax.swing.JSeparator;
-import javax.swing.JSplitPane;
-import javax.swing.JTable;
-import javax.swing.JTextPane;
-import javax.swing.JWindow;
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-import javax.swing.UnsupportedLookAndFeelException;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.text.Style;
-import javax.swing.text.StyleConstants;
-import javax.swing.text.StyledDocument;
-import javax.swing.text.View;
-
-import org.dllearner.core.ComponentInitException;
-import org.dllearner.core.LearningProblemUnsupportedException;
-import org.dllearner.core.owl.Description;
-import org.dllearner.core.owl.NamedClass;
-import org.dllearner.learningproblems.EvaluatedDescriptionClass;
-import org.dllearner.tools.ore.ui.GraphicalCoveragePanel;
-import org.dllearner.tools.ore.ui.MarkableClassesTable;
-import org.dllearner.tools.ore.ui.ResultTable;
-import org.dllearner.tools.ore.ui.SelectableClassExpressionsTable;
-import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor;
-import org.mindswap.pellet.utils.SetUtils;
-import org.semanticweb.owlapi.model.OWLClassExpression;
-
-import com.clarkparsia.owlapi.explanation.io.manchester.Keyword;
-import com.clarkparsia.owlapi.explanation.io.manchester.ManchesterSyntaxObjectRenderer;
-import com.clarkparsia.owlapi.explanation.io.manchester.TextBlockWriter;
-import com.jgoodies.looks.plastic.PlasticLookAndFeel;
-
-public class EvaluationGUI extends JFrame implements ActionListener, ListSelectionListener, MouseMotionListener {
-
- /**
- *
- */
- private static final long serialVersionUID = -3097551929270352556L;
-
- private File inputFile;
-
- private RatingTablePanel tab1;
- private RatingTablePanel tab2;
- private RatingTablePanel tab3;
- private RatingTablePanel tab4;
- private RatingTablePanel tab5;
- private RatingTablePanel tab6;
- private RatingTablePanel tab7;
- private RatingTablePanel tab8;
- private RatingTablePanel tab9;
- private RatingTablePanel tab10;
-
- private SelectableClassExpressionsTable defaultTab;
- private static String INCONSISTENCYWARNING =
- "<html>Warning. Selected class expressions leads to an inconsistent ontology!<br>" +
- "(Often, suggestions leading to an inconsistency should still be added. They help to detect problems in " +
- "the ontology elsewhere.<br>" +
- " See http://dl-learner.org/files/screencast/protege/screencast.htm .)</html>";
- private JLabel inconsistencyLabel;
- private JCheckBox noSuggestionCheckBox;
- private JCheckBox alternateSuggestionCheckBox;
- private ButtonGroup bg;
-
- private GraphicalCoveragePanel graphPanel;
- private GraphicalCoveragePanel graphPanel2;
-
- private MarkableClassesTable classesTable;
- private JButton nextFinishButton;
- private JLabel messageLabel;
-
- private JWindow coverageWindow;
-
- private JPanel cardPanel;
- private CardLayout cardLayout;
-
- private ResultTable mouseOverTable;
- private int oldRow;
-
- private static String SUPERCLASSTEXT = "Showing suggestions for superclasses of ";
- private static String EQUIVALENTCLASSTEXT = "Showing suggestions for classes equivalent to ";
-
- private static String SINGLETABLEVIEW = "single";
- private static String MULTITABLEVIEW = "multi";
-
- private int currentClassIndex = 0;
-
- private boolean showingEquivalentSuggestions = false;
- private boolean showingMultiTables = false;
-
- 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>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceGenFMeasureMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastEquivalenceJaccardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
-
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastSuperStandardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastSuperFMeasureMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastSuperPredaccMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastSuperGenFMeasureMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> fastSuperJaccardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
-
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceStandardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceFMeasureMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalencePredaccMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceGenFMeasureMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlEquivalenceJaccardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
-
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlSuperStandardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlSuperFMeasureMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlSuperPredaccMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlSuperGenFMeasureMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
- private Map<NamedClass, List<EvaluatedDescriptionClass>> owlSuperJaccardMap = new HashMap<NamedClass, List<EvaluatedDescriptionClass>>();
-
- 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<OWLClassExpression>> assertedEquivalentClasses = new HashMap<NamedClass, Set<OWLClassExpression>>();
- private Map<NamedClass, Set<OWLClassExpression>> assertedSuperClasses = new HashMap<NamedClass, Set<OWLClassExpression>>();
-
-
- private Map<NamedClass, String> selectedEquivalenceMap = new HashMap<NamedClass, String>();
- private Map<NamedClass, String> selectedSuperMap = new HashMap<NamedClass, String>();
-
- private Map<NamedClass, List<Integer>> equivalentClassListRating = new HashMap<NamedClass, List<Integer>>();
- private Map<NamedClass, List<Integer>> superClassListRating = new HashMap<NamedClass, List<Integer>>();
-
- public EvaluationGUI(File input) throws ComponentInitException, MalformedURLException,
- LearningProblemUnsupportedException {
- super();
- inputFile = input;
- loadResults(input);
- setTitle(input.getName());
- createUI();
- createCoverageWindow();
- classesTable.setSelectedClass(currentClassIndex);
- graphPanel.initManchesterSyntax(baseURI, prefixes);
- graphPanel2.initManchesterSyntax(baseURI, prefixes);
- graphPanel.setConcept(classesTable.getSelectedClass(currentClassIndex));
- graphPanel2.setConcept(classesTable.getSelectedClass(currentClassIndex));
- if (defaultEquivalenceMap.get(classesTable.getSelectedClass(currentClassIndex)) != null) {
- showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex));
- } else {
- showSuperSuggestions(classesTable.getSelectedClass(currentClassIndex));
- }
-
- cardLayout.last(cardPanel);
- pack();
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setExtendedState(JFrame.MAXIMIZED_BOTH);
- setVisible(true);
- }
-
- private void createUI() {
-
- setLayout(new BorderLayout());
- JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
- split.setDividerLocation(0.3);
- split.setOneTouchExpandable(true);
- classesTable = new MarkableClassesTable();
- classesTable.addClasses(new TreeSet<NamedClass>(SetUtils.union(defaultEquivalenceMap.keySet(), defaultSuperMap
- .keySet())));
- JScrollPane classesScroll = new JScrollPane(classesTable);
- classesTable.addMouseMotionListener(this);
- split.setLeftComponent(classesScroll);
-
- JPanel holder = new JPanel(new BorderLayout());
- JScrollPane suggestionsScroll = new JScrollPane(createMainPanel());
- holder.add(suggestionsScroll, BorderLayout.CENTER);
-
- JPanel buttonPanel = new JPanel();
- buttonPanel.setLayout(new BorderLayout());
- JSeparator separator = new JSeparator();
- buttonPanel.add(separator, BorderLayout.NORTH);
- Box buttonBox = new Box(BoxLayout.X_AXIS);
- nextFinishButton = new JButton("Next");
- nextFinishButton.setActionCommand("next");
- nextFinishButton.addActionListener(this);
- buttonBox.add(nextFinishButton);
- buttonPanel.add(buttonBox, java.awt.BorderLayout.EAST);
- holder.add(buttonPanel, BorderLayout.SOUTH);
- split.setRightComponent(holder);
- addMouseMotionListener(this);
- add(split);
-
- }
-
- private JPanel createMainPanel() {
- JPanel messageTablesPanel = new JPanel();
- messageTablesPanel.setLayout(new BorderLayout());
-
- messageLabel = new JLabel();
- messageLabel.addMouseMotionListener(this);
- messageTablesPanel.add(messageLabel, BorderLayout.NORTH);
-
- cardPanel = new JPanel();
- cardPanel.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10)));
- cardLayout = new CardLayout();
-
- cardPanel.add(createMultiTablesPanel(), MULTITABLEVIEW);
- cardPanel.add(createSingleTablePanel(), SINGLETABLEVIEW);
- cardPanel.setLayout(cardLayout);
-
- messageTablesPanel.add(cardPanel, BorderLayout.CENTER);
-
- return messageTablesPanel;
- }
-
- private void showInconsistencyWarning(boolean show){
- if(show){
- inconsistencyLabel.setForeground(Color.BLACK);
- } else {
- inconsistencyLabel.setForeground(SystemColor.control);
- }
-
- }
-
- private JPanel createSingleTablePanel() {
- JPanel panel = new JPanel(new GridBagLayout());
- GridBagConstraints c = new GridBagConstraints();
- c.fill = GridBagConstraints.BOTH;
- c.gridwidth = GridBagConstraints.REMAINDER;
- c.weightx = 1.0;
- c.weighty = 0.0;
- JPanel tableHolderPanel = new JPanel(new GridBagLayout());
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.fill = GridBagConstraints.HORIZONTAL;
- gbc.weightx = 1.0;
- defaultTab = new SelectableClassExpressionsTable();
- defaultTab.getColumn(1).setCellRenderer(new MultiLineTableCellRenderer());
- defaultTab.getSelectionModel().addListSelectionListener(this);
- defaultTab.setRowHeightEnabled(true);
- tableHolderPanel.add(new JScrollPane(defaultTab), gbc);
- graphPanel = new GraphicalCoveragePanel("");
- gbc.weightx = 0.0;
- tableHolderPanel.add(graphPanel, gbc);
- panel.add(tableHolderPanel, c);
-
- inconsistencyLabel = new JLabel();
- panel.add(inconsistencyLabel, c);
- inconsistencyLabel.setText(INCONSISTENCYWARNING);
- inconsistencyLabel.setForeground(SystemColor.control);
-
- c.weightx = 1.0;
- c.weighty = 0.0;
- c.ipady = 10;
- c.fill = GridBagConstraints.HORIZONTAL;
- noSuggestionCheckBox = new JCheckBox();
- noSuggestionCheckBox.setAction(new AbstractAction(
- "There is no appropriate suggestion for this class in your opinion.") {
-
- /**
- *
- */
- private static final long serialVersionUID = 5923669465504160583L;
-
- @Override
- public void actionPerformed(ActionEvent e) {
- defaultTab.clearSelection();
- defaultTab.removeSelection();
- graphPanel.clear();
- showInconsistencyWarning(false);
- }
- });
- panel.add(noSuggestionCheckBox, c);
-
- alternateSuggestionCheckBox = new JCheckBox();
- alternateSuggestionCheckBox.setAction(new AbstractAction(
- "There is an appropriate suggestion in your opinion, but the algorithm did not suggest it.") {
-
- /**
- *
- */
- private static final long serialVersionUID = -8642827827310795390L;
-
- @Override
- public void actionPerformed(ActionEvent e) {
- defaultTab.clearSelection();
- defaultTab.removeSelection();
- graphPanel.clear();
- showInconsistencyWarning(false);
- }
- });
- panel.add(alternateSuggestionCheckBox, c);
-
- bg = new ButtonGroup();
- bg.add(alternateSuggestionCheckBox);
- bg.add(noSuggestionCheckBox);
- noSuggestionCheckBox.setSelected(true);
- return panel;
- }
-
- private JPanel createMultiTablesPanel() {
- JPanel tablesHolderPanel = new JPanel();
- tablesHolderPanel.setLayout(new GridLayout(5, 2, 5, 5));
- tablesHolderPanel.addMouseMotionListener(this);
- tab1 = new RatingTablePanel();
- tab1.addMouseMotionListener(this);
- tablesHolderPanel.add(tab1);
- tab2 = new RatingTablePanel();
- tab2.addMouseMotionListener(this);
- tablesHolderPanel.add(tab2);
- tab3 = new RatingTablePanel();
- tab3.addMouseMotionListener(this);
- tablesHolderPanel.add(tab3);
- tab4 = new RatingTablePanel();
- tab4.addMouseMotionListener(this);
- tablesHolderPanel.add(tab4);
- tab5 = new RatingTablePanel();
- tab5.addMouseMotionListener(this);
- tablesHolderPanel.add(tab5);
- tab6 = new RatingTablePanel();
- tab6.addMouseMotionListener(this);
- tablesHolderPanel.add(tab6);
- tab7 = new RatingTablePanel();
- tab7.addMouseMotionListener(this);
- tablesHolderPanel.add(tab7);
- tab8 = new RatingTablePanel();
- tab8.addMouseMotionListener(this);
- tablesHolderPanel.add(tab8);
- tab9 = new RatingTablePanel();
- tab9.addMouseMotionListener(this);
- tablesHolderPanel.add(tab9);
- tab10 = new RatingTablePanel();
- tab10.addMouseMotionListener(this);
- tablesHolderPanel.add(tab10);
-
- return tablesHolderPanel;
- }
-
- private void showSingleTable() {
-
- graphPanel.clear();
- cardLayout.last(cardPanel);
- showingMultiTables = false;
- }
-
- private void showMultiTables() {
- cardLayout.first(cardPanel);
- showingMultiTables = true;
- }
-
- private void showEquivalentSuggestions(NamedClass nc) {
- messageLabel.setText("<html>" + EQUIVALENTCLASSTEXT
- + "<b>" + classesTable.getSelectedClass(currentClassIndex).toManchesterSyntaxString(baseURI, prefixes)
- + "</b></html>");
- if (owlEquivalenceStandardMap.get(nc) != null) {
-
- tab1.addResults(owlEquivalenceStandardMap.get(nc));
- tab2.addResults(owlEquivalenceFMeasureMap.get(nc));
- tab3.addResults(owlEquivalencePredaccMap.get(nc));
- tab4.addResults(owlEquivalenceJaccardMap.get(nc));
- tab5.addResults(owlEquivalenceGenFMeasureMap.get(nc));
-
- tab6.addResults(fastEquivalenceStandardMap.get(nc));
- tab7.addResults(fastEquivalenceFMeasureMap.get(nc));
- tab8.addResults(fastEquivalencePredaccMap.get(nc));
- tab9.addResults(fastEquivalenceJaccardMap.get(nc));
- tab10.addResults(fastEquivalenceGenFMeasureMap.get(nc));
- }
- defaultTab.addResults(defaultEquivalenceMap.get(nc));
-
- showingEquivalentSuggestions = true;
- }
-
- private void showSuperSuggestions(NamedClass nc) {
- messageLabel.setText("<html>" + SUPERCLASSTEXT
- + "<b>" + classesTable.getSelectedClass(currentClassIndex).toManchesterSyntaxString(baseURI, prefixes) + "</b></html>");
-
- if (owlSuperStandardMap.get(nc) != null) {
-
- tab1.addResults(owlSuperStandardMap.get(nc));
- tab2.addResults(owlSuperFMeasureMap.get(nc));
- tab3.addResults(owlSuperPredaccMap.get(nc));
- tab4.addResults(owlSuperJaccardMap.get(nc));
- tab5.addResults(owlSuperGenFMeasureMap.get(nc));
-
- tab6.addResults(fastSuperStandardMap.get(nc));
- tab7.addResults(fastSuperFMeasureMap.get(nc));
- tab8.addResults(fastSuperPredaccMap.get(nc));
- tab9.addResults(fastSuperJaccardMap.get(nc));
- tab10.addResults(fastSuperGenFMeasureMap.get(nc));
- }
-
- defaultTab.addResults(defaultSuperMap.get(nc));
-
- showingEquivalentSuggestions = false;
- }
-
- private void createCoverageWindow() {
- coverageWindow = new JWindow(this);
- graphPanel2 = new GraphicalCoveragePanel("");
- coverageWindow.add(graphPanel2);
- coverageWindow.pack();
- // coverageWindow.setLocationRelativeTo(classesTable);
- }
-
- @SuppressWarnings("unchecked")
- private void loadResults(File input) {
- InputStream fis = null;
-
- try {
- fis = new FileInputStream(input);
- ObjectInputStream o = new ObjectInputStream(fis);
-
- owlEquivalenceStandardMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- owlEquivalenceFMeasureMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- owlEquivalencePredaccMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- owlEquivalenceJaccardMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- owlEquivalenceGenFMeasureMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
-
- owlSuperStandardMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- owlSuperFMeasureMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- owlSuperPredaccMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- owlSuperJaccardMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- owlSuperGenFMeasureMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
-
- fastEquivalenceStandardMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- fastEquivalenceFMeasureMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- fastEquivalencePredaccMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- fastEquivalenceJaccardMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- fastEquivalenceGenFMeasureMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
-
- fastSuperStandardMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- fastSuperFMeasureMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- fastSuperPredaccMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- fastSuperJaccardMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
- fastSuperGenFMeasureMap = (HashMap<NamedClass, List<EvaluatedDescriptionClass>>) o.readObject();
-
- 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<OWLClassExpression>>) o.readObject();
- assertedSuperClasses = (Map<NamedClass, Set<OWLClassExpression>>) o.readObject();
-
- }
-
- catch (IOException e) {
- System.err.println(e);
- } catch (ClassNotFoundException e) {
- System.err.println(e);
- } finally {
- try {
- fis.close();
- } catch (Exception e) {
- }
- }
- }
-
- private void closeDialog() {
- setVisible(false);
- dispose();
- }
-
- 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) {
- Component parent = component.getParent();
- Point componentLocation = component.getLocationOnScreen();
- Point p;
- if (componentLocation.getX() < parent.getSize().width / 2) {
- p = new Point((int) (componentLocation.getX() + parent.getSize().width / 2 + coverageWindow.getSize()
- .getWidth() / 2), componentLocation.y);
- } else {
- p = new Point((int) (componentLocation.getX() - parent.getSize().width / 2 - coverageWindow.getSize()
- .getWidth() / 2), componentLocation.y);
- }
-
- coverageWindow.setLocation(p);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- traceInput();
- if (e.getActionCommand().equals("next")) {
- defaultTab.clearSelection();
-
- NamedClass nc = classesTable.getSelectedClass(currentClassIndex);
- if(!showingMultiTables){
-
- }
- if (showingMultiTables && showingEquivalentSuggestions) {
- if (defaultSuperMap.get(nc) != null) {
- showSuperSuggestions(nc);
- showSingleTable();
- } else {
- currentClassIndex++;
- classesTable.setSelectedClass(currentClassIndex);
- graphPanel.setConcept(classesTable.getSelectedClass(currentClassIndex));
-
-
- if(defaultEquivalenceMap.get(classesTable.getSelectedClass(currentClassIndex)) != null){
- showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex));
- } else {
- showSuperSuggestions(classesTable.getSelectedClass(currentClassIndex));
- }
- showSingleTable();
- }
-
- } else if (!showingMultiTables && showingEquivalentSuggestions) {
- if (owlEquivalenceStandardMap.get(nc) != null) {
- showMultiTables();
- } 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));
- if(defaultEquivalenceMap.get(classesTable.getSelectedClass(currentClassIndex)) != null){
- showEquivalentSuggestions(classesTable.getSelectedClass(currentClassIndex));
- } else {
- showSuperSuggestions(classesTable.getSelectedClass(currentClassIndex));
- }
-
- showSingleTable();
- }
-
- } else if (!showingMultiTables && !showingEquivalentSuggestions) {
- if (owlSuperStandardMap.get(nc) != null) {
- showMultiTables();
-
- } else {
-
- currentClassIndex++;
- classesTable.setSelectedClass(currentClassIndex);
- NamedClass newNc = classesTable.getSelectedClass(currentClassIndex);
- graphPanel.setConcept(newNc);
- if (defaultEquivalenceMap.get(newNc) != null) {
- showEquivalentSuggestions(newNc);
- } else {
- showSuperSuggestions(newNc);
- }
-
- showSingleTable();
- }
-
- } else {
-
- currentClassIndex++;
- classesTable.setSelectedClass(currentClassIndex);
- NamedClass newCl = classesTable.getSelectedClass(currentClassIndex);
- graphPanel.setConcept(newCl);
- if(defaultEquivalenceMap.containsKey(newCl)){
- showEquivalentSuggestions(newCl);
- } else {
- showSuperSuggestions(newCl);
- }
-
- showSingleTable();
- }
- setFinished();
- resetTablePanels();
-
- } else if (e.getActionCommand().equals("finish")) {
- closeDialog();
- saveInput();
- }
-
- }
-
- private void resetTablePanels(){
- tab1.reset();
- tab2.reset();
- tab3.reset();
- tab4.reset();
- tab5.reset();
- tab6.reset();
- tab7.reset();
- tab8.reset();
- tab9.reset();
- tab10.reset();
- bg.clearSelection();
- noSuggestionCheckBox.setSelected(true);
- showInconsistencyWarning(false);
- }
-
- private void traceInput(){
- NamedClass currentClass = classesTable.getSelectedClass(currentClassIndex);
- if (!showingMultiTables) {
- if (alternateSuggestionCheckBox.isSelected()) {
- if (showingEquivalentSuggestions) {
- selectedEquivalenceMap.put(currentClass, "m");
- } else {
- selectedSuperMap.put(currentClass, "m");
- }
- } else if (noSuggestionCheckBox.isSelected()) {
- if (showingEquivalentSuggestions) {
- selectedEquivalenceMap.put(currentClass, "n");
- } else {
- selectedSuperMap.put(currentClass, "n");
- }
- } else {
- int position = defaultTab.getSelectedPosition() - 1;
- if (showingEquivalentSuggestions) {
- selectedEquivalenceMap.put(currentClass, String.valueOf(position));
- } else {
- selectedSuperMap.put(currentClass, String.valueOf(position));
- }
- }
- } else {
- List<Integer> ratingList = new ArrayList<Integer>();
- ratingList.add(tab1.getRatingValue());
- ratingList.add(tab2.getRatingValue());
- ratingList.add(tab3.getRatingValue());
- ratingList.add(tab4.getRatingValue());
- ratingList.add(tab5.getRatingValue());
- ratingList.add(tab6.getRatingValue());
- ratingList.add(tab7.getRatingValue());
- ratingList.add(tab8.getRatingValue());
- ratingList.add(tab9.getRatingValue());
- ratingList.add(tab10.getRatingValue());
- if(showingEquivalentSuggestions){
- equivalentClassListRating.put(currentClass, ratingList);
- } else {
- superClassListRating.put(currentClass, ratingList);
- }
- }
- }
-
-
- private void saveInput(){
- OutputStream fos = null;
- int index = inputFile.getName().lastIndexOf('.');
- String fileName = "test.inp";
- if (index>0&& index <= inputFile.getName().length() - 2 ) {
- fileName = inputFile.getName().substring(0, index) + ".inp";
- }
- File file = new File(fileName);
- try {
- fos = new FileOutputStream(file);
- ObjectOutputStream o = new ObjectOutputStream(fos);
-
- o.writeObject(selectedEquivalenceMap);
- o.writeObject(selectedSuperMap);
-
- o.writeObject(equivalentClassListRating);
- o.writeObject(superClassListRating);
-
- o.flush();
- o.close();
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- try {
- fos.close();
- } catch (Exception e) {
- }
- }
- }
-
- private void setFinished() {
- NamedClass nc = classesTable.getSelectedClass(currentClassIndex);
- if (currentClassIndex == SetUtils.union(defaultEquivalenceMap.keySet(), defaultSuperMap.keySet()).size() - 1) {
- 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) {
- EvaluatedDescriptionClass cl = defaultTab.getSelectedValue();
- showInconsistencyWarning(!cl.isConsistent());
- graphPanel.setNewClassDescription(cl);
- if(defaultTab.getSelectedClassExpression() != null){
- bg.clearSelection();
- }
-
- }
-
- }
-
-
- @Override
- public void mouseDragged(MouseEvent e) {
-
- }
-
- @Override
- public void mouseMoved(MouseEvent e) {
- if (e.getSource() instanceof ResultTable) {
- ResultTable result = ((ResultTable) e.getSource());
- int column = result.columnAtPoint(e.getPoint());
- int row = result.rowAtPoint(e.getPoint());
-
- 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);
- }
- } else {
- showCoveragePanel(false);
- }
-
- }
-
- /**
- * @param args
- * @throws ComponentInitException
- * @throws MalformedURLException
- * @throws LearningProblemUnsupportedException
- * @throws UnsupportedLookAndFeelException
- * @throws IllegalAccessException
- * @throws InstantiationException
- * @throws ClassNotFoundException
- * @throws URISyntaxException
- */
- public static void main(String[] args) throws ComponentInitException,
- LearningProblemUnsupportedException, ClassNotFoundException, InstantiationException,
- IllegalAccessException, UnsupportedLookAndFeelException, URISyntaxException {
-
- UIManager.setLookAndFeel(new PlasticLookAndFeel());
-
- if (args.length == 0) {
- System.out.println("You need to give an file as argument.");
- System.exit(0);
- }
- final File input = new File(args[0]);
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
- try {
- new EvaluationGUI(input);
- } catch (MalformedURLException e) {
- e.printStackTrace();
- } catch (ComponentInitException e) {
- e.printStackTrace();
- } catch (LearningProblemUnsupportedException e) {
- e.printStackTrace();
- }
-
- }
- });
-
- }
-
-
- class RatingTablePanel extends JPanel {
-
- /**
- *
- */
- private static final long serialVersionUID = 7408917327199664584L;
- private ResultTable table;
- private RatingPanel rating;
-
- public RatingTablePanel() {
- setLayout(new BorderLayout());
- setBorder(BorderFactory.createLineBorder(Color.BLACK));
- table = new ResultTable();
- table.getColumn(1).setCellRenderer(new MultiLineTableCellRenderer());
- table.setRowHeightEnabled(true);
- add(table, BorderLayout.CENTER);
- rating = new RatingPanel();
- add(rating, BorderLayout.EAST);
-
- }
-
- public void addResults(List<EvaluatedDescriptionClass> resultList) {
- table.addResults(resultList);
- }
-
- public void reset() {
- rating.clearSelection();
- }
-
- public int getRatingValue() {
- return rating.getSelectedValue();
- }
-
- public void addMouseMotionListener(MouseMotionListener mL) {
- rating.addMouseMotionListener(mL);
- table.addMouseMotionListener(mL);
- }
-
- }
-
- class RatingPanel extends JPanel {
-
- /**
- *
- */
- private static final long serialVersionUID = -111227945780885551L;
-
- private JRadioButton rb1 = new JRadioButton("1");
- private JRadioButton rb2 = new JRadioButton("2");;
- private JRadioButton rb3 = new JRadioButton("3");;
- private JRadioButton rb4 = new JRadioButton("4");;
- private JRadioButton rb5 = new JRadioButton("5");;
- private ButtonGroup bg;
- private ImageIcon thumbs_up = new ImageIcon(EvaluationGUI.class.getResource("Thumb_up.png"));
- private ImageIcon thumbs_down = new ImageIcon(EvaluationGUI.class.getResource("Thumb_down.png"));
-
- public RatingPanel() {
- setLayout(new GridLayout(7, 1));
- bg = new ButtonGroup();
-
- add(new JLabel(thumbs_up));
- add(rb5);
- add(rb4);
- add(rb3);
- add(rb2);
- add(rb1);
- add(new JLabel(thumbs_down));
- bg.add(rb1);
- bg.add(rb2);
- bg.add(rb3);
- bg.add(rb4);
- bg.add(rb5);
- rb1.setSelected(true);
- }
-
- public int getSelectedValue() {
- if (rb1.isSelected()) {
- return 1;
- } else if (rb2.isSelected()) {
- return 2;
- } else if (rb3.isSelected()) {
- return 3;
- } else if (rb4.isSelected()) {
- return 4;
- } else {
- return 5;
- }
- }
-
- public void clearSelection() {
- rb1.setSelected(true);
- }
-
- }
-
-}
-
-class MultiLineTableCellRenderer extends JTextPane implements TableCellRenderer{
-
- /**
- *
- */
-private static final long serialVersionUID = -5375479462711405013L;
- protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
-
- private StringWriter buffer;
- private TextBlockWriter writer;
- private ManchesterSyntaxObjectRenderer renderer;
-
- private StyledDocument doc;
- Style style;
- public MultiLineTableCellRenderer() {
- super();
-
-
- setContentType("text/html");
- setBorder(noFocusBorder);
-
- buffer = new StringWriter();
- writer = new TextBlockWriter(buffer);
- renderer = new ManchesterSyntaxObjectRenderer(writer);
- renderer.setWrapLines( false );
- renderer.setSmartIndent( true );
-
-
- doc = (StyledDocument)getDocument();
- style = doc.addStyle("StyleName", null);
- StyleConstants.setItalic(style, true);
-
-
-
- }
-
-
- public Component getTableCellRendererComponent(JTable table,
- Object value,
- boolean isSelected,
- boolean hasFocus,
- int row,
- int column)
- {
- if (isSelected)
- {
- super.setForeground(table.getSelectionForeground());
- super.setBackground(table.getSelectionBackground());
- }
- else
- {
- super.setForeground(table.getForeground());
- super.setBackground(table.getBackground());
- }
-
- setFont(table.getFont());
-
- if (hasFocus)
- {
- setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
- if (!isSelected && table.isCellEditable(row, column))
- {
- Color col;
- col = UIManager.getColor("Table.focusCellForeground");
- if (col != null)
- {
- super.setForeground(col);
- }
- col = UIManager.getColor("Table.focusCellBackground");
- if (col != null)
- {
- super.setBackground(col);
- }
- }
- }
- else
- {
- setBorder(noFocusBorder);
- }
-
- setEnabled(table.isEnabled());
-
- setValue(table, row, column, value);
-
- return this;
- }
-
- protected void setValue(JTable table, int row, int column, Object value)
- {
- if (value != null)
- {
- String text = value.toString();
- setText(text);
-
- if(value instanceof Description){
- OWLClassExpression desc = OWLAPIDescriptionConvertVisitor.getOWLClassExpression((Description)value);
- desc.accept(renderer);
-
- writer.flush();
- String newAxiom = buffer.toString();
-
- StringTokenizer st = new StringTokenizer(newAxiom);
-
- StringBuffer bf = new StringBuffer();
- bf.append("<html>");
-
- String token;
- while(st.hasMoreTokens()){
- token = st.nextToken();
-
- String color = "black";
-
- boolean isReserved = false;
- if(!token.equals("type") && !token.equals("subClassOf")){
- for(Keyword key : Keyword.values()){
- if(token.equals(key.getLabel())){
- color = key.getColor();
- isReserved = true;break;
- }
- }
- }
- if(isReserved){
- bf.append("<b><font color=" + color + ">" + token + " </font></b>");
- } else {
- bf.append(" " + token + " ");
- }
- }
- bf.append("</html>");
- newAxiom = bf.toString();
- setText(newAxiom);
-// oldAxioms.add(buffer.toString());
- buffer.getBuffer().delete(0, buffer.toString().length());
- }
-
-
- View view = getUI().getRootView(this);
- view.setSize((float) table.getColumnModel().getColumn(column).getWidth() - 3, -1);
- float y = view.getPreferredSpan(View.Y_AXIS);
- int h = (int) Math.ceil(y + 3);
-
- if (table.getRowHeight(row) != h)
- {
- table.setRowHeight(row, h );
- }
- }
- else
- {
- setText("");
- }
- }
-
-}
Modified: trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyChecker.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyChecker.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyChecker.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -77,6 +77,7 @@
private static long reasonerTaskTimeoutInMinutes = 10;
+ @SuppressWarnings("unchecked")
public static void main(String[] args) throws ComponentInitException, MalformedURLException {
Map<String, Integer> ontologyRelClassCountMap = new HashMap<String, Integer>();
Set<String> inconsistentOntologies = new HashSet<String>();
@@ -242,6 +243,7 @@
}
+ @SuppressWarnings("unchecked")
static Map sortByValue(Map map) {
List list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
Modified: trunk/src/dl-learner/org/dllearner/scripts/evaluation/StatsGenerator.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/evaluation/StatsGenerator.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/scripts/evaluation/StatsGenerator.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -343,6 +343,7 @@
latexMetrics.append("\\hline\n");
}
+ @SuppressWarnings("static-access")
private void addStatsTableRow() {
double accept = acceptedGlobalStat.getMean() / suggestionListsCount * 100;
double reject = rejectedGlobalStat.getMean() / suggestionListsCount * 100;
@@ -355,6 +356,7 @@
double stdDeviationPosition = positionStat.getStandardDeviation();
DecimalFormat df = new DecimalFormat("0.0");
double additionalInstanceCountEq = new Stat(moreInstancesCountStats).getMean();
+ @SuppressWarnings("unused")
double additionalInstanceCountSC = new Stat(moreInstancesCountStatsSC).getMean();
double additionalInstanceCount = new Stat(new Stat(moreInstancesCountStats), new Stat(moreInstancesCountStatsSC)).getMean();
Stat avgSelectedAccuracyEq = new Stat(accSelectedStats);
@@ -409,6 +411,7 @@
* Loads the computed suggestion files.
* @param resultFile The file where the suggestions are serialized.
*/
+ @SuppressWarnings("unchecked")
private void loadSuggestions(File resultFile) {
InputStream fis = null;
@@ -438,6 +441,7 @@
* Loads the user input evaluated in the EvaluationGUI.
* @param input
*/
+ @SuppressWarnings("unchecked")
private void loadUserInput(File input) {
InputStream fis = null;
Modified: trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/ConceptSelector.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/ConceptSelector.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/scripts/improveWikipedia/ConceptSelector.java 2010-05-31 13:19:41 UTC (rev 2156)
@@ -52,7 +52,6 @@
return getConceptsNotContainingString(concepts, "OR");
}
- @SuppressWarnings("unchecked")
public List<EvaluatedDescriptionPosNeg> getConceptsNotContainingString(
List<EvaluatedDescriptionPosNeg> concepts, String filterString,
int limitSize) {
Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java
===================================================================
--- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2010-05-27 16:45:38 UTC (rev 2155)
+++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2010-05-31 13:19:41 UTC (rev 2156)
@...
[truncated message content] |