You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(120) |
Sep
(36) |
Oct
(116) |
Nov
(17) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(143) |
Feb
(192) |
Mar
(74) |
Apr
(84) |
May
(105) |
Jun
(64) |
Jul
(49) |
Aug
(120) |
Sep
(159) |
Oct
(156) |
Nov
(51) |
Dec
(28) |
2009 |
Jan
(17) |
Feb
(55) |
Mar
(33) |
Apr
(57) |
May
(54) |
Jun
(28) |
Jul
(6) |
Aug
(16) |
Sep
(38) |
Oct
(30) |
Nov
(26) |
Dec
(52) |
2010 |
Jan
(7) |
Feb
(91) |
Mar
(65) |
Apr
(2) |
May
(14) |
Jun
(25) |
Jul
(38) |
Aug
(48) |
Sep
(80) |
Oct
(70) |
Nov
(75) |
Dec
(77) |
2011 |
Jan
(68) |
Feb
(53) |
Mar
(51) |
Apr
(35) |
May
(65) |
Jun
(101) |
Jul
(29) |
Aug
(230) |
Sep
(95) |
Oct
(49) |
Nov
(110) |
Dec
(63) |
2012 |
Jan
(41) |
Feb
(42) |
Mar
(25) |
Apr
(46) |
May
(51) |
Jun
(44) |
Jul
(45) |
Aug
(29) |
Sep
(12) |
Oct
(9) |
Nov
(17) |
Dec
(2) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(7) |
Apr
(16) |
May
(54) |
Jun
(27) |
Jul
(11) |
Aug
(5) |
Sep
(85) |
Oct
(27) |
Nov
(37) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(29) |
Mar
(5) |
Apr
(3) |
May
(22) |
Jun
(3) |
Jul
(4) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <jen...@us...> - 2008-12-17 15:20:34
|
Revision: 1558 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1558&view=rev Author: jenslehmann Date: 2008-12-17 15:20:27 +0000 (Wed, 17 Dec 2008) Log Message: ----------- fixed some EL refinement operator bugs Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -91,6 +91,11 @@ this(tree, new TreeSet<NamedClass>()); } + // convenience constructor + public ELDescriptionNode(ELDescriptionTree tree, NamedClass... label) { + this(tree, new TreeSet<NamedClass>(Arrays.asList(label))); + } + /** * Constructs an EL description tree given its root label. * @param label Label of the root node. Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -161,7 +161,7 @@ ELDescriptionNode node1 = edges.get(j).getNode(); ELDescriptionNode node2 = edges.get(k).getNode(); // check simulation condition - if(node1.in.contains(node2) || node2.in.contains(node1)) { + if(node1.in.contains(node2)) { // || node2.in.contains(node1)) { // node1 is simulated by node2, i.e. we could remove one // of them, so the tree is not minimal return false; @@ -433,6 +433,14 @@ node2.out.remove(node1); } + public String toSimulationString() { + String str = ""; + for(ELDescriptionNode node : nodes) { + str += node.toSimulationString() + "\n"; + } + return str; + } + public String toSimulationString(Map<ELDescriptionNode,String> nodeNames) { String str = ""; for(Entry<ELDescriptionNode,String> entry : nodeNames.entrySet()) { @@ -514,7 +522,14 @@ // update global tree treeClone.rootNode = newRoot; treeClone.maxLevel = maxLevel; - treeClone.nodes = new HashSet<ELDescriptionNode>(nodes); + + // nodes + treeClone.nodes = new HashSet<ELDescriptionNode>(); + for(ELDescriptionNode oldNode : nodes) { + treeClone.nodes.add(cloneMap.get(oldNode)); + } + + // level node mapping for(int i=1; i<=maxLevel; i++) { Set<ELDescriptionNode> oldNodes = levelNodeMapping.get(i); Set<ELDescriptionNode> newNodes = new HashSet<ELDescriptionNode>(); Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -38,7 +38,6 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Thing; import org.dllearner.learningproblems.PosNegLP; -import org.dllearner.refinementoperators.ELDown; import org.dllearner.refinementoperators.ELDown2; import org.dllearner.utilities.owl.EvaluatedDescriptionSet; Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -29,10 +29,8 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.Negation; -import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.Helper; import org.dllearner.utilities.datastructures.SetManipulation; -import org.dllearner.utilities.owl.ConceptTransformation; /** * The aim of this learning problem is to find an appropriate inclusion axiom Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -107,6 +107,7 @@ */ @Override public Set<Description> refine(Description concept) { + System.out.println("refining " + concept); ELDescriptionTree tree = new ELDescriptionTree(rs, concept); Set<ELDescriptionTree> refinementTrees = refine(tree); Set<Description> refinements = new HashSet<Description>(); @@ -125,20 +126,24 @@ * @return Set of refined EL description trees. */ public Set<ELDescriptionTree> refine(ELDescriptionTree tree) { + System.out.println("applying \\rho on " + tree.toDescriptionString()); + Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); // loop over all nodes of the tree and perform one of the // transformations on it (we make a copy of all nodes, because // the transformations can, of course, add new nodes) Set<ELDescriptionNode> nodes = new HashSet<ELDescriptionNode>(tree.getNodes()); for(ELDescriptionNode v : nodes) { + System.out.println("picked node v: " + v); + // the position of the node within the tree (needed for getting // the corresponding node in a cloned tree) int[] position = v.getCurrentPosition(); // perform operations refinements.addAll(extendLabel(tree, v, position)); - refinements.addAll(refineLabel(tree, v, position)); - refinements.addAll(refineEdge(tree, v, position)); +// refinements.addAll(refineLabel(tree, v, position)); +// refinements.addAll(refineEdge(tree, v, position)); refinements.addAll(attachSubtree(tree, v, position)); } @@ -160,8 +165,10 @@ // call ncc (see paper) Set<NamedClass> candidates = utility.getClassCandidates(index, v.getLabel()); +// System.out.println("label: " + v.getLabel()); for(NamedClass nc : candidates) { +// System.out.println("candidate: " + nc); // clone operation ELDescriptionTree clonedTree = tree.clone(); ELDescriptionNode clonedNode = clonedTree.getNode(position); @@ -246,14 +253,11 @@ SortedSet<ObjectProperty> appOPs = utility.computeApplicableObjectProperties(index); Set<ObjectProperty> mgr = utility.computeMgr(appOPs); - // TODO: in as ist ein baum t nicht definiert; ersetzen durch t_{C'} - // TODO: Einrückung in as nach pick element nicht notwendig - // loop through most general roles for(ObjectProperty op : mgr) { + System.out.println("pick most general role: " + op); // a list of subtrees (stored as edges i.e. role + root node which points to tree) - // TODO: Do we need to store m at all? LinkedList<ELDescriptionEdge> m = new LinkedList<ELDescriptionEdge>(); // create tree corresponding to top node @@ -266,20 +270,29 @@ while(!m.isEmpty()) { // pick and remove first element ELDescriptionEdge edge = m.pollFirst(); + System.out.println("picked first element of M: " + edge); ObjectProperty r = edge.getLabel(); // tp = t' in algorithm description (p stands for prime) ELDescriptionTree tp = edge.getNode().getTree(); // merge tree into main tree ELDescriptionTree mergedTree = mergeTrees(tree, v, position, r, tp); + ELDescriptionNode vClone = mergedTree.getNode(position); + System.out.println("merged to t_{C'}: \n" + mergedTree); + +// System.out.println(mergedTree.toSimulationString()); + // we check equivalence by a minimality test (TODO: can we still do this?) if(mergedTree.isMinimal()) { + System.out.println("Merged tree is minimal, i.e. not equivalent."); // it is not equivalent, i.e. we found a refinement refinements.add(mergedTree); } else { - // perform complex check - boolean check = asCheck(v); + System.out.println("Merged tree is not minimal, i.e. equivalent."); + // perform complex check in merged tree + boolean check = asCheck(vClone); + System.out.println("Result of complex check: " + check); if(check) { // refine property @@ -287,12 +300,17 @@ m.add(new ELDescriptionEdge(subRole, tp.getRootNode())); } // refine tree using recursive operator call + System.out.println("Recursive Call"); Set<ELDescriptionTree> recRefs = refine(tp); + System.out.println("Recursive Call Done"); for(ELDescriptionTree tpp : recRefs) { +// System.out.println("aa " + tpp.toDescriptionString()); m.add(new ELDescriptionEdge(r, tpp.getRootNode())); } } - } + } + + System.out.println("M: " + m); } } @@ -301,11 +319,17 @@ // create a new tree which is obtained by attaching the new tree at the given node in the tree via role r private ELDescriptionTree mergeTrees(ELDescriptionTree tree, ELDescriptionNode node, int[] position, ObjectProperty r, ELDescriptionTree newTree) { +// System.out.println("merge start"); +// System.out.println(tree); +// System.out.println(newTree); // merged tree = tree + new node with role pointing to a new node ELDescriptionTree mergedTree = tree.clone(); ELDescriptionNode clonedNode = mergedTree.getNode(position); // ELDescriptionNode nodeNew = new ELDescriptionNode(clonedNode, r); +// System.out.println("node: " + node); +// System.out.println("cloned node: " + clonedNode); + // create a list of nodes we still need to process LinkedList<ELDescriptionNode> toProcess = new LinkedList<ELDescriptionNode>(); toProcess.add(newTree.getRootNode()); @@ -322,7 +346,7 @@ ELDescriptionNode vp; if(v.isRoot()) { // root is connected to main tree via role r - vp = new ELDescriptionNode(clonedNode, r); + vp = new ELDescriptionNode(clonedNode, r, newTree.getRootNode().getLabel()); } else { ELDescriptionNode parent = cloneMap.get(v.getParent()); ObjectProperty role = v.getParentEdge().getLabel(); @@ -337,6 +361,8 @@ } } +// System.out.println(mergedTree); +// System.out.println("merge end"); return mergedTree; } @@ -351,16 +377,16 @@ // go through all edges for(ELDescriptionEdge piVEdge : piVEdges) { - // collect (w,s,w') + // collect (w,r',w') ELDescriptionNode wp = piVEdge.getNode(); - ObjectProperty s = piVEdge.getLabel(); + ObjectProperty rp = piVEdge.getLabel(); ELDescriptionNode w = wp.getParent(); // go through all (w,s,w'') - TODO: s or a new s' ? for(ELDescriptionEdge wEdge : w.getEdges()) { - ObjectProperty sp = wEdge.getLabel(); + ObjectProperty rpp = wEdge.getLabel(); ELDescriptionNode wpp = wEdge.getNode(); - if(s.equals(sp) && wp != wpp) { + if(wp != wpp && opHierarchy.isSubpropertyOf(rp, rpp)) { if(wp.getIn().contains(wpp)) { return false; } Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -123,11 +123,11 @@ // not satisfied // check1: disjointness with index // check3: no superclass exists already - if(!isDisjoint(candidate,index) || !checkSubClasses(existingClasses,candidate)) { + if(!isDisjoint(candidate,index) && checkSubClasses(existingClasses,candidate)) { // check whether the class is meaningful, i.e. adds something to the index // to do this, we need to make sure that the class is not a superclass of the // index (otherwise we get nothing new) - if(!isDisjoint(new Negation(candidate),index) || !checkSuperClasses(existingClasses,candidate)) { + if(!isDisjoint(new Negation(candidate),index) && checkSuperClasses(existingClasses,candidate)) { // candidate went successfully through all checks candidates.add(candidate); } else { @@ -140,17 +140,19 @@ return candidates; } - // returns true of the candidate is not subclass of an existing class, + // returns true if the candidate is not subclass of an existing class, // false otherwise (check 3) private boolean checkSubClasses(Set<NamedClass> existingClasses, NamedClass candidate) { for(NamedClass nc : existingClasses) { - if(sh.isSubclassOf(candidate, nc)) +// System.out.println("csc: " + nc + candidate); + if(sh.isSubclassOf(candidate, nc)) { return false; + } } return true; } - // returns true of the candidate is not superclass of an existing class, + // returns true if the candidate is not superclass of an existing class, // false otherwise (check 4) private boolean checkSuperClasses(Set<NamedClass> existingClasses, NamedClass candidate) { for(NamedClass nc : existingClasses) { Modified: trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/test/junit/ELDescriptionTreeTests.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -85,7 +85,7 @@ ConceptTransformation.cleanConcept(d); ELDescriptionTree tree = new ELDescriptionTree(rs, d); // clone performance (false for simple unit test, true for clone performance test) - boolean testPerformance = false; + boolean testPerformance = true; ELDescriptionTree treeCloned = null; if(testPerformance) { int runs = 1000000; Modified: trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/test/junit/ELDownTests.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -28,7 +28,7 @@ import org.dllearner.core.owl.Description; import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; -import org.dllearner.refinementoperators.ELDown; +import org.dllearner.refinementoperators.ELDown2; import org.dllearner.test.junit.TestOntologies.TestOntology; import org.dllearner.utilities.Helper; import org.dllearner.utilities.owl.ConceptComparator; @@ -61,7 +61,7 @@ // TODO For this test, we need to turn instance based disjoints // off! (We do not have any instances here.) - ELDown operator = new ELDown(rs); + ELDown2 operator = new ELDown2(rs); // desired refinements as strings Set<String> desiredString = new TreeSet<String>(); Modified: trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-12-17 15:05:28 UTC (rev 1557) +++ trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-12-17 15:20:27 UTC (rev 1558) @@ -32,6 +32,7 @@ import org.dllearner.core.ReasonerComponent; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.Thing; import org.dllearner.parser.KBParser; import org.dllearner.test.junit.TestOntologies.TestOntology; import org.junit.Test; @@ -662,6 +663,25 @@ } + @Test + public void test7() { + ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.SIMPLE); + ELDescriptionTree tree = new ELDescriptionTree(rs); + + ObjectProperty has = new ObjectProperty(uri("has")); + ObjectProperty hasChild = new ObjectProperty(uri("hasChild")); + NamedClass human = new NamedClass(uri("human")); + NamedClass animal = new NamedClass(uri("animal")); + + ELDescriptionNode v1 = new ELDescriptionNode(tree, human); + new ELDescriptionNode(v1, has, animal); + new ELDescriptionNode(v1, hasChild); + +// System.out.println(tree.toSimulationString()); + + assertTrue(tree.isMinimal()); + } + // display a simulation as debug log @SuppressWarnings("unused") private void log(String message, ELDescriptionTree tree, Map<ELDescriptionNode,String> nodeNames) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-17 15:05:38
|
Revision: 1557 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1557&view=rev Author: heeroyuy Date: 2008-12-17 15:05:28 +0000 (Wed, 17 Dec 2008) Log Message: ----------- -code cleanup -added accuracy in suggest list Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -26,8 +26,8 @@ import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.util.Iterator; import java.util.List; +import java.util.Set; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ExecutionException; @@ -44,9 +44,6 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.owl.Description; -import org.protege.editor.owl.OWLEditorKit; -import org.semanticweb.owl.model.OWLOntology; - /** * This class processes input from the user. * @@ -61,7 +58,6 @@ private static Logger logger = Logger.getLogger(ActionHandler.class); private DLLearnerModel model; - private OWLEditorKit editorKit; // This is the id that checks if the equivalent class or subclass button is // pressed in protege @@ -93,8 +89,7 @@ */ public ActionHandler(ActionHandler a, DLLearnerModel m, OWLClassDescriptionEditorWithDLLearnerTab.DLLearnerView view, - String i, OWLEditorKit editor) { - this.editorKit = editor; + String i) { this.view = view; this.id = i; this.model = m; @@ -212,36 +207,22 @@ * MouseEvent */ public void mouseClicked(MouseEvent m) { - EvaluatedDescription eDescription = null; + //EvaluatedDescription eDescription = null; if (view.getSuggestClassPanel().getSuggestList().getSelectedValue() != null) { SuggestListItem item = (SuggestListItem) view .getSuggestClassPanel().getSuggestList().getSelectedValue(); String desc = item.getValue(); if (model.getEvaluatedDescriptionList() != null) { - for (Iterator<EvaluatedDescription> i = model - .getEvaluatedDescriptionList().iterator(); i.hasNext();) { - eDescription = i.next(); - if(eDescription.getDescription().toString().contains("#")) { + List<EvaluatedDescription> evalList = model.getEvaluatedDescriptionList(); + Set<String> onto = model.getOntologyURIString(); + for(EvaluatedDescription eDescription : evalList) { + for(String ont : onto) { if (desc.equals(eDescription.getDescription() - .toManchesterSyntaxString( - editorKit.getModelManager() - .getActiveOntology().getURI().toString() + "#" - , null))) { + .toManchesterSyntaxString(ont, null))) { evaluatedDescription = eDescription; - break; } - } else { - if (desc.equals(eDescription.getDescription() - .toManchesterSyntaxString( - editorKit.getModelManager() - .getActiveOntology().getURI().toString() - , null))) { - evaluatedDescription = eDescription; - - break; - } } } } @@ -403,36 +384,20 @@ public void run() { model.setSuggestList(result); - // learnPanel.getListModel().clear(); dm.clear(); - Iterator<EvaluatedDescription> it = result.iterator(); int i = 0; - while (it.hasNext()) { - Iterator<OWLOntology> ont = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - EvaluatedDescription eval = it.next(); - while(ont.hasNext()) { - String onto = ont.next().getURI().toString(); - if(eval.getDescription().toString().contains(onto)) { - if(eval.getDescription().toString().contains("#")) { - if(model.isConsistent(eval)) { - dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); - i++; - break; - } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); - i++; - break; - } + for(EvaluatedDescription eval : result) { + Set<String> ont = model.getOntologyURIString(); + for(String ontology : ont) { + if(eval.getDescription().toString().contains(ontology)) { + if(model.isConsistent(eval)) { + dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(ontology, null),eval.getAccuracy()*100)); + i++; + break; } else { - if(model.isConsistent(eval)) { - dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(onto, null))); - i++; - break; - } else { - dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(onto, null))); - i++; - break; - } + dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(ontology, null),eval.getAccuracy()*100)); + i++; + break; } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -22,7 +22,6 @@ import java.net.URI; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.SortedSet; @@ -43,6 +42,7 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Thing; import org.dllearner.kb.OWLAPIOntology; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegInclusionLP; @@ -185,10 +185,10 @@ private DefaultListModel posListModel; private DefaultListModel negListModel; private Set<KnowledgeSource> sources; - // private KnowledgeSource source; private boolean hasIndividuals; private NamedClass currentConcept; private Vector<IndividualObject> individualVector; + private Set<String> ontologieURI; // This is a List of evaluated descriptions to get more information of the // suggested concept @@ -221,10 +221,10 @@ cm = ComponentManager.getInstance(); ds = new HashSet<OWLDescription>(); suggestModel = new DefaultListModel(); + ontologieURI = new HashSet<String>(); detailPane = new JXTaskPane(); detailPane.setTitle("Details"); sources = new HashSet<KnowledgeSource>(); - } /** @@ -289,12 +289,9 @@ * OWLAPIOntology will be available. */ public void setKnowledgeSource() { - // source = new - // OWLAPIOntology(editor.getModelManager().getActiveOntology()); - Iterator<OWLOntology> it = editor.getModelManager() - .getActiveOntologies().iterator(); - while (it.hasNext()) { - sources.add(new OWLAPIOntology(it.next())); + Set<OWLOntology> ontologies = editor.getModelManager().getActiveOntologies(); + for(OWLOntology onto : ontologies) { + sources.add(new OWLAPIOntology(onto)); } } @@ -333,7 +330,7 @@ } // adds the positive examples cm.applyConfigEntry(lp, "positiveExamples", positiveExamples); - // adds the neagtive examples + // adds the negative examples cm.applyConfigEntry(lp, "negativeExamples", negativeExamples); try { lp.init(); @@ -358,14 +355,13 @@ ignore.add(currentConcept.toString()); if(id.equals(SUPER_CLASS_AXIOM_STRING)) { Description currentClass = (Description)currentConcept; - String currentClassString = currentConcept.toString(); - while(!currentClassString.contains("TOP")) { - Iterator<Description> it = reasoner.getSuperClasses(currentClass).iterator(); - while(it.hasNext()) { - Description ignoredClass = it.next(); - if(!ignoredClass.toString().equals("TOP")) { + while(!(currentClass instanceof Thing)) { + SortedSet<Description> superClasses = reasoner.getSuperClasses(currentClass); + for(Description ignoredClass : superClasses) { + if(!(ignoredClass instanceof Thing)) { ignore.add(ignoredClass.toString()); } + currentClass = ignoredClass; } } } @@ -406,61 +402,31 @@ public void setPosVector() { setPositiveConcept(); SortedSet<Individual> reasonerIndi = reasoner.getIndividuals(); - Iterator<Individual> reasonerIt = reasonerIndi.iterator(); - while (reasonerIt.hasNext()) { - Individual ind = reasonerIt.next(); - Iterator<OWLOntology> onto = editor.getModelManager() - .getActiveOntologies().iterator(); - while (onto.hasNext()) { - OWLOntology ont = onto.next(); + for(Individual ind : reasonerIndi) { + Set<String> onto = ontologieURI; + for(String ont : onto) { String indiv = ind.toString(); // checks if individual belongs to the selected concept - if(ind.toString().contains("#")) { if (setPositivExamplesChecked(indiv)) { - if (indiv.contains(ont.getURI().toString())) { + if (indiv.contains(ont)) { // when yes then it sets the positive example checked // OWLExpressionCheckerFactory - posListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString()+"#", null)); + posListModel.add(0, ind.toManchesterSyntaxString(ont, null)); individualVector.add(new IndividualObject(indiv, true)); break; } } else { // When no it unchecks the positive example - if (indiv.contains(ont.getURI().toString())) { + if (indiv.contains(ont)) { individualVector .add(new IndividualObject(indiv, false)); - negListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString()+"#", null)); + negListModel.add(0, ind.toManchesterSyntaxString(ont, null)); break; } } - } else { - if (setPositivExamplesChecked(indiv)) { - if (indiv.contains(ont.getURI().toString())) { - // when yes then it sets the positive example checked - - // OWLExpressionCheckerFactory - posListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString(), null)); - individualVector.add(new IndividualObject(indiv, true)); - break; - } - - } else { - // When no it unchecks the positive example - if (indiv.contains(ont.getURI().toString())) { - individualVector - .add(new IndividualObject(indiv, false)); - negListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString(), null)); - break; - } - } } - } } } @@ -469,9 +435,8 @@ * This method resets the Concepts that are learned. */ public void unsetNewConcepts() { - while (owlDescription.iterator().hasNext()) { - owlDescription.remove(owlDescription.iterator().next()); - + for(OWLDescription o : owlDescription) { + owlDescription.remove(o); } } @@ -493,17 +458,16 @@ hasIndividuals = false; // checks if selected concept is thing when yes then it selects all // individuals - if (!current.getRootObject().toString().equals("Thing")) { - - for (Iterator<NamedClass> i = reasoner.getAtomicConceptsList() - .iterator(); i.hasNext();) { + if (!(current.getRootObject() instanceof Thing)) { + List<NamedClass> classList = reasoner.getAtomicConceptsList(); + for(NamedClass concept : classList) { // if individuals is null if (individuals == null) { - NamedClass concept = i.next(); // checks if the concept is the selected concept in protege - if (concept.toString().contains("#")) { - if (concept.toString().endsWith( - "#" + current.getRootObject().toString())) { + for(String onto : ontologieURI) { + if (concept.toString().contains(onto)) { + if (concept.toString().equals( + onto + current.getRootObject().toString())) { // if individuals is not null it gets all // individuals of // the concept @@ -516,24 +480,10 @@ break; } } - } else { - if (concept.toString().endsWith( - current.getRootObject().toString())) { - // if individuals is not null it gets all - // individuals of - // the concept - currentConcept = concept; - if (reasoner.getIndividuals(concept) != null) { - if (reasoner.getIndividuals(concept).size() > 0) { - hasIndividuals = true; - } - individual = reasoner.getIndividuals(concept); - break; - } - } } } } + } } else { if (reasoner.getIndividuals().size() > 0) { hasIndividuals = true; @@ -719,25 +669,6 @@ return suggestModel; } - /* - * This method gets the old concept from checking the positive examples. - * - * private void setOldConceptOWLAPI() { // gets all individuals - * SortedSet<Individual> indi = reasoner.getIndividuals(); // Iterator of - * Individuals for (Iterator<Individual> i = indi.iterator(); i.hasNext();) - * { Individual indi2 = i.next(); // checks if the current individual - * belongs to positive examples if (positiveExamples != null) { if - * (positiveExamples.toString().contains(indi2.toString())) { // if yes then - * get the concepts of this individuals Set<NamedClass> concept = - * reasoner.getTypes(indi2); // adds all concepts to old concept OWLAPI for - * (Iterator<NamedClass> k = concept.iterator(); k .hasNext();) { - * OWLDescription oldOWLAPI = OWLAPIDescriptionConvertVisitor - * .getOWLDescription(k.next()); oldConceptOWLAPI = oldOWLAPI; - * ds.add(oldOWLAPI); } - * - * } } } } - */ - /** * This method stores the new concept learned by the DL-Learner in the * Ontology. @@ -748,7 +679,6 @@ public void changeDLLearnerDescriptionsToOWLDescriptions( Description descript) { setNewConceptOWLAPI(descript); - // setOldConceptOWLAPI(); oldConceptOWLAPI = OWLAPIDescriptionConvertVisitor .getOWLDescription(currentConcept); ds.add(oldConceptOWLAPI); @@ -853,47 +783,36 @@ public Set<KnowledgeSource> getKnowledgeSources() { return sources; } - - /*public void updateSuggestListItems() { - evalDescriptions = la.getCurrentlyBestEvaluatedDescriptions(view - .getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts(), - view.getPosAndNegSelectPanel().getOptionPanel() - .getMinAccuracy(), true); - // learnPanel.getListModel().clear(); - DefaultListModel dm = new DefaultListModel(); - Iterator<EvaluatedDescription> it = evalDescriptions.iterator(); - int i = 0; - while (it.hasNext()) { - Iterator<OWLOntology> ont = editor.getModelManager() - .getActiveOntologies().iterator(); - EvaluatedDescription eval = it.next(); - while (ont.hasNext()) { - String onto = ont.next().getURI().toString(); - if (eval.getDescription().toString().contains(onto)) { - if (isConsistent(eval)) { - dm.add(i, new SuggestListItem(Color.GREEN, eval - .getDescription().toManchesterSyntaxString( - onto, null))); - i++; + + /** + * Checks the URI if a "#" is in it. + */ + public void checkURI() { + Set<OWLOntology> ont = editor.getModelManager().getActiveOntologies(); + Set<Individual> indi = reasoner.getIndividuals(); + for(OWLOntology onto : ont) { + String ontURI = onto.getURI().toString(); + for(Individual ind : indi) { + if(ind.toString().contains(ontURI)) { + if(ind.toString().contains("#")) { + ontologieURI.add(onto.getURI().toString()+"#"); break; } else { - dm.add(i, new SuggestListItem(Color.RED, eval - .getDescription().toManchesterSyntaxString( - onto, null))); - i++; + ontologieURI.add(onto.getURI().toString()); break; } } } - } - view.getSuggestClassPanel().setSuggestList(dm); + } } - public void algorithmTerminated() { - error = "learning succesful"; - String message = "To view details about why a class description was suggested, please doubleclick on it."; - // start the algorithm and print the best concept found - view.renderErrorMessage(error); - view.setHintMessage(message); - }*/ + /** + * This method returns the Strings of the Ontology uri's that are currently used. + * @return ontologieURI + */ + public Set<String> getOntologyURIString() { + return ontologieURI; + } + + } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-17 15:05:28 UTC (rev 1557) @@ -11,6 +11,6 @@ To use the plugin go to view --> class views and click on class descriptions (including DL-Learner plugin). Put the new frame somewhere in the classes tab in Protégé and close the old class description view. All features are included in the plugin. -If you have problems look at the screen cast: http://dl-learner.org/files/screencast/protege/prot.htm +If you have problems look at the screen cast: http://dl-learner.org/wiki/ProtegePlugin. Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -21,7 +21,7 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; -import java.util.Iterator; +import java.util.Set; import javax.swing.JDialog; import javax.swing.JLabel; @@ -32,7 +32,6 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Individual; -import org.semanticweb.owl.model.OWLOntology; @@ -110,6 +109,7 @@ private JPanel negNotCoveredPanel; private EvaluatedDescription eval; private JTextArea concept; + private Set<String> ontologiesStrings; private JTextArea conceptText; private final Color colorRed = new Color(139, 0, 0); private final Color colorGreen = new Color(0, 139, 0); @@ -237,120 +237,74 @@ * This method sets the Informations of the selected description. */ private void setInformation() { + ontologiesStrings = model.getOntologyURIString(); if(eval!=null) { //sets the accuracy of the selected concept - System.out.println("EVAL: " + eval.getDescription()); - if(eval.getDescription().toString().contains("#")) { - conceptText.setText(eval.getDescription().toManchesterSyntaxString(model.getURI().toString() + "#", null)); - } else { - conceptText.setText(eval.getDescription().toManchesterSyntaxString(model.getURI().toString(), null)); + for(String ontoString : ontologiesStrings) { + if(eval.getDescription().toString().contains(ontoString)) { + conceptText.setText(eval.getDescription().toManchesterSyntaxString(ontoString, null)); + break; + } } + + //sets the accuracy of the concept double acc = (eval.getAccuracy())*100; accuracyText.setText(String.valueOf(acc)+"%"); - Iterator<Individual> i = eval.getCoveredPositives().iterator(); - while (i.hasNext()) { - Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - Individual ind = i.next(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if(ind.toString().contains("#")) { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); - posLabel.setForeground(colorGreen); - posCoveredPanel.add(posLabel); - break; - } - } else { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorGreen); - posCoveredPanel.add(posLabel); - break; - } - } + + //Sets positive Covered Examples for the detail panel + Set<Individual> indi = eval.getCoveredPositives(); + for(Individual ind : indi) { + for(String ontology : ontologiesStrings) { + if(ind.toString().contains(ontology)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(ontology, null)); + posLabel.setForeground(colorGreen); + posCoveredPanel.add(posLabel); + break; + } } + } - } + //sets the positive examples that are not covered - Iterator<Individual> a = eval.getNotCoveredPositives().iterator(); - while (a.hasNext()) { - Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - Individual ind = a.next(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if(ind.toString().contains("#")) { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); - posLabel.setForeground(colorRed); - posNotCoveredPanel.add(posLabel); - break; - } - } else { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorRed); - posNotCoveredPanel.add(posLabel); - break; - } + Set<Individual> individuals = eval.getNotCoveredPositives(); + for(Individual ind : individuals) { + for(String onto : ontologiesStrings) { + if(ind.toString().contains(onto)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(onto, null)); + posLabel.setForeground(colorRed); + posNotCoveredPanel.add(posLabel); + break; } } - - } //sets the negative examples that are covered - Iterator<Individual> b = eval.getCoveredNegatives().iterator(); - while (b.hasNext()) { - Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - Individual ind = b.next(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if(ind.toString().contains("#")) { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); - posLabel.setForeground(colorRed); - negCoveredPanel.add(posLabel); - break; - } - } else { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorRed); - negCoveredPanel.add(posLabel); - break; - } + Set<Individual> negCoveredIndi = eval.getCoveredNegatives(); + for(Individual negIndi : negCoveredIndi) { + for(String ont : ontologiesStrings) { + if(negIndi.toString().contains(ont)) { + JLabel posLabel = new JLabel(negIndi.toManchesterSyntaxString(ont, null)); + posLabel.setForeground(colorRed); + negCoveredPanel.add(posLabel); + break; } } - - - } + } //sets the negative examples that are not covered - Iterator<Individual> c = eval.getNotCoveredNegatives().iterator(); - while (c.hasNext()) { - Iterator<OWLOntology> onto = model.getOWLEditorKit().getModelManager().getActiveOntologies().iterator(); - Individual ind = c.next(); - while (onto.hasNext()) { - String uri = onto.next().getURI().toString(); - if(ind.toString().contains("#")) { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); - posLabel.setForeground(colorGreen); - negNotCoveredPanel.add(posLabel); - } - } else { - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorGreen); - negNotCoveredPanel.add(posLabel); - } + Set<Individual> negNotCoveredIndi = eval.getNotCoveredNegatives(); + for(Individual negNotIndi : negNotCoveredIndi) { + for(String ontol : ontologiesStrings) { + if(negNotIndi.toString().contains(ontol)) { + JLabel posLabel = new JLabel(negNotIndi.toManchesterSyntaxString(ontol, null)); + posLabel.setForeground(colorGreen); + negNotCoveredPanel.add(posLabel); + break; } - } - - + } } } + } } -} Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -119,8 +119,7 @@ editor = new ExpressionEditor<OWLDescription>(editorKit, editorKit.getModelManager().getOWLExpressionCheckerFactory().getOWLDescriptionChecker()); editor.setExpressionObject(description); - action = new ActionHandler(this.action, null, dllearner, null, - editorKit); + action = new ActionHandler(this.action, null, dllearner, null); tabbedPane = new JTabbedPane(); tabbedPane.setFocusable(false); editingComponent = new JPanel(new BorderLayout()); @@ -381,8 +380,7 @@ toggledIcon = new ImageIcon(toggledIconUrl); model = new DLLearnerModel(editorKit, current, label, this); sugPanel = new SuggestClassPanel(); - action = new ActionHandler(this.action, model, this, label, - editorKit); + action = new ActionHandler(this.action, model, this, label); adv = new JLabel("Advanced Settings"); advanced = new JToggleButton(icon); advanced.setVisible(true); @@ -438,6 +436,7 @@ model.clearVector(); model.unsetListModel(); model.initReasoner(); + model.checkURI(); model.setPosVector(); hint.setVisible(true); if (model.hasIndividuals()) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListCellRenderer.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -36,7 +36,7 @@ private static final long serialVersionUID = 8040385703448641356L; /** - * Construktor for the Cell Renderer for the Suggest List. + * Constructor for the Cell Renderer for the Suggest List. */ public SuggestListCellRenderer() { setOpaque(true); @@ -55,7 +55,7 @@ int arg2, boolean iss, boolean arg4) { // Set the text and // background color for rendering - setText(((SuggestListItem) value).getValue()); + setText(((SuggestListItem) value).getValue() + " " + "Accuracy: " + ((SuggestListItem) value).getAccuracy()+"%"); setBackground(Color.WHITE); setForeground(((SuggestListItem) value).getColor()); // Set a border if the list Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java 2008-12-16 16:24:53 UTC (rev 1556) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestListItem.java 2008-12-17 15:05:28 UTC (rev 1557) @@ -29,15 +29,18 @@ private Color color; private String value; + private double accuracy; /** * Constructor for the SuggestListItem. * @param c Color Color in which the text is painted. * @param s String text that is shown. */ public SuggestListItem( - Color c, String s) { - color = c; - value = s; + Color c, String s, double acc) { + this.color = c; + this.value = s; + this.accuracy = acc; + } /** @@ -55,5 +58,13 @@ public String getValue() { return value; } + + /** + * This method returns the accuracy of the current list item. + * @return accuracy + */ + public double getAccuracy() { + return accuracy; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-12-16 16:24:58
|
Revision: 1556 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1556&view=rev Author: jenslehmann Date: 2008-12-16 16:24:53 +0000 (Tue, 16 Dec 2008) Log Message: ----------- EL refinement operator II ctd. Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionEdge.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNodeComparator.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java trunk/src/dl-learner/org/dllearner/core/SchemaReasoner.java trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionEdge.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionEdge.java 2008-12-16 10:16:51 UTC (rev 1555) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionEdge.java 2008-12-16 16:24:53 UTC (rev 1556) @@ -33,7 +33,7 @@ private ObjectProperty label; - private ELDescriptionNode tree; + private ELDescriptionNode node; /** * Constructs and edge given a label and an EL description tree. @@ -42,7 +42,7 @@ */ public ELDescriptionEdge(ObjectProperty label, ELDescriptionNode tree) { this.label = label; - this.tree = tree; + this.node = tree; } /** @@ -62,13 +62,13 @@ /** * @return The EL description tree */ - public ELDescriptionNode getTree() { - return tree; + public ELDescriptionNode getNode() { + return node; } @Override public String toString() { - return "--" + label + "--> " + tree.toDescriptionString(); + return "--" + label + "--> " + node.toDescriptionString(); } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-12-16 10:16:51 UTC (rev 1555) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-12-16 16:24:53 UTC (rev 1556) @@ -111,7 +111,7 @@ this(parentNode, parentProperty, new TreeSet<NamedClass>(Arrays.asList(label))); } - public ELDescriptionNode(ELDescriptionNode parentNode, ObjectProperty parentProperty, TreeSet<NamedClass> label) { + public ELDescriptionNode(ELDescriptionNode parentNode, ObjectProperty parentProperty, Set<NamedClass> label) { // this.label = label; // we first need to add the edge and update the simulation and then add // all classes iteratively to the label (each time updating the simulation again) @@ -261,7 +261,7 @@ return label.first(); } else { ELDescriptionEdge edge = edges.get(0); - Description child = edge.getTree().transformToDescription(); + Description child = edge.getNode().transformToDescription(); return new ObjectSomeRestriction(edge.getLabel(),child); } // return an intersection of labels and edges @@ -271,7 +271,7 @@ is.addChild(nc); } for(ELDescriptionEdge edge : edges) { - Description child = edge.getTree().transformToDescription(); + Description child = edge.getNode().transformToDescription(); ObjectSomeRestriction osr = new ObjectSomeRestriction(edge.getLabel(),child); is.addChild(osr); } @@ -298,11 +298,12 @@ } // returns the child number of this node, i.e. whether it is - // the first, second, third etc. child + // the first, second, third etc. child; + // TODO: might be a bit faster to store this explicitly private int getChildNumber() { int count = 0; for(ELDescriptionEdge edge : parent.edges) { - if(edge.getTree() == this) { + if(edge.getNode() == this) { return count; } } @@ -472,7 +473,7 @@ String str = indentString + label.toString() + "\n"; for(ELDescriptionEdge edge : edges) { str += indentString + "-- " + edge.getLabel() + " -->\n"; - str += edge.getTree().toString(indent + 2); + str += edge.getNode().toString(indent + 2); } return str; } @@ -494,7 +495,7 @@ } for(ELDescriptionEdge edge : edges) { str += " AND EXISTS " + edge.getLabel().toString() + ".("; - str += edge.getTree().toDescriptionString() + ")"; + str += edge.getNode().toDescriptionString() + ")"; } return str; } @@ -557,6 +558,11 @@ public ELDescriptionNode getParent() { return parent; } + + public ELDescriptionEdge getParentEdge() { + int childNr = getChildNumber(); + return parent.edges.get(childNr); + } /** * @return the in @@ -599,4 +605,8 @@ public Set<ELDescriptionNode> getOutSC2() { return outSC2; } + + public ELDescriptionTree getTree() { + return tree; + } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNodeComparator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNodeComparator.java 2008-12-16 10:16:51 UTC (rev 1555) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNodeComparator.java 2008-12-16 16:24:53 UTC (rev 1556) @@ -78,8 +78,8 @@ return compare; // compare child nodes - ELDescriptionNode child1 = node1.getEdges().get(i).getTree(); - ELDescriptionNode child2 = node2.getEdges().get(i).getTree(); + ELDescriptionNode child1 = node1.getEdges().get(i).getNode(); + ELDescriptionNode child2 = node2.getEdges().get(i).getNode(); int compare2 = compare(child1, child2); if(compare2 != 0) return compare2; Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-16 10:16:51 UTC (rev 1555) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-16 16:24:53 UTC (rev 1556) @@ -158,8 +158,8 @@ ObjectProperty op1 = edges.get(j).getLabel(); ObjectProperty op2 = edges.get(k).getLabel(); if(rs.getObjectPropertyHierarchy().isSubpropertyOf(op1, op2)) { - ELDescriptionNode node1 = edges.get(j).getTree(); - ELDescriptionNode node2 = edges.get(k).getTree(); + ELDescriptionNode node1 = edges.get(j).getNode(); + ELDescriptionNode node2 = edges.get(k).getNode(); // check simulation condition if(node1.in.contains(node2) || node2.in.contains(node1)) { // node1 is simulated by node2, i.e. we could remove one @@ -224,7 +224,7 @@ public ELDescriptionNode getNode(int[] position) { ELDescriptionNode currentNode = rootNode; for (int i = 0; i < position.length; i++) { - currentNode = currentNode.getEdges().get(position[i]).getTree(); + currentNode = currentNode.getEdges().get(position[i]).getNode(); } return currentNode; } @@ -357,7 +357,7 @@ // check whether edges contains an element satisfying SC2 private boolean checkSC2Edge(ELDescriptionEdge superEdge, List<ELDescriptionEdge> edges) { ObjectProperty superOP = superEdge.getLabel(); - ELDescriptionNode superNode = superEdge.getTree(); + ELDescriptionNode superNode = superEdge.getNode(); for(ELDescriptionEdge edge : edges) { // System.out.println("superEdge: " + superEdge); @@ -367,7 +367,7 @@ // we first check the condition on the properties if(roleHierarchy.isSubpropertyOf(op, superOP)) { // check condition on simulations of referred nodes - ELDescriptionNode node = edge.getTree(); + ELDescriptionNode node = edge.getNode(); // if(superNode.in.contains(node) || node.in.contains(superNode)) { if(node.in.contains(superNode)) { // we found a node satisfying the condition, so we can return @@ -506,7 +506,7 @@ // edges for(ELDescriptionEdge edge : oldNode.edges) { // create a new edge with same label and replace the node the edge points to - newNode.edges.add(new ELDescriptionEdge(edge.getLabel(), cloneMap.get(edge.getTree()))); + newNode.edges.add(new ELDescriptionEdge(edge.getLabel(), cloneMap.get(edge.getNode()))); } } @@ -514,6 +514,7 @@ // update global tree treeClone.rootNode = newRoot; treeClone.maxLevel = maxLevel; + treeClone.nodes = new HashSet<ELDescriptionNode>(nodes); for(int i=1; i<=maxLevel; i++) { Set<ELDescriptionNode> oldNodes = levelNodeMapping.get(i); Set<ELDescriptionNode> newNodes = new HashSet<ELDescriptionNode>(); @@ -541,8 +542,8 @@ // loop through all edges and clone the subtrees for (ELDescriptionEdge edge : node.getEdges()) { ELDescriptionNode tmp = new ELDescriptionNode(nodeClone, edge.getLabel(), - new TreeSet<NamedClass>(edge.getTree().getLabel())); - cloneRecursively(edge.getTree(), tmp); + new TreeSet<NamedClass>(edge.getNode().getLabel())); + cloneRecursively(edge.getNode(), tmp); } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-12-16 10:16:51 UTC (rev 1555) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithm.java 2008-12-16 16:24:53 UTC (rev 1556) @@ -39,6 +39,7 @@ import org.dllearner.core.owl.Thing; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.refinementoperators.ELDown; +import org.dllearner.refinementoperators.ELDown2; import org.dllearner.utilities.owl.EvaluatedDescriptionSet; /** @@ -55,7 +56,7 @@ private static Logger logger = Logger.getLogger(ELLearningAlgorithm.class); private ELLearningAlgorithmConfigurator configurator; - private ELDown operator; + private ELDown2 operator; private boolean isRunning = false; private boolean stop = false; @@ -97,7 +98,7 @@ heuristic = new StableHeuristic(); candidates = new TreeSet<SearchTreeNode>(heuristic); - operator = new ELDown(reasoner); + operator = new ELDown2(reasoner); } @Override Modified: trunk/src/dl-learner/org/dllearner/core/SchemaReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/SchemaReasoner.java 2008-12-16 10:16:51 UTC (rev 1555) +++ trunk/src/dl-learner/org/dllearner/core/SchemaReasoner.java 2008-12-16 16:24:53 UTC (rev 1556) @@ -101,7 +101,7 @@ public ClassHierarchy getClassHierarchy(); /** - * Returns more general concepts in the subsumption hierarchy. + * Returns direct super classes in the class hierarchy. * * @param description * Atomic concept, top, or bottom. @@ -110,7 +110,7 @@ public SortedSet<Description> getSuperClasses(Description description); /** - * Returns more special concepts in the subsumption hierarchy. + * Returns direct sub classes in the class hierarchy. * * @param description * Atomic concept, top, or bottom. Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java 2008-12-16 10:16:51 UTC (rev 1555) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java 2008-12-16 16:24:53 UTC (rev 1556) @@ -220,7 +220,7 @@ // recursive call on child node and property range as index Description range = rs.getRange(edge.getLabel()); // System.out.println(tree + "\nrecurse to:\n" + edge.getTree()); - refinements.addAll(refine(tree, edge.getTree(), range, minimize)); + refinements.addAll(refine(tree, edge.getNode(), range, minimize)); } // we found out that, in case we start from the TOP concept @@ -255,7 +255,7 @@ // with the existing child node (we do not perform a full disjointness // check, but only compare with the flattened concept to keep the number // of possible disjointness checks finite) - if(!utility.isDisjoint(getFlattenedConcept(edge.getTree()), opRanges.get(op2))) { + if(!utility.isDisjoint(getFlattenedConcept(edge.getNode()), opRanges.get(op2))) { // clone operation ELDescriptionTree clonedTree = tree.clone(); // find cloned edge and replace its label Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java 2008-12-16 10:16:51 UTC (rev 1555) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java 2008-12-16 16:24:53 UTC (rev 1556) @@ -20,6 +20,7 @@ package org.dllearner.refinementoperators; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; @@ -51,7 +52,7 @@ * * <p>Properties: * <ul> - * <li>complete</li> + * <li>weakly complete (can be extended to guarantee completeness if desired)</li> * <li>proper</li> * <li>finite</li> * <li>uses class/property hierarchy</li> @@ -130,55 +131,56 @@ // the transformations can, of course, add new nodes) Set<ELDescriptionNode> nodes = new HashSet<ELDescriptionNode>(tree.getNodes()); for(ELDescriptionNode v : nodes) { + // the position of the node within the tree (needed for getting + // the corresponding node in a cloned tree) + int[] position = v.getCurrentPosition(); + // perform operations - refinements.addAll(extendLabel(tree, v)); - refinements.addAll(refineLabel(tree, v)); - refinements.addAll(refineEdge(tree, v)); - refinements.addAll(attachSubtree(tree, v)); + refinements.addAll(extendLabel(tree, v, position)); + refinements.addAll(refineLabel(tree, v, position)); + refinements.addAll(refineEdge(tree, v, position)); + refinements.addAll(attachSubtree(tree, v, position)); } // return refine(tree, tree.getRootNode(), new Thing(), true); return refinements; } - - private Set<ELDescriptionTree> extendLabel(ELDescriptionTree tree, ELDescriptionNode v) { - return null; - } - - private Set<ELDescriptionTree> refineLabel(ELDescriptionTree tree, ELDescriptionNode v) { - return null; - } - - private Set<ELDescriptionTree> refineEdge(ELDescriptionTree tree, ELDescriptionNode v) { - return null; - } - - private Set<ELDescriptionTree> attachSubtree(ELDescriptionTree tree, ELDescriptionNode v) { - return null; - } - - private Set<ELDescriptionTree> refine(ELDescriptionTree tree, ELDescriptionNode node, Description index, boolean minimize) { - // the set of all refinements, which we will return + + // operation 1: label extension + private Set<ELDescriptionTree> extendLabel(ELDescriptionTree tree, ELDescriptionNode v, int[] position) { Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); - // the position of the node within the tree (needed for getting - // the corresponding node in a cloned tree) - int[] position = node.getCurrentPosition(); + + // the index is the range of role in the edge pointing to the parent of this node + Description index; + if(v.isRoot()) { + index = Thing.instance; + } else { + index = opRanges.get(v.getParentEdge().getLabel()); + } - // option 1: label extension - Set<NamedClass> candidates = utility.getClassCandidates(index, node.getLabel()); + // call ncc (see paper) + Set<NamedClass> candidates = utility.getClassCandidates(index, v.getLabel()); + for(NamedClass nc : candidates) { // clone operation ELDescriptionTree clonedTree = tree.clone(); ELDescriptionNode clonedNode = clonedTree.getNode(position); // extend label clonedNode.extendLabel(nc); - refinements.add(clonedTree); + if(clonedTree.isMinimal()) { + refinements.add(clonedTree); + } } + + return refinements; + } + + // operation 2: label refinement + private Set<ELDescriptionTree> refineLabel(ELDescriptionTree tree, ELDescriptionNode v, int[] position) { + Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); - - // option 2: label refinement // loop through all classes in label - for(NamedClass nc : node.getLabel()) { + for(NamedClass nc : v.getLabel()) { // find all more special classes for the given label for(Description moreSpecial : rs.getSubClasses(nc)) { if(moreSpecial instanceof NamedClass) { @@ -186,117 +188,187 @@ ELDescriptionTree clonedTree = tree.clone(); ELDescriptionNode clonedNode = clonedTree.getNode(position); -// System.out.println("tree: " + tree); -// System.out.println("cloned tree: " + clonedTree); -// System.out.println("node: " + node); -// System.out.println("cloned unmodified: " + clonedNode); - // create refinements by replacing class clonedNode.replaceInLabel(nc, (NamedClass) moreSpecial); -// System.out.println("cloned modified: " + clonedNode); - refinements.add(clonedTree); + if(clonedTree.isMinimal()) { + refinements.add(clonedTree); + } } } } + + return refinements; + } + + // operation 3: refine edge + private Set<ELDescriptionTree> refineEdge(ELDescriptionTree tree, ELDescriptionNode v, int[] position) { + Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); + + for(int edgeNumber = 0; edgeNumber < v.getEdges().size(); edgeNumber++) { + ELDescriptionEdge edge = v.getEdges().get(edgeNumber); + ObjectProperty op = edge.getLabel(); + // find all more special properties + for(ObjectProperty op2 : rs.getSubProperties(op)) { + // we check whether the range of this property is not disjoint + // with the existing child node (we do not perform a full disjointness + // check, but only compare with the flattened concept to keep the number + // of possible disjointness checks finite) + if(!utility.isDisjoint(getFlattenedConcept(edge.getNode()), opRanges.get(op2))) { + // clone operation + ELDescriptionTree clonedTree = tree.clone(); + // find cloned edge and replace its label + clonedTree.getNode(position).refineEdge(edgeNumber, op2); +// ELDescriptionEdge clonedEdge = clonedTree.getNode(position).getEdges().get(edgeNumber); +// clonedEdge.setLabel(op2); + if(clonedTree.isMinimal()) { + refinements.add(clonedTree); + } + } + } + } - // option 3: new edge + return refinements; + } + + // operation 4: attach tree + private Set<ELDescriptionTree> attachSubtree(ELDescriptionTree tree, ELDescriptionNode v, int[] position) { + Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); + + // compute the set of most general roles such that the domain of each role is not disjoint + // with the range of the role pointing to this node + Description index; + if(v.isRoot()) { + index = Thing.instance; + } else { + index = opRanges.get(v.getParentEdge().getLabel()); + } SortedSet<ObjectProperty> appOPs = utility.computeApplicableObjectProperties(index); Set<ObjectProperty> mgr = utility.computeMgr(appOPs); - // temporary set of all concepts, which still have to pass the equivalence check - Stack<ELDescriptionTree> stack = new Stack<ELDescriptionTree>(); + + // TODO: in as ist ein baum t nicht definiert; ersetzen durch t_{C'} + // TODO: Einrückung in as nach pick element nicht notwendig + + // loop through most general roles for(ObjectProperty op : mgr) { - // clone operation - ELDescriptionTree clonedTree = tree.clone(); - ELDescriptionNode clonedNode = clonedTree.getNode(position); - // add a new node and edge - ELDescriptionNode newNode = new ELDescriptionNode(clonedNode, op, new TreeSet<NamedClass>()); - stack.add(clonedTree); - // recurse if concept is equivalent - while(stack.size() != 0) { - // we pick an arbitrary tree and remove it from the stack - ELDescriptionTree testTree = stack.pop(); - // test equivalence (we found out that we can use the - // minimality test for equivalence in this case) - boolean equivalent = !testTree.isMinimal(); - // if the tree is equivalent, we need to populate the - // stack with refinements (which are later tested for - // equivalence) - if(equivalent) { - // edge refinement - // we know that the edge we added is the last one for this node - int edgeNr = node.getEdges().size() - 1; - ELDescriptionEdge edge = node.getEdges().get(edgeNr); - // all refinements of this edge are added to the stack - // (set 1 in article) - refineEdge(stack, tree, node, position, edgeNr); - // perform node refinements in non-minimize-mode - // (set 2 in article) -// commented out, because didn't make sense to me -// refinements.addAll(refineEdges(tree, newNode, position)); - stack.addAll(refine(tree, newNode, opRanges.get(edge), false)); - } else { - // tree is not equivalent, i.e. a proper refinement - refinements.add(testTree); - } - } + // a list of subtrees (stored as edges i.e. role + root node which points to tree) + // TODO: Do we need to store m at all? + LinkedList<ELDescriptionEdge> m = new LinkedList<ELDescriptionEdge>(); + + // create tree corresponding to top node + ELDescriptionTree topTree = new ELDescriptionTree(rs, Thing.instance); + + // init list with picked role and top node i.e. its root + m.add(new ELDescriptionEdge(op, topTree.getRootNode())); + + // iterate until m is empty + while(!m.isEmpty()) { + // pick and remove first element + ELDescriptionEdge edge = m.pollFirst(); + ObjectProperty r = edge.getLabel(); + // tp = t' in algorithm description (p stands for prime) + ELDescriptionTree tp = edge.getNode().getTree(); + + // merge tree into main tree + ELDescriptionTree mergedTree = mergeTrees(tree, v, position, r, tp); + + // we check equivalence by a minimality test (TODO: can we still do this?) + if(mergedTree.isMinimal()) { + // it is not equivalent, i.e. we found a refinement + refinements.add(mergedTree); + } else { + // perform complex check + boolean check = asCheck(v); + + if(check) { + // refine property + for(ObjectProperty subRole : rs.getSubProperties(r)) { + m.add(new ELDescriptionEdge(subRole, tp.getRootNode())); + } + // refine tree using recursive operator call + Set<ELDescriptionTree> recRefs = refine(tp); + for(ELDescriptionTree tpp : recRefs) { + m.add(new ELDescriptionEdge(r, tpp.getRootNode())); + } + } + } + } } + + return refinements; + } + + // create a new tree which is obtained by attaching the new tree at the given node in the tree via role r + private ELDescriptionTree mergeTrees(ELDescriptionTree tree, ELDescriptionNode node, int[] position, ObjectProperty r, ELDescriptionTree newTree) { + // merged tree = tree + new node with role pointing to a new node + ELDescriptionTree mergedTree = tree.clone(); + ELDescriptionNode clonedNode = mergedTree.getNode(position); +// ELDescriptionNode nodeNew = new ELDescriptionNode(clonedNode, r); - // option 4: edge refinement - refinements.addAll(refineEdges(tree, node, position)); + // create a list of nodes we still need to process + LinkedList<ELDescriptionNode> toProcess = new LinkedList<ELDescriptionNode>(); + toProcess.add(newTree.getRootNode()); - // option 5: child refinement - for(ELDescriptionEdge edge : node.getEdges()) { - // recursive call on child node and property range as index - Description range = rs.getRange(edge.getLabel()); -// System.out.println(tree + "\nrecurse to:\n" + edge.getTree()); - refinements.addAll(refine(tree, edge.getTree(), range, minimize)); - } + // map from nodes to cloned nodes + Map<ELDescriptionNode,ELDescriptionNode> cloneMap = new HashMap<ELDescriptionNode,ELDescriptionNode>(); +// cloneMap.put(newTree.getRootNode(), nodeNew); - // we found out that, in case we start from the TOP concept - // (which is assumed in the current implementation), we can - // simply throw away all non-minimal concepts - if(minimize) { - Iterator<ELDescriptionTree> it = refinements.iterator(); - while(it.hasNext()) { - if(!it.next().isMinimal()) { - it.remove(); - } + // loop until the process list is empty + while(!toProcess.isEmpty()) { + // process a node + ELDescriptionNode v = toProcess.pollFirst(); + // find parent + ELDescriptionNode vp; + if(v.isRoot()) { + // root is connected to main tree via role r + vp = new ELDescriptionNode(clonedNode, r); + } else { + ELDescriptionNode parent = cloneMap.get(v.getParent()); + ObjectProperty role = v.getParentEdge().getLabel(); + Set<NamedClass> label = v.getLabel(); + // create new node + vp = new ELDescriptionNode(parent, role, label); } + cloneMap.put(v, vp); + // attach children of node to process list + for(ELDescriptionEdge edge : v.getEdges()) { + toProcess.add(edge.getNode()); + } } - return refinements; + return mergedTree; } - - private Set<ELDescriptionTree> refineEdges(ELDescriptionTree tree, ELDescriptionNode node, int[] position) { - Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); - for(int edgeNumber = 0; edgeNumber < node.getEdges().size(); edgeNumber++) { - refineEdge(refinements, tree, node, position, edgeNumber); + + private boolean asCheck(ELDescriptionNode v) { + // find all edges up to the root node + List<ELDescriptionEdge> piVEdges = new LinkedList<ELDescriptionEdge>(); + ELDescriptionNode tmp = v; + while(!tmp.isRoot()) { + piVEdges.add(tmp.getParentEdge()); + tmp = tmp.getParent(); } - return refinements; - } - - private void refineEdge(Collection<ELDescriptionTree> refinements, ELDescriptionTree tree, ELDescriptionNode node, int[] position, int edgeNumber) { - ELDescriptionEdge edge = node.getEdges().get(edgeNumber); - ObjectProperty op = edge.getLabel(); - // find all more special properties - for(ObjectProperty op2 : rs.getSubProperties(op)) { - // we check whether the range of this property is not disjoint - // with the existing child node (we do not perform a full disjointness - // check, but only compare with the flattened concept to keep the number - // of possible disjointness checks finite) - if(!utility.isDisjoint(getFlattenedConcept(edge.getTree()), opRanges.get(op2))) { - // clone operation - ELDescriptionTree clonedTree = tree.clone(); - // find cloned edge and replace its label - clonedTree.getNode(position).refineEdge(edgeNumber, op2); -// ELDescriptionEdge clonedEdge = clonedTree.getNode(position).getEdges().get(edgeNumber); -// clonedEdge.setLabel(op2); - refinements.add(clonedTree); + + // go through all edges + for(ELDescriptionEdge piVEdge : piVEdges) { + // collect (w,s,w') + ELDescriptionNode wp = piVEdge.getNode(); + ObjectProperty s = piVEdge.getLabel(); + ELDescriptionNode w = wp.getParent(); + + // go through all (w,s,w'') - TODO: s or a new s' ? + for(ELDescriptionEdge wEdge : w.getEdges()) { + ObjectProperty sp = wEdge.getLabel(); + ELDescriptionNode wpp = wEdge.getNode(); + if(s.equals(sp) && wp != wpp) { + if(wp.getIn().contains(wpp)) { + return false; + } + } } - } + + return true; } // simplifies a potentially nested tree in a flat conjunction by taking @@ -304,6 +376,7 @@ // C = Professor \sqcap \exists hasChild.Student // the result would be Professor \sqcap Human (assuming Human is the domain // of hasChild) + // TODO: used in both EL operators => move to utility class private Description getFlattenedConcept(ELDescriptionNode node) { Intersection i = new Intersection(); @@ -323,16 +396,6 @@ } return i; - } + } -// private void computeMg(Description index) { -// // compute the applicable properties if this has not been done yet -// if(app.get(index) == null) -// app.put(index, utility.computeApplicableObjectProperties(index)); -// -// mgr.put(index, new TreeSet<ObjectProperty>()); -// -// -// } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-12-16 10:17:01
|
Revision: 1555 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1555&view=rev Author: jenslehmann Date: 2008-12-16 10:16:51 +0000 (Tue, 16 Dec 2008) Log Message: ----------- nnf conversion in fast instance checker Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-12-16 07:11:01 UTC (rev 1554) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-12-16 10:16:51 UTC (rev 1555) @@ -195,9 +195,9 @@ public Score computeScore(Description concept) { // FastInstanceChecker supports only negation normal form, so we have to make // sure to convert the description before - if(reasoner instanceof FastInstanceChecker) { - return definitionLP.computeScore(ConceptTransformation.transformToNegationNormalForm(new Negation(concept))); - } +// if(reasoner instanceof FastInstanceChecker) { +// return definitionLP.computeScore(ConceptTransformation.transformToNegationNormalForm(new Negation(concept))); +// } return definitionLP.computeScore(new Negation(concept)); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-12-16 07:11:01 UTC (rev 1554) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-12-16 10:16:51 UTC (rev 1555) @@ -70,6 +70,7 @@ import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; import org.dllearner.utilities.Helper; +import org.dllearner.utilities.owl.ConceptTransformation; /** * Reasoner for fast instance checks. It works by completely dematerialising the @@ -260,9 +261,12 @@ if (child instanceof NamedClass) { return classInstancesNeg.get((NamedClass) child).contains(individual); } else { - throw new ReasoningMethodUnsupportedException("Instance check for description " - + description - + " unsupported. Description needs to be in negation normal form."); + logger.debug("Converting description to negation normal form in fast instance check (should be avoided if possible)."); + Description nnf = ConceptTransformation.transformToNegationNormalForm(child); + return hasTypeImpl(nnf, individual); +// throw new ReasoningMethodUnsupportedException("Instance check for description " +// + description +// + " unsupported. Description needs to be in negation normal form."); } } else if (description instanceof Thing) { return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-12-16 07:11:08
|
Revision: 1554 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1554&view=rev Author: jenslehmann Date: 2008-12-16 07:11:01 +0000 (Tue, 16 Dec 2008) Log Message: ----------- EL refinement operator II Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-15 12:04:17 UTC (rev 1553) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-16 07:11:01 UTC (rev 1554) @@ -60,6 +60,10 @@ protected ELDescriptionNode rootNode; + // the set of all nodes in the tree + private Set<ELDescriptionNode> nodes = new HashSet<ELDescriptionNode>(); + + // nodes on a given level of the tree private Map<Integer, Set<ELDescriptionNode>> levelNodeMapping = new HashMap<Integer, Set<ELDescriptionNode>>(); // the background knowledge (we need to have it explicitly here, @@ -172,8 +176,8 @@ } /** - * Internal method for updating the level node mapping. It is called when a - * new node is added to the tree. + * Internal method for updating the node set and the level node mapping. It must be + * called when a new node is added to the tree. * * @param node * The new node. @@ -181,6 +185,7 @@ * Level of the new node. */ protected void addNodeToLevel(ELDescriptionNode node, int level) { + nodes.add(node); if (level <= maxLevel) { levelNodeMapping.get(level).add(node); } else if (level == maxLevel + 1) { @@ -554,4 +559,11 @@ public String toDescriptionString() { return rootNode.toDescriptionString(); } + + /** + * @return the nodes + */ + public Set<ELDescriptionNode> getNodes() { + return nodes; + } } Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java 2008-12-15 12:04:17 UTC (rev 1553) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown.java 2008-12-16 07:11:01 UTC (rev 1554) @@ -50,7 +50,7 @@ * * <p>Properties: * <ul> - * <li>complete</li> + * <li>complete? (still open)</li> * <li>proper</li> * <li>finite</li> * <li>uses class/property hierarchy</li> Added: trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/ELDown2.java 2008-12-16 07:11:01 UTC (rev 1554) @@ -0,0 +1,338 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.refinementoperators; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.SortedSet; +import java.util.Stack; +import java.util.TreeMap; +import java.util.TreeSet; + +import org.apache.log4j.Logger; +import org.dllearner.algorithms.el.ELDescriptionEdge; +import org.dllearner.algorithms.el.ELDescriptionNode; +import org.dllearner.algorithms.el.ELDescriptionTree; +import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Intersection; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectProperty; +import org.dllearner.core.owl.ObjectPropertyHierarchy; +import org.dllearner.core.owl.ClassHierarchy; +import org.dllearner.core.owl.Thing; + +/** + * EL downward refinement operator constructed by Jens Lehmann + * and Christoph Haase. It takes an EL description tree as input + * and outputs a set of EL description trees. + * + * <p>Properties: + * <ul> + * <li>complete</li> + * <li>proper</li> + * <li>finite</li> + * <li>uses class/property hierarchy</li> + * <li>takes domain/range into account</li> + * <li>uses disjoint classes/classes without common instances</li> + * <li>all refinements are minimal (i.e. cannot be shortened without changing semantics)</li> + * </ul> + * + * @author Jens Lehmann + * + */ +@SuppressWarnings("unused") +public class ELDown2 extends RefinementOperatorAdapter { + + private static Logger logger = Logger.getLogger(ELDown2.class); + + private ReasonerComponent rs; + + // hierarchies + private ClassHierarchy subsumptionHierarchy; + private ObjectPropertyHierarchy opHierarchy; + + // domains and ranges + private Map<ObjectProperty,Description> opDomains = new TreeMap<ObjectProperty,Description>(); + private Map<ObjectProperty,Description> opRanges = new TreeMap<ObjectProperty,Description>(); + + // app_A set of applicable properties for a given class + private Map<Description, Set<ObjectProperty>> app = new TreeMap<Description, Set<ObjectProperty>>(); + + // most general applicable properties + private Map<Description,Set<ObjectProperty>> mgr = new TreeMap<Description,Set<ObjectProperty>>(); + + // utility class + private Utility utility; + + public ELDown2(ReasonerComponent rs) { + this.rs = rs; + utility = new Utility(rs); + subsumptionHierarchy = rs.getClassHierarchy(); + opHierarchy = rs.getObjectPropertyHierarchy(); + + // query reasoner for domains and ranges + // (because they are used often in the operator) + for(ObjectProperty op : rs.getObjectProperties()) { + opDomains.put(op, rs.getDomain(op)); + opRanges.put(op, rs.getRange(op)); + } + } + + /* (non-Javadoc) + * @see org.dllearner.refinementoperators.RefinementOperator#refine(org.dllearner.core.owl.Description) + */ + @Override + public Set<Description> refine(Description concept) { + ELDescriptionTree tree = new ELDescriptionTree(rs, concept); + Set<ELDescriptionTree> refinementTrees = refine(tree); + Set<Description> refinements = new HashSet<Description>(); + for(ELDescriptionTree refinementTree : refinementTrees) { + refinements.add(refinementTree.transformToDescription()); + } + return refinements; + } + + /** + * Performs downward refinement for the given tree. The operator + * works directly on EL description trees (which differ from the + * the tree structures build by descriptions). + * + * @param tree Input EL description tree. + * @return Set of refined EL description trees. + */ + public Set<ELDescriptionTree> refine(ELDescriptionTree tree) { + Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); + // loop over all nodes of the tree and perform one of the + // transformations on it (we make a copy of all nodes, because + // the transformations can, of course, add new nodes) + Set<ELDescriptionNode> nodes = new HashSet<ELDescriptionNode>(tree.getNodes()); + for(ELDescriptionNode v : nodes) { + // perform operations + refinements.addAll(extendLabel(tree, v)); + refinements.addAll(refineLabel(tree, v)); + refinements.addAll(refineEdge(tree, v)); + refinements.addAll(attachSubtree(tree, v)); + } + +// return refine(tree, tree.getRootNode(), new Thing(), true); + return refinements; + } + + private Set<ELDescriptionTree> extendLabel(ELDescriptionTree tree, ELDescriptionNode v) { + return null; + } + + private Set<ELDescriptionTree> refineLabel(ELDescriptionTree tree, ELDescriptionNode v) { + return null; + } + + private Set<ELDescriptionTree> refineEdge(ELDescriptionTree tree, ELDescriptionNode v) { + return null; + } + + private Set<ELDescriptionTree> attachSubtree(ELDescriptionTree tree, ELDescriptionNode v) { + return null; + } + + private Set<ELDescriptionTree> refine(ELDescriptionTree tree, ELDescriptionNode node, Description index, boolean minimize) { + // the set of all refinements, which we will return + Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); + // the position of the node within the tree (needed for getting + // the corresponding node in a cloned tree) + int[] position = node.getCurrentPosition(); + + // option 1: label extension + Set<NamedClass> candidates = utility.getClassCandidates(index, node.getLabel()); + for(NamedClass nc : candidates) { + // clone operation + ELDescriptionTree clonedTree = tree.clone(); + ELDescriptionNode clonedNode = clonedTree.getNode(position); + // extend label + clonedNode.extendLabel(nc); + refinements.add(clonedTree); + } + + + // option 2: label refinement + // loop through all classes in label + for(NamedClass nc : node.getLabel()) { + // find all more special classes for the given label + for(Description moreSpecial : rs.getSubClasses(nc)) { + if(moreSpecial instanceof NamedClass) { + // clone operation + ELDescriptionTree clonedTree = tree.clone(); + ELDescriptionNode clonedNode = clonedTree.getNode(position); + +// System.out.println("tree: " + tree); +// System.out.println("cloned tree: " + clonedTree); +// System.out.println("node: " + node); +// System.out.println("cloned unmodified: " + clonedNode); + + // create refinements by replacing class + clonedNode.replaceInLabel(nc, (NamedClass) moreSpecial); + +// System.out.println("cloned modified: " + clonedNode); + refinements.add(clonedTree); + } + } + } + + // option 3: new edge + SortedSet<ObjectProperty> appOPs = utility.computeApplicableObjectProperties(index); + Set<ObjectProperty> mgr = utility.computeMgr(appOPs); + // temporary set of all concepts, which still have to pass the equivalence check + Stack<ELDescriptionTree> stack = new Stack<ELDescriptionTree>(); + for(ObjectProperty op : mgr) { + // clone operation + ELDescriptionTree clonedTree = tree.clone(); + ELDescriptionNode clonedNode = clonedTree.getNode(position); + // add a new node and edge + ELDescriptionNode newNode = new ELDescriptionNode(clonedNode, op, new TreeSet<NamedClass>()); + stack.add(clonedTree); + + // recurse if concept is equivalent + while(stack.size() != 0) { + // we pick an arbitrary tree and remove it from the stack + ELDescriptionTree testTree = stack.pop(); + // test equivalence (we found out that we can use the + // minimality test for equivalence in this case) + boolean equivalent = !testTree.isMinimal(); + // if the tree is equivalent, we need to populate the + // stack with refinements (which are later tested for + // equivalence) + if(equivalent) { + // edge refinement + // we know that the edge we added is the last one for this node + int edgeNr = node.getEdges().size() - 1; + ELDescriptionEdge edge = node.getEdges().get(edgeNr); + // all refinements of this edge are added to the stack + // (set 1 in article) + refineEdge(stack, tree, node, position, edgeNr); + // perform node refinements in non-minimize-mode + // (set 2 in article) +// commented out, because didn't make sense to me +// refinements.addAll(refineEdges(tree, newNode, position)); + stack.addAll(refine(tree, newNode, opRanges.get(edge), false)); + } else { + // tree is not equivalent, i.e. a proper refinement + refinements.add(testTree); + } + } + } + + // option 4: edge refinement + refinements.addAll(refineEdges(tree, node, position)); + + // option 5: child refinement + for(ELDescriptionEdge edge : node.getEdges()) { + // recursive call on child node and property range as index + Description range = rs.getRange(edge.getLabel()); +// System.out.println(tree + "\nrecurse to:\n" + edge.getTree()); + refinements.addAll(refine(tree, edge.getTree(), range, minimize)); + } + + // we found out that, in case we start from the TOP concept + // (which is assumed in the current implementation), we can + // simply throw away all non-minimal concepts + if(minimize) { + Iterator<ELDescriptionTree> it = refinements.iterator(); + while(it.hasNext()) { + if(!it.next().isMinimal()) { + it.remove(); + } + } + } + + return refinements; + } + + private Set<ELDescriptionTree> refineEdges(ELDescriptionTree tree, ELDescriptionNode node, int[] position) { + Set<ELDescriptionTree> refinements = new HashSet<ELDescriptionTree>(); + for(int edgeNumber = 0; edgeNumber < node.getEdges().size(); edgeNumber++) { + refineEdge(refinements, tree, node, position, edgeNumber); + } + return refinements; + } + + private void refineEdge(Collection<ELDescriptionTree> refinements, ELDescriptionTree tree, ELDescriptionNode node, int[] position, int edgeNumber) { + ELDescriptionEdge edge = node.getEdges().get(edgeNumber); + ObjectProperty op = edge.getLabel(); + // find all more special properties + for(ObjectProperty op2 : rs.getSubProperties(op)) { + // we check whether the range of this property is not disjoint + // with the existing child node (we do not perform a full disjointness + // check, but only compare with the flattened concept to keep the number + // of possible disjointness checks finite) + if(!utility.isDisjoint(getFlattenedConcept(edge.getTree()), opRanges.get(op2))) { + // clone operation + ELDescriptionTree clonedTree = tree.clone(); + // find cloned edge and replace its label + clonedTree.getNode(position).refineEdge(edgeNumber, op2); +// ELDescriptionEdge clonedEdge = clonedTree.getNode(position).getEdges().get(edgeNumber); +// clonedEdge.setLabel(op2); + refinements.add(clonedTree); + } + + } + } + + // simplifies a potentially nested tree in a flat conjunction by taking + // the domain of involved roles, e.g. for + // C = Professor \sqcap \exists hasChild.Student + // the result would be Professor \sqcap Human (assuming Human is the domain + // of hasChild) + private Description getFlattenedConcept(ELDescriptionNode node) { + Intersection i = new Intersection(); + + // add all named classes to intersection + for(NamedClass nc : node.getLabel()) { + i.addChild(nc); + } + // add domain of all roles to intersection + for(ELDescriptionEdge edge : node.getEdges()) { + i.addChild(opDomains.get(edge.getLabel())); + } + + // if the intersection has just one element, we return + // the element itself instead + if(i.getChildren().size() == 1) { + return i.getChild(0); + } + + return i; + } + +// private void computeMg(Description index) { +// // compute the applicable properties if this has not been done yet +// if(app.get(index) == null) +// app.put(index, utility.computeApplicableObjectProperties(index)); +// +// mgr.put(index, new TreeSet<ObjectProperty>()); +// +// +// } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-15 12:22:15
|
Revision: 1552 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1552&view=rev Author: heeroyuy Date: 2008-12-15 12:03:26 +0000 (Mon, 15 Dec 2008) Log Message: ----------- -added ignored classes when learning a super class Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/README Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -75,8 +75,8 @@ private Timer timer; private LearningAlgorithm la; private SuggestionRetriever retriever; - private final Color colorRed = new Color(139,0,0); - private final Color colorGreen = new Color(0,139,0); + private final Color colorRed = new Color(139, 0, 0); + private final Color colorGreen = new Color(0, 139, 0); /** * This is the constructor for the action handler. * Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url 2008-12-15 12:03:26 UTC (rev 1552) @@ -1,6 +0,0 @@ -[InternetShortcut] -URL=http://dl-learner.org/files/screencast/protege/prot.htm -HotKey=0 -IDList= -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -356,6 +356,19 @@ } Set<String> ignore = new TreeSet<String>(); ignore.add(currentConcept.toString()); + if(id.equals(SUPER_CLASS_AXIOM_STRING)) { + Description currentClass = (Description)currentConcept; + String currentClassString = currentConcept.toString(); + while(!currentClassString.contains("TOP")) { + Iterator<Description> it = reasoner.getSuperClasses(currentClass).iterator(); + while(it.hasNext()) { + Description ignoredClass = it.next(); + if(!ignoredClass.toString().equals("TOP")) { + ignore.add(ignoredClass.toString()); + } + } + } + } cm.applyConfigEntry(la, "ignoredConcepts", ignore); cm.applyConfigEntry(la, "noisePercentage", 5.0); cm.applyConfigEntry(la, "terminateOnNoiseReached", false); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-15 12:03:26 UTC (rev 1552) @@ -1,15 +1,16 @@ Requirements ============ -Java 6 and the Prot\xE9g\xE9 4.0 Beta are required. (All other libraries are included in the release.) +Java 6 and the Protégé 4.0 Beta are required. (All other libraries are included in the release.) Installation ============ -Put the DL-Learner-protege-plugin.jar in your plugin folder of Prot\xE9g\xE9. +Put the DL-Learner-protege-plugin.jar in your plugin folder of Protégé. Running Instructions ==================== To use the plugin go to view --> class views and click on class descriptions (including DL-Learner plugin). -Put the new frame somewhere in the classes tab in Prot\xE9g\xE9 and close the old class description view. All features are included in the plugin. -If you have problems look at the screen cast link in the release bundle. +Put the new frame somewhere in the classes tab in Protégé and close the old class description view. All features are included in the plugin. +If you have problems look at the screen cast: http://dl-learner.org/files/screencast/protege/prot.htm + Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -111,8 +111,8 @@ private EvaluatedDescription eval; private JTextArea concept; private JTextArea conceptText; - private final Color colorRed = new Color(139,0,0); - private final Color colorGreen = new Color(0,139,0); + private final Color colorRed = new Color(139, 0, 0); + private final Color colorGreen = new Color(0, 139, 0); /** * This is the constructor for the Panel. * @param model DLLearnerModel Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -144,7 +144,7 @@ helpForPosExamples = new JButton("?"); helpForPosExamples.setBounds(100, 5, 20, 20); helpForNegExamples = new JButton("?"); - helpForNegExamples.setBounds(100, 5, 20, 20); + helpForNegExamples.setBounds(105, 5, 20, 20); helpForPosExamples.setName("PosHelpButton"); helpForNegExamples.setName("NegHelpButton"); //set size for components that have no layout. Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-12-15 12:03:26 UTC (rev 1552) @@ -76,12 +76,13 @@ if (action.getActionCommand().equals("?")) { if (action.getSource().toString().contains("PosHelpButton")) { String help = "An individual that should be an instance of the learned class description.\n" - +"Per Default all that belongs to the class."; + +"Per default all that belongs to the class."; view.getPosAndNegSelectPanel().renderHelpMessage(help); } if (action.getSource().toString().contains("NegHelpButton")) { - String help = "A Instance tht doesn't follow from the classdescription."; + String help = "An individual that should not be instance of the learned class description.\n" + +" By default, these are all individuals, which are not instances of the current class."; view.getPosAndNegSelectPanel().renderHelpMessage(help); } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/README =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/README 2008-12-12 15:42:11 UTC (rev 1551) +++ trunk/src/dl-learner/org/dllearner/tools/protege/README 2008-12-15 12:03:26 UTC (rev 1552) @@ -1,15 +1,17 @@ README ====== -The Prot\xE9g\xE9 DL-Learner plugin allows to learn equivalence and super class axioms based on -the instance data in the ontologies loaded in Prot\xE9g\xE9. It integrated seamlessly in Prot\xE9g\xE9. +The Protégé DL-Learner plugin allows to learn equivalence and super class axioms based on +the instance data in the ontologies loaded in Protégé. It integrated seamlessly in Protégé. Homepage: http://dl-learner.org/wiki/ProtegePlugin Sourceforge.net Project Page: http://sourceforge.net/projects/dl-learner/ Bugs & Feature Requests: http://sourceforge.net/tracker/?group_id=203619 Mailing Lists: http://sourceforge.net/mail/?group_id=203619 Latest Release: http://sourceforge.net/project/showfiles.php?group_id=203619 +Sourcecode: https://dl-learner.svn.sourceforge.net/svnroot/dl-learner/trunk/src/dl-learner/org/dllearner/tools/protege/ -The Prot\xE9g\xE9 Plugin is Open Source and licenced under the GNU General Public License. +The Protégé Plugin is Open Source and licenced under the GNU General Public License. -Documentation for the Prot\xE9g\xE9 Plugin can be found +Documentation for the Protégé Plugin can be found at http://dl-learner.org/wiki/ProtegePlugin. + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-15 12:22:13
|
Revision: 1553 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1553&view=rev Author: heeroyuy Date: 2008-12-15 12:04:17 +0000 (Mon, 15 Dec 2008) Log Message: ----------- -small change in the Protege tasks Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2008-12-15 12:03:26 UTC (rev 1552) +++ trunk/build.xml 2008-12-15 12:04:17 UTC (rev 1553) @@ -348,7 +348,7 @@ </target> - <!--Builds the DL-Learner-Protege-plugin jar file --> + <!--Copy the DL-Learner-Protege-plugin jar file into the Protege plugin folder --> <target name="copyProtegePluginToProtegeDir" depends="protege"> <copy toDir="${protege_dir}" > <fileset dir="${release}" includes="DL-Learner-protege-plugin.jar" /> @@ -361,7 +361,7 @@ <target name="buildProtegePlugin" depends="protege"> <copy file="LICENSE" toDir="${release}" /> <copy toDir="${release}" > - <fileset dir="${source}" includes="INSTALL,README,DL-Learner-Protege-plugin-screencast.url" excludes="**/*.java,**/*.gif" /> + <fileset dir="${source}" includes="INSTALL,README" excludes="**/*.java,**/*.gif" /> </copy> <property name="ProtRelease" value="releaseProtege/" /> <mkdir dir="${ProtRelease}" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-12-12 15:42:17
|
Revision: 1551 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1551&view=rev Author: jenslehmann Date: 2008-12-12 15:42:11 +0000 (Fri, 12 Dec 2008) Log Message: ----------- added transformation to negation normal form, such that inclusion axioms can be learned with FastInstanceChecker Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java Modified: trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-12-12 13:09:10 UTC (rev 1550) +++ trunk/src/dl-learner/org/dllearner/learningproblems/PosNegInclusionLP.java 2008-12-12 15:42:11 UTC (rev 1551) @@ -29,8 +29,10 @@ import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; import org.dllearner.core.owl.Negation; +import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.Helper; import org.dllearner.utilities.datastructures.SetManipulation; +import org.dllearner.utilities.owl.ConceptTransformation; /** * The aim of this learning problem is to find an appropriate inclusion axiom @@ -191,6 +193,11 @@ */ @Override public Score computeScore(Description concept) { + // FastInstanceChecker supports only negation normal form, so we have to make + // sure to convert the description before + if(reasoner instanceof FastInstanceChecker) { + return definitionLP.computeScore(ConceptTransformation.transformToNegationNormalForm(new Negation(concept))); + } return definitionLP.computeScore(new Negation(concept)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-12-12 09:49:45
|
Revision: 1549 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1549&view=rev Author: jenslehmann Date: 2008-12-12 09:49:41 +0000 (Fri, 12 Dec 2008) Log Message: ----------- simulation unit test 6 completed Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java Modified: trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-12-09 19:00:45 UTC (rev 1548) +++ trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-12-12 09:49:41 UTC (rev 1549) @@ -319,6 +319,8 @@ // log("tree 5", tree, nodeNames); + assertTrue(!tree.isMinimal()); + // automatically generated asserts assertInSC1(v1); @@ -415,7 +417,253 @@ // logAsserts(tree, nodeNames); } + /** + * -------v_22------- + * / | \ + * r_1 r_1 r_1 + * / | \ + * v_19 v_20 v_21 + * / \ / \ / \ + * r_2 r_2 r_2 r_2 r_2 r_2 + * / | | | | | + * v_13 v_14 v_15 v_16 v_17 v_18__ + * / \ /\ /\ / \ / | | \ + * r_3 r_4 r_3 r_5 r_3 r_5 r_4 r_5 r_4 r_5 r_3 r_4 + * | | | | | | | | | | | | + * v_1 v_2 v_3 v_4 v_5 v_6 v_7 v_8 v_9 v_10 v_11 v_12 + * + * SC1=inSC1=outSC1={v_1,..,v_12}2 U {v_13,..,v_18}2 U {v_19,v_20,v_21}2 + * + * SC2={v_1,..,v_12}2 U {(v_13, v_18), (v_14,v_15), (v_16,v_17)} U + * {(v_18, v_13), (v_15,v_14), (v_17,v_16)} + * + * S={v_1,..,v_12}2 + */ + @Test + public void test6() { + ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.FIVE_ROLES); + ELDescriptionTree tree = new ELDescriptionTree(rs); + Map<ELDescriptionNode,String> nodeNames = new LinkedHashMap<ELDescriptionNode,String>(); + + ObjectProperty r1 = new ObjectProperty(uri("r1")); + ObjectProperty r2 = new ObjectProperty(uri("r2")); + ObjectProperty r3 = new ObjectProperty(uri("r3")); + ObjectProperty r4 = new ObjectProperty(uri("r4")); + ObjectProperty r5 = new ObjectProperty(uri("r5")); + + ELDescriptionNode v22 = new ELDescriptionNode(tree); + nodeNames.put(v22, "v22"); + ELDescriptionNode v21 = new ELDescriptionNode(v22, r1); + nodeNames.put(v21, "v21"); + ELDescriptionNode v20 = new ELDescriptionNode(v22, r1); + nodeNames.put(v20, "v20"); + ELDescriptionNode v19 = new ELDescriptionNode(v22, r1); + nodeNames.put(v19, "v19"); + ELDescriptionNode v18 = new ELDescriptionNode(v21, r2); + nodeNames.put(v18, "v18"); + ELDescriptionNode v17 = new ELDescriptionNode(v21, r2); + nodeNames.put(v17, "v17"); + ELDescriptionNode v16 = new ELDescriptionNode(v20, r2); + nodeNames.put(v16, "v16"); + ELDescriptionNode v15 = new ELDescriptionNode(v20, r2); + nodeNames.put(v15, "v15"); + ELDescriptionNode v14 = new ELDescriptionNode(v19, r2); + nodeNames.put(v14, "v14"); + ELDescriptionNode v13 = new ELDescriptionNode(v19, r2); + nodeNames.put(v13, "v13"); + ELDescriptionNode v12 = new ELDescriptionNode(v18, r4); + nodeNames.put(v12, "v12"); + ELDescriptionNode v11 = new ELDescriptionNode(v18, r3); + nodeNames.put(v11, "v11"); + ELDescriptionNode v10 = new ELDescriptionNode(v17, r5); + nodeNames.put(v10, "v10"); + ELDescriptionNode v9 = new ELDescriptionNode(v17, r4); + nodeNames.put(v9, "v9"); + ELDescriptionNode v8 = new ELDescriptionNode(v16, r5); + nodeNames.put(v8, "v8"); + ELDescriptionNode v7 = new ELDescriptionNode(v16, r4); + nodeNames.put(v7, "v7"); + ELDescriptionNode v6 = new ELDescriptionNode(v15, r5); + nodeNames.put(v6, "v6"); + ELDescriptionNode v5 = new ELDescriptionNode(v15, r3); + nodeNames.put(v5, "v5"); + ELDescriptionNode v4 = new ELDescriptionNode(v14, r5); + nodeNames.put(v4, "v4"); + ELDescriptionNode v3 = new ELDescriptionNode(v14, r3); + nodeNames.put(v3, "v3"); + ELDescriptionNode v2 = new ELDescriptionNode(v13, r4); + nodeNames.put(v2, "v2"); + ELDescriptionNode v1 = new ELDescriptionNode(v13, r3); + nodeNames.put(v1, "v1"); + +// log("tree 6", tree, nodeNames); +// logAsserts(tree, nodeNames); + + assertTrue(tree.isMinimal()); + + // automatically added asserts + assertInSC1(v22); + assertInSC2(v22); + assertIn(v22); + assertOutSC1(v22); + assertOutSC2(v22); + assertOut(v22); + + assertInSC1(v21,v20,v19); + assertInSC2(v21); + assertIn(v21); + assertOutSC1(v21,v20,v19); + assertOutSC2(v21); + assertOut(v21); + + assertInSC1(v20,v21,v19); + assertInSC2(v20); + assertIn(v20); + assertOutSC1(v20,v21,v19); + assertOutSC2(v20); + assertOut(v20); + + assertInSC1(v19,v20,v21); + assertInSC2(v19); + assertIn(v19); + assertOutSC1(v19,v20,v21); + assertOutSC2(v19); + assertOut(v19); + + assertInSC1(v18,v14,v16,v15,v17,v13); + assertInSC2(v18,v13); + assertIn(v18,v13); + assertOutSC1(v18,v14,v16,v15,v17,v13); + assertOutSC2(v18,v13); + assertOut(v18,v13); + + assertInSC1(v17,v14,v16,v18,v15,v13); + assertInSC2(v17,v16); + assertIn(v17,v16); + assertOutSC1(v17,v14,v16,v18,v15,v13); + assertOutSC2(v17,v16); + assertOut(v17,v16); + + assertInSC1(v16,v14,v18,v15,v17,v13); + assertInSC2(v16,v17); + assertIn(v16,v17); + assertOutSC1(v16,v14,v18,v15,v17,v13); + assertOutSC2(v16,v17); + assertOut(v16,v17); + + assertInSC1(v15,v14,v16,v18,v17,v13); + assertInSC2(v15,v14); + assertIn(v15,v14); + assertOutSC1(v15,v14,v16,v18,v17,v13); + assertOutSC2(v15,v14); + assertOut(v15,v14); + + assertInSC1(v14,v16,v18,v15,v17,v13); + assertInSC2(v14,v15); + assertIn(v14,v15); + assertOutSC1(v14,v16,v18,v15,v17,v13); + assertOutSC2(v14,v15); + assertOut(v14,v15); + + assertInSC1(v13,v14,v16,v18,v15,v17); + assertInSC2(v13,v18); + assertIn(v13,v18); + assertOutSC1(v13,v14,v16,v18,v15,v17); + assertOutSC2(v13,v18); + assertOut(v13,v18); + + assertInSC1(v12,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v10); + assertInSC2(v12,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v10); + assertIn(v12,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v10); + assertOutSC1(v12,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v10); + assertOutSC2(v12,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v10); + assertOut(v12,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v10); + + assertInSC1(v11,v3,v8,v5,v4,v9,v1,v2,v7,v6,v10,v12); + assertInSC2(v11,v3,v8,v5,v4,v9,v1,v2,v7,v6,v10,v12); + assertIn(v11,v3,v8,v5,v4,v9,v1,v2,v7,v6,v10,v12); + assertOutSC1(v11,v3,v8,v5,v4,v9,v1,v2,v7,v6,v10,v12); + assertOutSC2(v11,v3,v8,v5,v4,v9,v1,v2,v7,v6,v10,v12); + assertOut(v11,v3,v8,v5,v4,v9,v1,v2,v7,v6,v10,v12); + + assertInSC1(v10,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v12); + assertInSC2(v10,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v12); + assertIn(v10,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v12); + assertOutSC1(v10,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v12); + assertOutSC2(v10,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v12); + assertOut(v10,v3,v8,v5,v11,v4,v9,v1,v2,v7,v6,v12); + + assertInSC1(v9,v3,v8,v5,v11,v4,v1,v2,v7,v6,v10,v12); + assertInSC2(v9,v3,v8,v5,v11,v4,v1,v2,v7,v6,v10,v12); + assertIn(v9,v3,v8,v5,v11,v4,v1,v2,v7,v6,v10,v12); + assertOutSC1(v9,v3,v8,v5,v11,v4,v1,v2,v7,v6,v10,v12); + assertOutSC2(v9,v3,v8,v5,v11,v4,v1,v2,v7,v6,v10,v12); + assertOut(v9,v3,v8,v5,v11,v4,v1,v2,v7,v6,v10,v12); + + assertInSC1(v8,v3,v5,v11,v4,v9,v1,v2,v7,v6,v10,v12); + assertInSC2(v8,v3,v5,v11,v4,v9,v1,v2,v7,v6,v10,v12); + assertIn(v8,v3,v5,v11,v4,v9,v1,v2,v7,v6,v10,v12); + assertOutSC1(v8,v3,v5,v11,v4,v9,v1,v2,v7,v6,v10,v12); + assertOutSC2(v8,v3,v5,v11,v4,v9,v1,v2,v7,v6,v10,v12); + assertOut(v8,v3,v5,v11,v4,v9,v1,v2,v7,v6,v10,v12); + + assertInSC1(v7,v3,v8,v5,v11,v4,v9,v1,v2,v6,v10,v12); + assertInSC2(v7,v3,v8,v5,v11,v4,v9,v1,v2,v6,v10,v12); + assertIn(v7,v3,v8,v5,v11,v4,v9,v1,v2,v6,v10,v12); + assertOutSC1(v7,v3,v8,v5,v11,v4,v9,v1,v2,v6,v10,v12); + assertOutSC2(v7,v3,v8,v5,v11,v4,v9,v1,v2,v6,v10,v12); + assertOut(v7,v3,v8,v5,v11,v4,v9,v1,v2,v6,v10,v12); + + assertInSC1(v6,v3,v8,v5,v11,v4,v9,v1,v2,v7,v10,v12); + assertInSC2(v6,v3,v8,v5,v11,v4,v9,v1,v2,v7,v10,v12); + assertIn(v6,v3,v8,v5,v11,v4,v9,v1,v2,v7,v10,v12); + assertOutSC1(v6,v3,v8,v5,v11,v4,v9,v1,v2,v7,v10,v12); + assertOutSC2(v6,v3,v8,v5,v11,v4,v9,v1,v2,v7,v10,v12); + assertOut(v6,v3,v8,v5,v11,v4,v9,v1,v2,v7,v10,v12); + + assertInSC1(v5,v3,v8,v11,v4,v9,v1,v2,v7,v10,v6,v12); + assertInSC2(v5,v3,v8,v11,v4,v9,v1,v2,v7,v10,v6,v12); + assertIn(v5,v3,v8,v11,v4,v9,v1,v2,v7,v10,v6,v12); + assertOutSC1(v5,v3,v8,v11,v4,v9,v1,v2,v7,v10,v6,v12); + assertOutSC2(v5,v3,v8,v11,v4,v9,v1,v2,v7,v10,v6,v12); + assertOut(v5,v3,v8,v11,v4,v9,v1,v2,v7,v10,v6,v12); + + assertInSC1(v4,v3,v8,v11,v5,v9,v1,v2,v7,v10,v6,v12); + assertInSC2(v4,v3,v8,v11,v5,v9,v1,v2,v7,v10,v6,v12); + assertIn(v4,v3,v8,v11,v5,v9,v1,v2,v7,v10,v6,v12); + assertOutSC1(v4,v3,v8,v11,v5,v9,v1,v2,v7,v10,v6,v12); + assertOutSC2(v4,v3,v8,v11,v5,v9,v1,v2,v7,v10,v6,v12); + assertOut(v4,v3,v8,v11,v5,v9,v1,v2,v7,v10,v6,v12); + + assertInSC1(v3,v8,v11,v5,v4,v9,v1,v2,v7,v10,v6,v12); + assertInSC2(v3,v8,v11,v5,v4,v9,v1,v2,v7,v10,v6,v12); + assertIn(v3,v8,v11,v5,v4,v9,v1,v2,v7,v10,v6,v12); + assertOutSC1(v3,v8,v11,v5,v4,v9,v1,v2,v7,v10,v6,v12); + assertOutSC2(v3,v8,v11,v5,v4,v9,v1,v2,v7,v10,v6,v12); + assertOut(v3,v8,v11,v5,v4,v9,v1,v2,v7,v10,v6,v12); + + assertInSC1(v2,v8,v3,v11,v5,v4,v9,v1,v7,v10,v6,v12); + assertInSC2(v2,v8,v3,v11,v5,v4,v9,v1,v7,v10,v6,v12); + assertIn(v2,v8,v3,v11,v5,v4,v9,v1,v7,v10,v6,v12); + assertOutSC1(v2,v8,v3,v11,v5,v4,v9,v1,v7,v10,v6,v12); + assertOutSC2(v2,v8,v3,v11,v5,v4,v9,v1,v7,v10,v6,v12); + assertOut(v2,v8,v3,v11,v5,v4,v9,v1,v7,v10,v6,v12); + + assertInSC1(v1,v8,v3,v11,v5,v4,v9,v2,v7,v10,v6,v12); + assertInSC2(v1,v8,v3,v11,v5,v4,v9,v2,v7,v10,v6,v12); + assertIn(v1,v8,v3,v11,v5,v4,v9,v2,v7,v10,v6,v12); + assertOutSC1(v1,v8,v3,v11,v5,v4,v9,v2,v7,v10,v6,v12); + assertOutSC2(v1,v8,v3,v11,v5,v4,v9,v2,v7,v10,v6,v12); + assertOut(v1,v8,v3,v11,v5,v4,v9,v2,v7,v10,v6,v12); + + // adding an edge leads to a non-minimal tree (it collapses) + new ELDescriptionNode(v13, r5); + assertTrue(!tree.isMinimal()); + + } + // display a simulation as debug log + @SuppressWarnings("unused") private void log(String message, ELDescriptionTree tree, Map<ELDescriptionNode,String> nodeNames) { // print underlined message System.out.println(message); Modified: trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-12-09 19:00:45 UTC (rev 1548) +++ trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-12-12 09:49:41 UTC (rev 1549) @@ -36,7 +36,7 @@ */ public final class TestOntologies { - public enum TestOntology { EMPTY, SIMPLE, SIMPLE2, SIMPLE3, R1SUBR2, DATA1 }; + public enum TestOntology { EMPTY, SIMPLE, SIMPLE2, SIMPLE3, R1SUBR2, DATA1, FIVE_ROLES }; public static ReasonerComponent getTestOntology(TestOntology ont) { String kbString = ""; @@ -74,6 +74,13 @@ kbString += "married(eric,diana).\n"; kbString += "hasChild(eric,frank).\n"; kbString += "hasChild(eric,tim).\n"; + } else if(ont.equals(TestOntology.FIVE_ROLES)) { + // we only define five roles, no TBox + kbString += "r1(a,b).\n"; + kbString += "r2(a,b).\n"; + kbString += "r3(a,b).\n"; + kbString += "r4(a,b).\n"; + kbString += "r5(a,b).\n"; } try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-12-09 19:00:50
|
Revision: 1548 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1548&view=rev Author: jenslehmann Date: 2008-12-09 19:00:45 +0000 (Tue, 09 Dec 2008) Log Message: ----------- added simulation unit test 5 and fixed a bug Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/core/options/DoubleConfigOption.java trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-12-09 11:03:35 UTC (rev 1547) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-12-09 19:00:45 UTC (rev 1548) @@ -352,9 +352,7 @@ if(outSC2.contains(w)) { tree.shrinkSimulationSC12(w, this); } - if(!update.contains(w.getParent())) { - update.add(w.getParent()); - } + update.add(w.getParent()); } } } @@ -525,7 +523,14 @@ return str; } - private String toString(Set<ELDescriptionNode> nodes, Map<ELDescriptionNode,String> nodeNames) { + /** + * A convenience method (for debugging purposes) to get a comma separated list of nodes, where the + * nodes are given names (to make them readable). + * @param nodes The node objects. + * @param nodeNames A mapping to node names. + * @return A comma separated list of the node names. + */ + public static String toString(Set<ELDescriptionNode> nodes, Map<ELDescriptionNode,String> nodeNames) { String str = ""; // comma separated list of descriptions for(ELDescriptionNode node : nodes) { Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-09 11:03:35 UTC (rev 1547) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-09 19:00:45 UTC (rev 1548) @@ -334,29 +334,37 @@ List<ELDescriptionEdge> edges1 = node1.getEdges(); List<ELDescriptionEdge> edges2 = node2.getEdges(); +// System.out.println(node1.transformToDescription()); +// System.out.println(node2.transformToDescription()); + for(ELDescriptionEdge superEdge : edges2) { // try to find an edge satisfying SC2 in the set, // i.e. detect whether superEdge is indeed more general if(!checkSC2Edge(superEdge, edges1)) { +// System.out.println("false"); return false; } } - +// System.out.println("true"); return true; } // check whether edges contains an element satisfying SC2 private boolean checkSC2Edge(ELDescriptionEdge superEdge, List<ELDescriptionEdge> edges) { ObjectProperty superOP = superEdge.getLabel(); - ELDescriptionNode node1 = superEdge.getTree(); + ELDescriptionNode superNode = superEdge.getTree(); for(ELDescriptionEdge edge : edges) { +// System.out.println("superEdge: " + superEdge); +// System.out.println("edge: " + edge); + ObjectProperty op = edge.getLabel(); // we first check the condition on the properties if(roleHierarchy.isSubpropertyOf(op, superOP)) { // check condition on simulations of referred nodes - ELDescriptionNode node2 = edge.getTree(); - if(node1.in.contains(node2) || node2.in.contains(node1)) { + ELDescriptionNode node = edge.getTree(); +// if(superNode.in.contains(node) || node.in.contains(superNode)) { + if(node.in.contains(superNode)) { // we found a node satisfying the condition, so we can return return true; } Modified: trunk/src/dl-learner/org/dllearner/core/options/DoubleConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/options/DoubleConfigOption.java 2008-12-09 11:03:35 UTC (rev 1547) +++ trunk/src/dl-learner/org/dllearner/core/options/DoubleConfigOption.java 2008-12-09 19:00:45 UTC (rev 1548) @@ -57,10 +57,8 @@ */ @Override public boolean isValidValue(Double value) { - if (value >= lowerLimit && value <= upperLimit) - return true; - else - return false; + double tolerance = 0.0001; + return ((value >= lowerLimit-tolerance) && (value <= upperLimit+tolerance)); } /** Modified: trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-12-09 11:03:35 UTC (rev 1547) +++ trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-12-09 19:00:45 UTC (rev 1548) @@ -23,7 +23,9 @@ import java.util.LinkedHashMap; import java.util.Map; +import java.util.Set; import java.util.TreeSet; +import java.util.Map.Entry; import org.dllearner.algorithms.el.ELDescriptionNode; import org.dllearner.algorithms.el.ELDescriptionTree; @@ -193,27 +195,27 @@ nodeNames.put(v1, "v1"); ELDescriptionNode v2 = new ELDescriptionNode(v1, r1, a2, a3); nodeNames.put(v2, "v2"); - log("v2 added", tree, nodeNames); +// log("v2 added", tree, nodeNames); ELDescriptionNode v3 = new ELDescriptionNode(v1, r1); nodeNames.put(v3, "v3"); - log("v3 added", tree, nodeNames); +// log("v3 added", tree, nodeNames); ELDescriptionNode v4 = new ELDescriptionNode(v2, r1, a1); nodeNames.put(v4, "v4"); - log("v4 added", tree, nodeNames); +// log("v4 added", tree, nodeNames); ELDescriptionNode v5 = new ELDescriptionNode(v2, r3); nodeNames.put(v5, "v5"); - log("tmp 1", tree, nodeNames); +// log("tmp 1", tree, nodeNames); v5.extendLabel(a1); - log("tmp 2", tree, nodeNames); +// log("tmp 2", tree, nodeNames); v5.extendLabel(a2); - log("v5 added", tree, nodeNames); +// log("v5 added", tree, nodeNames); v2.refineEdge(1, r2); - log("edge refined", tree, nodeNames); +// log("edge refined", tree, nodeNames); ELDescriptionNode v6 = new ELDescriptionNode(v3, r3); nodeNames.put(v6, "v6"); - log("v6 added", tree, nodeNames); +// log("v6 added", tree, nodeNames); v6.extendLabel(a3); - log("tree 4", tree, nodeNames); +// log("tree 4", tree, nodeNames); assertEmpty(v1); @@ -257,9 +259,12 @@ * v_8 v_9 v_10 v_11 v_12 v_13 * A_1 A_2 A_2 A_1 A_2 A_2 * + * Knowledge base: A_1\sqsubseteq A_2 + r_1\sqsubseteq r_2 * * inSC1: - * (v_8,{v_9,..,v_13}), (v_9,{v_10,v_12,v_13}),... (Pattern wiederholt sich dann fuer die A_1 bzw A_2 Blaetter), (v_4,{v_5,v_6,v_7}),... (selbiges hier) (v_2,{v_3}), (v_3,{v_2}) + * (v_8,{v_9,..,v_13}), (v_9,{v_10,v_12,v_13}),... (Pattern wiederholt sich dann fuer die A_1 bzw A_2 Blaetter), + * (v_4,{v_5,v_6,v_7}),... (selbiges hier) (v_2,{v_3}), (v_3,{v_2}) * * outSC1: * (v_8,{v_11}), v_9,{v_8, v_10,...v_13}),... Pattern wiederholt sich @@ -280,8 +285,137 @@ ELDescriptionTree tree = new ELDescriptionTree(rs); Map<ELDescriptionNode,String> nodeNames = new LinkedHashMap<ELDescriptionNode,String>(); + ObjectProperty r1 = new ObjectProperty(uri("r1")); + ObjectProperty r2 = new ObjectProperty(uri("r2")); + NamedClass a1 = new NamedClass(uri("a1")); + NamedClass a2 = new NamedClass(uri("a2")); + + ELDescriptionNode v1 = new ELDescriptionNode(tree); + nodeNames.put(v1, "v1"); + ELDescriptionNode v2 = new ELDescriptionNode(v1, r2); + nodeNames.put(v2, "v2"); + ELDescriptionNode v3 = new ELDescriptionNode(v1, r1); + nodeNames.put(v3, "v3"); + ELDescriptionNode v4 = new ELDescriptionNode(v2, r1); + nodeNames.put(v4, "v4"); + ELDescriptionNode v5 = new ELDescriptionNode(v2, r1); + nodeNames.put(v5, "v5"); + ELDescriptionNode v6 = new ELDescriptionNode(v3, r1); + nodeNames.put(v6, "v6"); + ELDescriptionNode v7 = new ELDescriptionNode(v3, r2); + nodeNames.put(v7, "v7"); + ELDescriptionNode v8 = new ELDescriptionNode(v4, r2, a1); + nodeNames.put(v8, "v8"); + ELDescriptionNode v9 = new ELDescriptionNode(v4, r1, a2); + nodeNames.put(v9, "v9"); + ELDescriptionNode v10 = new ELDescriptionNode(v5, r2, a2); + nodeNames.put(v10, "v10"); + ELDescriptionNode v11 = new ELDescriptionNode(v5, r2, a1); + nodeNames.put(v11, "v11"); + ELDescriptionNode v12 = new ELDescriptionNode(v6, r1, a2); + nodeNames.put(v12, "v12"); + ELDescriptionNode v13 = new ELDescriptionNode(v7, r2, a2); + nodeNames.put(v13, "v13"); + +// log("tree 5", tree, nodeNames); + + // automatically generated asserts + + assertInSC1(v1); + assertInSC2(v1); + assertIn(v1); + assertOutSC1(v1); + assertOutSC2(v1); + assertOut(v1); + + assertInSC1(v2,v3); + assertInSC2(v2,v3); + assertIn(v2,v3); + assertOutSC1(v2,v3); + assertOutSC2(v2); + assertOut(v2); + + assertInSC1(v3,v2); + assertInSC2(v3); + assertIn(v3); + assertOutSC1(v3,v2); + assertOutSC2(v3,v2); + assertOut(v3,v2); + + assertInSC1(v4,v6,v5,v7); + assertInSC2(v4,v6,v5,v7); + assertIn(v4,v6,v5,v7); + assertOutSC1(v4,v6,v5,v7); + assertOutSC2(v4); + assertOut(v4); + + assertInSC1(v5,v4,v6,v7); + assertInSC2(v5,v7); + assertIn(v5,v7); + assertOutSC1(v5,v4,v6,v7); + assertOutSC2(v5,v4); + assertOut(v5,v4); + + assertInSC1(v6,v4,v5,v7); + assertInSC2(v6,v7); + assertIn(v6,v7); + assertOutSC1(v6,v4,v5,v7); + assertOutSC2(v6,v4); + assertOut(v6,v4); + + assertInSC1(v7,v4,v6,v5); + assertInSC2(v7); + assertIn(v7); + assertOutSC1(v7,v4,v6,v5); + assertOutSC2(v7,v4,v6,v5); + assertOut(v7,v4,v6,v5); + + assertInSC1(v8,v10,v13,v11,v9,v12); + assertInSC2(v8,v10,v13,v11,v9,v12); + assertIn(v8,v10,v13,v11,v9,v12); + assertOutSC1(v8,v11); + assertOutSC2(v8,v10,v13,v11,v9,v12); + assertOut(v8,v11); + + assertInSC1(v9,v10,v13,v12); + assertInSC2(v9,v10,v13,v11,v12,v8); + assertIn(v9,v10,v13,v12); + assertOutSC1(v9,v10,v13,v11,v12,v8); + assertOutSC2(v9,v10,v13,v11,v12,v8); + assertOut(v9,v10,v13,v11,v12,v8); + + assertInSC1(v10,v13,v9,v12); + assertInSC2(v10,v13,v11,v9,v12,v8); + assertIn(v10,v13,v9,v12); + assertOutSC1(v10,v13,v11,v9,v12,v8); + assertOutSC2(v10,v13,v11,v9,v12,v8); + assertOut(v10,v13,v11,v9,v12,v8); + + assertInSC1(v11,v10,v13,v9,v12,v8); + assertInSC2(v11,v10,v13,v9,v12,v8); + assertIn(v11,v10,v13,v9,v12,v8); + assertOutSC1(v11,v8); + assertOutSC2(v11,v10,v13,v9,v12,v8); + assertOut(v11,v8); + + assertInSC1(v12,v10,v13,v9); + assertInSC2(v12,v10,v13,v11,v9,v8); + assertIn(v12,v10,v13,v9); + assertOutSC1(v12,v10,v13,v11,v9,v8); + assertOutSC2(v12,v10,v13,v11,v9,v8); + assertOut(v12,v10,v13,v11,v9,v8); + + assertInSC1(v13,v10,v9,v12); + assertInSC2(v13,v10,v11,v9,v8,v12); + assertIn(v13,v10,v9,v12); + assertOutSC1(v13,v10,v11,v9,v8,v12); + assertOutSC2(v13,v10,v11,v9,v8,v12); + assertOut(v13,v10,v11,v9,v8,v12); + +// logAsserts(tree, nodeNames); } + // display a simulation as debug log private void log(String message, ELDescriptionTree tree, Map<ELDescriptionNode,String> nodeNames) { // print underlined message System.out.println(message); @@ -292,6 +426,35 @@ System.out.println(tree.toSimulationString(nodeNames)); } + // display Java code for assertions, i.e. the method generates the assertion code + // (under the assumption that the current algorithm output is correct, which needs + // to be verified of course) + @SuppressWarnings("unused") + private void logAsserts(ELDescriptionTree tree, Map<ELDescriptionNode,String> nodeNames) { + String str = ""; + for(Entry<ELDescriptionNode,String> entry : nodeNames.entrySet()) { + String nodeName = entry.getValue(); + ELDescriptionNode node = entry.getKey(); + str += "assertInSC1" + getAssertString(node, nodeName, node.getInSC1(), nodeNames); + str += "assertInSC2" + getAssertString(node, nodeName, node.getInSC2(), nodeNames); + str += "assertIn" + getAssertString(node, nodeName, node.getIn(), nodeNames); + str += "assertOutSC1" + getAssertString(node, nodeName, node.getOutSC1(), nodeNames); + str += "assertOutSC2" + getAssertString(node, nodeName, node.getOutSC2(), nodeNames); + str += "assertOut" + getAssertString(node, nodeName, node.getOut(), nodeNames); + str += "\n"; + } + System.out.println(str); + } + + // convenience method + private String getAssertString(ELDescriptionNode node, String nodeName, Set<ELDescriptionNode> nodes, Map<ELDescriptionNode,String> nodeNames) { + if(nodes.isEmpty()) { + return "(" + nodeName+");\n"; + } else { + return "(" + nodeName+","+ELDescriptionNode.toString(nodes, nodeNames) + ");\n"; + } + } + // all relations (in, inSC1, inSC2) should have the // the specified node set as value private void assertAll(ELDescriptionNode node, ELDescriptionNode... nodes) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-09 11:03:37
|
Revision: 1547 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1547&view=rev Author: heeroyuy Date: 2008-12-09 11:03:35 +0000 (Tue, 09 Dec 2008) Log Message: ----------- -small change in the buildProtegePlugin task Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2008-12-09 11:02:46 UTC (rev 1546) +++ trunk/build.xml 2008-12-09 11:03:35 UTC (rev 1547) @@ -303,7 +303,7 @@ </javadoc> </target> - <!-- build protege plugin and copy it to the plugin folder --> + <!-- copy all necessary files in a folder to build the jar or a release bundle --> <target name="protege"> <property name="source" value="src/dl-learner/org/dllearner/tools/protege" /> <property name="temp" value="${source}/temp" /> @@ -345,13 +345,10 @@ <jar destfile="${release}/DL-Learner-protege-plugin.jar" manifest="${temp}/META-INF/MANIFEST.MF"> <fileset dir="${temp}" /> </jar> - <copy file="LICENSE" toDir="${release}" /> - <copy toDir="${release}" > - <fileset dir="${source}" includes="Install_protege,Readme_protege" excludes="**/*.java,**/*.gif" /> - </copy> - - </target> + + </target> + <!--Builds the DL-Learner-Protege-plugin jar file --> <target name="copyProtegePluginToProtegeDir" depends="protege"> <copy toDir="${protege_dir}" > <fileset dir="${release}" includes="DL-Learner-protege-plugin.jar" /> @@ -360,8 +357,15 @@ <delete dir="${release}" /> </target> + <!--Builds the Releasebundle --> <target name="buildProtegePlugin" depends="protege"> - <zip destfile="${source}/protege-plugin.zip" + <copy file="LICENSE" toDir="${release}" /> + <copy toDir="${release}" > + <fileset dir="${source}" includes="INSTALL,README,DL-Learner-Protege-plugin-screencast.url" excludes="**/*.java,**/*.gif" /> + </copy> + <property name="ProtRelease" value="releaseProtege/" /> + <mkdir dir="${ProtRelease}" /> + <zip destfile="${ProtRelease}/DL-Learner-plugin.zip" basedir="${release}" /> <delete dir="${temp}" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-09 11:02:49
|
Revision: 1546 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1546&view=rev Author: heeroyuy Date: 2008-12-09 11:02:46 +0000 (Tue, 09 Dec 2008) Log Message: ----------- -added link to the screen cast Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL trunk/src/dl-learner/org/dllearner/tools/protege/README Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/protege/Install_protege trunk/src/dl-learner/org/dllearner/tools/protege/Readme_protege Added: trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DL-Learner-Protege-plugin-screencast.url 2008-12-09 11:02:46 UTC (rev 1546) @@ -0,0 +1,6 @@ +[InternetShortcut] +URL=http://dl-learner.org/files/screencast/protege/prot.htm +HotKey=0 +IDList= +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 Added: trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/INSTALL 2008-12-09 11:02:46 UTC (rev 1546) @@ -0,0 +1,15 @@ +Requirements +============ +Java 6 and the Prot\xE9g\xE9 4.0 Beta are required. (All other libraries are included in the release.) + +Installation +============ +Put the DL-Learner-protege-plugin.jar in your plugin folder of Prot\xE9g\xE9. + +Running Instructions +==================== +To use the plugin go to view --> class views and click on class descriptions (including DL-Learner plugin). +Put the new frame somewhere in the classes tab in Prot\xE9g\xE9 and close the old class description view. All features are included in the plugin. +If you have problems look at the screen cast link in the release bundle. + + Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/Install_protege =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/Install_protege 2008-12-08 13:06:44 UTC (rev 1545) +++ trunk/src/dl-learner/org/dllearner/tools/protege/Install_protege 2008-12-09 11:02:46 UTC (rev 1546) @@ -1,15 +0,0 @@ -Requirements -============ -Java 6 and the Prot\xE9g\xE9 4.0 Beta are required. (All other libraries are included in the release.) - -Installation -============ -Put the DL-Learner-protege-plugin.jar in your plugin folder of Prot\xE9g\xE9. - -Running Instructions -==================== -To use the plugin go to view --> class views and click on class descriptions (including DL-Learner plugin). -Put the new frame somewhere in the classes tab in Prot\xE9g\xE9 and close the old class description view. All features are included in the plugin. -If you have problems look at the screen cast in the release bundle. - - Added: trunk/src/dl-learner/org/dllearner/tools/protege/README =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/README (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/README 2008-12-09 11:02:46 UTC (rev 1546) @@ -0,0 +1,15 @@ +README +====== +The Prot\xE9g\xE9 DL-Learner plugin allows to learn equivalence and super class axioms based on +the instance data in the ontologies loaded in Prot\xE9g\xE9. It integrated seamlessly in Prot\xE9g\xE9. + +Homepage: http://dl-learner.org/wiki/ProtegePlugin +Sourceforge.net Project Page: http://sourceforge.net/projects/dl-learner/ +Bugs & Feature Requests: http://sourceforge.net/tracker/?group_id=203619 +Mailing Lists: http://sourceforge.net/mail/?group_id=203619 +Latest Release: http://sourceforge.net/project/showfiles.php?group_id=203619 + +The Prot\xE9g\xE9 Plugin is Open Source and licenced under the GNU General Public License. + +Documentation for the Prot\xE9g\xE9 Plugin can be found +at http://dl-learner.org/wiki/ProtegePlugin. Deleted: trunk/src/dl-learner/org/dllearner/tools/protege/Readme_protege =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/Readme_protege 2008-12-08 13:06:44 UTC (rev 1545) +++ trunk/src/dl-learner/org/dllearner/tools/protege/Readme_protege 2008-12-09 11:02:46 UTC (rev 1546) @@ -1,15 +0,0 @@ -README -====== -The Prot\xE9g\xE9 DL-Learner plugin allows to learn equivalence and super class axioms based on -the instance data in the ontologies loaded in Prot\xE9g\xE9. It integrated seamlessly in Prot\xE9g\xE9. - -Homepage: http://dl-learner.org/wiki/ProtegePlugin -Sourceforge.net Project Page: http://sourceforge.net/projects/dl-learner/ -Bugs & Feature Requests: http://sourceforge.net/tracker/?group_id=203619 -Mailing Lists: http://sourceforge.net/mail/?group_id=203619 -Latest Release: http://sourceforge.net/project/showfiles.php?group_id=203619 - -The Prot\xE9g\xE9 Plugin is Open Source and licenced under the GNU General Public License. - -Documentation for the Prot\xE9g\xE9 Plugin can be found -at http://dl-learner.org/wiki/ProtegePlugin. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-12-08 13:06:51
|
Revision: 1545 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1545&view=rev Author: jenslehmann Date: 2008-12-08 13:06:44 +0000 (Mon, 08 Dec 2008) Log Message: ----------- continued EL simulation updates (now all 4 unit tests pass) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionEdge.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionEdge.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionEdge.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionEdge.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -66,4 +66,9 @@ return tree; } + @Override + public String toString() { + return "--" + label + "--> " + tree.toDescriptionString(); + } + } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionNode.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -174,7 +174,7 @@ // } // } - System.out.println(update); +// System.out.println(update); // apply updates recursively top-down tree.updateSimulation(update); @@ -335,13 +335,42 @@ // compute the nodes, which need to be updated Set<ELDescriptionNode> update = new HashSet<ELDescriptionNode>(); + Set<ELDescriptionNode> tmp = tree.getNodesOnLevel(level); + for(ELDescriptionNode w : tmp) { + if(w != this) { + // SC1(v,w) can only change from false to true + if(!inSC1.contains(w) && tree.checkSC1(this, w)) { + tree.extendSimulationSC1(this, w); + if(inSC2.contains(w)) { + tree.extendSimulationSC12(this, w); + } + update.add(w.getParent()); + } + // SC1(w,v) can only change from true to false + if(outSC1.contains(w) && !tree.checkSC1(w, this)) { + tree.shrinkSimulationSC1(w, this); + if(outSC2.contains(w)) { + tree.shrinkSimulationSC12(w, this); + } + if(!update.contains(w.getParent())) { + update.add(w.getParent()); + } + } + } + } + if(parent != null) { + update.add(parent); + } + + /* // loop over all nodes on the same level, which are not in the in set Set<ELDescriptionNode> tmp = new HashSet<ELDescriptionNode>(tree.getNodesOnLevel(level)); tmp.removeAll(in); for(ELDescriptionNode w : tmp) { if(w != this) { - // we only need to recompute SC2 + // we only need to recompute SC1 if(inSC1.contains(w) && tree.checkSC2(this, w)) { + System.out.println("satisfied"); tree.extendSimulation(this, w); update.add(w.parent); } @@ -361,6 +390,7 @@ } } } + */ // apply updates recursively top-down tree.updateSimulation(update); @@ -371,7 +401,9 @@ // compute the nodes, which need to be updated Set<ELDescriptionNode> update = new HashSet<ELDescriptionNode>(); + update.add(this); + /* // loop over all nodes on the same level, which are not in the in set Set<ELDescriptionNode> tmp = new HashSet<ELDescriptionNode>(tree.getNodesOnLevel(level)); tmp.removeAll(in); @@ -394,7 +426,10 @@ } } } + */ +// update.add(this.parent); + // apply updates recursively top-down tree.updateSimulation(update); } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELDescriptionTree.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -237,6 +237,42 @@ Set<ELDescriptionNode> sameLevel = levelNodeMapping.get(v.getLevel()); for(ELDescriptionNode w : sameLevel) { if(v != w) { + +// System.out.println(v); +// System.out.println(w); + + // we update if SC2 did not hold but does now + if(!v.inSC2.contains(w) && checkSC2(v,w)) { +// System.out.println("extend sim. after update"); + + extendSimulationSC2(v,w); + if(v.inSC1.contains(w)) { + extendSimulationSC12(v,w); + } + if(!list.contains(v.getParent())) { + list.add(v.getParent()); + } + if(!list.contains(w.getParent())) { + list.add(w.getParent()); + } + } + + // similar case, but now possibly shrinking the simulation + if(w.inSC2.contains(v) && !checkSC2(w,v)) { +// System.out.println("shrink sim. after update"); + + shrinkSimulationSC2(w,v); + if(w.inSC1.contains(v)) { + shrinkSimulationSC12(w,v); + } + if(!list.contains(v.getParent())) { + list.add(v.getParent()); + } + if(!list.contains(w.getParent())) { + list.add(w.getParent()); + } + } + /* if(!v.out.contains(w) ) { System.out.println("test"); if(checkSC2(v,w) && v.outSC1.contains(w)) { @@ -257,6 +293,7 @@ shrinkSimulationSC2(w,v); } } + */ } } } @@ -297,9 +334,10 @@ List<ELDescriptionEdge> edges1 = node1.getEdges(); List<ELDescriptionEdge> edges2 = node2.getEdges(); - for(ELDescriptionEdge edge : edges1) { - // try to find an edge satisfying SC2 in the set - if(!checkSC2Edge(edge, edges2)) { + for(ELDescriptionEdge superEdge : edges2) { + // try to find an edge satisfying SC2 in the set, + // i.e. detect whether superEdge is indeed more general + if(!checkSC2Edge(superEdge, edges1)) { return false; } } @@ -308,16 +346,16 @@ } // check whether edges contains an element satisfying SC2 - private boolean checkSC2Edge(ELDescriptionEdge edge, List<ELDescriptionEdge> edges) { - ObjectProperty op1 = edge.getLabel(); - ELDescriptionNode node1 = edge.getTree(); + private boolean checkSC2Edge(ELDescriptionEdge superEdge, List<ELDescriptionEdge> edges) { + ObjectProperty superOP = superEdge.getLabel(); + ELDescriptionNode node1 = superEdge.getTree(); - for(ELDescriptionEdge edge2 : edges) { - ObjectProperty op2 = edge2.getLabel(); + for(ELDescriptionEdge edge : edges) { + ObjectProperty op = edge.getLabel(); // we first check the condition on the properties - if(roleHierarchy.isSubpropertyOf(op1, op2)) { + if(roleHierarchy.isSubpropertyOf(op, superOP)) { // check condition on simulations of referred nodes - ELDescriptionNode node2 = edge2.getTree(); + ELDescriptionNode node2 = edge.getTree(); if(node1.in.contains(node2) || node2.in.contains(node1)) { // we found a node satisfying the condition, so we can return return true; @@ -371,10 +409,10 @@ } public void shrinkSimulationSC2(ELDescriptionNode node1, ELDescriptionNode node2) { - System.out.println(node2.outSC2); +// System.out.println(node2.outSC2); node1.inSC2.remove(node2); node2.outSC2.remove(node1); - System.out.println(node2.outSC2); +// System.out.println(node2.outSC2); } public void shrinkSimulationSC12(ELDescriptionNode node1, ELDescriptionNode node2) { Modified: trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ClassHierarchy.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -147,6 +147,7 @@ return true; } else { for (Description moreGeneralClass : subsumptionHierarchyUp.get(subClass)) { + // search the upper classes of the subclass if (moreGeneralClass instanceof NamedClass) { if (isSubclassOf((NamedClass) moreGeneralClass, superClass)) { Modified: trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/core/owl/DatatypeProperty.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -69,4 +69,22 @@ public int compareTo(DatatypeProperty o) { return name.compareTo(o.name); } + + @Override + public boolean equals(Object nc) { + // standard equals code - always return true for object identity and + // false if classes differ + if(nc == this) { + return true; + } else if(getClass() != nc.getClass()) { + return false; + } + // compare on URIs + return ((DatatypeProperty)nc).name.equals(name); + } + + @Override + public int hashCode() { + return name.hashCode(); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/core/owl/NamedClass.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -32,7 +32,7 @@ */ public class NamedClass extends Description implements Entity, NamedKBElement, Comparable<NamedClass> { - String name; + private String name; public NamedClass(String name) { this.name = name; @@ -82,4 +82,22 @@ public int compareTo(NamedClass o) { return name.compareTo(o.name); } + + @Override + public boolean equals(Object nc) { + // standard equals code - always return true for object identity and + // false if classes differ + if(nc == this) { + return true; + } else if(getClass() != nc.getClass()) { + return false; + } + // compare on URIs + return ((NamedClass)nc).name.equals(name); + } + + @Override + public int hashCode() { + return name.hashCode(); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectProperty.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -60,4 +60,22 @@ public int compareTo(ObjectProperty o) { return name.compareTo(o.name); } + + @Override + public boolean equals(Object nc) { + // standard equals code - always return true for object identity and + // false if classes differ + if(nc == this) { + return true; + } else if(getClass() != nc.getClass()) { + return false; + } + // compare on URIs + return ((ObjectProperty)nc).name.equals(name); + } + + @Override + public int hashCode() { + return name.hashCode(); + } } Modified: trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/core/owl/ObjectPropertyHierarchy.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -74,6 +74,7 @@ if(subProperty.equals(superProperty)) { return true; } else { +// System.out.println("oph: " + subProperty + " " + superProperty); for(ObjectProperty moreGeneralProperty : roleHierarchyUp.get(subProperty)) { if(isSubpropertyOf(moreGeneralProperty, superProperty)) { return true; Modified: trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/test/junit/SimulationTests.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -200,14 +200,19 @@ ELDescriptionNode v4 = new ELDescriptionNode(v2, r1, a1); nodeNames.put(v4, "v4"); log("v4 added", tree, nodeNames); - ELDescriptionNode v5 = new ELDescriptionNode(v2, r3, a1, a2); + ELDescriptionNode v5 = new ELDescriptionNode(v2, r3); nodeNames.put(v5, "v5"); + log("tmp 1", tree, nodeNames); + v5.extendLabel(a1); + log("tmp 2", tree, nodeNames); + v5.extendLabel(a2); log("v5 added", tree, nodeNames); v2.refineEdge(1, r2); log("edge refined", tree, nodeNames); - ELDescriptionNode v6 = new ELDescriptionNode(v3, r3, a3); + ELDescriptionNode v6 = new ELDescriptionNode(v3, r3); nodeNames.put(v6, "v6"); - log("v6 added", tree, nodeNames); + log("v6 added", tree, nodeNames); + v6.extendLabel(a3); log("tree 4", tree, nodeNames); assertEmpty(v1); @@ -233,9 +238,50 @@ assertInSC1(v6); assertIn(v6); assertOut(v6,v5); - assertOutSC1(v6,v5); + assertOutSC1(v6,v5); } + /** + * v_1 + * / \ + * r_2 r_1 + * / \ + * v_2 v_3 + * / | | \ + * r_1 r_1 r_1 r_2 + * / | | \ + * v_4 v_5 v_6 v_7 + * / | | \ | | + * r_2 r_1 r_2 r_2 r_1 r_2 + * / | | | | | + * v_8 v_9 v_10 v_11 v_12 v_13 + * A_1 A_2 A_2 A_1 A_2 A_2 + * + * + * inSC1: + * (v_8,{v_9,..,v_13}), (v_9,{v_10,v_12,v_13}),... (Pattern wiederholt sich dann fuer die A_1 bzw A_2 Blaetter), (v_4,{v_5,v_6,v_7}),... (selbiges hier) (v_2,{v_3}), (v_3,{v_2}) + * + * outSC1: + * (v_8,{v_11}), v_9,{v_8, v_10,...v_13}),... Pattern wiederholt sich + * fuer restliche Knoten gilt inSC1=outSC1 + * + * inSC2: + * {v_8,...,v_13}2, (v_4,{v_5, v_6, v_7}), (v_5,{v_7}), (v_6,{v_7}) + * (v_2,{v_3}) + * + * outSC2: + * {v_8,...,v_13}2, (v_5,{v_4}), (v_6,{v_4}), (v_7,{v_5, v_6}), (v_3,{v_2}) + * + * Baum ist nicht minimal. + */ + @Test + public void test5() { + ReasonerComponent rs = TestOntologies.getTestOntology(TestOntology.SIMPLE3); + ELDescriptionTree tree = new ELDescriptionTree(rs); + Map<ELDescriptionNode,String> nodeNames = new LinkedHashMap<ELDescriptionNode,String>(); + + } + private void log(String message, ELDescriptionTree tree, Map<ELDescriptionNode,String> nodeNames) { // print underlined message System.out.println(message); Modified: trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-12-07 22:42:39 UTC (rev 1544) +++ trunk/src/dl-learner/org/dllearner/test/junit/TestOntologies.java 2008-12-08 13:06:44 UTC (rev 1545) @@ -36,7 +36,7 @@ */ public final class TestOntologies { - public enum TestOntology { EMPTY, SIMPLE, SIMPLE2, R1SUBR2, DATA1 }; + public enum TestOntology { EMPTY, SIMPLE, SIMPLE2, SIMPLE3, R1SUBR2, DATA1 }; public static ReasonerComponent getTestOntology(TestOntology ont) { String kbString = ""; @@ -55,9 +55,13 @@ kbString += "cat SUB animal.\n"; kbString += "(human AND animal) = BOTTOM.\n"; } else if(ont.equals(TestOntology.SIMPLE2)) { - kbString += "Subrole(r1,r2).\n"; + kbString += "Subrole(r2,r3).\n"; kbString += "a1 SUB TOP.\n"; kbString += "a2 SUB a3.\n"; + kbString += "r1(a,b).\n"; // we have to declare r1 + } else if(ont.equals(TestOntology.SIMPLE3)) { + kbString += "a1 SUB a2.\n"; + kbString += "Subrole(r1,r2).\n"; } else if(ont.equals(TestOntology.R1SUBR2)) { kbString += "Subrole(r1,r2).\n"; kbString += "a1 SUB TOP.\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-07 22:42:48
|
Revision: 1544 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1544&view=rev Author: heeroyuy Date: 2008-12-07 22:42:39 +0000 (Sun, 07 Dec 2008) Log Message: ----------- -added task to build protege plugin release Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2008-12-07 22:42:06 UTC (rev 1543) +++ trunk/build.xml 2008-12-07 22:42:39 UTC (rev 1544) @@ -4,7 +4,7 @@ <!-- directory settings --> <property name="lib_dir" value="lib" /> <property name="source_dir" value="src/dl-learner" /> - <property name="protege_dir" value="/home/jl/programme/Protege_4.0_beta/plugins" /> + <property name="protege_dir" value="C:/Programme/Protege_4.0_beta/plugins" /> <property name="class_dir" value="classes" /> <property name="php_client_dir" value="src/php-client" /> @@ -307,8 +307,10 @@ <target name="protege"> <property name="source" value="src/dl-learner/org/dllearner/tools/protege" /> <property name="temp" value="${source}/temp" /> + <property name="release" value="${source}/release" /> <mkdir dir="${temp}" /> + <mkdir dir="${release}" /> <mkdir dir="${temp}/META-INF" /> <mkdir dir="${temp}/lib" /> <mkdir dir="${temp}/lib/pellet" /> @@ -340,11 +342,30 @@ debug="on"> <classpath refid="classpath"/> </javac> - <jar destfile="${protege_dir}/dl-learner.jar" manifest="${temp}/META-INF/MANIFEST.MF"> + <jar destfile="${release}/DL-Learner-protege-plugin.jar" manifest="${temp}/META-INF/MANIFEST.MF"> <fileset dir="${temp}" /> </jar> - <delete dir="${temp}" /> + <copy file="LICENSE" toDir="${release}" /> + <copy toDir="${release}" > + <fileset dir="${source}" includes="Install_protege,Readme_protege" excludes="**/*.java,**/*.gif" /> + </copy> </target> + <target name="copyProtegePluginToProtegeDir" depends="protege"> + <copy toDir="${protege_dir}" > + <fileset dir="${release}" includes="DL-Learner-protege-plugin.jar" /> + </copy> + <delete dir="${temp}" /> + <delete dir="${release}" /> + </target> + + <target name="buildProtegePlugin" depends="protege"> + <zip destfile="${source}/protege-plugin.zip" + basedir="${release}" + /> + <delete dir="${temp}" /> + <delete dir="${release}" /> + </target> + </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-12-07 22:42:12
|
Revision: 1543 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1543&view=rev Author: heeroyuy Date: 2008-12-07 22:42:06 +0000 (Sun, 07 Dec 2008) Log Message: ----------- -added arrows for the buttons to change an individual to positive or negative example list -added install and readme Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/protege/Install_protege trunk/src/dl-learner/org/dllearner/tools/protege/Readme_protege trunk/src/dl-learner/org/dllearner/tools/protege/backspace.gif trunk/src/dl-learner/org/dllearner/tools/protege/space.gif Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-02 15:26:20 UTC (rev 1542) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-12-07 22:42:06 UTC (rev 1543) @@ -75,6 +75,8 @@ private Timer timer; private LearningAlgorithm la; private SuggestionRetriever retriever; + private final Color colorRed = new Color(139,0,0); + private final Color colorGreen = new Color(0,139,0); /** * This is the constructor for the action handler. * @@ -220,16 +222,27 @@ for (Iterator<EvaluatedDescription> i = model .getEvaluatedDescriptionList().iterator(); i.hasNext();) { eDescription = i.next(); - if (desc.equals(eDescription.getDescription() - .toManchesterSyntaxString( - editorKit.getModelManager() - .getActiveOntology().getURI().toString() - , null))) { - evaluatedDescription = eDescription; - - break; + if(eDescription.getDescription().toString().contains("#")) { + if (desc.equals(eDescription.getDescription() + .toManchesterSyntaxString( + editorKit.getModelManager() + .getActiveOntology().getURI().toString() + "#" + , null))) { + evaluatedDescription = eDescription; + + break; + } + } else { + if (desc.equals(eDescription.getDescription() + .toManchesterSyntaxString( + editorKit.getModelManager() + .getActiveOntology().getURI().toString() + , null))) { + evaluatedDescription = eDescription; + + break; + } } - } } @@ -400,14 +413,26 @@ while(ont.hasNext()) { String onto = ont.next().getURI().toString(); if(eval.getDescription().toString().contains(onto)) { - if(model.isConsistent(eval)) { - dm.add(i, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(onto, null))); - i++; - break; + if(eval.getDescription().toString().contains("#")) { + if(model.isConsistent(eval)) { + dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); + i++; + break; + } else { + dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(onto+"#", null))); + i++; + break; + } } else { - dm.add(i, new SuggestListItem(Color.RED, eval.getDescription().toManchesterSyntaxString(onto, null))); - i++; - break; + if(model.isConsistent(eval)) { + dm.add(i, new SuggestListItem(colorGreen, eval.getDescription().toManchesterSyntaxString(onto, null))); + i++; + break; + } else { + dm.add(i, new SuggestListItem(colorRed, eval.getDescription().toManchesterSyntaxString(onto, null))); + i++; + break; + } } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-02 15:26:20 UTC (rev 1542) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-07 22:42:06 UTC (rev 1543) @@ -402,25 +402,49 @@ OWLOntology ont = onto.next(); String indiv = ind.toString(); // checks if individual belongs to the selected concept - if (setPositivExamplesChecked(indiv)) { - if (indiv.contains(ont.getURI().toString())) { - // when yes then it sets the positive example checked + if(ind.toString().contains("#")) { + if (setPositivExamplesChecked(indiv)) { + if (indiv.contains(ont.getURI().toString())) { + // when yes then it sets the positive example checked - // OWLExpressionCheckerFactory - posListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString(), null)); - individualVector.add(new IndividualObject(indiv, true)); - break; + // OWLExpressionCheckerFactory + posListModel.add(0, ind.toManchesterSyntaxString(ont + .getURI().toString()+"#", null)); + individualVector.add(new IndividualObject(indiv, true)); + break; + } + + } else { + // When no it unchecks the positive example + if (indiv.contains(ont.getURI().toString())) { + individualVector + .add(new IndividualObject(indiv, false)); + negListModel.add(0, ind.toManchesterSyntaxString(ont + .getURI().toString()+"#", null)); + break; + } } + } else { + if (setPositivExamplesChecked(indiv)) { + if (indiv.contains(ont.getURI().toString())) { + // when yes then it sets the positive example checked - } else { - // When no it unchecks the positive example - if (indiv.contains(ont.getURI().toString())) { - individualVector - .add(new IndividualObject(indiv, false)); - negListModel.add(0, ind.toManchesterSyntaxString(ont - .getURI().toString(), null)); - break; + // OWLExpressionCheckerFactory + posListModel.add(0, ind.toManchesterSyntaxString(ont + .getURI().toString(), null)); + individualVector.add(new IndividualObject(indiv, true)); + break; + } + + } else { + // When no it unchecks the positive example + if (indiv.contains(ont.getURI().toString())) { + individualVector + .add(new IndividualObject(indiv, false)); + negListModel.add(0, ind.toManchesterSyntaxString(ont + .getURI().toString(), null)); + break; + } } } } Added: trunk/src/dl-learner/org/dllearner/tools/protege/Install_protege =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/Install_protege (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/Install_protege 2008-12-07 22:42:06 UTC (rev 1543) @@ -0,0 +1,15 @@ +Requirements +============ +Java 6 and the Prot\xE9g\xE9 4.0 Beta are required. (All other libraries are included in the release.) + +Installation +============ +Put the DL-Learner-protege-plugin.jar in your plugin folder of Prot\xE9g\xE9. + +Running Instructions +==================== +To use the plugin go to view --> class views and click on class descriptions (including DL-Learner plugin). +Put the new frame somewhere in the classes tab in Prot\xE9g\xE9 and close the old class description view. All features are included in the plugin. +If you have problems look at the screen cast in the release bundle. + + Modified: trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-02 15:26:20 UTC (rev 1542) +++ trunk/src/dl-learner/org/dllearner/tools/protege/MoreDetailForSuggestedConceptsPanel.java 2008-12-07 22:42:06 UTC (rev 1543) @@ -109,10 +109,10 @@ private JPanel negCoveredPanel; private JPanel negNotCoveredPanel; private EvaluatedDescription eval; - private final Color colorRed = Color.red; private JTextArea concept; private JTextArea conceptText; - private final Color colorGreen = Color.green; + private final Color colorRed = new Color(139,0,0); + private final Color colorGreen = new Color(0,139,0); /** * This is the constructor for the Panel. * @param model DLLearnerModel @@ -239,7 +239,12 @@ private void setInformation() { if(eval!=null) { //sets the accuracy of the selected concept - conceptText.setText(eval.getDescription().toManchesterSyntaxString(model.getURI().toString(), null)); + System.out.println("EVAL: " + eval.getDescription()); + if(eval.getDescription().toString().contains("#")) { + conceptText.setText(eval.getDescription().toManchesterSyntaxString(model.getURI().toString() + "#", null)); + } else { + conceptText.setText(eval.getDescription().toManchesterSyntaxString(model.getURI().toString(), null)); + } double acc = (eval.getAccuracy())*100; accuracyText.setText(String.valueOf(acc)+"%"); Iterator<Individual> i = eval.getCoveredPositives().iterator(); @@ -248,10 +253,20 @@ Individual ind = i.next(); while (onto.hasNext()) { String uri = onto.next().getURI().toString(); - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorGreen); - posCoveredPanel.add(posLabel); + if(ind.toString().contains("#")) { + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); + posLabel.setForeground(colorGreen); + posCoveredPanel.add(posLabel); + break; + } + } else { + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); + posLabel.setForeground(colorGreen); + posCoveredPanel.add(posLabel); + break; + } } } @@ -264,10 +279,20 @@ Individual ind = a.next(); while (onto.hasNext()) { String uri = onto.next().getURI().toString(); - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorRed); - posNotCoveredPanel.add(posLabel); + if(ind.toString().contains("#")) { + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); + posLabel.setForeground(colorRed); + posNotCoveredPanel.add(posLabel); + break; + } + } else { + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); + posLabel.setForeground(colorRed); + posNotCoveredPanel.add(posLabel); + break; + } } } @@ -282,10 +307,20 @@ Individual ind = b.next(); while (onto.hasNext()) { String uri = onto.next().getURI().toString(); - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorRed); - negCoveredPanel.add(posLabel); + if(ind.toString().contains("#")) { + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); + posLabel.setForeground(colorRed); + negCoveredPanel.add(posLabel); + break; + } + } else { + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); + posLabel.setForeground(colorRed); + negCoveredPanel.add(posLabel); + break; + } } } @@ -299,10 +334,18 @@ Individual ind = c.next(); while (onto.hasNext()) { String uri = onto.next().getURI().toString(); - if(ind.toString().contains(uri)) { - JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); - posLabel.setForeground(colorGreen); - negNotCoveredPanel.add(posLabel); + if(ind.toString().contains("#")) { + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri + "#", null)); + posLabel.setForeground(colorGreen); + negNotCoveredPanel.add(posLabel); + } + } else { + if(ind.toString().contains(uri)) { + JLabel posLabel = new JLabel(ind.toManchesterSyntaxString(uri, null)); + posLabel.setForeground(colorGreen); + negNotCoveredPanel.add(posLabel); + } } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-12-02 15:26:20 UTC (rev 1542) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-12-07 22:42:06 UTC (rev 1543) @@ -61,7 +61,7 @@ minAccuracy.setPaintLabels(true); - maxExecutionTime = new JSlider(2, 20, 3); + maxExecutionTime = new JSlider(2, 20, 5); maxExecutionTime.setPaintTicks(true); maxExecutionTime.setMajorTickSpacing(5); maxExecutionTime.setMinorTickSpacing(1); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-12-02 15:26:20 UTC (rev 1542) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanel.java 2008-12-07 22:42:06 UTC (rev 1543) @@ -21,8 +21,10 @@ import java.awt.Dimension; import java.awt.GridLayout; +import java.net.URL; import javax.swing.DefaultListModel; +import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JList; @@ -90,6 +92,8 @@ // This is the Text area where the help message is displayed. private OptionPanel optionPanel; private DefaultListModel posListModel; + private ImageIcon addToPosListIcon; + private ImageIcon addToNegListIcon; private DefaultListModel negListModel; private JPanel examplePanel; private PosAndNegSelectPanelHandler handler; @@ -117,6 +121,10 @@ examplePanel = new JPanel(null); posLabelPanel = new JPanel(null); negLabelPanel = new JPanel(null); + URL iconUrl = this.getClass().getResource("backspace.gif"); + addToPosListIcon = new ImageIcon(iconUrl); + URL toggledIconUrl = this.getClass().getResource("space.gif"); + addToNegListIcon = new ImageIcon(toggledIconUrl); posListModel = new DefaultListModel(); negListModel = new DefaultListModel(); pos = new JLabel("Positive Examples"); @@ -129,8 +137,10 @@ negList = new JList(negListModel); negList.setName("neg"); negList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - addToPosExamples = new JButton("pos"); - addToNegExamples = new JButton("neg"); + addToPosExamples = new JButton(addToPosListIcon); + addToPosExamples.setName("pos"); + addToNegExamples = new JButton(addToNegListIcon); + addToNegExamples.setName("neg"); helpForPosExamples = new JButton("?"); helpForPosExamples.setBounds(100, 5, 20, 20); helpForNegExamples = new JButton("?"); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-12-02 15:26:20 UTC (rev 1542) +++ trunk/src/dl-learner/org/dllearner/tools/protege/PosAndNegSelectPanelHandler.java 2008-12-07 22:42:06 UTC (rev 1543) @@ -60,8 +60,8 @@ */ public void actionPerformed(ActionEvent action) { - - if (action.getActionCommand().equals("pos")) { + System.out.println(action.getSource()); + if (action.getSource().toString().contains("pos")) { panel.setExampleToOtherList(true, panel.getNegExampleList().getSelectedValue().toString()); System.out.println("COUNT: " + panel.getPosExampleList().getModel().getSize()); if(panel.getPosExampleList().getModel().getSize()>0) { @@ -69,7 +69,7 @@ } } - if (action.getActionCommand().equals("neg")) { + if (action.getSource().toString().contains("neg")) { panel.setExampleToOtherList(false, panel.getPosExampleList().getSelectedValue().toString()); } Added: trunk/src/dl-learner/org/dllearner/tools/protege/Readme_protege =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/Readme_protege (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/protege/Readme_protege 2008-12-07 22:42:06 UTC (rev 1543) @@ -0,0 +1,15 @@ +README +====== +The Prot\xE9g\xE9 DL-Learner plugin allows to learn equivalence and super class axioms based on +the instance data in the ontologies loaded in Prot\xE9g\xE9. It integrated seamlessly in Prot\xE9g\xE9. + +Homepage: http://dl-learner.org/wiki/ProtegePlugin +Sourceforge.net Project Page: http://sourceforge.net/projects/dl-learner/ +Bugs & Feature Requests: http://sourceforge.net/tracker/?group_id=203619 +Mailing Lists: http://sourceforge.net/mail/?group_id=203619 +Latest Release: http://sourceforge.net/project/showfiles.php?group_id=203619 + +The Prot\xE9g\xE9 Plugin is Open Source and licenced under the GNU General Public License. + +Documentation for the Prot\xE9g\xE9 Plugin can be found +at http://dl-learner.org/wiki/ProtegePlugin. Added: trunk/src/dl-learner/org/dllearner/tools/protege/backspace.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/tools/protege/backspace.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/src/dl-learner/org/dllearner/tools/protege/space.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/tools/protege/space.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2008-12-02 15:26:31
|
Revision: 1542 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1542&view=rev Author: lorenz_b Date: 2008-12-02 15:26:20 +0000 (Tue, 02 Dec 2008) Log Message: ----------- jars required for explain debugging results new owlapi-bin.jar is used Added Paths: ----------- trunk/lib/ore-tool/owlapi-bin.jar trunk/lib/ore-tool/pellet-cli.jar trunk/lib/ore-tool/pellet-explanation.jar trunk/lib/ore-tool/pellet-owlapi.jar Added: trunk/lib/ore-tool/owlapi-bin.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/ore-tool/owlapi-bin.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lib/ore-tool/pellet-cli.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/ore-tool/pellet-cli.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lib/ore-tool/pellet-explanation.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/ore-tool/pellet-explanation.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/lib/ore-tool/pellet-owlapi.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/ore-tool/pellet-owlapi.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jen...@us...> - 2008-12-02 13:18:01
|
Revision: 1541 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1541&view=rev Author: JensLehmann Date: 2008-12-02 13:17:57 +0000 (Tue, 02 Dec 2008) Log Message: ----------- corrected option value to double Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-01 11:24:10 UTC (rev 1540) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-12-02 13:17:57 UTC (rev 1541) @@ -357,7 +357,7 @@ Set<String> ignore = new TreeSet<String>(); ignore.add(currentConcept.toString()); cm.applyConfigEntry(la, "ignoredConcepts", ignore); - cm.applyConfigEntry(la, "noisePercentage", 5); + cm.applyConfigEntry(la, "noisePercentage", 5.0); cm.applyConfigEntry(la, "terminateOnNoiseReached", false); cm.applyConfigEntry(la, "negationPenalty", 2); cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2008-12-01 11:24:18
|
Revision: 1540 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1540&view=rev Author: lorenz_b Date: 2008-12-01 11:24:10 +0000 (Mon, 01 Dec 2008) Log Message: ----------- fixed failures caused by reasoning updates Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardController.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTest.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2008-12-01 07:40:08 UTC (rev 1539) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2008-12-01 11:24:10 UTC (rev 1540) @@ -61,6 +61,7 @@ desc.setText(((EvaluatedDescription) value).getDescription().toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); //round accuracy to 2 digits double accuracy = ((EvaluatedDescription) value).getAccuracy(); + BigDecimal roundedAccuracy = new BigDecimal(accuracy * 100); roundedAccuracy = roundedAccuracy.setScale(2, BigDecimal.ROUND_HALF_UP); cor.setText(roundedAccuracy.toString()); Added: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTest.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTest.java 2008-12-01 11:24:10 UTC (rev 1540) @@ -0,0 +1,102 @@ +package org.dllearner.tools.ore; + +import java.io.IOException; +import java.io.PrintWriter; +import java.net.URI; +import java.util.Set; + +import org.mindswap.pellet.owlapi.Reasoner; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLException; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; + +import com.clarkparsia.explanation.PelletExplanation; +import com.clarkparsia.explanation.io.manchester.ManchesterSyntaxExplanationRenderer; + + +public class ExplanationTest { + +// private static final String file = "file:examples/ore/inconsistent.owl"; + private static final String file = "file:examples/ore/buggyPolicy.owl"; + private static final String NS = "http://cohse.semanticweb.org/ontologies/people#"; + + /** + * @param args + */ + public static void main(String[] args) { + + try { + PelletExplanation.setup(); + + // The renderer is used to pretty print explanation + ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); + // The writer used for the explanation rendered + PrintWriter out = new PrintWriter( System.out ); + renderer.startRendering( out ); + + // Create an OWLAPI manager that allows to load an ontology file and + // create OWLEntities + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLOntology ontology = manager.loadOntology( URI.create( file ) ); + OWLDataFactory factory = manager.getOWLDataFactory(); + + // Create the reasoner and load the ontology + Reasoner reasoner = new Reasoner( manager ); + reasoner.loadOntology( ontology ); + + // Create an explanation generator + PelletExplanation expGen = new PelletExplanation( reasoner ); + + // Create some concepts + OWLClass madCow = factory.getOWLClass( URI.create( NS + "mad+cow" ) ); + OWLClass animalLover = factory.getOWLClass( URI.create( NS + "animal+lover" ) ); + OWLClass petOwner = factory.getOWLClass( URI.create( NS + "pet+owner" ) ); + + //Explain why ontology is inconsistent + out.println( "Why is ontology inconsistent?" ); + renderer.render(expGen.getInconsistencyExplanations()); + + out.println( "unsatisfiable classes:" ); + for(OWLClass cl : reasoner.getClasses()){ + if(!reasoner.isSatisfiable(cl)){ + out.println(cl); + renderer.render(expGen.getUnsatisfiableExplanations(cl)); + } + } + + + + + // Explain why mad cow is an unsatisfiable concept + Set<Set<OWLAxiom>> exp = expGen.getUnsatisfiableExplanations( madCow ); + out.println( "Why is " + madCow + " concept unsatisfiable?" ); + renderer.render( exp ); + + // Now explain why animal lover is a sub class of pet owner + exp = expGen.getSubClassExplanations( animalLover, petOwner ); + out.println( "Why is " + animalLover + " subclass of " + petOwner + "?" ); + renderer.render( exp ); + + renderer.endRendering(); + } catch (OWLOntologyCreationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedOperationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OWLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} + + Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-12-01 07:40:08 UTC (rev 1539) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-12-01 11:24:10 UTC (rev 1540) @@ -66,8 +66,8 @@ private PosNegDefinitionLP lp; private ComponentManager cm; - private FastInstanceChecker fastReasoner; - private OWLAPIReasoner owlReasoner; + private ReasonerComponent fastReasoner; + private ReasonerComponent owlReasoner; private SortedSet<Individual> posExamples; private SortedSet<Individual> negExamples; @@ -85,9 +85,9 @@ public ORE() { - + cm = ComponentManager.getInstance(); - + } // step 1: detect knowledge sources @@ -141,7 +141,7 @@ modifier = new OntologyModifier(owlReasoner, rs); baseURI = fastReasoner.getBaseURI(); prefixes = fastReasoner.getPrefixes(); - + } /** @@ -155,9 +155,10 @@ public void setPosNegExamples(){ - posExamples = rs.getIndividuals(classToLearn); - negExamples = rs.getIndividuals(); + posExamples = owlReasoner.getIndividuals(classToLearn); + negExamples = owlReasoner.getIndividuals(); + for (Individual pos : posExamples){ negExamples.remove(pos); } @@ -182,11 +183,11 @@ return prefixes; } - public OWLAPIReasoner getOwlReasoner() { + public ReasonerComponent getOwlReasoner() { return owlReasoner; } - public FastInstanceChecker getFastReasoner() { + public ReasonerComponent getFastReasoner() { return fastReasoner; } @@ -470,8 +471,8 @@ */ public Set<NamedClass> getpossibleClassesMoveTo(Individual ind){ Set<NamedClass> moveClasses = new HashSet<NamedClass>(); - for(NamedClass nc : rs.getNamedClasses()){ - if(!rs.hasType(nc, ind)){ + for(NamedClass nc : owlReasoner.getNamedClasses()){ + if(!owlReasoner.hasType(nc, ind)){ moveClasses.add(nc); } } @@ -487,8 +488,8 @@ */ public Set<NamedClass> getpossibleClassesMoveFrom(Individual ind){ Set<NamedClass> moveClasses = new HashSet<NamedClass>(); - for(NamedClass nc : rs.getNamedClasses()){ - if(rs.hasType(nc, ind)){ + for(NamedClass nc : owlReasoner.getNamedClasses()){ + if(owlReasoner.hasType(nc, ind)){ moveClasses.add(nc); } } @@ -541,9 +542,34 @@ return complements; } + + + + public static void main(String[] args){ + final ORE test = new ORE(); + + File owlFile1 = new File("examples/ore/people+pets.owl"); + File owlFile2 = new File("examples/ore/inconsistent.owl"); + File owlFile3 = new File("examples/ore/incohaerent.owl"); + + test.setKnowledgeSource(owlFile1); + test.initReasoners(); + System.out.println(test.owlReasoner.isSatisfiable()); + + test.setKnowledgeSource(owlFile2); + test.initReasoners(); + System.out.println(test.owlReasoner.isSatisfiable()); + + test.setKnowledgeSource(owlFile3); + test.initReasoners(); + System.out.println(test.owlReasoner.isSatisfiable()); + + + + + } } - // public static void main(String[] args){ // // final ORE test = new ORE(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-12-01 07:40:08 UTC (rev 1539) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OntologyModifier.java 2008-12-01 11:24:10 UTC (rev 1540) @@ -75,17 +75,17 @@ public class OntologyModifier { private OWLOntology ontology; - private OWLAPIReasoner reasoner; + private ReasonerComponent reasoner; private OWLDataFactory factory; private OWLOntologyManager manager; private ReasonerComponent rs; - public OntologyModifier(OWLAPIReasoner reasoner, ReasonerComponent rs){ + public OntologyModifier(ReasonerComponent reasoner, ReasonerComponent rs){ this.reasoner = reasoner; this.manager = OWLManager.createOWLOntologyManager(); this.factory = manager.getOWLDataFactory(); - this.ontology = reasoner.getOWLAPIOntologies().get(0); + this.ontology = ((OWLAPIReasoner)reasoner).getOWLAPIOntologies().get(0); this.rs = rs; } @@ -595,7 +595,7 @@ } OWLDebugger debugger = new BlackBoxOWLDebugger(manager, ontology, checker); - for(OWLClass owlClass : reasoner.getInconsistentOWLClasses()){ + for(OWLClass owlClass : ((OWLAPIReasoner)reasoner).getInconsistentOWLClasses()){ /* Find the sets of support and print them */ Set<Set<OWLAxiom>> allsos = null; try { Modified: trunk/src/dl-learner/org/dllearner/tools/ore/WizardController.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/WizardController.java 2008-12-01 07:40:08 UTC (rev 1539) +++ trunk/src/dl-learner/org/dllearner/tools/ore/WizardController.java 2008-12-01 11:24:10 UTC (rev 1540) @@ -282,8 +282,8 @@ wizard.getModel().getOre().initReasoners(); - Set<NamedClass> ind = wizard.getModel().getOre() - .getReasonerComponent().getNamedClasses(); + Set<NamedClass> ind = wizard.getModel().getOre().getOwlReasoner().getNamedClasses(); + return ind; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2008-12-01 07:40:13
|
Revision: 1539 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1539&view=rev Author: kurzum Date: 2008-12-01 07:40:08 +0000 (Mon, 01 Dec 2008) Log Message: ----------- corpus still halfway done Added Paths: ----------- trunk/src/dl-learner/org/dllearner/examples/Corpus.java trunk/src/dl-learner/org/dllearner/examples/corpus/ trunk/src/dl-learner/org/dllearner/examples/corpus/Sentence.java Added: trunk/src/dl-learner/org/dllearner/examples/Corpus.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/Corpus.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/examples/Corpus.java 2008-12-01 07:40:08 UTC (rev 1539) @@ -0,0 +1,127 @@ +package org.dllearner.examples; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +import org.dllearner.examples.corpus.Sentence; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.AddAxiom; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.util.SimpleURIMapper; + +public class Corpus { + + static BufferedReader br = null; + static File file; + public static String namespace = "http://www.test.de/test"; + static OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + public static OWLDataFactory factory; + static OWLOntology currentOntology; + + /** + * @param args + */ + public static void main(String[] args) { + file= new File("ling/test.export"); + init(); + try{ + Sentence sentence = nextSentence(); + sentence.processSentence(); + + /*for (String line : sentence) { + System.out.println(line); + }*/ + }catch (Exception e) { + e.printStackTrace(); + } + + saveOntology(); + } + + + + public static Sentence nextSentence()throws IOException { + List<String> retList = new ArrayList<String>(); + int retID = 0; + String line = ""; + boolean proceed = true; + while (proceed ) { + line = br.readLine(); + if (line == null){ + break; + }else if(line.startsWith("#EOS")){ + + proceed = false; + }else if(line.startsWith("%%")||line.startsWith("#BOS")){ + if(line.startsWith("#BOS")){ + StringTokenizer s = new StringTokenizer(line); + s.nextToken(); + String id = s.nextToken(); + retID = Integer.parseInt(id); + } + proceed = true;; + }else{ + retList.add(line); + } + } + + return new Sentence(retID, retList); + + } + + + + public static void init(){ + try{ + br = new BufferedReader(new FileReader(file)); + URI ontologyURI = URI.create(namespace); + //URI physicalURI = new File("cache/"+System.currentTimeMillis()+".owl").toURI(); + URI physicalURI = new File("cache/tiger.owl").toURI(); + SimpleURIMapper mapper = new SimpleURIMapper(ontologyURI, physicalURI); + manager.addURIMapper(mapper); + try{ + currentOntology = manager.createOntology(ontologyURI); + }catch(OWLOntologyCreationException e){ + //logger.error("FATAL failed to create Ontology " + ontologyURI); + e.printStackTrace(); + } + factory = manager.getOWLDataFactory(); + + }catch (Exception e) { + e.printStackTrace(); + System.exit(0); + } + } + + public static void addAxiom(OWLAxiom axiom){ + AddAxiom addAxiom = new AddAxiom(currentOntology, axiom); + try{ + manager.applyChange(addAxiom); + }catch (OWLOntologyChangeException e) { + //TODO + e.printStackTrace(); + } + } + + public static void saveOntology(){ + try{ + manager.saveOntology(currentOntology); + //manager.s + }catch (Exception e) { + e.printStackTrace(); + + } + } + +} Added: trunk/src/dl-learner/org/dllearner/examples/corpus/Sentence.java =================================================================== --- trunk/src/dl-learner/org/dllearner/examples/corpus/Sentence.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/examples/corpus/Sentence.java 2008-12-01 07:40:08 UTC (rev 1539) @@ -0,0 +1,124 @@ +package org.dllearner.examples.corpus; + +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +import org.dllearner.examples.Corpus; +import org.dllearner.utilities.URLencodeUTF8; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLClassAssertionAxiom; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLIndividual; +import org.semanticweb.owl.model.OWLObject; +import org.semanticweb.owl.model.OWLObjectProperty; + +public class Sentence { + int id ; + OWLIndividual sentenceURI; + List<String> sentence; + List<String> wordsInOrder; + List<String> urisInOrder; + + OWLClass element; + OWLClass structElement; + OWLClass wordElement; + OWLClass sentenceClass; + + OWLClass tagClass; + OWLClass morphClass; + OWLClass edgeClass; + + OWLObjectProperty hasElement; + + public Sentence(int id, List<String> sentence) { + super(); + this.id = id; + this.sentence = sentence; + this.sentenceURI = Corpus.factory.getOWLIndividual(URI.create(Corpus.namespace+"#"+"satz"+id)); + + this.urisInOrder = new ArrayList<String>(); + this.wordsInOrder = new ArrayList<String>(); + + element = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#Element")); + structElement = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#StructureElement")); + wordElement = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#WordElement")); + sentenceClass = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#Sentence")); + tagClass = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#Tag")); + morphClass = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#Morph")); + edgeClass = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#Edge")); + + hasElement = Corpus.factory.getOWLObjectProperty(URI.create(Corpus.namespace+"#hasElement")); + + Corpus.addAxiom(Corpus.factory.getOWLClassAssertionAxiom(this.sentenceURI,sentenceClass )); + } + + public void processSentence(){ + + int pos=0; + for (String line : sentence) { + + processLine(line,pos); + pos++; + } + } + + + public void processLine(String line, int pos){ + String elementURL = Corpus.namespace+"#"; + OWLIndividual lineElement; + StringTokenizer st = new StringTokenizer(line); + + //%String %% word lemma tag morph edge parent secedge comment + String word = st.nextToken(); + String lemma = st.nextToken(); + String tag = st.nextToken(); + String morph = st.nextToken(); + String edge = st.nextToken(); + String parent = st.nextToken(); + //word + if(word.startsWith("#")){ + elementURL+="s_"+id+"_"+word.substring(1); + lineElement = Corpus.factory.getOWLIndividual(URI.create(elementURL)); + Corpus.addAxiom(Corpus.factory.getOWLClassAssertionAxiom(lineElement, structElement)); + + }else{ + elementURL+="s_"+id+"_"+pos+"_"+URLencodeUTF8.encode(word); + wordsInOrder.add(word); + urisInOrder.add(elementURL); + lineElement = Corpus.factory.getOWLIndividual(URI.create(elementURL)); + Corpus.addAxiom(Corpus.factory.getOWLClassAssertionAxiom(lineElement, wordElement)); + Corpus.addAxiom(Corpus.factory.getOWLEntityAnnotationAxiom(lineElement, Corpus.factory.getCommentAnnotation(line))); + Corpus.addAxiom(Corpus.factory.getOWLEntityAnnotationAxiom(lineElement, Corpus.factory.getOWLLabelAnnotation(word))); + } + + Corpus.addAxiom(Corpus.factory.getOWLObjectPropertyAssertionAxiom(sentenceURI, hasElement, lineElement)); + + //tag + tag = (tag.equals("$("))?"SentenceBoundary":tag; + //morph + morph= "m_"+URLencodeUTF8.encode(morph); + makeClasses(lineElement, tag,morph,edge); + + } + + void makeClasses(OWLIndividual lineElement, String tag, String morph, String edge){ + if(!tag.equals("--")){ + OWLDescription d = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#"+tag)); + Corpus.addAxiom(Corpus.factory.getOWLClassAssertionAxiom(lineElement,d )); + Corpus.addAxiom(Corpus.factory.getOWLSubClassAxiom(d, tagClass)); + } + if(!morph.equals("m_--")){ + + OWLDescription d = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#"+morph)); + Corpus.addAxiom(Corpus.factory.getOWLClassAssertionAxiom(lineElement,d )); + Corpus.addAxiom(Corpus.factory.getOWLSubClassAxiom(d, morphClass)); + } + if(!edge.equals("--")){ + OWLDescription d = Corpus.factory.getOWLClass(URI.create(Corpus.namespace+"#"+edge)); + Corpus.addAxiom(Corpus.factory.getOWLClassAssertionAxiom(lineElement,d )); + Corpus.addAxiom(Corpus.factory.getOWLSubClassAxiom(d, edgeClass)); + } + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-30 16:29:30
|
Revision: 1538 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1538&view=rev Author: heeroyuy Date: 2008-11-30 16:29:25 +0000 (Sun, 30 Nov 2008) Log Message: ----------- -fixed problem with listupdate while learning Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-30 15:09:42 UTC (rev 1537) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-30 16:29:25 UTC (rev 1538) @@ -75,7 +75,6 @@ private Timer timer; private LearningAlgorithm la; private SuggestionRetriever retriever; - /** * This is the constructor for the action handler. * @@ -110,9 +109,6 @@ public void actionPerformed(ActionEvent z) { if (z.getActionCommand().equals(id)) { - if (model.getAlreadyLearned()) { - model.unsetListModel(); - } model.setKnowledgeSource(); model.setReasoner(); model.setPositiveAndNegativeExamples(); @@ -122,8 +118,6 @@ view.renderErrorMessage("learning started"); view.getPosAndNegSelectPanel().setCheckBoxesEnable(false); retriever = new SuggestionRetriever(); - // - // dlLearner.start(); retriever.execute(); } @@ -301,6 +295,9 @@ // TODO Auto-generated method stub } + + + /** * Inner Class that retrieves the concepts given by the DL-Learner. * @author Christian Koetteritzsch @@ -322,18 +319,14 @@ timer.schedule(new TimerTask(){ @Override - public void run() { - System.out.println("DA BIN ICH:"); + public void run() { if (la != null) { - - //System.out.println("EVAL: " + la.getCurrentlyBestEvaluatedDescriptions().isEmpty()); - //System.out.println("SIZE: " + la.getCurrentlyBestEvaluatedDescriptions().size()); publish(la.getCurrentlyBestEvaluatedDescriptions(view.getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts() , view.getPosAndNegSelectPanel().getOptionPanel().getMinAccuracy(), true)); } } - }, 0, 1000); + }, 0, 500); dlLearner = new Thread(new Runnable() { @@ -374,8 +367,7 @@ e.printStackTrace(); } - view.getRunButton().setEnabled(true); - System.out.println("DONE"); + view.algorithmTerminated(); updateList(result); } @@ -397,7 +389,6 @@ public void run() { - System.out.println("JETZT HIER:"); model.setSuggestList(result); // learnPanel.getListModel().clear(); dm.clear(); @@ -421,7 +412,6 @@ } } } - System.out.println("NAJA NUN HIER"); view.getSuggestClassPanel().setSuggestList(dm); } }; Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-30 15:09:42 UTC (rev 1537) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-30 16:29:25 UTC (rev 1538) @@ -46,7 +46,7 @@ import org.dllearner.kb.OWLAPIOntology; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegInclusionLP; -import org.dllearner.reasoning.OWLAPIReasoner; +import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.jdesktop.swingx.JXTaskPane; import org.protege.editor.owl.OWLEditorKit; @@ -68,13 +68,13 @@ * @author Christian Koetteritzsch * */ -public class DLLearnerModel implements Runnable { +public class DLLearnerModel implements Runnable{ // The Sting is for components that are available in the DL-Learner private String[] componenten = { "org.dllearner.kb.OWLFile", "org.dllearner.reasoning.OWLAPIReasoner", - "org.dllearner.reasoning.DIGReasoner", + "org.dllearner.reasoning.FastInstanceChecker", "org.dllearner.reasoning.FastRetrievalReasoner", "org.dllearner.learningproblems.PosNegInclusionLP", "org.dllearner.learningproblems.PosNegDefinitionLP", @@ -90,6 +90,8 @@ // The Reasoning Service for the Reasoner private ReasonerComponent rs; + private static final String EQUIVALENT_CLASS_AXIOM_STRING = "Suggest equivalent class"; + private static final String SUPER_CLASS_AXIOM_STRING = "Suggest super class"; // The View of the DL-Learner Plugin @@ -127,7 +129,7 @@ // The Reasoner which is used to learn - private OWLAPIReasoner reasoner; + private FastInstanceChecker reasoner; // A Set of Descriptions in OWL Syntax which the DL-Learner suggested @@ -172,7 +174,6 @@ // The error message which is rendered when an error occured - private String error; // This is the new axiom which will be added to the Ontology @@ -184,7 +185,7 @@ private DefaultListModel posListModel; private DefaultListModel negListModel; private Set<KnowledgeSource> sources; - //private KnowledgeSource source; + // private KnowledgeSource source; private boolean hasIndividuals; private NamedClass currentConcept; private Vector<IndividualObject> individualVector; @@ -288,20 +289,22 @@ * OWLAPIOntology will be available. */ public void setKnowledgeSource() { - //Ssource = new OWLAPIOntology(editor.getModelManager().getActiveOntology()); - Iterator<OWLOntology> it = editor.getModelManager().getActiveOntologies().iterator(); + // source = new + // OWLAPIOntology(editor.getModelManager().getActiveOntology()); + Iterator<OWLOntology> it = editor.getModelManager() + .getActiveOntologies().iterator(); while (it.hasNext()) { sources.add(new OWLAPIOntology(it.next())); } } /** - * This method sets the reasoner and the reasoning service Only - * OWLAPIReasoner is available. + * This method sets the reasoner. Only + * FastInstanceChecker is available. */ public void setReasoner() { - this.reasoner = cm.reasoner(OWLAPIReasoner.class, sources); - + this.reasoner = cm.reasoner(FastInstanceChecker.class, sources); + try { reasoner.init(); } catch (ComponentInitException e) { @@ -318,12 +321,12 @@ * classes. */ public void setLearningProblem() { - if (id.equals("Suggest equivalent class")) { + if (id.equals(EQUIVALENT_CLASS_AXIOM_STRING)) { // sets the learning problem to PosNegDefinitionLP when the // dllearner should suggest an equivalent class lp = cm.learningProblem(PosNegDefinitionLP.class, reasoner); } - if (id.equals("Suggest super class")) { + if (id.equals(SUPER_CLASS_AXIOM_STRING)) { // sets the learning problem to PosNegInclusionLP when the dllearner // should suggest a subclass lp = cm.learningProblem(PosNegInclusionLP.class, reasoner); @@ -354,6 +357,9 @@ Set<String> ignore = new TreeSet<String>(); ignore.add(currentConcept.toString()); cm.applyConfigEntry(la, "ignoredConcepts", ignore); + cm.applyConfigEntry(la, "noisePercentage", 5); + cm.applyConfigEntry(la, "terminateOnNoiseReached", false); + cm.applyConfigEntry(la, "negationPenalty", 2); cm.applyConfigEntry(la, "maxExecutionTimeInSeconds", view .getPosAndNegSelectPanel().getOptionPanel() .getMaxExecutionTime()); @@ -367,18 +373,6 @@ } /** - * This method starts the learning process. - */ - public void run() { - error = "learning succesful"; - String message = "To view details about why a class description was suggested, please doubleclick on it."; - // start the algorithm and print the best concept found - la.start(); - view.renderErrorMessage(error); - view.setHintMessage(message); - } - - /** * This method returns the Concepts from the DL-Learner. * * @return Array of learned Concepts. @@ -386,17 +380,12 @@ public Description[] getSolutions() { return description; } - /** - * This method gets an error message and storess it. - * - * @param err - * error message + * Starts the learning algorithm. */ - public void setErrorMessage(String err) { - this.error = err; + public void run() { + la.start(); } - /** * This method sets the check boxes for the positive check boxes checked if * the individuals matches the concept that is chosen in protege. @@ -416,8 +405,8 @@ if (setPositivExamplesChecked(indiv)) { if (indiv.contains(ont.getURI().toString())) { // when yes then it sets the positive example checked - - //OWLExpressionCheckerFactory + + // OWLExpressionCheckerFactory posListModel.add(0, ind.toManchesterSyntaxString(ont .getURI().toString(), null)); individualVector.add(new IndividualObject(indiv, true)); @@ -475,10 +464,11 @@ if (individuals == null) { NamedClass concept = i.next(); // checks if the concept is the selected concept in protege - if(concept.toString().contains("#")) { - if (concept.toString().endsWith("#"+ - current.getRootObject().toString())) { - // if individuals is not null it gets all individuals of + if (concept.toString().contains("#")) { + if (concept.toString().endsWith( + "#" + current.getRootObject().toString())) { + // if individuals is not null it gets all + // individuals of // the concept currentConcept = concept; if (reasoner.getIndividuals(concept) != null) { @@ -491,8 +481,9 @@ } } else { if (concept.toString().endsWith( - current.getRootObject().toString())) { - // if individuals is not null it gets all individuals of + current.getRootObject().toString())) { + // if individuals is not null it gets all + // individuals of // the concept currentConcept = concept; if (reasoner.getIndividuals(concept) != null) { @@ -517,8 +508,6 @@ /** * This Method checks if the selected class has any individuals. * - * @param owlConcept - * OWLClass * @return boolean hasIndividuals */ public boolean hasIndividuals() { @@ -729,11 +718,11 @@ OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLDataFactory factory = manager.getOWLDataFactory(); - if (id.equals("Suggest equivalent class")) { + if (id.equals(EQUIVALENT_CLASS_AXIOM_STRING)) { axiomOWLAPI = factory.getOWLEquivalentClassesAxiom(ds); } else { - axiomOWLAPI = factory.getOWLSubClassAxiom(newConceptOWLAPI, - oldConceptOWLAPI); + axiomOWLAPI = factory.getOWLSubClassAxiom(oldConceptOWLAPI, + newConceptOWLAPI); } OWLOntology onto = editor.getModelManager().getActiveOntology(); AddAxiom axiom = new AddAxiom(onto, axiomOWLAPI); @@ -801,21 +790,73 @@ public void setSuggestList(List<EvaluatedDescription> list) { evalDescriptions = list; } - + + /** + * This method returns the OWLEditorKit. + * @return OWLEditorKit + */ public OWLEditorKit getOWLEditorKit() { return editor; } - + /** - * This method returns the currently used ontoloies including - * importet ontologies. + * This method returns the currently used ontoloies including importet + * ontologies. + * * @return Set<OWLAPIOntology> ontologies */ public Set<OWLAPIOntology> getOWLOntologies() { return ontologies; } - + + /** + * This method returns the Knowledgesources currenty used. + * @return Set<KnowledgSource> + */ public Set<KnowledgeSource> getKnowledgeSources() { return sources; } + + /*public void updateSuggestListItems() { + evalDescriptions = la.getCurrentlyBestEvaluatedDescriptions(view + .getPosAndNegSelectPanel().getOptionPanel().getNrOfConcepts(), + view.getPosAndNegSelectPanel().getOptionPanel() + .getMinAccuracy(), true); + // learnPanel.getListModel().clear(); + DefaultListModel dm = new DefaultListModel(); + Iterator<EvaluatedDescription> it = evalDescriptions.iterator(); + int i = 0; + while (it.hasNext()) { + Iterator<OWLOntology> ont = editor.getModelManager() + .getActiveOntologies().iterator(); + EvaluatedDescription eval = it.next(); + while (ont.hasNext()) { + String onto = ont.next().getURI().toString(); + if (eval.getDescription().toString().contains(onto)) { + if (isConsistent(eval)) { + dm.add(i, new SuggestListItem(Color.GREEN, eval + .getDescription().toManchesterSyntaxString( + onto, null))); + i++; + break; + } else { + dm.add(i, new SuggestListItem(Color.RED, eval + .getDescription().toManchesterSyntaxString( + onto, null))); + i++; + break; + } + } + } + } + view.getSuggestClassPanel().setSuggestList(dm); + } + + public void algorithmTerminated() { + error = "learning succesful"; + String message = "To view details about why a class description was suggested, please doubleclick on it."; + // start the algorithm and print the best concept found + view.renderErrorMessage(error); + view.setHintMessage(message); + }*/ } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2008-11-30 15:09:42 UTC (rev 1537) +++ trunk/src/dl-learner/org/dllearner/tools/protege/IndividualObject.java 2008-11-30 16:29:25 UTC (rev 1538) @@ -31,7 +31,6 @@ /** * Constructor for the IndividualObject. * @param normal String - * @param manchester String * @param pos boolean */ public IndividualObject(String normal, boolean pos) { Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-30 15:09:42 UTC (rev 1537) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OWLClassDescriptionEditorWithDLLearnerTab.java 2008-11-30 16:29:25 UTC (rev 1538) @@ -629,6 +629,18 @@ public void addAdvancedButtonListener(ActionListener a) { advanced.addActionListener(a); } + + /** + * This method sets the run button enable after learning. + */ + public void algorithmTerminated() { + String error = "learning succesful"; + String message = "To view details about why a class description was suggested, please doubleclick on it."; + run.setEnabled(true); + // start the algorithm and print the best concept found + renderErrorMessage(error); + setHintMessage(message); + } } /** Modified: trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-11-30 15:09:42 UTC (rev 1537) +++ trunk/src/dl-learner/org/dllearner/tools/protege/OptionPanel.java 2008-11-30 16:29:25 UTC (rev 1538) @@ -54,14 +54,14 @@ maxExecutionTimeLabel = new JLabel("maximum execution time"); nrOfConceptsLabel = new JLabel("maximum number of results"); - minAccuracy = new JSlider(50, 100, 50); + minAccuracy = new JSlider(50, 100, 90); minAccuracy.setPaintTicks(true); minAccuracy.setMajorTickSpacing(10); minAccuracy.setMinorTickSpacing(1); minAccuracy.setPaintLabels(true); - maxExecutionTime = new JSlider(5, 20, 10); + maxExecutionTime = new JSlider(2, 20, 3); maxExecutionTime.setPaintTicks(true); maxExecutionTime.setMajorTickSpacing(5); maxExecutionTime.setMinorTickSpacing(1); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2008-11-30 15:09:42 UTC (rev 1537) +++ trunk/src/dl-learner/org/dllearner/tools/protege/SuggestClassPanel.java 2008-11-30 16:29:25 UTC (rev 1538) @@ -88,7 +88,6 @@ * @param desc List model of descriptions made by the DL-Learner */ public void setSuggestList(DefaultListModel desc) { - System.out.println("HUHU"); descriptions.setModel(desc); repaint(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-11-30 15:09:45
|
Revision: 1537 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1537&view=rev Author: jenslehmann Date: 2008-11-30 15:09:42 +0000 (Sun, 30 Nov 2008) Log Message: ----------- extended learning algorithm options wrt. ontology engineering Modified Paths: -------------- trunk/examples/swore/swore.conf trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.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/PrologParser.java trunk/src/dl-learner/org/dllearner/parser/PrologParserConstants.java trunk/src/dl-learner/org/dllearner/parser/PrologParserTokenManager.java trunk/src/dl-learner/org/dllearner/parser/SimpleCharStream.java trunk/src/dl-learner/org/dllearner/parser/Token.java trunk/src/dl-learner/org/dllearner/parser/TokenMgrError.java trunk/src/dl-learner/org/dllearner/tools/protege/ProtegePlugin.java Modified: trunk/examples/swore/swore.conf =================================================================== --- trunk/examples/swore/swore.conf 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/examples/swore/swore.conf 2008-11-30 15:09:42 UTC (rev 1537) @@ -1,8 +1,32 @@ +/** + * Example file for typical ontology engineering setup. + * + * SWORE is the SoftWiki ontology for requirements engineering. + * + * Desired Solution: + * CustomerRequirement = Requirement AND EXISTS createdBy Customer + */ + import("swore.rdf"); +// ignore class for which we want to learn a definition refexamples.ignoredConcepts = { "http://ns.softwiki.de/req/CustomerRequirement" }; -refexamples.ignoredRoles = { "http://ns.softwiki.de/req/broader" }; +// we usually have a configurable minimum accuracy and should set noise to 100 - (min. accuracy)/2 +// because min. accuracy is recommended to be 90%, we set the noise value to 5% +refexamples.noisePercentage = 5; + +// we do not want to terminate when the noise level is reached +refexamples.terminateOnNoiseReached = false; + +// maximum execution time should be sufficiently low value (because the user has to wait for the result) +refexamples.maxExecutionTimeInSeconds = 3; + +// negations are penalised, because they are often not desired, e.g. +// $superclass AND NOT $neighbourclass1 AND NOT $neighbourclass2 is +// one of the patterns which is learned but only sometimes/rarely useful +refexamples.negationPenalty = 2; + +"http://ns.softwiki.de/req/BuildAFastSoftware" +"http://ns.softwiki.de/req/BuildASoftwareThatRuns24hADay" +"http://ns.softwiki.de/req/CreateModernGUIDesign" Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -92,7 +92,7 @@ // actual algorithm private ExampleBasedROLearner algorithm; private static Logger logger = Logger - .getLogger(ExampleBasedROLearner.class); + .getLogger(ExampleBasedROLComponent.class); private String logLevel = CommonConfigOptions.logLevelDefault; // configuration options @@ -208,14 +208,13 @@ options.add(new BooleanConfigOption("usePropernessChecks", "specifies whether to check for equivalence (i.e. discard equivalent refinements)",usePropernessChecksDefault)); options.add(new IntegerConfigOption("maxPosOnlyExpansion", "specifies how often a node in the search tree of a posonly learning problem needs to be expanded before it is" + " considered as solution candidate",maxPosOnlyExpansionDefault)); - DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples",noisePercentageDefault); - noisePercentage.setLowerLimit(0); - noisePercentage.setUpperLimit(100); - options.add(noisePercentage); + options.add(CommonConfigOptions.getNoisePercentage()); + options.add(CommonConfigOptions.getTerminateOnNoiseReached()); options.add(new StringConfigOption("startClass", "the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class)")); options.add(new BooleanConfigOption("forceRefinementLengthIncrease", "specifies whether nodes should be expanded until only longer refinements are reached")); options.add(new DoubleConfigOption("negativeWeight", "Used to penalise errors on negative examples different from those of positive examples (lower = less importance for negatives).",1.0)); options.add(new DoubleConfigOption("startNodeBonus", "You can use this to give a heuristic bonus on the start node (= initially broader exploration of search space).",0.0)); + options.add(new IntegerConfigOption("negationPenalty", "Penalty on negations (TODO: better explanation).", 0)); return options; } Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -413,9 +413,9 @@ long traversalInterval = 300l * 1000000000l; long reductionInterval = 300l * 1000000000l; long currentTime; + + while ((!solutionFound || !configurator.getTerminateOnNoiseReached() ) && !stop) { - while (!solutionFound && !stop) { - // print statistics at most once a second currentTime = System.nanoTime(); if (currentTime - lastPrintTime > 3000000000l) { Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/MultiHeuristic.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -24,6 +24,7 @@ import org.dllearner.core.configurators.ExampleBasedROLComponentConfigurator; import org.dllearner.core.owl.DatatypeSomeRestriction; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Negation; import org.dllearner.core.owl.Thing; import org.dllearner.utilities.owl.ConceptComparator; @@ -69,7 +70,7 @@ public class MultiHeuristic implements ExampleBasedHeuristic { private ConceptComparator conceptComparator = new ConceptComparator(); -// private ExampleBasedROLComponentConfigurator configurator; + private ExampleBasedROLComponentConfigurator configurator; // heuristic parameters private double expansionPenaltyFactor = 0.02; @@ -94,7 +95,7 @@ public MultiHeuristic(int nrOfPositiveExamples, int nrOfNegativeExamples, ExampleBasedROLComponentConfigurator configurator) { this.nrOfNegativeExamples = nrOfNegativeExamples; nrOfExamples = nrOfPositiveExamples + nrOfNegativeExamples; -// this.configurator = configurator; + this.configurator = configurator; negativeWeight = configurator.getNegativeWeight(); startNodeBonus = configurator.getStartNodeBonus(); } @@ -149,7 +150,7 @@ // this function can be used to give some constructs a length bonus // compared to their syntactic length - private static int getHeuristicLengthBonus(Description description) { + private int getHeuristicLengthBonus(Description description) { int bonus = 0; // do not count TOP symbols (in particular in ALL r.TOP and EXISTS r.TOP) @@ -157,11 +158,17 @@ if(description instanceof Thing) bonus = 1; //2; + // we put a penalty on negations, because they often overfit + // (TODO: make configurable) + else if(description instanceof Negation) { + bonus = -configurator.getNegationPenalty(); + } + // if(description instanceof BooleanValueRestriction) // bonus = -1; // some bonus for doubles because they are already penalised by length 3 - if(description instanceof DatatypeSomeRestriction) { + else if(description instanceof DatatypeSomeRestriction) { // System.out.println(description); bonus = 3; //2; } Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ExampleBasedROLComponentConfigurator.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -349,6 +349,15 @@ return (Double) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "noisePercentage") ; } /** +* terminateOnNoiseReached specifies whether to terminate when noise criterion is met. +* mandatory: false| reinit necessary: true +* default value: true +* @return boolean +**/ +public boolean getTerminateOnNoiseReached() { +return (Boolean) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "terminateOnNoiseReached") ; +} +/** * startClass the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class). * mandatory: false| reinit necessary: true * default value: null @@ -384,6 +393,15 @@ public double getStartNodeBonus() { return (Double) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "startNodeBonus") ; } +/** +* negationPenalty Penalty on negations (TODO: better explanation).. +* mandatory: false| reinit necessary: true +* default value: 0 +* @return int +**/ +public int getNegationPenalty() { +return (Integer) ComponentManager.getInstance().getConfigOptionValue(exampleBasedROLComponent, "negationPenalty") ; +} /** * @param writeSearchTree specifies whether to write a search tree. @@ -674,6 +692,15 @@ reinitNecessary = true; } /** +* @param terminateOnNoiseReached specifies whether to terminate when noise criterion is met. +* mandatory: false| reinit necessary: true +* default value: true +**/ +public void setTerminateOnNoiseReached(boolean terminateOnNoiseReached) { +ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "terminateOnNoiseReached", terminateOnNoiseReached); +reinitNecessary = true; +} +/** * @param startClass the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class). * mandatory: false| reinit necessary: true * default value: null @@ -709,6 +736,15 @@ ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "startNodeBonus", startNodeBonus); reinitNecessary = true; } +/** +* @param negationPenalty Penalty on negations (TODO: better explanation).. +* mandatory: false| reinit necessary: true +* default value: 0 +**/ +public void setNegationPenalty(int negationPenalty) { +ComponentManager.getInstance().applyConfigEntry(exampleBasedROLComponent, "negationPenalty", negationPenalty); +reinitNecessary = true; +} /** * true, if this component needs reinitializsation. Modified: trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/core/options/CommonConfigOptions.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -52,7 +52,8 @@ public static int guaranteeXgoodDescriptionsDefault = 1; public static int maxClassDescriptionTestsDefault = 0; public static String logLevelDefault = "DEBUG"; - //public static double noisePercentageDefault = 0.0; + public static double noisePercentageDefault = 0.0; + public static boolean terminateOnNoiseReachedDefault = true; public static StringConfigOption getVerbosityOption() { StringConfigOption verbosityOption = new StringConfigOption("verbosity", "control verbosity of output for this component", "warning"); @@ -61,6 +62,17 @@ return verbosityOption; } + public static DoubleConfigOption getNoisePercentage() { + DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples",noisePercentageDefault); + noisePercentage.setLowerLimit(0); + noisePercentage.setUpperLimit(100); + return noisePercentage; + } + + public static BooleanConfigOption getTerminateOnNoiseReached() { + return new BooleanConfigOption("terminateOnNoiseReached", "specifies whether to terminate when noise criterion is met", terminateOnNoiseReachedDefault); + } + public static DoubleConfigOption getPercentPerLenghtUnitOption(double defaultValue) { DoubleConfigOption option = new DoubleConfigOption("percentPerLenghtUnit", "describes the reduction in classification accuracy in percent one is willing to accept for reducing the length of the concept by one", defaultValue); option.setLowerLimit(0.0); Modified: trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/parser/ConfParserTokenManager.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -16,8 +16,8 @@ import org.dllearner.cli.*; import org.dllearner.utilities.datastructures.*; +@SuppressWarnings("all") /** Token Manager. */ -@SuppressWarnings("all") public class ConfParserTokenManager implements ConfParserConstants { Modified: trunk/src/dl-learner/org/dllearner/parser/KBParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -5,7 +5,8 @@ import java.io.*; import java.net.URL; -public @SuppressWarnings("all") class KBParser implements KBParserConstants { +@SuppressWarnings("all") +public class KBParser implements KBParserConstants { public static String internalNamespace = "http://localhost/foo#"; @@ -659,88 +660,88 @@ throw new Error("Missing return statement in function"); } - final private boolean jj_2_1(int xla) { + private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } - final private boolean jj_2_2(int xla) { + private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } - final private boolean jj_2_3(int xla) { + private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_3(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } - final private boolean jj_2_4(int xla) { + private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } - final private boolean jj_2_5(int xla) { + private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_5(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } - final private boolean jj_2_6(int xla) { + private boolean jj_2_6(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_6(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(5, xla); } } - final private boolean jj_2_7(int xla) { + private boolean jj_2_7(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_7(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(6, xla); } } - final private boolean jj_2_8(int xla) { + private boolean jj_2_8(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_8(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(7, xla); } } - final private boolean jj_3_7() { + 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; } - final private boolean jj_3R_13() { + private boolean jj_3R_13() { if (jj_scan_token(18)) return true; if (jj_3R_2()) return true; return false; } - final private boolean jj_3R_25() { + private boolean jj_3R_25() { if (jj_scan_token(NUMBER)) return true; return false; } - final private boolean jj_3_6() { + private boolean jj_3_6() { if (jj_scan_token(22)) return true; if (jj_3R_2()) return true; if (jj_scan_token(14)) return true; return false; } - final private boolean jj_3R_12() { + private boolean jj_3R_12() { if (jj_scan_token(17)) return true; if (jj_3R_4()) return true; if (jj_scan_token(COMMAND_END)) return true; @@ -748,7 +749,7 @@ return false; } - final private boolean jj_3R_11() { + private boolean jj_3R_11() { if (jj_scan_token(16)) return true; if (jj_3R_4()) return true; if (jj_scan_token(COMMAND_END)) return true; @@ -756,7 +757,7 @@ return false; } - final private boolean jj_3R_10() { + private boolean jj_3R_10() { if (jj_scan_token(22)) return true; if (jj_3R_2()) return true; if (jj_scan_token(15)) return true; @@ -765,7 +766,7 @@ return false; } - final private boolean jj_3_4() { + private boolean jj_3_4() { if (jj_3R_2()) return true; Token xsp; xsp = jj_scanpos; @@ -776,7 +777,7 @@ return false; } - final private boolean jj_3R_9() { + 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; @@ -785,33 +786,33 @@ return false; } - final private boolean jj_3_3() { + private boolean jj_3_3() { if (jj_3R_2()) return true; if (jj_scan_token(25)) return true; return false; } - final private boolean jj_3R_18() { + private boolean jj_3R_18() { if (jj_3R_27()) return true; return false; } - final private boolean jj_3_5() { + private boolean jj_3_5() { if (jj_3R_5()) return true; return false; } - final private boolean jj_3R_8() { + private boolean jj_3R_8() { if (jj_scan_token(13)) return true; return false; } - final private boolean jj_3R_7() { + private boolean jj_3R_7() { if (jj_scan_token(12)) return true; return false; } - final private boolean jj_3R_2() { + private boolean jj_3R_2() { Token xsp; xsp = jj_scanpos; if (jj_3R_7()) { @@ -851,22 +852,22 @@ return false; } - final private boolean jj_3R_26() { + private boolean jj_3R_26() { if (jj_scan_token(ID)) return true; return false; } - final private boolean jj_3R_20() { + private boolean jj_3R_20() { if (jj_3R_27()) return true; return false; } - final private boolean jj_3R_17() { + private boolean jj_3R_17() { if (jj_3R_26()) return true; return false; } - final private boolean jj_3R_3() { + private boolean jj_3R_3() { Token xsp; xsp = jj_scanpos; if (jj_3R_17()) { @@ -876,7 +877,7 @@ return false; } - final private boolean jj_3_2() { + private boolean jj_3_2() { Token xsp; xsp = jj_scanpos; if (jj_scan_token(18)) jj_scanpos = xsp; @@ -887,7 +888,7 @@ return false; } - final private boolean jj_3_1() { + private boolean jj_3_1() { if (jj_3R_2()) return true; if (jj_scan_token(22)) return true; if (jj_3R_3()) return true; @@ -896,17 +897,17 @@ return false; } - final private boolean jj_3R_24() { + private boolean jj_3R_24() { if (jj_3R_27()) return true; return false; } - final private boolean jj_3R_19() { + private boolean jj_3R_19() { if (jj_3R_26()) return true; return false; } - final private boolean jj_3R_4() { + private boolean jj_3R_4() { Token xsp; xsp = jj_scanpos; if (jj_3R_19()) { @@ -916,17 +917,17 @@ return false; } - final private boolean jj_3R_22() { + private boolean jj_3R_22() { if (jj_3R_27()) return true; return false; } - final private boolean jj_3R_23() { + private boolean jj_3R_23() { if (jj_3R_26()) return true; return false; } - final private boolean jj_3R_6() { + private boolean jj_3R_6() { Token xsp; xsp = jj_scanpos; if (jj_3R_23()) { @@ -936,12 +937,12 @@ return false; } - final private boolean jj_3R_21() { + private boolean jj_3R_21() { if (jj_3R_26()) return true; return false; } - final private boolean jj_3R_5() { + private boolean jj_3R_5() { Token xsp; xsp = jj_scanpos; if (jj_3R_21()) { @@ -951,12 +952,12 @@ return false; } - final private boolean jj_3R_27() { + private boolean jj_3R_27() { if (jj_scan_token(STRING)) return true; return false; } - final private boolean jj_3R_16() { + private boolean jj_3R_16() { if (jj_scan_token(22)) return true; if (jj_3R_6()) return true; if (jj_scan_token(47)) return true; @@ -965,7 +966,7 @@ return false; } - final private boolean jj_3_8() { + private boolean jj_3_8() { if (jj_scan_token(22)) return true; if (jj_3R_6()) return true; if (jj_scan_token(47)) return true; @@ -974,7 +975,7 @@ return false; } - final private boolean jj_3R_15() { + private boolean jj_3R_15() { if (jj_scan_token(20)) return true; if (jj_3R_25()) return true; if (jj_3R_4()) return true; @@ -983,7 +984,7 @@ return false; } - final private boolean jj_3R_14() { + private boolean jj_3R_14() { if (jj_scan_token(19)) return true; if (jj_3R_25()) return true; if (jj_3R_4()) return true; @@ -992,35 +993,39 @@ return false; } + /** Generated Token Manager. */ public KBParserTokenManager token_source; SimpleCharStream jj_input_stream; - public Token token, jj_nt; + /** Current token. */ + public Token token; + /** Next token. */ + public Token jj_nt; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; - public boolean lookingAhead = false; - private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[16]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { - jj_la1_0(); - jj_la1_1(); + jj_la1_init_0(); + jj_la1_init_1(); } - private static void jj_la1_0() { + private static void jj_la1_init_0() { jj_la1_0 = new int[] {0xf07f3200,0xf0000000,0x40000,0xc000000,0x0,0x0,0x0,0x0,0x0,0x3000,0x1f0000,0x400000,0x200200,0x200200,0x200200,0x200200,}; } - private static void jj_la1_1() { + 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[8]; private boolean jj_rescan = false; private int jj_gc = 0; + /** Constructor with InputStream. */ public KBParser(java.io.InputStream stream) { this(stream, null); } + /** Constructor with InputStream and supplied encoding */ public KBParser(java.io.InputStream stream, String encoding) { try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new KBParserTokenManager(jj_input_stream); @@ -1031,9 +1036,11 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } + /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); @@ -1044,6 +1051,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Constructor. */ public KBParser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new KBParserTokenManager(jj_input_stream); @@ -1054,6 +1062,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Reinitialise. */ public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); @@ -1064,6 +1073,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Constructor with generated Token Manager. */ public KBParser(KBParserTokenManager tm) { token_source = tm; token = new Token(); @@ -1073,6 +1083,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Reinitialise. */ public void ReInit(KBParserTokenManager tm) { token_source = tm; token = new Token(); @@ -1082,7 +1093,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } - final private Token jj_consume_token(int kind) throws ParseException { + private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); @@ -1108,7 +1119,7 @@ static private final class LookaheadSuccess extends java.lang.Error { } final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - final private boolean jj_scan_token(int kind) { + private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { @@ -1129,6 +1140,8 @@ return false; } + +/** Get the next Token. */ final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); @@ -1137,8 +1150,9 @@ return token; } +/** Get the specific Token. */ final public Token getToken(int index) { - Token t = lookingAhead ? jj_scanpos : token; + Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); @@ -1146,14 +1160,14 @@ return t; } - final private int jj_ntk() { + private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } - private java.util.Vector<int[]> jj_expentries = new java.util.Vector<int[]>(); + private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; @@ -1168,27 +1182,25 @@ for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } - boolean exists = false; - for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { - int[] oldentry = (int[])(e.nextElement()); + jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + int[] oldentry = (int[])(it.next()); if (oldentry.length == jj_expentry.length) { - exists = true; for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { - exists = false; - break; + continue jj_entries_loop; } } - if (exists) break; + jj_expentries.add(jj_expentry); + break jj_entries_loop; } } - if (!exists) jj_expentries.addElement(jj_expentry); if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } + /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.removeAllElements(); + jj_expentries.clear(); boolean[] la1tokens = new boolean[50]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; @@ -1210,7 +1222,7 @@ if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; - jj_expentries.addElement(jj_expentry); + jj_expentries.add(jj_expentry); } } jj_endpos = 0; @@ -1218,18 +1230,20 @@ jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = jj_expentries.elementAt(i); + exptokseq[i] = jj_expentries.get(i); } return new ParseException(token, exptokseq, tokenImage); } + /** Enable tracing. */ final public void enable_tracing() { } + /** Disable tracing. */ final public void disable_tracing() { } - final private void jj_rescan_token() { + private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 8; i++) { try { @@ -1255,7 +1269,7 @@ jj_rescan = false; } - final private void jj_save(int index, int xla) { + private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } Modified: trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/parser/KBParserConstants.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -1,29 +1,54 @@ /* Generated By:JavaCC: Do not edit this line. KBParserConstants.java */ package org.dllearner.parser; -public @SuppressWarnings("all") interface KBParserConstants { +/** + * Token literal values and constants. + * Generated by org.javacc.parser.OtherFilesGen#start() + */ +public interface KBParserConstants { + + /** End of File. */ int EOF = 0; + /** RegularExpression Id. */ int SINGLE_LINE_COMMENT = 5; + /** RegularExpression Id. */ int FORMAL_COMMENT = 6; + /** RegularExpression Id. */ int MULTI_LINE_COMMENT = 7; + /** RegularExpression Id. */ int COMMAND_END = 8; + /** RegularExpression Id. */ int ID = 9; + /** RegularExpression Id. */ int NUMBER = 10; + /** RegularExpression Id. */ int DOUBLE = 11; + /** RegularExpression Id. */ int TOP = 12; + /** RegularExpression Id. */ int BOTTOM = 13; + /** RegularExpression Id. */ int AND = 14; + /** RegularExpression Id. */ int OR = 15; + /** RegularExpression Id. */ int EXISTS = 16; + /** RegularExpression Id. */ int ALL = 17; + /** RegularExpression Id. */ int NOT = 18; + /** RegularExpression Id. */ int GE = 19; + /** RegularExpression Id. */ int LE = 20; + /** RegularExpression Id. */ int STRING = 21; + /** Lexical state. */ int DEFAULT = 0; + /** Literal token values. */ String[] tokenImage = { "<EOF>", "\" \"", Modified: trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/parser/KBParserTokenManager.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -4,9 +4,14 @@ import java.io.*; import java.net.URL; -public @SuppressWarnings("all") class KBParserTokenManager implements KBParserConstants +@SuppressWarnings("all") +/** Token Manager. */ +public class KBParserTokenManager implements KBParserConstants { + + /** Debug output. */ public java.io.PrintStream debugStream = System.out; + /** Set debug output. */ public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; } private final int jjStopStringLiteralDfa_0(int pos, long active0) { @@ -28,22 +33,14 @@ { return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1); } -private final int jjStopAtPos(int pos, int kind) +private int jjStopAtPos(int pos, int kind) { jjmatchedKind = kind; jjmatchedPos = pos; return pos + 1; } -private final int jjStartNfaWithStates_0(int pos, int kind, int state) +private int jjMoveStringLiteralDfa0_0() { - jjmatchedKind = kind; - jjmatchedPos = pos; - try { curChar = input_stream.readChar(); } - catch(java.io.IOException e) { return pos + 1; } - return jjMoveNfa_0(state, pos + 1); -} -private final int jjMoveStringLiteralDfa0_0() -{ switch(curChar) { case 40: @@ -82,7 +79,7 @@ return jjMoveNfa_0(0, 0); } } -private final int jjMoveStringLiteralDfa1_0(long active0) +private int jjMoveStringLiteralDfa1_0(long active0) { try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { @@ -130,7 +127,7 @@ } return jjStartNfa_0(0, active0); } -private final int jjMoveStringLiteralDfa2_0(long old0, long active0) +private int jjMoveStringLiteralDfa2_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(0, old0); @@ -187,7 +184,7 @@ } return jjStartNfa_0(1, active0); } -private final int jjMoveStringLiteralDfa3_0(long old0, long active0) +private int jjMoveStringLiteralDfa3_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(1, old0); @@ -233,7 +230,7 @@ } return jjStartNfa_0(2, active0); } -private final int jjMoveStringLiteralDfa4_0(long old0, long active0) +private int jjMoveStringLiteralDfa4_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(2, old0); @@ -281,7 +278,7 @@ } return jjStartNfa_0(3, active0); } -private final int jjMoveStringLiteralDfa5_0(long old0, long active0) +private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); @@ -325,7 +322,7 @@ } return jjStartNfa_0(4, active0); } -private final int jjMoveStringLiteralDfa6_0(long old0, long active0) +private int jjMoveStringLiteralDfa6_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(4, old0); @@ -375,7 +372,7 @@ } return jjStartNfa_0(5, active0); } -private final int jjMoveStringLiteralDfa7_0(long old0, long active0) +private int jjMoveStringLiteralDfa7_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(5, old0); @@ -407,7 +404,7 @@ } return jjStartNfa_0(6, active0); } -private final int jjMoveStringLiteralDfa8_0(long old0, long active0) +private int jjMoveStringLiteralDfa8_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(6, old0); @@ -435,7 +432,7 @@ } return jjStartNfa_0(7, active0); } -private final int jjMoveStringLiteralDfa9_0(long old0, long active0) +private int jjMoveStringLiteralDfa9_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(7, old0); @@ -469,7 +466,7 @@ } return jjStartNfa_0(8, active0); } -private final int jjMoveStringLiteralDfa10_0(long old0, long active0) +private int jjMoveStringLiteralDfa10_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(8, old0); @@ -489,7 +486,7 @@ } return jjStartNfa_0(9, active0); } -private final int jjMoveStringLiteralDfa11_0(long old0, long active0) +private int jjMoveStringLiteralDfa11_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(9, old0); @@ -513,7 +510,7 @@ } return jjStartNfa_0(10, active0); } -private final int jjMoveStringLiteralDfa12_0(long old0, long active0) +private int jjMoveStringLiteralDfa12_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(10, old0); @@ -533,7 +530,7 @@ } return jjStartNfa_0(11, active0); } -private final int jjMoveStringLiteralDfa13_0(long old0, long active0) +private int jjMoveStringLiteralDfa13_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(11, old0); @@ -553,7 +550,7 @@ } return jjStartNfa_0(12, active0); } -private final int jjMoveStringLiteralDfa14_0(long old0, long active0) +private int jjMoveStringLiteralDfa14_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(12, old0); @@ -575,7 +572,7 @@ } return jjStartNfa_0(13, active0); } -private final int jjMoveStringLiteralDfa15_0(long old0, long active0) +private int jjMoveStringLiteralDfa15_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(13, old0); @@ -597,7 +594,7 @@ } return jjStartNfa_0(14, active0); } -private final int jjMoveStringLiteralDfa16_0(long old0, long active0) +private int jjMoveStringLiteralDfa16_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(14, old0); @@ -621,7 +618,7 @@ } return jjStartNfa_0(15, active0); } -private final int jjMoveStringLiteralDfa17_0(long old0, long active0) +private int jjMoveStringLiteralDfa17_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(15, old0); @@ -643,7 +640,7 @@ } return jjStartNfa_0(16, active0); } -private final int jjMoveStringLiteralDfa18_0(long old0, long active0) +private int jjMoveStringLiteralDfa18_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(16, old0); @@ -669,7 +666,7 @@ } return jjStartNfa_0(17, active0); } -private final int jjMoveStringLiteralDfa19_0(long old0, long active0) +private int jjMoveStringLiteralDfa19_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(17, old0); @@ -693,7 +690,7 @@ } return jjStartNfa_0(18, active0); } -private final int jjMoveStringLiteralDfa20_0(long old0, long active0) +private int jjMoveStringLiteralDfa20_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(18, old0); @@ -715,7 +712,7 @@ } return jjStartNfa_0(19, active0); } -private final int jjMoveStringLiteralDfa21_0(long old0, long active0) +private int jjMoveStringLiteralDfa21_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(19, old0); @@ -735,47 +732,16 @@ } return jjStartNfa_0(20, active0); } -private final void jjCheckNAdd(int state) -{ - if (jjrounds[state] != jjround) - { - jjstateSet[jjnewStateCnt++] = state; - jjrounds[state] = jjround; - } -} -private final void jjAddStates(int start, int end) -{ - do { - jjstateSet[jjnewStateCnt++] = jjnextStates[start]; - } while (start++ != end); -} -private final void jjCheckNAddTwoStates(int state1, int state2) -{ - jjCheckNAdd(state1); - jjCheckNAdd(state2); -} -private final void jjCheckNAddStates(int start, int end) -{ - do { - jjCheckNAdd(jjnextStates[start]); - } while (start++ != end); -} -private final void jjCheckNAddStates(int start) -{ - jjCheckNAdd(jjnextStates[start]); - jjCheckNAdd(jjnextStates[start + 1]); -} static final long[] jjbitVec0 = { 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL }; -private final int jjMoveNfa_0(int startState, int curPos) +private int jjMoveNfa_0(int startState, int curPos) { - int[] nextStates; int startsAt = 0; jjnewStateCnt = 53; int i = 1; jjstateSet[0] = startState; - int j, kind = 0x7fffffff; + int kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) @@ -783,7 +749,7 @@ if (curChar < 64) { long l = 1L << curChar; - MatchLoop: do + do { switch(jjstateSet[--i]) { @@ -946,7 +912,7 @@ else if (curChar < 128) { long l = 1L << (curChar & 077); - MatchLoop: do + do { switch(jjstateSet[--i]) { @@ -1093,7 +1059,7 @@ { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); - MatchLoop: do + do { switch(jjstateSet[--i]) { @@ -1144,6 +1110,8 @@ 48, 49, 50, 29, 40, 41, 30, 31, 33, 36, 37, 39, 43, 44, 46, 25, 27, 21, 22, }; + +/** Token literal values. */ public static final String[] jjstrLiteralImages = { "", null, null, null, null, null, null, null, "\56", null, null, null, "\124\117\120", "\102\117\124\124\117\115", "\101\116\104", "\117\122", null, null, null, @@ -1157,6 +1125,8 @@ "\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", }; + +/** Lexer state names. */ public static final String[] lexStateNames = { "DEFAULT", }; @@ -1170,15 +1140,20 @@ private final int[] jjrounds = new int[53]; private final int[] jjstateSet = new int[106]; protected char curChar; +/** Constructor. */ public KBParserTokenManager(SimpleCharStream stream){ if (SimpleCharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream; } + +/** Constructor. */ public KBParserTokenManager(SimpleCharStream stream, int lexState){ this(stream); SwitchTo(lexState); } + +/** Reinitialise parser. */ public void ReInit(SimpleCharStream stream) { jjmatchedPos = jjnewStateCnt = 0; @@ -1186,18 +1161,22 @@ input_stream = stream; ReInitRounds(); } -private final void ReInitRounds() +private void ReInitRounds() { int i; jjround = 0x80000001; for (i = 53; i-- > 0;) jjrounds[i] = 0x80000000; } + +/** Reinitialise parser. */ public void ReInit(SimpleCharStream stream, int lexState) { ReInit(stream); SwitchTo(lexState); } + +/** Switch to specified lex state. */ public void SwitchTo(int lexState) { if (lexState >= 1 || lexState < 0) @@ -1208,14 +1187,25 @@ protected Token jjFillToken() { - Token t = Token.newToken(jjmatchedKind); - t.kind = jjmatchedKind; + final Token t; + final String curTokenImage; + final int beginLine; + final int endLine; + final int beginColumn; + final int endColumn; String im = jjstrLiteralImages[jjmatchedKind]; - t.image = (im == null) ? input_stream.GetImage() : im; - t.beginLine = input_stream.getBeginLine(); - t.beginColumn = input_stream.getBeginColumn(); - t.endLine = input_stream.getEndLine(); - t.endColumn = input_stream.getEndColumn(); + curTokenImage = (im == null) ? input_stream.GetImage() : im; + beginLine = input_stream.getBeginLine(); + beginColumn = input_stream.getBeginColumn(); + endLine = input_stream.getEndLine(); + endColumn = input_stream.getEndColumn(); + t = Token.newToken(jjmatchedKind, curTokenImage); + + t.beginLine = beginLine; + t.endLine = endLine; + t.beginColumn = beginColumn; + t.endColumn = endColumn; + return t; } @@ -1226,10 +1216,9 @@ int jjmatchedPos; int jjmatchedKind; +/** Get the next Token. */ public Token getNextToken() { - int kind; - Token specialToken = null; Token matchedToken; int curPos = 0; @@ -1292,4 +1281,31 @@ } } +private void jjCheckNAdd(int state) +{ + if (jjrounds[state] != jjround) + { + jjstateSet[jjnewStateCnt++] = state; + jjrounds[state] = jjround; + } } +private void jjAddStates(int start, int end) +{ + do { + jjstateSet[jjnewStateCnt++] = jjnextStates[start]; + } while (start++ != end); +} +private void jjCheckNAddTwoStates(int state1, int state2) +{ + jjCheckNAdd(state1); + jjCheckNAdd(state2); +} + +private void jjCheckNAddStates(int start, int end) +{ + do { + jjCheckNAdd(jjnextStates[start]); + } while (start++ != end); +} + +} Modified: trunk/src/dl-learner/org/dllearner/parser/PrologParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/PrologParser.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/parser/PrologParser.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -1,7 +1,8 @@ /* Generated By:JavaCC: Do not edit this line. PrologParser.java */ package org.dllearner.parser; -public @SuppressWarnings("all") class PrologParser implements PrologParserConstants { +@SuppressWarnings("all") +public class PrologParser implements PrologParserConstants { public PrologParser() { this(new java.io.StringReader("")); } @@ -307,106 +308,106 @@ throw new Error("Missing return statement in function"); } - final private boolean jj_2_1(int xla) { + private boolean jj_2_1(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_1(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(0, xla); } } - final private boolean jj_2_2(int xla) { + private boolean jj_2_2(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_2(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(1, xla); } } - final private boolean jj_2_3(int xla) { + private boolean jj_2_3(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_3(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(2, xla); } } - final private boolean jj_2_4(int xla) { + private boolean jj_2_4(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_4(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(3, xla); } } - final private boolean jj_2_5(int xla) { + private boolean jj_2_5(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_5(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(4, xla); } } - final private boolean jj_2_6(int xla) { + private boolean jj_2_6(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_6(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(5, xla); } } - final private boolean jj_2_7(int xla) { + private boolean jj_2_7(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_7(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(6, xla); } } - final private boolean jj_2_8(int xla) { + private boolean jj_2_8(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_8(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(7, xla); } } - final private boolean jj_2_9(int xla) { + private boolean jj_2_9(int xla) { jj_la = xla; jj_lastpos = jj_scanpos = token; try { return !jj_3_9(); } catch(LookaheadSuccess ls) { return true; } finally { jj_save(8, xla); } } - final private boolean jj_3R_5() { + private boolean jj_3R_5() { if (jj_scan_token(OPERATOR)) return true; return false; } - final private boolean jj_3_7() { + private boolean jj_3_7() { if (jj_3R_9()) return true; if (jj_scan_token(21)) return true; return false; } - final private boolean jj_3R_13() { + private boolean jj_3R_13() { if (jj_3R_15()) return true; return false; } - final private boolean jj_3R_12() { + private boolean jj_3R_12() { if (jj_scan_token(STRINGCONSTANT)) return true; return false; } - final private boolean jj_3R_11() { + private boolean jj_3R_11() { if (jj_scan_token(DOUBLE)) return true; return false; } - final private boolean jj_3R_10() { + private boolean jj_3R_10() { if (jj_scan_token(VAR)) return true; return false; } - final private boolean jj_3_6() { + private boolean jj_3_6() { if (jj_scan_token(IDENTIFIER)) return true; return false; } - final private boolean jj_3R_18() { + private boolean jj_3R_18() { if (jj_scan_token(25)) return true; Token xsp; while (true) { @@ -418,7 +419,7 @@ return false; } - final private boolean jj_3_5() { + private boolean jj_3_5() { if (jj_scan_token(IDENTIFIER)) return true; if (jj_scan_token(22)) return true; if (jj_3R_14()) return true; @@ -426,7 +427,7 @@ return false; } - final private boolean jj_3R_6() { + private boolean jj_3R_6() { Token xsp; xsp = jj_scanpos; if (jj_3_5()) { @@ -448,7 +449,7 @@ return false; } - final private boolean jj_3_9() { + private boolean jj_3_9() { if (jj_scan_token(25)) return true; if (jj_3R_9()) return true; if (jj_scan_token(27)) return true; @@ -457,19 +458,19 @@ return false; } - final private boolean jj_3_8() { + private boolean jj_3_8() { if (jj_scan_token(25)) return true; if (jj_3R_9()) return true; if (jj_scan_token(26)) return true; return false; } - final private boolean jj_3R_17() { + private boolean jj_3R_17() { if (jj_scan_token(24)) return true; return false; } - final private boolean jj_3R_15() { + private boolean jj_3R_15() { Token xsp; xsp = jj_scanpos; if (jj_3R_17()) { @@ -485,31 +486,31 @@ return false; } - final private boolean jj_3_4() { + private boolean jj_3_4() { if (jj_3R_6()) return true; return false; } - final private boolean jj_3R_16() { + private boolean jj_3R_16() { if (jj_scan_token(21)) return true; if (jj_3R_9()) return true; return false; } - final private boolean jj_3_3() { + private boolean jj_3_3() { if (jj_3R_6()) return true; if (jj_3R_8()) return true; return false; } - final private boolean jj_3_2() { + private boolean jj_3_2() { if (jj_3R_6()) return true; if (jj_3R_7()) return true; if (jj_3R_6()) return true; return false; } - final private boolean jj_3R_14() { + private boolean jj_3R_14() { if (jj_3R_9()) return true; Token xsp; while (true) { @@ -519,13 +520,13 @@ return false; } - final private boolean jj_3_1() { + private boolean jj_3_1() { if (jj_3R_5()) return true; if (jj_3R_6()) return true; return false; } - final private boolean jj_3R_9() { + private boolean jj_3R_9() { Token xsp; xsp = jj_scanpos; if (jj_3_1()) { @@ -541,40 +542,44 @@ return false; } - final private boolean jj_3R_8() { + private boolean jj_3R_8() { if (jj_scan_token(OPERATOR)) return true; return false; } - final private boolean jj_3R_7() { + private boolean jj_3R_7() { if (jj_scan_token(OPERATOR)) return true; return false; } + /** Generated Token Manager. */ public PrologParserTokenManager token_source; SimpleCharStream jj_input_stream; - public Token token, jj_nt; + /** Current token. */ + public Token token; + /** Next token. */ + public Token jj_nt; private int jj_ntk; private Token jj_scanpos, jj_lastpos; private int jj_la; - public boolean lookingAhead = false; - private boolean jj_semLA; private int jj_gen; final private int[] jj_la1 = new int[9]; static private int[] jj_la1_0; static { - jj_la1_0(); + jj_la1_init_0(); } - private static void jj_la1_0() { + private static void jj_la1_init_0() { jj_la1_0 = new int[] {0x2000,0x80000,0x200000,0x400000,0x2080,0x3001900,0x200000,0x1000000,0x2000000,}; } final private JJCalls[] jj_2_rtns = new JJCalls[9]; private boolean jj_rescan = false; private int jj_gc = 0; + /** Constructor with InputStream. */ public PrologParser(java.io.InputStream stream) { this(stream, null); } + /** Constructor with InputStream and supplied encoding */ public PrologParser(java.io.InputStream stream, String encoding) { try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source = new PrologParserTokenManager(jj_input_stream); @@ -585,9 +590,11 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Reinitialise. */ public void ReInit(java.io.InputStream stream) { ReInit(stream, null); } + /** Reinitialise. */ public void ReInit(java.io.InputStream stream, String encoding) { try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } token_source.ReInit(jj_input_stream); @@ -598,6 +605,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Constructor. */ public PrologParser(java.io.Reader stream) { jj_input_stream = new SimpleCharStream(stream, 1, 1); token_source = new PrologParserTokenManager(jj_input_stream); @@ -608,6 +616,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Reinitialise. */ public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); @@ -618,6 +627,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Constructor with generated Token Manager. */ public PrologParser(PrologParserTokenManager tm) { token_source = tm; token = new Token(); @@ -627,6 +637,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } + /** Reinitialise. */ public void ReInit(PrologParserTokenManager tm) { token_source = tm; token = new Token(); @@ -636,7 +647,7 @@ for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } - final private Token jj_consume_token(int kind) throws ParseException { + private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); @@ -662,7 +673,7 @@ static private final class LookaheadSuccess extends java.lang.Error { } final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - final private boolean jj_scan_token(int kind) { + private boolean jj_scan_token(int kind) { if (jj_scanpos == jj_lastpos) { jj_la--; if (jj_scanpos.next == null) { @@ -683,6 +694,8 @@ return false; } + +/** Get the next Token. */ final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); @@ -691,8 +704,9 @@ return token; } +/** Get the specific Token. */ final public Token getToken(int index) { - Token t = lookingAhead ? jj_scanpos : token; + Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); @@ -700,14 +714,14 @@ return t; } - final private int jj_ntk() { + private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } - private java.util.Vector<int[]> jj_expentries = new java.util.Vector<int[]>(); + private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); private int[] jj_expentry; private int jj_kind = -1; private int[] jj_lasttokens = new int[100]; @@ -722,27 +736,25 @@ for (int i = 0; i < jj_endpos; i++) { jj_expentry[i] = jj_lasttokens[i]; } - boolean exists = false; - for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) { - int[] oldentry = (int[])(e.nextElement()); + jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) { + int[] oldentry = (int[])(it.next()); if (oldentry.length == jj_expentry.length) { - exists = true; for (int i = 0; i < jj_expentry.length; i++) { if (oldentry[i] != jj_expentry[i]) { - exists = false; - break; + continue jj_entries_loop; } } - if (exists) break; + jj_expentries.add(jj_expentry); + break jj_entries_loop; } } - if (!exists) jj_expentries.addElement(jj_expentry); if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; } } + /** Generate ParseException. */ public ParseException generateParseException() { - jj_expentries.removeAllElements(); + jj_expentries.clear(); boolean[] la1tokens = new boolean[28]; if (jj_kind >= 0) { la1tokens[jj_kind] = true; @@ -761,7 +773,7 @@ if (la1tokens[i]) { jj_expentry = new int[1]; jj_expentry[0] = i; - jj_expentries.addElement(jj_expentry); + jj_expentries.add(jj_expentry); } } jj_endpos = 0; @@ -769,18 +781,20 @@ jj_add_error_token(0, 0); int[][] exptokseq = new int[jj_expentries.size()][]; for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = jj_expentries.elementAt(i); + exptokseq[i] = jj_expentries.get(i); } return new ParseException(token, exptokseq, tokenImage); } + /** Enable tracing. */ final public void enable_tracing() { } + /** Disable tracing. */ final public void disable_tracing() { } - final private void jj_rescan_token() { + private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 9; i++) { try { @@ -807,7 +821,7 @@ jj_rescan = false; } - final private void jj_save(int index, int xla) { + private void jj_save(int index, int xla) { JJCalls p = jj_2_rtns[index]; while (p.gen > jj_gen) { if (p.next == null) { p = p.next = new JJCalls(); break; } Modified: trunk/src/dl-learner/org/dllearner/parser/PrologParserConstants.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/PrologParserConstants.java 2008-11-30 13:24:18 UTC (rev 1536) +++ trunk/src/dl-learner/org/dllearner/parser/PrologParserConstants.java 2008-11-30 15:09:42 UTC (rev 1537) @@ -1,25 +1,46 @@ /* Generated By:JavaCC: Do not edit this line. PrologParserConstants.java */ package org.dllearner.parser; -public @SuppressWarnings("all") interface PrologParserConstants { +/** + * Token literal values and constants. + * Generated by org.javacc.parser.OtherFilesGen#start() + */ +public interface PrologParserConstants { + + /** End of File. */ int EOF = 0; + /** RegularExpression Id. */ int SINGLE_LINE_COMMENT = 6; + /** RegularExpression Id. */ int NOT = 7; + /** RegularExpression Id. */ int DOUBLE = 8; + /** RegularExpression Id. */ int NUMBER = 9; + /** RegularExpression Id. */ int DIGIT = 10; + /** RegularExpression Id. */ int STRINGCONSTANT = 11; + /** RegularExpression Id. */ int VAR = 12; + /** RegularExpression Id. */ int IDENTIFIER = 13; + /** RegularExpression Id. */ int OPERATOR = 14; + /** RegularExpression Id. */ int ANYCHAR = 15; + /** RegularExpression Id. */ int LOCASE = 16; + /** RegularExpression Id. */ int HICASE = 17; + /** RegularExpression Id. */ int SPECIALCHAR... [truncated message content] |
From: <hee...@us...> - 2008-11-30 13:24:22
|
Revision: 1536 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1536&view=rev Author: heeroyuy Date: 2008-11-30 13:24:18 +0000 (Sun, 30 Nov 2008) Log Message: ----------- -removed unnecessary instances Modified Paths: -------------- trunk/examples/swore/swore.conf trunk/examples/swore/swore.rdf Modified: trunk/examples/swore/swore.conf =================================================================== --- trunk/examples/swore/swore.conf 2008-11-30 12:40:07 UTC (rev 1535) +++ trunk/examples/swore/swore.conf 2008-11-30 13:24:18 UTC (rev 1536) @@ -1,6 +1,6 @@ import("swore.rdf"); -// refexamples.ignoredConcepts = { "http://ns.softwiki.de/req/CustomerRequirement" }; +refexamples.ignoredConcepts = { "http://ns.softwiki.de/req/CustomerRequirement" }; refexamples.ignoredRoles = { "http://ns.softwiki.de/req/broader" }; +"http://ns.softwiki.de/req/BuildAFastSoftware" @@ -9,7 +9,7 @@ +"http://ns.softwiki.de/req/CustomerRequirement1" +"http://ns.softwiki.de/req/UseAsLittleSystemResourcesAsPosible" +"http://ns.softwiki.de/req/UseDatabaseToStoreUserData" --"http://ns.softwiki.de/req/1c" +-"http://ns.softwiki.de/req/1" -"http://ns.softwiki.de/req/2" -"http://ns.softwiki.de/req/3" -"http://ns.softwiki.de/req/4" @@ -25,10 +25,18 @@ -"http://ns.softwiki.de/req/calculations" -"http://ns.softwiki.de/req/CentralOranisationOfFinnishTrage" -"http://ns.softwiki.de/req/Charlotte_Blay" --"http://ns.softwiki.de/req/cluster" -"http://ns.softwiki.de/req/comment" --"http://ns.softwiki.de/req/Complete" --"http://ns.softwiki.de/req/Consistent" --"http://ns.softwiki.de/req/Correct" -"http://ns.softwiki.de/req/data_manipualtion" -"http://ns.softwiki.de/req/Derick_Garnier" +-"http://ns.softwiki.de/req/DialogSystemShouldRespondInUnder5Sec" +-"http://ns.softwiki.de/req/loadGUIInUnder2Sec" +-"http://ns.softwiki.de/req/LogEveryUserActivity" +-"http://ns.softwiki.de/req/MultiTabSystem" +-"http://ns.softwiki.de/req/MultiUserSystem" +-"http://ns.softwiki.de/req/MultiWindowSystem" +-"http://ns.softwiki.de/req/SystemStabilityRequirement" +-"http://ns.softwiki.de/req/technical_details" +-"http://ns.softwiki.de/req/Derick_Garnier" +-"http://ns.softwiki.de/req/UseOfIcons" +-"http://ns.softwiki.de/req/UserCanAccessDataFromEveryComputer" +-"http://ns.softwiki.de/req/WindowDesign" \ No newline at end of file Modified: trunk/examples/swore/swore.rdf =================================================================== --- trunk/examples/swore/swore.rdf 2008-11-30 12:40:07 UTC (rev 1535) +++ trunk/examples/swore/swore.rdf 2008-11-30 13:24:18 UTC (rev 1536) @@ -1056,21 +1056,19 @@ - <!-- http://ns.softwiki.de/req/Complete --> - - <QualityRequirement rdf:about="Complete"/> - - - <!-- http://ns.softwiki.de/req/Consistent --> - <QualityRequirement rdf:about="Consistent"/> + <rdf:Description rdf:about="Consistent"> + <isCreatedBy rdf:resource="USGovernment"/> + </rdf:Description> <!-- http://ns.softwiki.de/req/Correct --> - <QualityRequirement rdf:about="Correct"/> + <rdf:Description rdf:about="Correct"> + <isCreatedBy rdf:resource="Jennifer_Greene"/> + </rdf:Description> @@ -1104,24 +1102,12 @@ - <!-- http://ns.softwiki.de/req/Dual_Core_2_GHz_2GB_RAM --> - - <PerformanceRequirement rdf:about="Dual_Core_2_GHz_2GB_RAM"/> - - - <!-- http://ns.softwiki.de/req/EuropeanTradeUnionConfederation --> <TradeUnion rdf:about="EuropeanTradeUnionConfederation"/> - <!-- http://ns.softwiki.de/req/Feasible --> - - <QualityRequirement rdf:about="Feasible"/> - - - <!-- http://ns.softwiki.de/req/GermanGovernment --> <Government rdf:about="GermanGovernment"/> @@ -1163,12 +1149,6 @@ - <!-- http://ns.softwiki.de/req/Modifiable --> - - <QualityRequirement rdf:about="Modifiable"/> - - - <!-- http://ns.softwiki.de/req/MultiTabSystem --> <DesignRequirement rdf:about="MultiTabSystem"> @@ -1204,12 +1184,6 @@ - <!-- http://ns.softwiki.de/req/Necessary --> - - <QualityRequirement rdf:about="Necessary"/> - - - <!-- http://ns.softwiki.de/req/NotNecessaryRequirment --> <Comment rdf:about="NotNecessaryRequirment"> @@ -1230,18 +1204,6 @@ - <!-- http://ns.softwiki.de/req/Prioritized --> - - <QualityRequirement rdf:about="Prioritized"/> - - - - <!-- http://ns.softwiki.de/req/Quad_Core_3_GHz_16_GB_RAM --> - - <PerformanceRequirement rdf:about="Quad_Core_3_GHz_16_GB_RAM"/> - - - <!-- http://ns.softwiki.de/req/Steve_McConnell --> <Author rdf:about="Steve_McConnell"> @@ -1283,12 +1245,6 @@ - <!-- http://ns.softwiki.de/req/Traceable --> - - <QualityRequirement rdf:about="Traceable"/> - - - <!-- http://ns.softwiki.de/req/UML --> <Document rdf:about="UML"/> @@ -1301,12 +1257,6 @@ - <!-- http://ns.softwiki.de/req/Unambiguous --> - - <QualityRequirement rdf:about="Unambiguous"/> - - - <!-- http://ns.softwiki.de/req/UseAsLittleSystemResourcesAsPosible --> <CustomerRequirement rdf:about="UseAsLittleSystemResourcesAsPosible"> @@ -1344,12 +1294,6 @@ - <!-- http://ns.softwiki.de/req/Verifiable --> - - <QualityRequirement rdf:about="Verifiable"/> - - - <!-- http://ns.softwiki.de/req/WindowDesign --> <DesignRequirement rdf:about="WindowDesign"> @@ -1364,14 +1308,6 @@ - <!-- http://ns.softwiki.de/req/cluster --> - - <PerformanceRequirement rdf:about="cluster"> - <isCreatedBy rdf:resource="Andrew_Stellman"/> - </PerformanceRequirement> - - - <!-- http://ns.softwiki.de/req/comment --> <Comment rdf:about="comment"/> @@ -1386,7 +1322,9 @@ <!-- http://ns.softwiki.de/req/data_manipulation --> - <FunctionalRequirement rdf:about="data_manipulation"/> + <FunctionalRequirement rdf:about="data_manipulation"> + <isCreatedBy rdf:resource="Steve_McConnell"/> + </FunctionalRequirement> @@ -1402,14 +1340,6 @@ - <!-- http://ns.softwiki.de/req/großsystemen --> - - <PerformanceRequirement rdf:about="großsystemen"> - <isCreatedBy rdf:resource="GermanGovernment"/> - </PerformanceRequirement> - - - <!-- http://ns.softwiki.de/req/important --> <Vote rdf:about="important"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-30 12:40:15
|
Revision: 1535 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1535&view=rev Author: heeroyuy Date: 2008-11-30 12:40:07 +0000 (Sun, 30 Nov 2008) Log Message: ----------- added object property createdBy to some requirements Modified Paths: -------------- trunk/examples/swore/swore.conf trunk/examples/swore/swore.rdf Modified: trunk/examples/swore/swore.conf =================================================================== --- trunk/examples/swore/swore.conf 2008-11-30 12:37:29 UTC (rev 1534) +++ trunk/examples/swore/swore.conf 2008-11-30 12:40:07 UTC (rev 1535) @@ -1,9 +1,34 @@ import("swore.rdf"); -// refexamples.ignoredConcepts = { "http://ns.softwiki.de/req/AbstractRequirement" }; +// refexamples.ignoredConcepts = { "http://ns.softwiki.de/req/CustomerRequirement" }; refexamples.ignoredRoles = { "http://ns.softwiki.de/req/broader" }; -+"http://ns.softwiki.de/req/important" -+"http://ns.softwiki.de/req/very_important" ++"http://ns.softwiki.de/req/BuildAFastSoftware" ++"http://ns.softwiki.de/req/BuildASoftwareThatRuns24hADay" ++"http://ns.softwiki.de/req/CreateModernGUIDesign" ++"http://ns.softwiki.de/req/CustomerRequirement1" ++"http://ns.softwiki.de/req/UseAsLittleSystemResourcesAsPosible" ++"http://ns.softwiki.de/req/UseDatabaseToStoreUserData" +-"http://ns.softwiki.de/req/1c" +-"http://ns.softwiki.de/req/2" +-"http://ns.softwiki.de/req/3" +-"http://ns.softwiki.de/req/4" +-"http://ns.softwiki.de/req/5" +-"http://ns.softwiki.de/req/6" +-"http://ns.softwiki.de/req/7" +-"http://ns.softwiki.de/req/8" +-"http://ns.softwiki.de/req/9" -"http://ns.softwiki.de/req/Topic" --"http://ns.softwiki.de/req/important" \ No newline at end of file +-"http://ns.softwiki.de/req/important" +-"http://ns.softwiki.de/req/ActiveHelpDialog" +-"http://ns.softwiki.de/req/Andrew_Stellman" +-"http://ns.softwiki.de/req/calculations" +-"http://ns.softwiki.de/req/CentralOranisationOfFinnishTrage" +-"http://ns.softwiki.de/req/Charlotte_Blay" +-"http://ns.softwiki.de/req/cluster" +-"http://ns.softwiki.de/req/comment" +-"http://ns.softwiki.de/req/Complete" +-"http://ns.softwiki.de/req/Consistent" +-"http://ns.softwiki.de/req/Correct" +-"http://ns.softwiki.de/req/data_manipualtion" +-"http://ns.softwiki.de/req/Derick_Garnier" Modified: trunk/examples/swore/swore.rdf =================================================================== --- trunk/examples/swore/swore.rdf 2008-11-30 12:37:29 UTC (rev 1534) +++ trunk/examples/swore/swore.rdf 2008-11-30 12:40:07 UTC (rev 1535) @@ -62,6 +62,7 @@ /////////////////////////////////////////////////////////////////////////////////////// --> + <owl:AnnotationProperty rdf:about="&rdfs;label"/> <owl:AnnotationProperty rdf:about="&dc;contributor"/> @@ -184,6 +185,7 @@ <!-- http://ns.softwiki.de/req/isCreatedBy --> <owl:ObjectProperty rdf:about="isCreatedBy"> + <rdf:type rdf:resource="&owl;FunctionalProperty"/> <rdfs:domain rdf:resource="AbstractRequirement"/> </owl:ObjectProperty> @@ -1010,7 +1012,9 @@ <!-- http://ns.softwiki.de/req/ActiveHelpDialog --> - <DesignRequirement rdf:about="ActiveHelpDialog"/> + <DesignRequirement rdf:about="ActiveHelpDialog"> + <isCreatedBy rdf:resource="GermanGovernment"/> + </DesignRequirement> @@ -1095,7 +1099,7 @@ <!-- http://ns.softwiki.de/req/DialogSystemShoudRespondInUnder5Sec --> <PerformanceRequirement rdf:about="DialogSystemShoudRespondInUnder5Sec"> - <isDefinedBy rdf:resource="NotNecessaryRequirment"/> + <isCreatedBy rdf:resource="Tom"/> </PerformanceRequirement> @@ -1148,6 +1152,7 @@ <FunctionalRequirement rdf:about="LogEveryUserActivity"> <isDefinedBy rdf:resource="Steve_McConnell"/> + <isCreatedBy rdf:resource="USGovernment"/> </FunctionalRequirement> @@ -1167,6 +1172,7 @@ <!-- http://ns.softwiki.de/req/MultiTabSystem --> <DesignRequirement rdf:about="MultiTabSystem"> + <isCreatedBy rdf:resource="Steve_McConnell"/> <isDefinedBy rdf:resource="Steve_McConnell"/> </DesignRequirement> @@ -1176,6 +1182,7 @@ <FunctionalRequirement rdf:about="MultiUserSystem"> <isDefinedBy rdf:resource="Andrew_Stellman"/> + <isCreatedBy rdf:resource="Andrew_Stellman"/> </FunctionalRequirement> @@ -1184,6 +1191,7 @@ <DesignRequirement rdf:about="MultiWindowSystem"> <isDefinedBy rdf:resource="Jennifer_Greene"/> + <isCreatedBy rdf:resource="Jennifer_Greene"/> </DesignRequirement> @@ -1251,7 +1259,9 @@ <!-- http://ns.softwiki.de/req/SystemStabilityRequirement --> - <PerformanceRequirement rdf:about="SystemStabilityRequirement"/> + <PerformanceRequirement rdf:about="SystemStabilityRequirement"> + <isCreatedBy rdf:resource="CentralOrganisationOfFinnishTrade"/> + </PerformanceRequirement> @@ -1329,6 +1339,7 @@ <FunctionalRequirement rdf:about="UserCanAccessDataFromEveryComputer"> <isCommentedBy rdf:resource="MustBeDiscussed"/> + <isCreatedBy rdf:resource="USGovernment"/> </FunctionalRequirement> @@ -1341,7 +1352,9 @@ <!-- http://ns.softwiki.de/req/WindowDesign --> - <DesignRequirement rdf:about="WindowDesign"/> + <DesignRequirement rdf:about="WindowDesign"> + <isCreatedBy rdf:resource="Andrew_Stellman"/> + </DesignRequirement> @@ -1353,7 +1366,9 @@ <!-- http://ns.softwiki.de/req/cluster --> - <PerformanceRequirement rdf:about="cluster"/> + <PerformanceRequirement rdf:about="cluster"> + <isCreatedBy rdf:resource="Andrew_Stellman"/> + </PerformanceRequirement> @@ -1389,7 +1404,9 @@ <!-- http://ns.softwiki.de/req/großsystemen --> - <PerformanceRequirement rdf:about="großsystemen"/> + <PerformanceRequirement rdf:about="großsystemen"> + <isCreatedBy rdf:resource="GermanGovernment"/> + </PerformanceRequirement> @@ -1415,6 +1432,7 @@ <PerformanceRequirement rdf:about="loadGUIInUnder2Sec"> <isDefinedBy rdf:resource="Andrew_Stellman"/> + <isCreatedBy rdf:resource="Andrew_Stellman"/> </PerformanceRequirement> @@ -1490,40 +1508,9 @@ <Topic rdf:about="&skos;primarySubject"> <rdfs:label xml:lang="de">Thema</rdfs:label> </Topic> - - - - <!-- - /////////////////////////////////////////////////////////////////////////////////////// - // - // General axioms - // - /////////////////////////////////////////////////////////////////////////////////////// - --> - - <owl:Class> - <rdfs:subClassOf rdf:resource="CustomerRequirement"/> - <owl:intersectionOf rdf:parseType="Collection"> - <rdf:Description rdf:about="Requirement"/> - <owl:Restriction> - <owl:onProperty rdf:resource="isCreatedBy"/> - <owl:someValuesFrom rdf:resource="Customer"/> - </owl:Restriction> - </owl:intersectionOf> - </owl:Class> - <owl:Class> - <rdfs:subClassOf rdf:resource="CustomerRequirement"/> - <owl:intersectionOf rdf:parseType="Collection"> - <rdf:Description rdf:about="Requirement"/> - <owl:Restriction> - <owl:onProperty rdf:resource="isCreatedBy"/> - <owl:someValuesFrom rdf:resource="AbstractSource"/> - </owl:Restriction> - </owl:intersectionOf> - </owl:Class> </rdf:RDF> -<!-- Generated by the OWL API (version 2.2.1.842) http://owlapi.sourceforge.net --> +<!-- Generated by the OWL API (version 2.2.1.962) http://owlapi.sourceforge.net --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2008-11-30 12:37:33
|
Revision: 1534 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1534&view=rev Author: heeroyuy Date: 2008-11-30 12:37:29 +0000 (Sun, 30 Nov 2008) Log Message: ----------- -fixed bug that suggestList isn't cleared before updating List -fixed bug that equivalent class is also put to subclass Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java Modified: trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-29 23:26:05 UTC (rev 1533) +++ trunk/src/dl-learner/org/dllearner/tools/protege/ActionHandler.java 2008-11-30 12:37:29 UTC (rev 1534) @@ -400,6 +400,7 @@ System.out.println("JETZT HIER:"); model.setSuggestList(result); // learnPanel.getListModel().clear(); + dm.clear(); Iterator<EvaluatedDescription> it = result.iterator(); int i = 0; while (it.hasNext()) { @@ -407,7 +408,6 @@ EvaluatedDescription eval = it.next(); while(ont.hasNext()) { String onto = ont.next().getURI().toString(); - if(eval.getDescription().toString().contains(onto)) { if(model.isConsistent(eval)) { dm.add(i, new SuggestListItem(Color.GREEN, eval.getDescription().toManchesterSyntaxString(onto, null))); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-29 23:26:05 UTC (rev 1533) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-11-30 12:37:29 UTC (rev 1534) @@ -729,7 +729,7 @@ OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLDataFactory factory = manager.getOWLDataFactory(); - if (id.equals("Equivalent classes")) { + if (id.equals("Suggest equivalent class")) { axiomOWLAPI = factory.getOWLEquivalentClassesAxiom(ds); } else { axiomOWLAPI = factory.getOWLSubClassAxiom(newConceptOWLAPI, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |