From: <jen...@us...> - 2008-09-16 23:20:55
|
Revision: 1223 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1223&view=rev Author: jenslehmann Date: 2008-09-17 06:20:53 +0000 (Wed, 17 Sep 2008) Log Message: ----------- changed learning algorithm call in Prot?\195?\169g?\195?\169 plugin Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java trunk/src/dl-learner/org/dllearner/test/ComponentTest.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java Modified: trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-09-17 05:30:32 UTC (rev 1222) +++ trunk/src/dl-learner/org/dllearner/core/LearningAlgorithm.java 2008-09-17 06:20:53 UTC (rev 1223) @@ -247,6 +247,9 @@ } if(!filterNonMinimalDescriptions || ConceptTransformation.isDescriptionMinimal(ed.getDescription())) { + // before we add the description we replace EXISTS r.TOP with + // EXISTS r.range(r) if range(r) is atomic +// ConceptTransformation.replaceRange(ed.getDescription(), reasoningService); returnList.add(ed); } Modified: trunk/src/dl-learner/org/dllearner/test/ComponentTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-09-17 05:30:32 UTC (rev 1222) +++ trunk/src/dl-learner/org/dllearner/test/ComponentTest.java 2008-09-17 06:20:53 UTC (rev 1223) @@ -98,7 +98,7 @@ // start the algorithm and print the best concept found la.start(); - System.out.println(la.getCurrentlyBestEvaluatedDescriptions()); + System.out.println(la.getCurrentlyBestEvaluatedDescriptions(10, 0.8, true)); } } Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-09-17 05:30:32 UTC (rev 1222) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-09-17 06:20:53 UTC (rev 1223) @@ -112,7 +112,9 @@ // This is the count of Concepts which you get after learning - private static final int ANZAHL = 6; + // TODO make those configurable via user interface + private static final int nrOfDisplayedDescriptions = 6; + private static final double minAccuracy = 0.8; // A Array of Concepts which the DL-Learner suggested @@ -205,7 +207,7 @@ // This is a List of evaluated descriptions to get more information of the // suggested concept - private List<EvaluatedDescription> evalDescription; + private List<EvaluatedDescription> evalDescriptions; /** * This is the constructor for DL-Learner model. @@ -263,10 +265,9 @@ * This method adds the solutions from the DL-Learner to the List Model. */ private void addToListModel() { - evalDescription = la.getCurrentlyBestEvaluatedDescriptions(ANZAHL); - for (int j = 0; j < la.getCurrentlyBestEvaluatedDescriptions(ANZAHL).size(); j++) { - suggestModel.add(j, la - .getCurrentlyBestEvaluatedDescriptions(ANZAHL).get(j) + evalDescriptions = la.getCurrentlyBestEvaluatedDescriptions(nrOfDisplayedDescriptions, minAccuracy, true); + for (int j = 0; j < evalDescriptions.size(); j++) { + suggestModel.add(j, evalDescriptions.get(j) .getDescription().toManchesterSyntaxString( editor.getOWLModelManager().getActiveOntology() .getURI().toString() @@ -317,7 +318,7 @@ * @return list of evaluated descriptions */ public List<EvaluatedDescription> getEvaluatedDescriptionList() { - return evalDescription; + return evalDescriptions; } /** @@ -403,7 +404,7 @@ // start the algorithm and print the best concept found la.start(); description = new Description[la.getCurrentlyBestEvaluatedDescriptions( - ANZAHL).size()]; + nrOfDisplayedDescriptions).size()]; addToListModel(); // renders the errormessage view.renderErrorMessage(error); Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java 2008-09-17 05:30:32 UTC (rev 1222) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/ConceptTransformation.java 2008-09-17 06:20:53 UTC (rev 1223) @@ -28,10 +28,12 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.dllearner.core.ReasoningService; import org.dllearner.core.owl.ObjectAllRestriction; import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Nothing; import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.ObjectProperty; import org.dllearner.core.owl.ObjectSomeRestriction; import org.dllearner.core.owl.Intersection; import org.dllearner.core.owl.Union; @@ -443,4 +445,22 @@ return false; } + // replaces EXISTS hasChild.TOP with EXISTS hasChild.Person, + // i.e. TOP is replaced by the range of the property; + // this is semantically equivalent, but easier to read for some people + public static void replaceRange(Description description, ReasoningService rs) { + if(description instanceof ObjectSomeRestriction && description.getChild(0) instanceof Thing) { + ObjectPropertyExpression p = ((ObjectSomeRestriction)description).getRole(); + if(p instanceof ObjectProperty) { + // replace TOP with range of propery + description.removeChild(description.getChild(0)); + description.addChild(rs.getRange((ObjectProperty)p)); + } + } + + for(Description child : description.getChildren()) { + replaceRange(child, rs); + } + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |