From: <jen...@us...> - 2013-06-14 15:02:27
|
Revision: 4000 http://sourceforge.net/p/dl-learner/code/4000 Author: jenslehmann Date: 2013-06-14 15:02:24 +0000 (Fri, 14 Jun 2013) Log Message: ----------- added another semantic for all quantors to fast instance checker Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java trunk/components-core/src/test/java/org/dllearner/test/junit/SomeOnlyReasonerTest.java Modified: trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2013-06-14 12:41:49 UTC (rev 3999) +++ trunk/components-core/src/main/java/org/dllearner/reasoning/FastInstanceChecker.java 2013-06-14 15:02:24 UTC (rev 4000) @@ -139,7 +139,11 @@ "use those which have at least one r-filler and do not have an r-filler not in C.",defaultValue = "standard",propertyEditorClass = StringTrimmerEditor.class) private ForallSemantics forallSemantics = ForallSemantics.Standard; - public enum ForallSemantics { Standard, SomeOnly } + public enum ForallSemantics { + Standard, // standard all quantor + NonEmpty, // p only C for instance a returns false if there is no fact p(a,x) for any x + SomeOnly // p only C for instance a returns false if there is no fact p(a,x) with x \ in C + } /** * Creates an instance of the fast instance checker. @@ -401,6 +405,7 @@ return true; } SortedSet<Individual> roleFillers = opPos.get(op).get(individual); + if (roleFillers == null) { if(forallSemantics == ForallSemantics.Standard) { return true; @@ -408,12 +413,20 @@ return false; } } + boolean hasCorrectFiller = false; for (Individual roleFiller : roleFillers) { - if (!hasTypeImpl(child, roleFiller)) { + if (hasTypeImpl(child, roleFiller)) { + hasCorrectFiller = true; + } else { return false; - } + } } - return true; + + if(forallSemantics == ForallSemantics.SomeOnly) { + return hasCorrectFiller; + } else { + return true; + } } else if (description instanceof ObjectMinCardinalityRestriction) { ObjectPropertyExpression ope = ((ObjectCardinalityRestriction) description).getRole(); if (!(ope instanceof ObjectProperty)) { Modified: trunk/components-core/src/test/java/org/dllearner/test/junit/SomeOnlyReasonerTest.java =================================================================== --- trunk/components-core/src/test/java/org/dllearner/test/junit/SomeOnlyReasonerTest.java 2013-06-14 12:41:49 UTC (rev 3999) +++ trunk/components-core/src/test/java/org/dllearner/test/junit/SomeOnlyReasonerTest.java 2013-06-14 15:02:24 UTC (rev 4000) @@ -31,6 +31,7 @@ * */ public class SomeOnlyReasonerTest { + @Test public void someOnlyTest() throws ComponentInitException, LearningProblemUnsupportedException { // TODO: use aksw-commons-sparql instead of sparql-scala This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |